X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FUtil%2FLattice.java;h=b76b7bb0185f4ca7ee3fef7031f7792843d99e09;hb=cbc13efe1afc46ef542fde526361b4911d3da0e1;hp=aea74773d7ca8936c00105a61a8d6cd6283423bd;hpb=5e5c10a2592a9acd282a1ae27bdf7468beb12e90;p=IRC.git diff --git a/Robust/src/Util/Lattice.java b/Robust/src/Util/Lattice.java index aea74773..b76b7bb0 100644 --- a/Robust/src/Util/Lattice.java +++ b/Robust/src/Util/Lattice.java @@ -66,10 +66,15 @@ public class Lattice { } public boolean put(T key, T value) { + + if(isGreaterThan(key, value)){ + // this relation already exists + return false; + } + Set s; Set topNeighbor = table.get(top); - if (table.containsKey(key)) { s = table.get(key); } else { @@ -90,7 +95,10 @@ public class Lattice { } // if value is already connected with top, it is no longer to be - topNeighbor.remove(value); + if(!key.equals(top)){ + topNeighbor.remove(value); + } + // if key is already connected with bottom,, it is no longer to be if (!value.equals(getBottomItem())) {