3.x RC1 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / declarations / VariableUsage.java
1 package net.sourceforge.phpdt.internal.compiler.ast.declarations;
2
3 /**
4  * A variable usage.
5  * This describe a variable declaration in a php document and his starting offset
6  * @author Matthieu Casanova
7  */
8 public final class VariableUsage {
9
10   /** the variable name. */
11   private final String name;
12
13   /** where the variable is declared. */
14   private final int startOffset;
15
16   /**
17    * create a VariableUsage.
18    * @param name the name of the variable
19    * @param startOffset the offset
20    */
21   public VariableUsage(final String name, final int startOffset) {
22     this.name = name;
23     this.startOffset = startOffset;
24   }
25
26   public String toString() {
27     return name + ' ' + startOffset;
28   }
29
30   /**
31    * Get the name of the variable.
32    * @return the name if the variable
33    */
34   public String getName() {
35     return name;
36   }
37
38   /**
39    * Get the starting offset.
40    * @return the starting offset
41    */
42   public int getStartOffset() {
43     return startOffset;
44   }
45
46   public boolean equals(final Object object) {
47     return name.equals(object);
48   }
49
50   public int hashCode() {
51     return name.hashCode();
52   }
53 }