com.algoTrader.vo.ib.TickOptionComputation.java Source code

Java tutorial

Introduction

Here is the source code for com.algoTrader.vo.ib.TickOptionComputation.java

Source

// license-header java merge-point
//
/**
 * @author Generated on 02/10/2014 17:30:59+0000 Do not modify by hand!
 *
 * TEMPLATE:     ValueObject.vsl in andromda-java-cartridge.
 * MODEL CLASS:  Data::AlgoTrader::com.algoTrader::vo::ib::TickOptionComputation
 * STEREOTYPE:   ValueObject
 */
package com.algoTrader.vo.ib;

import java.io.Serializable;
import java.util.Arrays;
import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * TODO: Model Documentation for class TickOptionComputation
 */
public class TickOptionComputation implements Serializable, Comparable<TickOptionComputation> {
    /** The serial version UID of this class. Needed for serialization. */
    private static final long serialVersionUID = -5270665279157437480L;

    // Class attributes
    /** TODO: Model Documentation for attribute tickerId */
    protected int tickerId;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setTickerId = false;
    /** TODO: Model Documentation for attribute field */
    protected int field;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setField = false;
    /** TODO: Model Documentation for attribute impliedVol */
    protected double impliedVol;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setImpliedVol = false;
    /** TODO: Model Documentation for attribute delta */
    protected double delta;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setDelta = false;
    /** TODO: Model Documentation for attribute optPrice */
    protected double optPrice;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setOptPrice = false;
    /** TODO: Model Documentation for attribute pvDividend */
    protected double pvDividend;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setPvDividend = false;
    /** TODO: Model Documentation for attribute gamma */
    protected double gamma;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setGamma = false;
    /** TODO: Model Documentation for attribute vega */
    protected double vega;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setVega = false;
    /** TODO: Model Documentation for attribute theta */
    protected double theta;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setTheta = false;
    /** TODO: Model Documentation for attribute undPrice */
    protected double undPrice;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setUndPrice = false;

    /** Default Constructor with no properties */
    public TickOptionComputation() {
        // Documented empty block - avoid compiler warning - no super constructor
    }

    /**
     * Constructor with all properties
     * @param tickerIdIn int
     * @param fieldIn int
     * @param impliedVolIn double
     * @param deltaIn double
     * @param optPriceIn double
     * @param pvDividendIn double
     * @param gammaIn double
     * @param vegaIn double
     * @param thetaIn double
     * @param undPriceIn double
     */
    public TickOptionComputation(final int tickerIdIn, final int fieldIn, final double impliedVolIn,
            final double deltaIn, final double optPriceIn, final double pvDividendIn, final double gammaIn,
            final double vegaIn, final double thetaIn, final double undPriceIn) {
        this.tickerId = tickerIdIn;
        this.setTickerId = true;
        this.field = fieldIn;
        this.setField = true;
        this.impliedVol = impliedVolIn;
        this.setImpliedVol = true;
        this.delta = deltaIn;
        this.setDelta = true;
        this.optPrice = optPriceIn;
        this.setOptPrice = true;
        this.pvDividend = pvDividendIn;
        this.setPvDividend = true;
        this.gamma = gammaIn;
        this.setGamma = true;
        this.vega = vegaIn;
        this.setVega = true;
        this.theta = thetaIn;
        this.setTheta = true;
        this.undPrice = undPriceIn;
        this.setUndPrice = true;
    }

    /**
     * Copies constructor from other TickOptionComputation
     *
     * @param otherBean Cannot be <code>null</code>
     * @throws NullPointerException if the argument is <code>null</code>
     */
    public TickOptionComputation(final TickOptionComputation otherBean) {
        this.tickerId = otherBean.getTickerId();
        this.setTickerId = true;
        this.field = otherBean.getField();
        this.setField = true;
        this.impliedVol = otherBean.getImpliedVol();
        this.setImpliedVol = true;
        this.delta = otherBean.getDelta();
        this.setDelta = true;
        this.optPrice = otherBean.getOptPrice();
        this.setOptPrice = true;
        this.pvDividend = otherBean.getPvDividend();
        this.setPvDividend = true;
        this.gamma = otherBean.getGamma();
        this.setGamma = true;
        this.vega = otherBean.getVega();
        this.setVega = true;
        this.theta = otherBean.getTheta();
        this.setTheta = true;
        this.undPrice = otherBean.getUndPrice();
        this.setUndPrice = true;
    }

    /**
     * Copies all properties from the argument value object into this value object.
     * @param otherBean Cannot be <code>null</code>
     */
    public void copy(final TickOptionComputation otherBean) {
        if (null != otherBean) {
            this.setTickerId(otherBean.getTickerId());
            this.setTickerId = true;
            this.setField(otherBean.getField());
            this.setField = true;
            this.setImpliedVol(otherBean.getImpliedVol());
            this.setImpliedVol = true;
            this.setDelta(otherBean.getDelta());
            this.setDelta = true;
            this.setOptPrice(otherBean.getOptPrice());
            this.setOptPrice = true;
            this.setPvDividend(otherBean.getPvDividend());
            this.setPvDividend = true;
            this.setGamma(otherBean.getGamma());
            this.setGamma = true;
            this.setVega(otherBean.getVega());
            this.setVega = true;
            this.setTheta(otherBean.getTheta());
            this.setTheta = true;
            this.setUndPrice(otherBean.getUndPrice());
            this.setUndPrice = true;
        }
    }

    /**
     * TODO: Model Documentation for attribute tickerId
     * Get the tickerId Attribute
     * @return tickerId int
     */
    public int getTickerId() {
        return this.tickerId;
    }

    /**
     * 
     * @param value int
     */
    public void setTickerId(final int value) {
        this.tickerId = value;
        this.setTickerId = true;
    }

    /**
     * Return true if the primitive attribute tickerId is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetTickerId() {
        return this.setTickerId;
    }

    /**
     * TODO: Model Documentation for attribute field
     * Get the field Attribute
     * @return field int
     */
    public int getField() {
        return this.field;
    }

    /**
     * 
     * @param value int
     */
    public void setField(final int value) {
        this.field = value;
        this.setField = true;
    }

    /**
     * Return true if the primitive attribute field is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetField() {
        return this.setField;
    }

    /**
     * TODO: Model Documentation for attribute impliedVol
     * Get the impliedVol Attribute
     * @return impliedVol double
     */
    public double getImpliedVol() {
        return this.impliedVol;
    }

    /**
     * 
     * @param value double
     */
    public void setImpliedVol(final double value) {
        this.impliedVol = value;
        this.setImpliedVol = true;
    }

    /**
     * Return true if the primitive attribute impliedVol is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetImpliedVol() {
        return this.setImpliedVol;
    }

    /**
     * TODO: Model Documentation for attribute delta
     * Get the delta Attribute
     * @return delta double
     */
    public double getDelta() {
        return this.delta;
    }

    /**
     * 
     * @param value double
     */
    public void setDelta(final double value) {
        this.delta = value;
        this.setDelta = true;
    }

    /**
     * Return true if the primitive attribute delta is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetDelta() {
        return this.setDelta;
    }

    /**
     * TODO: Model Documentation for attribute optPrice
     * Get the optPrice Attribute
     * @return optPrice double
     */
    public double getOptPrice() {
        return this.optPrice;
    }

    /**
     * 
     * @param value double
     */
    public void setOptPrice(final double value) {
        this.optPrice = value;
        this.setOptPrice = true;
    }

    /**
     * Return true if the primitive attribute optPrice is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetOptPrice() {
        return this.setOptPrice;
    }

    /**
     * TODO: Model Documentation for attribute pvDividend
     * Get the pvDividend Attribute
     * @return pvDividend double
     */
    public double getPvDividend() {
        return this.pvDividend;
    }

    /**
     * 
     * @param value double
     */
    public void setPvDividend(final double value) {
        this.pvDividend = value;
        this.setPvDividend = true;
    }

    /**
     * Return true if the primitive attribute pvDividend is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetPvDividend() {
        return this.setPvDividend;
    }

    /**
     * TODO: Model Documentation for attribute gamma
     * Get the gamma Attribute
     * @return gamma double
     */
    public double getGamma() {
        return this.gamma;
    }

    /**
     * 
     * @param value double
     */
    public void setGamma(final double value) {
        this.gamma = value;
        this.setGamma = true;
    }

    /**
     * Return true if the primitive attribute gamma is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetGamma() {
        return this.setGamma;
    }

    /**
     * TODO: Model Documentation for attribute vega
     * Get the vega Attribute
     * @return vega double
     */
    public double getVega() {
        return this.vega;
    }

    /**
     * 
     * @param value double
     */
    public void setVega(final double value) {
        this.vega = value;
        this.setVega = true;
    }

    /**
     * Return true if the primitive attribute vega is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetVega() {
        return this.setVega;
    }

    /**
     * TODO: Model Documentation for attribute theta
     * Get the theta Attribute
     * @return theta double
     */
    public double getTheta() {
        return this.theta;
    }

    /**
     * 
     * @param value double
     */
    public void setTheta(final double value) {
        this.theta = value;
        this.setTheta = true;
    }

    /**
     * Return true if the primitive attribute theta is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetTheta() {
        return this.setTheta;
    }

    /**
     * TODO: Model Documentation for attribute undPrice
     * Get the undPrice Attribute
     * @return undPrice double
     */
    public double getUndPrice() {
        return this.undPrice;
    }

    /**
     * 
     * @param value double
     */
    public void setUndPrice(final double value) {
        this.undPrice = value;
        this.setUndPrice = true;
    }

    /**
     * Return true if the primitive attribute undPrice is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetUndPrice() {
        return this.setUndPrice;
    }

    /**
     * @param object to compare this object against
     * @return boolean if equal
     * @see Object#equals(Object)
     */
    @Override
    public boolean equals(final Object object) {
        if (object == null || object.getClass() != this.getClass()) {
            return false;
        }
        // Check if the same object instance
        if (object == this) {
            return true;
        }
        TickOptionComputation rhs = (TickOptionComputation) object;
        return new EqualsBuilder().append(this.getTickerId(), rhs.getTickerId())
                .append(this.getField(), rhs.getField()).append(this.getImpliedVol(), rhs.getImpliedVol())
                .append(this.getDelta(), rhs.getDelta()).append(this.getOptPrice(), rhs.getOptPrice())
                .append(this.getPvDividend(), rhs.getPvDividend()).append(this.getGamma(), rhs.getGamma())
                .append(this.getVega(), rhs.getVega()).append(this.getTheta(), rhs.getTheta())
                .append(this.getUndPrice(), rhs.getUndPrice()).isEquals();
    }

    /**
     * @param object to compare this object against
     * @return int if equal
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(final TickOptionComputation object) {
        if (object == null) {
            return -1;
        }
        // Check if the same object instance
        if (object == this) {
            return 0;
        }
        return new CompareToBuilder().append(this.getTickerId(), object.getTickerId())
                .append(this.getField(), object.getField()).append(this.getImpliedVol(), object.getImpliedVol())
                .append(this.getDelta(), object.getDelta()).append(this.getOptPrice(), object.getOptPrice())
                .append(this.getPvDividend(), object.getPvDividend()).append(this.getGamma(), object.getGamma())
                .append(this.getVega(), object.getVega()).append(this.getTheta(), object.getTheta())
                .append(this.getUndPrice(), object.getUndPrice()).toComparison();
    }

    /**
     * @return int hashCode value
     * @see Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(1249046965, -82296885).append(this.getTickerId()).append(this.getField())
                .append(this.getImpliedVol()).append(this.getDelta()).append(this.getOptPrice())
                .append(this.getPvDividend()).append(this.getGamma()).append(this.getVega()).append(this.getTheta())
                .append(this.getUndPrice()).toHashCode();
    }

    /**
     * @return String representation of object
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this).append("tickerId", this.getTickerId()).append("field", this.getField())
                .append("impliedVol", this.getImpliedVol()).append("delta", this.getDelta())
                .append("optPrice", this.getOptPrice()).append("pvDividend", this.getPvDividend())
                .append("gamma", this.getGamma()).append("vega", this.getVega()).append("theta", this.getTheta())
                .append("undPrice", this.getUndPrice()).toString();
    }

    /**
     * Compares the properties of this instance to the properties of the argument. This method will return
     * {@code false} as soon as it detects that the argument is {@code null} or not of the same type as
     * (or a sub-type of) this instance's type.
     *
     * <p/>For array, collection or map properties the comparison will be done one level deep, in other words:
     * the elements will be compared using the {@code equals()} operation.
     *
     * <p/>Note that two properties will be considered equal when both values are {@code null}.
     *
     * @param thatObject the object containing the properties to compare against this instance
     * @return this method will return {@code true} in case the argument has the same type as this class, or is a
     *      sub-type of this class and all properties as found on this class have equal values when queried on that
     *      argument instance; in all other cases this method will return {@code false}
     */
    public boolean equalProperties(final Object thatObject) {
        if (thatObject == null || !this.getClass().isAssignableFrom(thatObject.getClass())) {
            return false;
        }

        final TickOptionComputation that = (TickOptionComputation) thatObject;

        return equal(this.getTickerId(), that.getTickerId()) && equal(this.getField(), that.getField())
                && equal(this.getImpliedVol(), that.getImpliedVol()) && equal(this.getDelta(), that.getDelta())
                && equal(this.getOptPrice(), that.getOptPrice())
                && equal(this.getPvDividend(), that.getPvDividend()) && equal(this.getGamma(), that.getGamma())
                && equal(this.getVega(), that.getVega()) && equal(this.getTheta(), that.getTheta())
                && equal(this.getUndPrice(), that.getUndPrice());
    }

    /**
     * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
     * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
     * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
     *
     * <p/>Note that for array, collection or map instances the comparison runs one level deep.
     *
     * @param first the first object to compare, may be {@code null}
     * @param second the second object to compare, may be {@code null}
     * @return this method will return {@code true} in case both objects are equal as explained above;
     *      in all other cases this method will return {@code false}
     */
    protected static boolean equal(final Object first, final Object second) {
        final boolean equal;

        if (first == null) {
            equal = (second == null);
        } else if (first.getClass().isArray() && (second != null) && second.getClass().isArray()) {
            equal = Arrays.equals((Object[]) first, (Object[]) second);
        } else // note that the following also covers java.util.Collection and java.util.Map
        {
            equal = first.equals(second);
        }

        return equal;
    }

    // TickOptionComputation value-object java merge-point
}