source: fedd/abac-src/rtml/src/edu/stanford/rt/credential/HashID.java @ 8780cbec

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since 8780cbec was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.6 KB
Line 
1package edu.stanford.rt.credential;
2
3
4/**
5 * @author Ninghui Li, Sandra Qiu<br>
6 *
7 * HashID is the identifier of a <code>DomainSpecification</code> element.
8 * It is represented by the "id" attribute of the element.
9 *
10 */
11public class HashID
12{
13        /**
14     * ApplicationDomain type of hash id
15     */
16        static public final int APPLICATION_DOMAIN = 1;
17        /**
18     * CredentialDomain type of hash id
19     */
20        static public final int CREDENTIAL_DOMAIN = 2;
21    /**
22     * the hash value for the element.
23     */ 
24        private String hashValue;
25    /**
26     * type of the hash id.
27     */
28        private int hashType;
29       
30        /**
31         * Constructor for HashID
32         */
33        public HashID(int hashType, String hashValue)
34        {
35                this.hashType = hashType;
36                this.hashValue = hashValue;
37        }
38       
39        /* (non-Javadoc)
40         * @see java.lang.Object#hashCode()
41         */
42        public int hashCode()
43        {
44                return hashValue.hashCode();
45        }
46
47        /* (non-Javadoc)
48         * @see java.lang.Object#equals(Object)
49         */
50        public boolean equals(Object id)
51        {
52        if(! (id instanceof HashID))
53            return false;
54
55        HashID hashid = (HashID) id;
56                return    this.hashType == hashid.getHashType() 
57                          &&   this.hashCode() == hashid.hashCode();
58        }
59        /**
60         * Returns the hashType.
61         * @return int
62         */
63        public int getHashType()
64        {
65                return hashType;
66        }
67
68        /**
69         * Returns the hashValue.
70         * @return String
71         */
72        public String getHashValue()
73        {
74                return hashValue;
75        }
76
77        /* (non-Javadoc)
78         * @see java.lang.Object#toString()
79         */
80    public String toString()
81    {
82        return hashValue;
83    }
84}
Note: See TracBrowser for help on using the repository browser.