de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints
Class EqualStringConstraint

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.EqualStringConstraint
All Implemented Interfaces:
ParameterConstraint<String>

public class EqualStringConstraint
extends Object
implements ParameterConstraint<String>

Represents a parameter constraint for testing if the string value of the string parameter ( StringParameter ) to be tested is equal to the specified constraint-strings.


Field Summary
private  String[] testStrings
          Constraint-strings.
 
Constructor Summary
EqualStringConstraint(String[] testStrings)
          Creates an Equal-To-String parameter constraint.
 
Method Summary
private  String constraintStrings()
           
 String getDescription(String parameterName)
          Returns a description of this constraint.
 void test(String t)
          Checks if the given string value of the string parameter is equal to one of the constraint strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

testStrings

private String[] testStrings
Constraint-strings.

Constructor Detail

EqualStringConstraint

public EqualStringConstraint(String[] testStrings)
Creates an Equal-To-String parameter constraint.

That is, the string value of the parameter to be tested has to be equal to one of the given constraint-strings.

Parameters:
testStrings - constraint-strings.
Method Detail

constraintStrings

private String constraintStrings()

test

public void test(String t)
          throws ParameterException
Checks if the given string value of the string parameter is equal to one of the constraint strings. If not, a parameter exception is thrown.

Specified by:
test in interface ParameterConstraint<String>
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 String getDescription(String parameterName)
Description copied from interface: ParameterConstraint
Returns a description of this constraint.

Specified by:
getDescription in interface ParameterConstraint<String>
Parameters:
parameterName - the name of the parameter this constraint is used for
Returns:
a description of this constraint

Release 0.4.0 (2011-09-20_1324)