[Impressum] [E-Mail]

package generated.javacard.copycardMoneySecure.copycard;

/**
 * Generated Class
 * 
 */
public class AuthData implements HashData, Codeable {

	public short instruction;
	public Secret passphrase;
	public Nonce challenge;
	public short amount;

	/**
	 * Constructor wich sets all attributes to a initial value
	 */
	public AuthData() {
		instruction = 0;
		passphrase = new Secret();
		challenge = new Nonce();
		amount = 0;
	}

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

	/**
	 * 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;
		//instruction is of primitive type: We can use ==
		if (this.instruction != ((AuthData) other).instruction)
			return false;
		//Attributes of complex type: Use their equals-method
		if (!this.passphrase.equals(((AuthData) other).passphrase))
			return false;
		//Attributes of complex type: Use their equals-method
		if (!this.challenge.equals(((AuthData) other).challenge))
			return false;
		//amount is of primitive type: We can use ==
		if (this.amount != ((AuthData) other).amount)
			return false;
		return true;
	}

	public void copy(AuthData from) {
		//instruction is of primitive type: simple assignment
		this.instruction = from.instruction;
		//Complex types: Use their copy-method.
		this.passphrase.copy(from.passphrase);
		//Complex types: Use their copy-method.
		this.challenge.copy(from.challenge);
		//amount is of primitive type: simple assignment
		this.amount = from.amount;
	}

}