Class AbstractFlowSet<T>

  • All Implemented Interfaces:
    Iterable<T>, FlowSet<T>
    Direct Known Subclasses:
    AbstractBoundedFlowSet, ArraySparseSet, DavaFlowSet, HashSparseSet, ToppedSet

    public abstract class AbstractFlowSet<T>
    extends Object
    implements FlowSet<T>
    provides functional code for most of the methods. Subclasses are invited to provide a more efficient version. Most often this will be done in the following way:
     public void yyy(FlowSet dest) {
       if (dest instanceof xxx) {
         blahblah;
       } else
         super.yyy(dest)
     }
     
    • Constructor Detail

      • AbstractFlowSet

        public AbstractFlowSet()
    • Method Detail

      • emptySet

        public FlowSet<T> emptySet()
        implemented, but inefficient.
        Specified by:
        emptySet in interface FlowSet<T>
      • copy

        public void copy​(FlowSet<T> dest)
        Description copied from interface: FlowSet
        Copies the current FlowSet into dest.
        Specified by:
        copy in interface FlowSet<T>
      • clear

        public void clear()
        implemented, but *very* inefficient.
        Specified by:
        clear in interface FlowSet<T>
      • union

        public void union​(FlowSet<T> other)
        Description copied from interface: FlowSet
        Returns the union (join) of this FlowSet and other, putting result into this.
        Specified by:
        union in interface FlowSet<T>
      • union

        public void union​(FlowSet<T> other,
                          FlowSet<T> dest)
        Description copied from interface: FlowSet
        Returns the union (join) of this FlowSet and other, putting result into dest. dest, other and this could be the same object.
        Specified by:
        union in interface FlowSet<T>
      • intersection

        public void intersection​(FlowSet<T> other)
        Description copied from interface: FlowSet
        Returns the intersection (meet) of this FlowSet and other, putting result into this.
        Specified by:
        intersection in interface FlowSet<T>
      • intersection

        public void intersection​(FlowSet<T> other,
                                 FlowSet<T> dest)
        Description copied from interface: FlowSet
        Returns the intersection (meet) of this FlowSet and other, putting result into dest. dest, other and this could be the same object.
        Specified by:
        intersection in interface FlowSet<T>
      • difference

        public void difference​(FlowSet<T> other)
        Description copied from interface: FlowSet
        Returns the set difference (this intersect ~other) of this FlowSet and other, putting result into this.
        Specified by:
        difference in interface FlowSet<T>
      • difference

        public void difference​(FlowSet<T> other,
                               FlowSet<T> dest)
        Description copied from interface: FlowSet
        Returns the set difference (this intersect ~other) of this FlowSet and other, putting result into dest. dest, other and this could be the same object.
        Specified by:
        difference in interface FlowSet<T>
      • isEmpty

        public abstract boolean isEmpty()
        Description copied from interface: FlowSet
        Returns true if this FlowSet is the empty set.
        Specified by:
        isEmpty in interface FlowSet<T>
      • size

        public abstract int size()
        Description copied from interface: FlowSet
        Returns the size of the current FlowSet.
        Specified by:
        size in interface FlowSet<T>
      • add

        public abstract void add​(T obj)
        Description copied from interface: FlowSet
        Adds obj to this.
        Specified by:
        add in interface FlowSet<T>
      • add

        public void add​(T obj,
                        FlowSet<T> dest)
        Description copied from interface: FlowSet
        puts this union obj into dest.
        Specified by:
        add in interface FlowSet<T>
      • remove

        public abstract void remove​(T obj)
        Description copied from interface: FlowSet
        Removes obj from this.
        Specified by:
        remove in interface FlowSet<T>
      • remove

        public void remove​(T obj,
                           FlowSet<T> dest)
        Description copied from interface: FlowSet
        Puts this minus obj into dest.
        Specified by:
        remove in interface FlowSet<T>
      • isSubSet

        public boolean isSubSet​(FlowSet<T> other)
        Description copied from interface: FlowSet
        Returns true if the other FlowSet is a subset of this FlowSet.
        Specified by:
        isSubSet in interface FlowSet<T>
      • contains

        public abstract boolean contains​(T obj)
        Description copied from interface: FlowSet
        Returns true if this FlowSet contains obj.
        Specified by:
        contains in interface FlowSet<T>
      • iterator

        public abstract Iterator<T> iterator()
        Description copied from interface: FlowSet
        returns an iterator over the elements of the flowSet. Note that the iterator might be backed, and hence be faster in the creation, than doing toList().iterator().
        Specified by:
        iterator in interface FlowSet<T>
        Specified by:
        iterator in interface Iterable<T>
      • toList

        public abstract List<T> toList()
        Description copied from interface: FlowSet
        Returns an unbacked list of contained objects for this FlowSet.
        Specified by:
        toList in interface FlowSet<T>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object