Package edu.jas.util

Class CartesianProductLongIterator

java.lang.Object
edu.jas.util.CartesianProductLongIterator
All Implemented Interfaces:
Iterator<List<Long>>

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

  • Constructor Details

    • CartesianProductLongIterator

      public CartesianProductLongIterator(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 Details

    • hasNext

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

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

      public long totalDegree(List<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 Iterator<List<Long>>