public abstract class AbstractRule extends java.lang.Object implements java.io.Serializable, IRule
Constructor and Description |
---|
AbstractRule(boolean dissolves,
LeftHandRule leftHandRule,
RightHandRule rightHandRule)
Creates a new Rule instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
dissolves()
Gets if the rule dissolves the membrane which is applied to
|
boolean |
equals(java.lang.Object obj) |
boolean |
execute(ChangeableMembrane membrane,
MultiSet<java.lang.String> environment)
Executes the rule on a membrane and an outer multiset and returns if the
execution could be committed
|
boolean |
execute(ChangeableMembrane membrane,
MultiSet<java.lang.String> environment,
long executions)
Executes the rule on a membrane and an outer multiset a number of times
indicated by executions and returns if the execution could be committed
|
LeftHandRule |
getLeftHandRule()
Gets the left hand rule of the current rule
|
java.util.Set<java.lang.String> |
getObjects()
Gets all different objects within the rule
|
RightHandRule |
getRightHandRule()
Gets the right hand rule of the current rule
|
long |
getRuleId() |
int |
hashCode() |
boolean |
hasNewMembranes()
Reports if the cell-like rule creates new membranes when executed
|
boolean |
isExecutable(ChangeableMembrane membrane)
Gets if the rule can be applied to the given membrane
|
void |
setRuleId(long ruleId) |
java.lang.String |
toString() |
countExecutions
public AbstractRule(boolean dissolves, LeftHandRule leftHandRule, RightHandRule rightHandRule)
dissolves
- a boolean parameter which reflects if the rule will dissolve
the membraneleftHandRule
- the left hand of the rulerightHandRule
- the right hand of the rulepublic java.util.Set<java.lang.String> getObjects()
getObjects
in interface IRule
public boolean dissolves()
public LeftHandRule getLeftHandRule()
getLeftHandRule
in interface IRule
public RightHandRule getRightHandRule()
getRightHandRule
in interface IRule
public boolean execute(ChangeableMembrane membrane, MultiSet<java.lang.String> environment)
public boolean execute(ChangeableMembrane membrane, MultiSet<java.lang.String> environment, long executions)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public boolean hasNewMembranes()
hasNewMembranes
in interface IRule
public boolean isExecutable(ChangeableMembrane membrane)
IRule
isExecutable
in interface IRule
membrane
- the ChangeableMembrane instance which the rule could be
applied to