Package net.sf.okapi.lib.segmentation
Class Rule
- java.lang.Object
-
- net.sf.okapi.lib.segmentation.Rule
-
public class Rule extends Object
Stores the data for a SRX <rule> element.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
after
Pattern for after the break point.protected String
before
Pattern for before the break point.protected String
comment
Optional comment placed just before the rule.protected boolean
isActive
Flag indicating if the rule is active.protected boolean
isBreak
Flag indicating if the rule is a breaking rule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAfter()
Gets the pattern after the break point for this rule.String
getBefore()
Gets the pattern before the break point for this rule.String
getComment()
Gets the optional comment for this rule.boolean
isActive()
Indicates if this rule is active.boolean
isBreak()
Indicates if this rule is a breaking rule.void
setActive(boolean value)
Sets the flag indicating if this rule is active.void
setAfter(String value)
Sets the pattern after the break point for this rule.void
setBefore(String value)
Sets the pattern before the break point for this rule.void
setBreak(boolean value)
Sets the flag indicating if this rule is a breaking rule.void
setComment(String text)
Sets the comment for this rule.
-
-
-
Field Detail
-
before
protected String before
Pattern for before the break point.
-
after
protected String after
Pattern for after the break point.
-
isBreak
protected boolean isBreak
Flag indicating if the rule is a breaking rule.
-
isActive
protected boolean isActive
Flag indicating if the rule is active.
-
comment
protected String comment
Optional comment placed just before the rule.
-
-
Constructor Detail
-
Rule
public Rule()
Creates an empty breaking and active Rule object.
-
Rule
public Rule(String before, String after, boolean isBreak)
Creates a Rule object with given patterns and a flag indicating if the rule is a breaking one or a breaking exception.- Parameters:
before
- the pattern for before the break point.after
- the pattern for after the break point.isBreak
- true if the rule is a breaking rule, false if it is a breaking exception.
-
-
Method Detail
-
getBefore
public String getBefore()
Gets the pattern before the break point for this rule.- Returns:
- the pattern before the break point for this rule.
-
setBefore
public void setBefore(String value)
Sets the pattern before the break point for this rule.- Parameters:
value
- the new pattern before the break point for this rule.
-
getAfter
public String getAfter()
Gets the pattern after the break point for this rule.- Returns:
- the pattern after the break point for this rule.
-
setAfter
public void setAfter(String value)
Sets the pattern after the break point for this rule.- Parameters:
value
- the new pattern after the break point for this rule.
-
isBreak
public boolean isBreak()
Indicates if this rule is a breaking rule.- Returns:
- true if this rule is a breaking rule, false if it is a breaking exception.
-
setBreak
public void setBreak(boolean value)
Sets the flag indicating if this rule is a breaking rule.- Parameters:
value
- true if this rule is a breaking rule, false if it is a breaking exception.
-
isActive
public boolean isActive()
Indicates if this rule is active.- Returns:
- true if this rule is active, false otherwise.
-
setActive
public void setActive(boolean value)
Sets the flag indicating if this rule is active.- Parameters:
value
- true if this rule is active, false otherwise.
-
getComment
public String getComment()
Gets the optional comment for this rule.- Returns:
- the comment for this rule, or null if there is none.
-
setComment
public void setComment(String text)
Sets the comment for this rule.- Parameters:
text
- the new comment. Use null or empty string to remove the comment.
-
-