All Downloads are FREE. Search and download functionalities are using the official Maven repository.

flatgraph.traversal.NumericSteps.scala Maven / Gradle / Ivy

There is a newer version: 0.0.91
Show newest version
package flatgraph.traversal

class NumericSteps[N](val traversal: Iterator[N]) extends AnyVal {

  def greaterThan(n: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(numeric.gt(_, n))

  def greaterThanEqual(n: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(numeric.gteq(_, n))

  def lessThan(n: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(numeric.lt(_, n))

  def lessThanEqual(n: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(numeric.lteq(_, n))

  def equal(n: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(numeric.equiv(_, n))

  def equiv(n: N)(implicit numeric: Numeric[N]): Iterator[N] = equal(n)

  def between(startInclusive: N, endExclusive: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(n => numeric.gteq(n, startInclusive) && numeric.lt(n, endExclusive))

  def inside(startExclusive: N, endExclusive: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(n => numeric.gt(n, startExclusive) && numeric.lt(n, endExclusive))

  def outside(startInclusive: N, endInclusive: N)(implicit numeric: Numeric[N]): Iterator[N] =
    traversal.filter(n => numeric.lt(n, startInclusive) || numeric.gt(n, endInclusive))

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy