|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectanecho.JamochaMUD.plugins.TriggerDir.Rule
public class Rule
This class is used to contain rules used by Triggers.
A rule is a set of conditions. Each condition can be relatively
simple but when combined with other conditions will define the result
of a rule.
There are three descriptions for a rule:
Word - The text portion of the rule that JamochaMUD matches against
Option - specifying if a rule is type AND/NOT/MODIFIER etc.
Condition - A string containing both the Option and Word
A complete rule follows this format when saved to a text file
$RULES:1$0:AND:[idle$COLOUR:#ffffff$MATCHONLY:true$LAUNCH:None$MEDIA:None$TRIGGER:None$NAME:Highlight idle messages$DONE:
$RULES:1 Indicates there is only 1 condition to this rule
$0: Indicates the position of the first (0-based numbering) rule
AND: the option for rule 0
[idle the string to match for rule 0
$COLOUR: the colour to use for this rule
$MATCHONLY: Highlight with $COLOUR: only the portion of the text that matches this rule
$LAUNCH: path of a program to launch based on a correct match
$MEDIA: path to a media file to play based on a correct match
$TRIGGER: Text to be sent back to the MU* based on a correct match
$NAME: The human-readable name of this plug-in
$DONE: This marks the end of the given rule
| Constructor Summary | |
|---|---|
Rule()
|
|
Rule(java.lang.String name)
|
|
| Method Summary | |
|---|---|
void |
addCondition(java.lang.String cond)
Adds a new rule to the end the existing list of rules |
void |
addCondition(java.lang.String option,
java.lang.String word)
Add a new rule to the end of the existing list of rules |
int |
conditionCount()
This returns the number of conditions in this rule |
java.lang.String |
getColourString()
|
java.lang.String |
getConditionAt(int index)
Get the rule at the given index |
java.lang.String[] |
getConditions()
Returns all the current rules as a String array |
java.lang.String |
getMediaString()
|
java.lang.String |
getName()
Returns the human-readable name of this rule |
java.lang.String |
getOptionAt(int index)
Returns the option at the given index |
java.lang.String |
getTriggerString()
|
java.lang.String |
getWordAt(int index)
Returns the word at the given index |
void |
insertConditionAt(int index,
java.lang.String cond)
Set the rule at the given index. |
boolean |
isColour()
|
boolean |
isGag()
|
boolean |
isHighlight()
|
boolean |
isMatchOnly()
|
boolean |
isMedia()
|
boolean |
isTrigger()
|
void |
setColour(boolean state)
|
void |
setColourString(java.lang.String code)
|
void |
setConditions(java.lang.String conStr)
Set the conditions based on one string. |
void |
setGag(boolean state)
|
void |
setHighlight(boolean state)
|
void |
setMatchOnly(boolean state)
|
void |
setMedia(boolean state)
|
void |
setMediaString(java.lang.String code)
|
void |
setName(java.lang.String name)
Set the name of this rule |
void |
setTrigger(boolean state)
|
void |
setTriggerString(java.lang.String code)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Rule()
public Rule(java.lang.String name)
name - | Method Detail |
|---|
public void setName(java.lang.String name)
name - human-readable name of this rulepublic java.lang.String getName()
public int conditionCount()
public void insertConditionAt(int index,
java.lang.String cond)
index - The index of the rule to setpublic java.lang.String getConditionAt(int index)
index - The index of the rule to return
public java.lang.String[] getConditions()
public void setConditions(java.lang.String conStr)
conStr - A String representing all the conditionspublic void addCondition(java.lang.String cond)
cond - The string representing the new condition
public void addCondition(java.lang.String option,
java.lang.String word)
option - word - public java.lang.String getWordAt(int index)
index -
public java.lang.String getOptionAt(int index)
index -
public void setHighlight(boolean state)
state - public boolean isHighlight()
public void setColour(boolean state)
state - public boolean isColour()
public void setColourString(java.lang.String code)
code - public java.lang.String getColourString()
public void setMatchOnly(boolean state)
state - public boolean isMatchOnly()
public void setGag(boolean state)
state - public boolean isGag()
public void setMedia(boolean state)
state - public boolean isMedia()
public void setMediaString(java.lang.String code)
code - public java.lang.String getMediaString()
public void setTrigger(boolean state)
state - public boolean isTrigger()
public void setTriggerString(java.lang.String code)
code - public java.lang.String getTriggerString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||