org.expasy.jpl.commons.collection
Class IntegerSequence

java.lang.Object
  extended by org.expasy.jpl.commons.collection.IntegerSequence

public final class IntegerSequence
extends Object

A IntegerSequence in mathematics is a sequence (i.e., an ordered list) of integers. It is represented as an interval of numbers between a and b, including a and excluding b, it is often denoted [a,b[.

Version:
1.0
Author:
nikitin

Nested Class Summary
static class IntegerSequence.Builder
           
 
Constructor Summary
IntegerSequence(IntegerSequence.Builder builder)
           
 
Method Summary
static int computeSize(Interval interval, int by, boolean upperBoundIncluded)
          Compute the number of integers in the sequence form an interval.
static IntegerSequence emptyInstance()
           
 int getBy()
           
 int getFrom()
           
 int getTo()
           
 boolean isEmpty()
           
static boolean isUpperBoundIncluded(Interval interval, int by)
           
 int size()
           
 int[] toInts()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerSequence

public IntegerSequence(IntegerSequence.Builder builder)
Method Detail

emptyInstance

public static IntegerSequence emptyInstance()

getFrom

public final int getFrom()

getTo

public final int getTo()

getBy

public final int getBy()

size

public final int size()

toInts

public int[] toInts()

isEmpty

public boolean isEmpty()

isUpperBoundIncluded

public static boolean isUpperBoundIncluded(Interval interval,
                                           int by)

computeSize

public static int computeSize(Interval interval,
                              int by,
                              boolean upperBoundIncluded)
Compute the number of integers in the sequence form an interval.

Parameters:
interval - the sequence interval.
by - the step sequence.
Returns:
the size.

toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.