com.algoTrader.vo.SimulationResultVO.java Source code

Java tutorial

Introduction

Here is the source code for com.algoTrader.vo.SimulationResultVO.java

Source

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

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
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 SimulationResultVO
 */
public class SimulationResultVO implements Serializable, Comparable<SimulationResultVO> {
    /** The serial version UID of this class. Needed for serialization. */
    private static final long serialVersionUID = -3468426016047343004L;

    // Class attributes
    /** TODO: Model Documentation for attribute mins */
    protected double mins;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setMins = false;
    /** TODO: Model Documentation for attribute dataSet */
    protected String dataSet;
    /** TODO: Model Documentation for attribute netLiqValue */
    protected double netLiqValue;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setNetLiqValue = false;
    /** TODO: Model Documentation for attribute monthlyPerformanceVOs */
    protected List monthlyPerformanceVOs;
    /** TODO: Model Documentation for attribute performanceKeysVO */
    protected PerformanceKeysVO performanceKeysVO;
    /** TODO: Model Documentation for attribute maxDrawDownVO */
    protected MaxDrawDownVO maxDrawDownVO;

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

    /**
     * Constructor with all properties
     * @param minsIn double
     * @param dataSetIn String
     * @param netLiqValueIn double
     * @param monthlyPerformanceVOsIn List
     * @param performanceKeysVOIn PerformanceKeysVO
     * @param maxDrawDownVOIn MaxDrawDownVO
     */
    public SimulationResultVO(final double minsIn, final String dataSetIn, final double netLiqValueIn,
            final List monthlyPerformanceVOsIn, final PerformanceKeysVO performanceKeysVOIn,
            final MaxDrawDownVO maxDrawDownVOIn) {
        this.mins = minsIn;
        this.setMins = true;
        this.dataSet = dataSetIn;
        this.netLiqValue = netLiqValueIn;
        this.setNetLiqValue = true;
        this.monthlyPerformanceVOs = monthlyPerformanceVOsIn;
        this.performanceKeysVO = performanceKeysVOIn;
        this.maxDrawDownVO = maxDrawDownVOIn;
    }

    /**
     * Copies constructor from other SimulationResultVO
     *
     * @param otherBean Cannot be <code>null</code>
     * @throws NullPointerException if the argument is <code>null</code>
     */
    public SimulationResultVO(final SimulationResultVO otherBean) {
        this.mins = otherBean.getMins();
        this.setMins = true;
        this.dataSet = otherBean.getDataSet();
        this.netLiqValue = otherBean.getNetLiqValue();
        this.setNetLiqValue = true;
        this.monthlyPerformanceVOs = otherBean.getMonthlyPerformanceVOs();
        this.performanceKeysVO = otherBean.getPerformanceKeysVO();
        this.maxDrawDownVO = otherBean.getMaxDrawDownVO();
    }

    /**
     * Copies all properties from the argument value object into this value object.
     * @param otherBean Cannot be <code>null</code>
     */
    public void copy(final SimulationResultVO otherBean) {
        if (null != otherBean) {
            this.setMins(otherBean.getMins());
            this.setMins = true;
            this.setDataSet(otherBean.getDataSet());
            this.setNetLiqValue(otherBean.getNetLiqValue());
            this.setNetLiqValue = true;
            this.setMonthlyPerformanceVOs(otherBean.getMonthlyPerformanceVOs());
            this.setPerformanceKeysVO(otherBean.getPerformanceKeysVO());
            this.setMaxDrawDownVO(otherBean.getMaxDrawDownVO());
        }
    }

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

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

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

    /**
     * TODO: Model Documentation for attribute dataSet
     * Get the dataSet Attribute
     * @return dataSet String
     */
    public String getDataSet() {
        return this.dataSet;
    }

    /**
     * 
     * @param value String
     */
    public void setDataSet(final String value) {
        this.dataSet = value;
    }

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

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

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

    /**
     * TODO: Model Documentation for attribute monthlyPerformanceVOs
     * Get the monthlyPerformanceVOs Attribute
     * @return monthlyPerformanceVOs List
     */
    public List getMonthlyPerformanceVOs() {
        return this.monthlyPerformanceVOs;
    }

    /**
     * 
     * @param value List
     */
    public void setMonthlyPerformanceVOs(final List value) {
        this.monthlyPerformanceVOs = value;
    }

    /**
     * TODO: Model Documentation for attribute performanceKeysVO
     * Get the performanceKeysVO Attribute
     * @return performanceKeysVO PerformanceKeysVO
     */
    public PerformanceKeysVO getPerformanceKeysVO() {
        return this.performanceKeysVO;
    }

    /**
     * 
     * @param value PerformanceKeysVO
     */
    public void setPerformanceKeysVO(final PerformanceKeysVO value) {
        this.performanceKeysVO = value;
    }

    /**
     * TODO: Model Documentation for attribute maxDrawDownVO
     * Get the maxDrawDownVO Attribute
     * @return maxDrawDownVO MaxDrawDownVO
     */
    public MaxDrawDownVO getMaxDrawDownVO() {
        return this.maxDrawDownVO;
    }

    /**
     * 
     * @param value MaxDrawDownVO
     */
    public void setMaxDrawDownVO(final MaxDrawDownVO value) {
        this.maxDrawDownVO = value;
    }

    /**
     * @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;
        }
        SimulationResultVO rhs = (SimulationResultVO) object;
        return new EqualsBuilder().append(this.getMins(), rhs.getMins()).append(this.getDataSet(), rhs.getDataSet())
                .append(this.getNetLiqValue(), rhs.getNetLiqValue())
                .append(this.getMonthlyPerformanceVOs(), rhs.getMonthlyPerformanceVOs())
                .append(this.getPerformanceKeysVO(), rhs.getPerformanceKeysVO())
                .append(this.getMaxDrawDownVO(), rhs.getMaxDrawDownVO()).isEquals();
    }

    /**
     * @param object to compare this object against
     * @return int if equal
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(final SimulationResultVO object) {
        if (object == null) {
            return -1;
        }
        // Check if the same object instance
        if (object == this) {
            return 0;
        }
        return new CompareToBuilder().append(this.getMins(), object.getMins())
                .append(this.getDataSet(), object.getDataSet())
                .append(this.getNetLiqValue(), object.getNetLiqValue())
                .append(this.getMonthlyPerformanceVOs(), object.getMonthlyPerformanceVOs())
                .append(this.getPerformanceKeysVO(), object.getPerformanceKeysVO())
                .append(this.getMaxDrawDownVO(), object.getMaxDrawDownVO()).toComparison();
    }

    /**
     * @return int hashCode value
     * @see Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(1249046965, -82296885).append(this.getMins()).append(this.getDataSet())
                .append(this.getNetLiqValue()).append(this.getMonthlyPerformanceVOs())
                .append(this.getPerformanceKeysVO()).append(this.getMaxDrawDownVO()).toHashCode();
    }

    /**
     * @return String representation of object
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this).append("mins", this.getMins()).append("dataSet", this.getDataSet())
                .append("netLiqValue", this.getNetLiqValue())
                .append("monthlyPerformanceVOs", this.getMonthlyPerformanceVOs())
                .append("performanceKeysVO", this.getPerformanceKeysVO())
                .append("maxDrawDownVO", this.getMaxDrawDownVO()).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 SimulationResultVO that = (SimulationResultVO) thatObject;

        return equal(this.getMins(), that.getMins()) && equal(this.getDataSet(), that.getDataSet())
                && equal(this.getNetLiqValue(), that.getNetLiqValue())
                && equal(this.getMonthlyPerformanceVOs(), that.getMonthlyPerformanceVOs())
                && equal(this.getPerformanceKeysVO(), that.getPerformanceKeysVO())
                && equal(this.getMaxDrawDownVO(), that.getMaxDrawDownVO());
    }

    /**
     * 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;
    }

    // SimulationResultVO value-object java merge-point
}