Class Interval<S extends java.lang.Number>

  • Type Parameters:
    S - the (number-)type of the elements in this interval
    All Implemented Interfaces:
    java.lang.Iterable<S>, java.util.Collection<S>, java.util.Set<S>, NumberSet<S>

    public class Interval<S extends java.lang.Number>
    extends java.lang.Object
    implements NumberSet<S>
    This class contains a set of closed set (interval) of possible numbers
    Author:
    Bastian Wolf
    • Method Summary

      Modifier and Type Method Description
      boolean add​(S e)  
      boolean addAll​(java.util.Collection<? extends S> c)  
      void clear()  
      boolean contains​(java.lang.Object o)  
      boolean containsAll​(java.util.Collection<?> c)  
      NumberSet<S> getIntervalset()  
      S getLowerBound()
      Returns the lower bound
      S getUpperBound()  
      boolean isElementOf​(S a)
      checks, whether an element is within this interval
      boolean isEmpty()  
      java.util.Iterator<S> iterator()  
      boolean remove​(java.lang.Object o)  
      boolean removeAll​(java.util.Collection<?> c)  
      boolean retainAll​(java.util.Collection<?> c)  
      void setIntervalset​(NumberSet<S> intervalset)  
      void setLowerBound​(S lowerBound)  
      void setUpperBound​(S upperBound)  
      int size()  
      java.lang.Object[] toArray()  
      <T> T[] toArray​(T[] a)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        equals, hashCode, spliterator
    • Constructor Detail

      • Interval

        public Interval​(NumberSet<S> interval)
      • Interval

        public Interval​(S lower,
                        S upper)
    • Method Detail

      • getLowerBound

        public S getLowerBound()
        Returns the lower bound
        Returns:
        the lower bound
      • setLowerBound

        public void setLowerBound​(S lowerBound)
      • getUpperBound

        public S getUpperBound()
      • setUpperBound

        public void setUpperBound​(S upperBound)
      • getIntervalset

        public NumberSet<S> getIntervalset()
      • setIntervalset

        public void setIntervalset​(NumberSet<S> intervalset)
      • isElementOf

        public boolean isElementOf​(S a)
        checks, whether an element is within this interval
        Parameters:
        a - some element
        Returns:
        true iff a is an element of this interval
      • add

        public boolean add​(S e)
        Specified by:
        add in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        add in interface java.util.Set<S extends java.lang.Number>
      • addAll

        public boolean addAll​(java.util.Collection<? extends S> c)
        Specified by:
        addAll in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        addAll in interface java.util.Set<S extends java.lang.Number>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        clear in interface java.util.Set<S extends java.lang.Number>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        contains in interface java.util.Set<S extends java.lang.Number>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        containsAll in interface java.util.Set<S extends java.lang.Number>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        isEmpty in interface java.util.Set<S extends java.lang.Number>
      • iterator

        public java.util.Iterator<S> iterator()
        Specified by:
        iterator in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        iterator in interface java.lang.Iterable<S extends java.lang.Number>
        Specified by:
        iterator in interface java.util.Set<S extends java.lang.Number>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        remove in interface java.util.Set<S extends java.lang.Number>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        removeAll in interface java.util.Set<S extends java.lang.Number>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        retainAll in interface java.util.Set<S extends java.lang.Number>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        size in interface java.util.Set<S extends java.lang.Number>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        toArray in interface java.util.Set<S extends java.lang.Number>
      • toArray

        public <T> T[] toArray​(T[] a)
        Specified by:
        toArray in interface java.util.Collection<S extends java.lang.Number>
        Specified by:
        toArray in interface java.util.Set<S extends java.lang.Number>