Edge extends GraphObject { @Override public boolean equals(Object obj) { if (!(obj instanceof Edge)) return false; Edge other = (Edge) obj; boolean okFromNode = this.fromNodeId == other.fromNodeId; boolean okToNode = this.toNodeId == other.toNodeId; boolean okCost = this.weight == other.weight; return okFromNode && okToNode && okCost; } Edge();  Edge(long from, long to);  Edge(long from, long to, double cost); long getId(); void setId(long id); long getFromNodeId(); long getToNodeId(); double getWeight(); void setFromNodeId(long fromNode); void setToNodeId(long toNode); void setWeight(double weight); void setBidirectional(boolean bidirectional); boolean isBidirectional(); void invert(); long getAdjacent(long id); void addComponent(EdgeComponent component); void addComponent(Class<? extends EdgeComponent> key, EdgeComponent component); C getComponent(Class<C> componentClass); boolean hasComponent(Class<? extends EdgeComponent> key); Set<Class<? extends EdgeComponent>> getAllComponentClasses(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals(){ Edge e1 = new Edge(0,1,3); e1.setBidirectional(true); Edge e2 = new Edge(0,2,3); e2.setBidirectional(true); Edge e3 = new Edge(3,1,3); e3.setBidirectional(true); Edge e4 = new Edge(0,1,4); e4.setBidirectional(true); assertEquals(true, e.equals(e1)); assertEquals(false, e.equals(e2)); assertEquals(false, e.equals(e3)); assertEquals(false, e.equals(e4)); }