package edu.stanford.rt.credential;
/**
* @author Ninghui Li, Sandra Qiu
*
* HashID is the identifier of a DomainSpecification
element.
* It is represented by the "id" attribute of the element.
*
*/
public class HashID
{
/**
* ApplicationDomain type of hash id
*/
static public final int APPLICATION_DOMAIN = 1;
/**
* CredentialDomain type of hash id
*/
static public final int CREDENTIAL_DOMAIN = 2;
/**
* the hash value for the element.
*/
private String hashValue;
/**
* type of the hash id.
*/
private int hashType;
/**
* Constructor for HashID
*/
public HashID(int hashType, String hashValue)
{
this.hashType = hashType;
this.hashValue = hashValue;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
return hashValue.hashCode();
}
/* (non-Javadoc)
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object id)
{
if(! (id instanceof HashID))
return false;
HashID hashid = (HashID) id;
return this.hashType == hashid.getHashType()
&& this.hashCode() == hashid.hashCode();
}
/**
* Returns the hashType.
* @return int
*/
public int getHashType()
{
return hashType;
}
/**
* Returns the hashValue.
* @return String
*/
public String getHashValue()
{
return hashValue;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString()
{
return hashValue;
}
}