package generated.javacard.mondex.purse;

import javacard.framework.*;

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

	public byte[] name;
	public short nextSeqNo;

	/**
	 * Constructor wich sets all attributes to a initial value
	 */
	public PurseData() {
		name = new byte[Store.LENGTHOFSTRING];
		nextSeqNo = 0;
	}

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

	/**
	 * 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;
		if (!Arrays.equals(name, ((PurseData) other).name))
			return false;
		//nextSeqNo is of primitive type: We can use ==
		if (this.nextSeqNo != ((PurseData) other).nextSeqNo)
			return false;
		return true;
	}

	public void copy(PurseData from) {
		//The type of name is an array of primitive types.
		Arrays.copy(from.name, this.name);
		//nextSeqNo is of primitive type: simple assignment
		this.nextSeqNo = from.nextSeqNo;
	}

}