public static SortedMap<Integer, Double> shortestPath(DirectedGraph g, int source) { final SortedMap<Integer, Double> previousDistances = new TreeMap<Integer, Double>(); final SortedMap<Integer, Double> currentDistances = new TreeMap<Integer, Double>(); currentDistances.put(source, 0d); for (Integer v : g.getVertices()) { if (v != source) { currentDistances.put(v, Double.POSITIVE_INFINITY); } } for (int i = 1; i <= g.getNumVertices(); i++) { previousDistances.clear(); previousDistances.putAll(currentDistances); currentDistances.clear(); for (Integer v : g.getVertices()) { Double currentDistance = Double.POSITIVE_INFINITY; Double previousDistance = previousDistances.get(v); if (previousDistance < currentDistance) { currentDistance = previousDistance; } for (Edge e : g.getIncomingEdges(v)) { Double alternativeDistance = previousDistances.get(e.getVertexA()) + e.getLength(); if (alternativeDistance < currentDistance) { currentDistance = alternativeDistance; } } currentDistances.put(v, currentDistance); } } if (!previousDistances.equals(currentDistances)) { // there are negative cost cycles return null; } return previousDistances; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Header other = (Header) obj; if (members == null) { if (other.members != null) return false; } else if (!members.equals(other.members)) return false; return true; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PojoBar other = (PojoBar) obj; if (concurrentHashMap == null) { if (other.concurrentHashMap != null) return false; } else if (!concurrentHashMap.equals(other.concurrentHashMap)) return false; if (concurrentMap == null) { if (other.concurrentMap != null) return false; } else if (!concurrentMap.equals(other.concurrentMap)) return false; if (concurrentNavigableMap == null) { if (other.concurrentNavigableMap != null) return false; } else if (!concurrentNavigableMap.equals(other.concurrentNavigableMap)) return false; if (concurrentSkipListMap == null) { if (other.concurrentSkipListMap != null) return false; } else if (!concurrentSkipListMap.equals(other.concurrentSkipListMap)) return false; if (hashMap == null) { if (other.hashMap != null) return false; } else if (!hashMap.equals(other.hashMap)) return false; if (hashtable == null) { if (other.hashtable != null) return false; } else if (!hashtable.equals(other.hashtable)) return false; if (identityHashMap == null) { if (other.identityHashMap != null) return false; } else if (!identityHashMap.equals(other.identityHashMap)) return false; if (linkedHashMap == null) { if (other.linkedHashMap != null) return false; } else if (!linkedHashMap.equals(other.linkedHashMap)) return false; if (map == null) { if (other.map != null) return false; } else if (!map.equals(other.map)) return false; if (navigableMap == null) { if (other.navigableMap != null) return false; } else if (!navigableMap.equals(other.navigableMap)) return false; if (sortedMap == null) { if (other.sortedMap != null) return false; } else if (!sortedMap.equals(other.sortedMap)) return false; if (treeMap == null) { if (other.treeMap != null) return false; } else if (!treeMap.equals(other.treeMap)) return false; if (weakHashMap == null) { if (other.weakHashMap != null) return false; } else if (!weakHashMap.equals(other.weakHashMap)) return false; return true; }
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { return (obj instanceof SortedTagList) && tagSortedMap.equals(((SortedTagList) obj).tagSortedMap); }
public boolean equals(Object o) { return map.equals(o); }
@SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"}) public boolean equals(Object o) { checkInit(); return delegate.equals(o); }