Example #1
0
 @Override
 public boolean equals(Object oth) {
   if (this == oth) return true;
   else if (!getClass().isInstance(oth)) return false;
   DirWrapper<?> other = (DirWrapper<?>) oth;
   if (!get().equals(other.get())) return false;
   if (hasDirection() && other.hasDirection()) return getDirection().equals(other.getDirection());
   else if (!hasDirection() && !other.hasDirection()) return true;
   else return false;
 }
Example #2
0
 public boolean hasOverlappingDirection(DirWrapper<?> other) {
   if (!this.hasDirection() || !other.hasDirection()) return true;
   Direction d1 = getDirection(), d2 = other.getDirection();
   for (EdgeDirection dir : EdgeDirection.values()) {
     if (dir.impliedBy(d1) && dir.impliedBy(d2)) return true;
   }
   return false;
 }