irc
Class RuleList

java.lang.Object
  |
  +--irc.RuleList

public class RuleList
extends java.lang.Object

Implements a set of rules.


Constructor Summary
RuleList()
          Create a new, empty, set of rules.
 
Method Summary
 void addRule(java.lang.String[] pattern, java.lang.Object value)
          Add a new rule.
 java.lang.Object findValue(java.lang.String[] values)
          Find the first matching rule for the given values.
 java.lang.Object getDefaultValue()
          Get the default value.
 void setDefaultValue(java.lang.Object v)
          Set the default value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleList

public RuleList()
Create a new, empty, set of rules.

Method Detail

setDefaultValue

public void setDefaultValue(java.lang.Object v)
Set the default value. By default, this value is null.

Parameters:
v - new default value.

getDefaultValue

public java.lang.Object getDefaultValue()
Get the default value.

Returns:
the default value.

addRule

public void addRule(java.lang.String[] pattern,
                    java.lang.Object value)
Add a new rule. The rule uses the given array of list patterns (see ListHandler) and has the given value.

Parameters:
pattern - array of pattern.
value - rule value.

findValue

public java.lang.Object findValue(java.lang.String[] values)
Find the first matching rule for the given values.

Parameters:
values - array of values to be tested againts patterns.
Returns:
value of the first matching rule, or default value if no matcing rule is found.