Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints
Class ListSizeConstraint<T>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.ListSizeConstraint<T>
All Implemented Interfaces:
Loggable, ParameterConstraint<List<T>>

public class ListSizeConstraint<T>
extends AbstractLoggable
implements ParameterConstraint<List<T>>

Represents a list-size parameter constraint. The size of the list parameter (ListParameter) to be tested has to be equal to the specified list size constraint.

Author:
Steffi Wanka

Field Summary
private  int sizeConstraint
          The list size constraint.
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
ListSizeConstraint(int size)
          Constructs a list size constraint with the given constraint size.
 
Method Summary
 String getDescription(String parameterName)
          Returns a description of this constraint.
 void test(List<T> t)
          Checks if the list parameter fulfills the size constraint.
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.logging.Loggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, verbose, verbose, warning
 

Field Detail

sizeConstraint

private int sizeConstraint
The list size constraint.

Constructor Detail

ListSizeConstraint

public ListSizeConstraint(int size)
Constructs a list size constraint with the given constraint size.

Parameters:
size - the size constraint for the list parameter
Method Detail

test

public void test(List<T> t)
          throws ParameterException
Checks if the list parameter fulfills the size constraint. If not, a parameter exception is thrown.

Specified by:
test in interface ParameterConstraint<List<T>>
Parameters:
t - Value to be checked whether or not it fulfills the underlying parameter constraint.
Throws:
ParameterException, - if the size of the list parameter given is not equal to the list size constraint specified.
ParameterException - if the parameter to be tested does not fulfill the parameter constraint
See Also:
ParameterConstraint.test(java.lang.Object)

getDescription

public String getDescription(String parameterName)
Description copied from interface: ParameterConstraint
Returns a description of this constraint.

Specified by:
getDescription in interface ParameterConstraint<List<T>>
Parameters:
parameterName - the name of the parameter this constraint is used for
Returns:
a description of this constraint
See Also:
ParameterConstraint.getDescription(String)

Release 0.1 (2008-07-10_1838)