package generated.javacard.mondex.purse;

/**
 * Generated Class
 * 
 */
public class PayDetails implements Codeable {

	public short value;
	public PurseData from;
	public PurseData to;

	/**
	 * Constructor wich sets all attributes to a initial value
	 */
	public PayDetails() {
		value = 0;
		from = new PurseData();
		to = new PurseData();
	}

	/**
	 * Method for getting the typeflag
	 *
	 * @return den class-specific code
	 */
	public byte getCode() {
		return Code.PAYDETAILS;
	}

	/**
	 * This method deeply checks equality of classes.
	 *
	 * @param other Class to compare with
	 * @return true, if values of all attributes are equal
	 */
	public boolean equals(Codeable other) {
		//The types of the objects have to match
		if (getCode() != other.getCode())
			return false;
		//Attributes of complex type: Use their equals-method
		if (!this.from.equals(((PayDetails) other).from))
			return false;
		//Attributes of complex type: Use their equals-method
		if (!this.to.equals(((PayDetails) other).to))
			return false;
		//value is of primitive type: We can use ==
		if (this.value != ((PayDetails) other).value)
			return false;
		return true;
	}

	public void copy(PayDetails from) {
		//Complex types: Use their copy-method.
		this.from.copy(from.from);
		//Complex types: Use their copy-method.
		this.to.copy(from.to);
		//value is of primitive type: simple assignment
		this.value = from.value;
	}

}