1 11 package org.eclipse.jface.text; 12 13 14 15 23 public class TypedPosition extends Position { 24 25 26 private String fType; 27 28 35 public TypedPosition(int offset, int length, String type) { 36 super(offset, length); 37 fType= type; 38 } 39 40 45 public TypedPosition(ITypedRegion region) { 46 super(region.getOffset(), region.getLength()); 47 fType= region.getType(); 48 } 49 50 55 public String getType() { 56 return fType; 57 } 58 59 62 public boolean equals(Object o) { 63 if (o instanceof TypedPosition) { 64 if (super.equals(o)) { 65 TypedPosition p= (TypedPosition) o; 66 return (fType == null && p.getType() == null) || fType.equals(p.getType()); 67 } 68 } 69 return false; 70 } 71 72 75 public int hashCode() { 76 int type= fType == null ? 0 : fType.hashCode(); 77 return super.hashCode() | type; 78 } 79 } 80 | Popular Tags |