net.sf.freecol.client.gui.i18n
Class Rule

java.lang.Object
  extended by net.sf.freecol.client.gui.i18n.Rule

public class Rule
extends java.lang.Object

A rule consists of any number of relations combined with "and" and "or" operators. The "and" operator binds more strongly, and there are no grouping features.


Field Summary
(package private)  java.util.List<java.util.List<Relation>> conditions
           
 
Constructor Summary
Rule(java.lang.String input)
           
 
Method Summary
 void add(java.util.List<Relation> condition)
          Adds a list of relations combined with the "and" operator.
 boolean matches(double number)
          Returns true if this rule matches the given number.
 void parse(java.lang.String input)
          Parses a string.
private  java.util.List<Relation> parseCondition(java.util.List<java.lang.String> input)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

conditions

java.util.List<java.util.List<Relation>> conditions
Constructor Detail

Rule

public Rule(java.lang.String input)
Method Detail

add

public void add(java.util.List<Relation> condition)
Adds a list of relations combined with the "and" operator.

Parameters:
condition - a list of relations combined with the "and" operator

matches

public boolean matches(double number)
Returns true if this rule matches the given number.

Parameters:
number - a double value
Returns:
a boolean value

parse

public void parse(java.lang.String input)
Parses a string.

Parameters:
input - a String value

parseCondition

private java.util.List<Relation> parseCondition(java.util.List<java.lang.String> input)

toString

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