Class ListSizeConstraint
- java.lang.Object
-
- elki.utilities.optionhandling.constraints.ListSizeConstraint
-
- All Implemented Interfaces:
ParameterConstraint<java.lang.Object>
public class ListSizeConstraint extends java.lang.Object implements ParameterConstraint<java.lang.Object>
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.FIXME: Unfortunately, we cannot have good type safety anymore right now.
- Since:
- 0.1
- Author:
- Steffi Wanka
-
-
Field Summary
Fields Modifier and Type Field Description private int
sizeConstraint
The list size constraint.
-
Constructor Summary
Constructors Constructor Description ListSizeConstraint(int size)
Constructs a list size constraint with the given constraint size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDescription(java.lang.String parameterName)
Returns a description of this constraint.void
test(java.lang.Object t)
Checks if the list parameter fulfills the size constraint.
-
-
-
Method Detail
-
test
public void test(java.lang.Object t) throws ParameterException
Checks if the list parameter fulfills the size constraint. If not, a parameter exception is thrown.- Specified by:
test
in interfaceParameterConstraint<java.lang.Object>
- Parameters:
t
- Value to be checked whether or not it fulfills the underlying parameter constraint.- Throws:
ParameterException
- if the parameter to be tested does not fulfill the parameter constraint
-
getDescription
public java.lang.String getDescription(java.lang.String parameterName)
Description copied from interface:ParameterConstraint
Returns a description of this constraint.- Specified by:
getDescription
in interfaceParameterConstraint<java.lang.Object>
- Parameters:
parameterName
- the name of the parameter this constraint is used for- Returns:
- a description of this constraint
-
-