@Test public void testNotEquals() { DGraph<String> g1 = new LightDGraph<String>(); DTGraph<String, String> g2 = new LightDTGraph<String, String>(); assertFalse(g1.equals(g2)); assertFalse(g2.equals(g1)); }
public boolean equals(Object other) { if(!(other instanceof DTGraph<?,?>)) return false; DTGraph<Object,Object> oth = (DTGraph<Object,Object>) other; if(! oth.level().equals(level())) return false; if(size() != oth.size()) return false; if(numLinks() != oth.numLinks()) return false; if(labels().size() != oth.labels().size()) return false; for(DTNode<L,T> node : nodes()) { DTNode<Object,Object> othNode = oth.get(node.index()); if(! Functions.equals(node.label(), othNode.label())) return false; if (node.tags().size() != othNode.tags().size()) return false; for (T tag : node.tags()) { FrequencyModel<Integer> outs = new FrequencyModel<Integer>(), othOuts = new FrequencyModel<Integer>(); for(DTNode<L,T> neighbor : node.toTag(tag)) outs.add(neighbor.index()); for(DTNode<Object,Object> othNeighbor : othNode.toTag(tag)) othOuts.add(othNeighbor.index()); if(! outs.equals(othOuts)) return false; } } return true; }
LightDTGraph implements DTGraph<L, T> { public boolean equals(Object other) { if(!(other instanceof DTGraph<?,?>)) return false; DTGraph<Object,Object> oth = (DTGraph<Object,Object>) other; if(! oth.level().equals(level())) return false; if(size() != oth.size()) return false; if(numLinks() != oth.numLinks()) return false; if(labels().size() != oth.labels().size()) return false; for(DTNode<L,T> node : nodes()) { DTNode<Object,Object> othNode = oth.get(node.index()); if(! Functions.equals(node.label(), othNode.label())) return false; if (node.tags().size() != othNode.tags().size()) return false; for (T tag : node.tags()) { FrequencyModel<Integer> outs = new FrequencyModel<Integer>(), othOuts = new FrequencyModel<Integer>(); for(DTNode<L,T> neighbor : node.toTag(tag)) outs.add(neighbor.index()); for(DTNode<Object,Object> othNeighbor : othNode.toTag(tag)) othOuts.add(othNeighbor.index()); if(! outs.equals(othOuts)) return false; } } return true; } }
LightDTGraph implements DTGraph<L, T> { public boolean equals(Object other) { if(!(other instanceof DTGraph<?,?>)) return false; DTGraph<Object,Object> oth = (DTGraph<Object,Object>) other; if(! oth.level().equals(level())) return false; if(size() != oth.size()) return false; if(numLinks() != oth.numLinks()) return false; if(labels().size() != oth.labels().size()) return false; for(DTNode<L,T> node : nodes()) { DTNode<Object,Object> othNode = oth.get(node.index()); if(! Functions.equals(node.label(), othNode.label())) return false; if (node.tags().size() != othNode.tags().size()) return false; for (T tag : node.tags()) { FrequencyModel<Integer> outs = new FrequencyModel<Integer>(), othOuts = new FrequencyModel<Integer>(); for(DTNode<L,T> neighbor : node.toTag(tag)) outs.add(neighbor.index()); for(DTNode<Object,Object> othNeighbor : othNode.toTag(tag)) othOuts.add(othNeighbor.index()); if(! outs.equals(othOuts)) return false; } } return true; } LightDTGraph();  LightDTGraph(int capacity); }
LightDTGraph implements DTGraph<L, T> { public boolean equals(Object other) { if(!(other instanceof DTGraph<?,?>)) return false; DTGraph<Object,Object> oth = (DTGraph<Object,Object>) other; if(! oth.level().equals(level())) return false; if(size() != oth.size()) return false; if(numLinks() != oth.numLinks()) return false; if(labels().size() != oth.labels().size()) return false; for(DTNode<L,T> node : nodes()) { DTNode<Object,Object> othNode = oth.get(node.index()); if(! Functions.equals(node.label(), othNode.label())) return false; if (node.tags().size() != othNode.tags().size()) return false; for (T tag : node.tags()) { FrequencyModel<Integer> outs = new FrequencyModel<Integer>(), othOuts = new FrequencyModel<Integer>(); for(DTNode<L,T> neighbor : node.toTag(tag)) outs.add(neighbor.index()); for(DTNode<Object,Object> othNeighbor : othNode.toTag(tag)) othOuts.add(othNeighbor.index()); if(! outs.equals(othOuts)) return false; } } return true; } LightDTGraph();  LightDTGraph(int capacity); @Override Set<T> tags(); @Override int size(); @Override DTNode<L, T> node(L label); @Override Collection<? extends DTNode<L, T>> nodes(L label); @Override List<? extends DTNode<L, T>> nodes(); @Override DTNode<L, T> get(int i); @Override Iterable<? extends DTLink<L, T>> links(); @Override DTNode<L, T> add(L label); @Override long numLinks(); @Override Set<L> labels(); @Override boolean connected(L from, L to); @Override long state(); @SuppressWarnings("unchecked") @Override Class<? extends DTGraph<L, T>> level(); boolean equals(Object other); String toString(); }
LightDTGraph implements DTGraph<L, T> { public boolean equals(Object other) { if(!(other instanceof DTGraph<?,?>)) return false; DTGraph<Object,Object> oth = (DTGraph<Object,Object>) other; if(! oth.level().equals(level())) return false; if(size() != oth.size()) return false; if(numLinks() != oth.numLinks()) return false; if(labels().size() != oth.labels().size()) return false; for(DTNode<L,T> node : nodes()) { DTNode<Object,Object> othNode = oth.get(node.index()); if(! Functions.equals(node.label(), othNode.label())) return false; if (node.tags().size() != othNode.tags().size()) return false; for (T tag : node.tags()) { FrequencyModel<Integer> outs = new FrequencyModel<Integer>(), othOuts = new FrequencyModel<Integer>(); for(DTNode<L,T> neighbor : node.toTag(tag)) outs.add(neighbor.index()); for(DTNode<Object,Object> othNeighbor : othNode.toTag(tag)) othOuts.add(othNeighbor.index()); if(! outs.equals(othOuts)) return false; } } return true; } LightDTGraph();  LightDTGraph(int capacity); @Override Set<T> tags(); @Override int size(); @Override DTNode<L, T> node(L label); @Override Collection<? extends DTNode<L, T>> nodes(L label); @Override List<? extends DTNode<L, T>> nodes(); @Override DTNode<L, T> get(int i); @Override Iterable<? extends DTLink<L, T>> links(); @Override DTNode<L, T> add(L label); @Override long numLinks(); @Override Set<L> labels(); @Override boolean connected(L from, L to); @Override long state(); @SuppressWarnings("unchecked") @Override Class<? extends DTGraph<L, T>> level(); boolean equals(Object other); String toString(); static final int NEIGHBOR_CAPACITY; }