1 2 package gov.nasa.ltl.graph; 21 22 25 public class ITypeNeighbor extends Pair implements Comparable { 26 public ITypeNeighbor (int colorIn, String transitionIn) { 27 super(colorIn, transitionIn); 28 } 29 30 public void setColor (int colorIn) { 31 super.setValue(colorIn); 32 } 33 34 public int getColor () { 35 return super.getValue(); 36 } 37 38 public void setTransition (String transitionIn) { 39 super.setElement(transitionIn); 40 } 41 42 public String getTransition () { 43 return (String ) super.getElement(); 44 } 45 46 public int compareTo (Object o) { 48 ITypeNeighbor other = (ITypeNeighbor) o; 49 int comparison = getTransition().compareTo(other.getTransition()); 50 51 if (comparison == 0) { 52 if (getColor() < other.getColor()) { 53 return -1; 54 } 55 56 if (getColor() == other.getColor()) { 57 return 0; 58 } 59 60 if (getColor() > other.getColor()) { 61 return 1; 62 } 63 } 64 65 return comparison; 66 } 67 } | Popular Tags |