Package edu.jas.util

Class CartesianProductLongIterator

  • All Implemented Interfaces:
    java.util.Iterator<java.util.List<java.lang.Long>>

    class CartesianProductLongIterator
    extends java.lang.Object
    implements java.util.Iterator<java.util.List<java.lang.Long>>
    Cartesian product iterator for Longs. Similar to CartesianProductIterator but returns only tuples of given total degree.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.List<LongIterator> compit  
      (package private) java.util.List<LongIterable> comps
      data structure.
      (package private) java.util.List<java.lang.Long> current  
      (package private) boolean empty  
      long upperBound  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Test for availability of a next tuple.
      java.util.List<java.lang.Long> next()
      Get next tuple.
      void remove()
      Remove a tuple if allowed.
      long totalDegree​(java.util.List<java.lang.Long> e)
      Total degree of a tuple.
      • Methods inherited from class java.lang.Object

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

        forEachRemaining
    • Field Detail

      • comps

        final java.util.List<LongIterable> comps
        data structure.
      • current

        java.util.List<java.lang.Long> current
      • empty

        boolean empty
      • upperBound

        public final long upperBound
    • Constructor Detail

      • CartesianProductLongIterator

        public CartesianProductLongIterator​(java.util.List<LongIterable> comps,
                                            long ub)
        CartesianProduct iterator constructor.
        Parameters:
        comps - components of the Cartesian product.
        ub - an upper bound for the total degree of the elements.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Test for availability of a next tuple.
        Specified by:
        hasNext in interface java.util.Iterator<java.util.List<java.lang.Long>>
        Returns:
        true if the iteration has more tuples, else false.
      • next

        public java.util.List<java.lang.Long> next()
        Get next tuple.
        Specified by:
        next in interface java.util.Iterator<java.util.List<java.lang.Long>>
        Returns:
        next tuple.
      • totalDegree

        public long totalDegree​(java.util.List<java.lang.Long> e)
        Total degree of a tuple.
        Parameters:
        e - list of Longs.
        Returns:
        sum of all elements in e.
      • remove

        public void remove()
        Remove a tuple if allowed.
        Specified by:
        remove in interface java.util.Iterator<java.util.List<java.lang.Long>>