Check in Heap and Native generated impls of BondVOInterface for quicker reference

This commit is contained in:
leventov
2014-12-06 00:06:55 +07:00
parent 6cf932ff1f
commit dc449f1608
4 changed files with 670 additions and 0 deletions
@@ -0,0 +1,174 @@
/*
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.chronicle.map.fromdocs;
import static net.openhft.lang.Compare.*;
import java.io.IOException;
import net.openhft.chronicle.map.fromdocs.BondVOInterface;
import net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx;
import net.openhft.lang.io.Bytes;
import net.openhft.lang.io.serialization.BytesMarshallable;
import net.openhft.lang.model.Copyable;
public class BondVOInterface$$Heap implements BondVOInterface, BytesMarshallable, Copyable<net.openhft.chronicle.map.fromdocs.BondVOInterface> {
private double _coupon;
private long _issueDate;
private long _maturityDate;
private int _entry;
private net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx[] _marketPxIntraDayHistory = new net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx[7];
{
for (int i = 0; i < _marketPxIntraDayHistory.length; i++)
_marketPxIntraDayHistory[i] = new net.openhft.chronicle.map.fromdocs.BondVOInterface$MarketPx$$Heap();
} private java.lang.String _symbol;
public void setCoupon(double $) {
_coupon = $;
}
public double getCoupon() {
return _coupon;
}
public synchronized double addAtomicCoupon(double $) {
return _coupon += $;
}
public synchronized boolean compareAndSwapCoupon(double _1, double _2) {
if (_coupon == _1) {
_coupon = _2;
return true;
}
return false;
}
public void setIssueDate(long $) {
_issueDate = $;
}
public long getIssueDate() {
return _issueDate;
}
public void setMaturityDate(long $) {
_maturityDate = $;
}
public long getMaturityDate() {
return _maturityDate;
}
public synchronized long addAtomicMaturityDate(long $) {
return _maturityDate += $;
}
public void unlockEntry() {
throw new UnsupportedOperationException();
} public void busyLockEntry() {
throw new UnsupportedOperationException();
} public void setMarketPxIntraDayHistoryAt(int i, net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx $) {
if(i<0) throw new ArrayIndexOutOfBoundsException(i + " must be greater than 0");
if(i>=7) throw new ArrayIndexOutOfBoundsException(i + " must be less than 7");
_marketPxIntraDayHistory[i] = $;
}
public net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx getMarketPxIntraDayHistoryAt(int i) {
if(i<0) throw new ArrayIndexOutOfBoundsException(i + " must be greater than 0");
if(i>=7) throw new ArrayIndexOutOfBoundsException(i + " must be less than 7");
return _marketPxIntraDayHistory[i];
}
public void setSymbol(java.lang.String $) {
_symbol = $;
}
public java.lang.String getSymbol() {
return _symbol;
}
@SuppressWarnings("unchecked")
public void copyFrom(net.openhft.chronicle.map.fromdocs.BondVOInterface from) {
setCoupon(from.getCoupon());
setIssueDate(from.getIssueDate());
setMaturityDate(from.getMaturityDate());
for (int i = 0; i < 7; i++){
setMarketPxIntraDayHistoryAt(i, from.getMarketPxIntraDayHistoryAt(i));
}
setSymbol(from.getSymbol());
}
public void writeMarshallable(Bytes out) {
out.writeDouble(getCoupon());
out.writeLong(getIssueDate());
out.writeLong(getMaturityDate());
for (int i = 0; i < 7; i++){
out.writeObject(getMarketPxIntraDayHistoryAt(i));
}
out.writeUTFΔ(getSymbol());
}
public void readMarshallable(Bytes in) {
_coupon = in.readDouble();
_issueDate = in.readLong();
_maturityDate = in.readLong();
_entry = in.readInt();
for (int i = 0; i < 7; i++){
_marketPxIntraDayHistory[i] = in.readObject(net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx.class);
}
_symbol = in.readUTFΔ();
}
public long longHashCode_marketPxIntraDayHistory() {
long hc = 0;
for (int i = 0; i < 7; i++) {
hc += calcLongHashCode(getMarketPxIntraDayHistoryAt(i));
}
return hc;
}
public int hashCode() {
long lhc = longHashCode();
return (int) ((lhc >>> 32) ^ lhc);
}
public long longHashCode() {
return ((((calcLongHashCode(getCoupon())) * 10191 +
calcLongHashCode(getIssueDate())) * 10191 +
calcLongHashCode(getMaturityDate())) * 10191 +
longHashCode_marketPxIntraDayHistory()) * 10191 +
calcLongHashCode(getSymbol());
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BondVOInterface)) return false;
BondVOInterface that = (BondVOInterface) o;
if(!isEqual(getCoupon(), that.getCoupon())) return false;
if(!isEqual(getIssueDate(), that.getIssueDate())) return false;
if(!isEqual(getMaturityDate(), that.getMaturityDate())) return false;
for (int i = 0; i <7; i++) {
if(!isEqual(getMarketPxIntraDayHistoryAt(i), that.getMarketPxIntraDayHistoryAt(i))) return false;
}
if(!isEqual(getSymbol(), that.getSymbol())) return false;
return true;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("BondVOInterface{ ");
sb.append(" }");
return sb.toString();
}
}
@@ -0,0 +1,203 @@
/*
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.chronicle.map.fromdocs;
import net.openhft.lang.io.Bytes;
import net.openhft.lang.io.serialization.BytesMarshallable;
import net.openhft.lang.model.Byteable;
import net.openhft.lang.model.Copyable;
import static net.openhft.lang.Compare.calcLongHashCode;
import static net.openhft.lang.Compare.isEqual;
public class BondVOInterface$$Native
implements BondVOInterface, BytesMarshallable, Byteable,
Copyable<BondVOInterface> {
private static final int COUPON = 0;
private static final int ISSUEDATE = 8;
private static final int MATURITYDATE = 16;
private static final int ENTRY = 24;
private static final int MARKETPXINTRADAYHISTORY = 28;
private final BondVOInterface$MarketPx$$Native _marketPxIntraDayHistory[] =
new BondVOInterface$MarketPx$$Native[7];
{
for (int i = 0; i < 7; i++)
_marketPxIntraDayHistory[i] = new BondVOInterface$MarketPx$$Native();
}
private static final int SYMBOL = 308;
private Bytes _bytes;
private long _offset;
public void setCoupon(double $) {
_bytes.writeDouble(_offset + COUPON, $);
}
public double getCoupon() {
return _bytes.readDouble(_offset + COUPON);
}
public double addAtomicCoupon(double $) {
return _bytes.addAtomicDouble(_offset + COUPON, $);
} public boolean compareAndSwapCoupon(double _1, double _2) {
return _bytes.compareAndSwapDouble(_offset + COUPON, _1, _2);
}
public void setIssueDate(long $) {
_bytes.writeLong(_offset + ISSUEDATE, $);
}
public long getIssueDate() {
return _bytes.readLong(_offset + ISSUEDATE);
}
public void setMaturityDate(long $) {
_bytes.writeLong(_offset + MATURITYDATE, $);
}
public long getMaturityDate() {
return _bytes.readLong(_offset + MATURITYDATE);
}
public long addAtomicMaturityDate(long $) {
return _bytes.addAtomicLong(_offset + MATURITYDATE, $);
} public void unlockEntry() {
_bytes.unlockInt(_offset + ENTRY);
} public void busyLockEntry() throws InterruptedException {
_bytes.busyLockInt(_offset + ENTRY);
} public void setMarketPxIntraDayHistoryAt(int i, BondVOInterface.MarketPx $) {
_marketPxIntraDayHistory[i].copyFrom($);
}
public BondVOInterface.MarketPx getMarketPxIntraDayHistoryAt(int i) {
return _marketPxIntraDayHistory[i];
}
public void setSymbol(java.lang.String $) {
_bytes.writeUTFΔ(_offset + SYMBOL, 20, $);
}
public java.lang.String getSymbol() {
return _bytes.readUTFΔ(_offset + SYMBOL);
}
@Override
public void copyFrom(BondVOInterface from) {
setCoupon(from.getCoupon());
setIssueDate(from.getIssueDate());
setMaturityDate(from.getMaturityDate());
for (int i = 0; i < 7; i++){
setMarketPxIntraDayHistoryAt(i, from.getMarketPxIntraDayHistoryAt(i));
}
setSymbol(from.getSymbol());
}
@Override
public void writeMarshallable(Bytes out) {
out.writeDouble(getCoupon());
out.writeLong(getIssueDate());
out.writeLong(getMaturityDate());
for (int i = 0; i < 7; i++){
_marketPxIntraDayHistory[i].writeMarshallable(out);
}
out.writeUTFΔ(getSymbol());
}
@Override
public void readMarshallable(Bytes in) {
setCoupon(in.readDouble());
setIssueDate(in.readLong());
setMaturityDate(in.readLong());
for (int i = 0; i < 7; i++){
_marketPxIntraDayHistory[i].readMarshallable(in);
}
setSymbol(in.readUTFΔ());
}
@Override
public void bytes(Bytes bytes, long offset) {
this._bytes = bytes;
this._offset = offset;
for (int i = 0; i < 7; i++){
((Byteable) _marketPxIntraDayHistory[i]).bytes(bytes,
_offset + MARKETPXINTRADAYHISTORY + (i * 40));
}
}
@Override
public Bytes bytes() {
return _bytes;
}
@Override
public long offset() {
return _offset;
}
@Override
public int maxSize() {
return 328;
}
public long longHashCode_marketPxIntraDayHistory() {
long hc = 0;
for (int i = 0; i < 7; i++) {
hc += calcLongHashCode(getMarketPxIntraDayHistoryAt(i));
}
return hc;
}
public int hashCode() {
long lhc = longHashCode();
return (int) ((lhc >>> 32) ^ lhc);
}
public long longHashCode() {
return ((((calcLongHashCode(getCoupon())) * 10191 +
calcLongHashCode(getIssueDate())) * 10191 +
calcLongHashCode(getMaturityDate())) * 10191 +
longHashCode_marketPxIntraDayHistory()) * 10191 +
calcLongHashCode(getSymbol());
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BondVOInterface)) return false;
BondVOInterface that = (BondVOInterface) o;
if(!isEqual(getCoupon(), that.getCoupon())) return false;
if(!isEqual(getIssueDate(), that.getIssueDate())) return false;
if(!isEqual(getMaturityDate(), that.getMaturityDate())) return false;
for (int i = 0; i <7; i++) {
if(!isEqual(getMarketPxIntraDayHistoryAt(i), that.getMarketPxIntraDayHistoryAt(i)))
return false;
}
if(!isEqual(getSymbol(), that.getSymbol())) return false;
return true;
}
public String toString() {
if (_bytes == null) return "bytes is null";
StringBuilder sb = new StringBuilder();
sb.append("BondVOInterface{ ");
sb.append(" }");
return sb.toString();
}
}
@@ -0,0 +1,128 @@
/*
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.chronicle.map.fromdocs;
import static net.openhft.lang.Compare.*;
import java.io.IOException;
import net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx;
import net.openhft.lang.io.Bytes;
import net.openhft.lang.io.serialization.BytesMarshallable;
import net.openhft.lang.model.Copyable;
public class BondVOInterface$MarketPx$$Heap implements MarketPx, BytesMarshallable, Copyable<net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx> {
private double _askPx;
private double _bidPx;
private double _callPx;
private double _maturityPx;
private double _parPx;
public void setAskPx(double $) {
_askPx = $;
}
public double getAskPx() {
return _askPx;
}
public void setBidPx(double $) {
_bidPx = $;
}
public double getBidPx() {
return _bidPx;
}
public void setCallPx(double $) {
_callPx = $;
}
public double getCallPx() {
return _callPx;
}
public void setMaturityPx(double $) {
_maturityPx = $;
}
public double getMaturityPx() {
return _maturityPx;
}
public void setParPx(double $) {
_parPx = $;
}
public double getParPx() {
return _parPx;
}
@SuppressWarnings("unchecked")
public void copyFrom(net.openhft.chronicle.map.fromdocs.BondVOInterface.MarketPx from) {
setAskPx(from.getAskPx());
setBidPx(from.getBidPx());
setCallPx(from.getCallPx());
setMaturityPx(from.getMaturityPx());
setParPx(from.getParPx());
}
public void writeMarshallable(Bytes out) {
out.writeDouble(getAskPx());
out.writeDouble(getBidPx());
out.writeDouble(getCallPx());
out.writeDouble(getMaturityPx());
out.writeDouble(getParPx());
}
public void readMarshallable(Bytes in) {
_askPx = in.readDouble();
_bidPx = in.readDouble();
_callPx = in.readDouble();
_maturityPx = in.readDouble();
_parPx = in.readDouble();
}
public int hashCode() {
long lhc = longHashCode();
return (int) ((lhc >>> 32) ^ lhc);
}
public long longHashCode() {
return ((((calcLongHashCode(getAskPx())) * 10191 +
calcLongHashCode(getBidPx())) * 10191 +
calcLongHashCode(getCallPx())) * 10191 +
calcLongHashCode(getMaturityPx())) * 10191 +
calcLongHashCode(getParPx());
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BondVOInterface.MarketPx)) return false;
BondVOInterface.MarketPx that = (BondVOInterface.MarketPx) o;
if(!isEqual(getAskPx(), that.getAskPx())) return false;
if(!isEqual(getBidPx(), that.getBidPx())) return false;
if(!isEqual(getCallPx(), that.getCallPx())) return false;
if(!isEqual(getMaturityPx(), that.getMaturityPx())) return false;
if(!isEqual(getParPx(), that.getParPx())) return false;
return true;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("BondVOInterface.MarketPx{ ");
sb.append(" }");
return sb.toString();
}
}
@@ -0,0 +1,165 @@
/*
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.chronicle.map.fromdocs;
import net.openhft.lang.io.Bytes;
import net.openhft.lang.io.serialization.BytesMarshallable;
import net.openhft.lang.model.Byteable;
import net.openhft.lang.model.Copyable;
import static net.openhft.lang.Compare.calcLongHashCode;
import static net.openhft.lang.Compare.isEqual;
public class BondVOInterface$MarketPx$$Native
implements BondVOInterface.MarketPx, BytesMarshallable, Byteable,
Copyable<BondVOInterface.MarketPx> {
private static final int ASKPX = 0;
private static final int BIDPX = 8;
private static final int CALLPX = 16;
private static final int MATURITYPX = 24;
private static final int PARPX = 32;
private Bytes _bytes;
private long _offset;
public void setAskPx(double $) {
_bytes.writeDouble(_offset + ASKPX, $);
}
public double getAskPx() {
return _bytes.readDouble(_offset + ASKPX);
}
public void setBidPx(double $) {
_bytes.writeDouble(_offset + BIDPX, $);
}
public double getBidPx() {
return _bytes.readDouble(_offset + BIDPX);
}
public void setCallPx(double $) {
_bytes.writeDouble(_offset + CALLPX, $);
}
public double getCallPx() {
return _bytes.readDouble(_offset + CALLPX);
}
public void setMaturityPx(double $) {
_bytes.writeDouble(_offset + MATURITYPX, $);
}
public double getMaturityPx() {
return _bytes.readDouble(_offset + MATURITYPX);
}
public void setParPx(double $) {
_bytes.writeDouble(_offset + PARPX, $);
}
public double getParPx() {
return _bytes.readDouble(_offset + PARPX);
}
@Override
public void copyFrom(BondVOInterface.MarketPx from) {
setAskPx(from.getAskPx());
setBidPx(from.getBidPx());
setCallPx(from.getCallPx());
setMaturityPx(from.getMaturityPx());
setParPx(from.getParPx());
}
@Override
public void writeMarshallable(Bytes out) {
out.writeDouble(getAskPx());
out.writeDouble(getBidPx());
out.writeDouble(getCallPx());
out.writeDouble(getMaturityPx());
out.writeDouble(getParPx());
}
@Override
public void readMarshallable(Bytes in) {
setAskPx(in.readDouble());
setBidPx(in.readDouble());
setCallPx(in.readDouble());
setMaturityPx(in.readDouble());
setParPx(in.readDouble());
}
@Override
public void bytes(Bytes bytes, long offset) {
this._bytes = bytes;
this._offset = offset;
}
@Override
public Bytes bytes() {
return _bytes;
}
@Override
public long offset() {
return _offset;
}
@Override
public int maxSize() {
return 40;
}
public int hashCode() {
long lhc = longHashCode();
return (int) ((lhc >>> 32) ^ lhc);
}
public long longHashCode() {
return ((((calcLongHashCode(getAskPx())) * 10191 +
calcLongHashCode(getBidPx())) * 10191 +
calcLongHashCode(getCallPx())) * 10191 +
calcLongHashCode(getMaturityPx())) * 10191 +
calcLongHashCode(getParPx());
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BondVOInterface.MarketPx)) return false;
BondVOInterface.MarketPx that = (BondVOInterface.MarketPx) o;
if(!isEqual(getAskPx(), that.getAskPx())) return false;
if(!isEqual(getBidPx(), that.getBidPx())) return false;
if(!isEqual(getCallPx(), that.getCallPx())) return false;
if(!isEqual(getMaturityPx(), that.getMaturityPx())) return false;
if(!isEqual(getParPx(), that.getParPx())) return false;
return true;
}
public String toString() {
if (_bytes == null) return "bytes is null";
StringBuilder sb = new StringBuilder();
sb.append("BondVOInterface.MarketPx{ ");
sb.append(" }");
return sb.toString();
}
}