compbio.metadata
Class Limit<T>

java.lang.Object
  extended by compbio.metadata.Limit<T>
Type Parameters:
T - the type of an executable for which this limit is defined.

public class Limit<T>
extends java.lang.Object

A value object containing a maximum number of sequences and a maximum average sequence length for a preset.

Author:
pvtroshin Date January 2010
See Also:
LimitsManager

Constructor Summary
Limit(int seqNumber, int seqLength, java.lang.String preset)
           
Limit(int seqNumber, int seqLength, java.lang.String preset, boolean isDefault)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getAvgSeqLength()
           
static int getAvgSequenceLength(java.util.List<FastaSequence> data)
          Calculates an average sequence length of the dataset
 java.lang.String getPreset()
           
 int getSeqNumber()
           
 int hashCode()
           
 boolean isDefault()
           
 boolean isExceeded(java.util.List<FastaSequence> data)
          Checks if the number of sequences or their average length in the dataset exceeds limits the values defined by this Limit
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Limit

public Limit(int seqNumber,
             int seqLength,
             java.lang.String preset)

Limit

public Limit(int seqNumber,
             int seqLength,
             java.lang.String preset,
             boolean isDefault)
Method Detail

getPreset

public java.lang.String getPreset()

getAvgSeqLength

public int getAvgSeqLength()

getSeqNumber

public int getSeqNumber()

isDefault

public boolean isDefault()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isExceeded

public boolean isExceeded(java.util.List<FastaSequence> data)
Checks if the number of sequences or their average length in the dataset exceeds limits the values defined by this Limit

Parameters:
data -
Returns:
true if a limit is exceeded (what is the dataset is larger then the limit), false otherwise.

getAvgSequenceLength

public static int getAvgSequenceLength(java.util.List<FastaSequence> data)
Calculates an average sequence length of the dataset

Parameters:
data -
Returns:
an average sequence length in the input dataset