public class PMembrane extends BasicName implements Membrane, MembraneListener
membraneClass, membraneClassStatus
Constructor and Description |
---|
PMembrane()
Create an empty membrane with no name
|
PMembrane(java.lang.String name)
Create an empty membrane with a name
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(java.lang.Class<?> tunnelClass,
Membrane child)
Add a child to this membrane
|
void |
addDimension(java.lang.String formula)
Add new formula dimensions to an instance of dimension.
|
void |
addListener(MembraneListener listener)
Add a listener to this membrane
|
void |
addObject(Obj object,
java.lang.Number num)
Add object to this membrane
|
void |
addRule(Rule rule)
Add a new rule
|
void |
addTunnel(Tunnel t)
Add a tunnel between two membranes.
|
PMembrane |
deepClone()
Clone the name
|
void |
delete()
Delete a membrane.
|
void |
endChecking(Membrane membrane)
End checking all rules if some of them are satisfied
|
void |
endFetching(Membrane membrane)
End fetching all the satisfied rules
|
void |
endSetting(Membrane membrane)
End setting product in this membrane include all its sub-membranes.
|
void |
extend(Membrane template)
Extend a template
|
java.util.Map<Rule,java.lang.Integer> |
fetch()
All the satisfied rules try to fetch the objects they need
|
java.lang.Number |
getNumOf(Obj object)
Get the quantity of object
|
java.util.Map<Obj,java.lang.Number> |
getObjects()
Get all the objects contained in this membrane
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties() |
java.lang.Object |
getProperty(java.lang.String propertyName)
Get the property's value of this membrane
|
java.util.List<Rule> |
getRules()
Get all the rules contained in this membrane
|
Tunnel |
getTunnel(Tunnel.TunnelType type,
java.lang.String target)
Get the tunnel from current to target
|
java.util.List<Tunnel> |
getTunnels()
Get all the tunnels of current membrane
|
java.util.HashMap<Rule,java.lang.Integer> |
getUsableRules()
Check all the rules inside if they are satisfied, and return all the usable
rules.
|
boolean |
isDeleted()
Return if this membrane is deleted.
|
void |
newStepInit()
Remove runtime properties whose name starts with
$ and initialize
this membrane for a new simulation |
boolean |
reduceObject(Obj object,
java.lang.Number num)
Reduce object in this membrane
|
void |
removeListener(MembraneListener listener)
Remove a listener from this membrane
|
java.util.Map<Rule,java.lang.Integer> |
setProducts()
Set products of rules
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object propertyValue)
Set property of membrane
|
void |
startChecking(Membrane membrane)
Start to check all rules if some of them are satisfied
|
void |
startFetching(Membrane membrane)
Start to fetch all the satisfied rules
|
void |
startSetting(Membrane membrane)
Start to set product in this membrane
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String space,
boolean withObject,
boolean withProp,
boolean withRule,
boolean withSubmembrane,
boolean withTunnel) |
addDimension, addDimension, fix, get, getDimensions, getDimensionSize, getName, getNameDim, isFixed, predictPossibleValue, predictPossibleValueOfNeighbor, predictPossibleValueOfObjects, predictPossibleValueOfSubmembrane, setName
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChildren, getMemClass, getMemInstanceOf, getNeighbors, getParent, isPredefinedMem, registMemClass, removeTunnel
getName, getNameDim, setName
addDimension, addDimension, fix, get, getDimensions, getDimensionSize, isFixed, predictPossibleValue
public PMembrane(java.lang.String name)
name
- membrane namepublic PMembrane()
public java.lang.Number getNumOf(Obj object)
Membrane
public void addObject(Obj object, java.lang.Number num)
Membrane
public boolean reduceObject(Obj object, java.lang.Number num)
Membrane
reduceObject
in interface Membrane
object
- the object which will be reducednum
- the reduced quantitytrue
public java.util.Map<Obj,java.lang.Number> getObjects()
Membrane
getObjects
in interface Membrane
public java.util.HashMap<Rule,java.lang.Integer> getUsableRules() throws UnpredictableDimensionException, java.lang.CloneNotSupportedException
Membrane
getUsableRules
in interface Membrane
UnpredictableDimensionException
- if there exist unpredictable dimension, such as the dimension of
one rule only appears at a inhibitorjava.lang.CloneNotSupportedException
- if some rules, objects, cannot be clonedpublic java.util.Map<Rule,java.lang.Integer> fetch() throws TunnelNotExistException
Membrane
fetch
in interface Membrane
TunnelNotExistException
- If one rule want to get a neighbor of this membrane and no tunnel
was foundpublic java.util.Map<Rule,java.lang.Integer> setProducts()
Membrane
setProducts
in interface Membrane
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String space, boolean withObject, boolean withProp, boolean withRule, boolean withSubmembrane, boolean withTunnel)
toString
in interface Membrane
space
- put in the front of itemswithObject
- whether show objects or notwithProp
- whether show properties or notwithRule
- whether show rules or notwithSubmembrane
- whether show sub-membranes or notwithTunnel
- whether show tunnelspublic void setProperty(java.lang.String propertyName, java.lang.Object propertyValue)
Membrane
setProperty
in interface Membrane
propertyName
- the name of propertypropertyValue
- the value of propertypublic java.lang.Object getProperty(java.lang.String propertyName)
Membrane
getProperty
in interface Membrane
propertyName
- the name of propertynull
will be returned.public java.util.List<Rule> getRules()
Membrane
public void addDimension(java.lang.String formula)
Dimensional
i+1
and i+1
should be added to a
.addDimension
in interface Dimensional
addDimension
in class BasicName
formula
- dimensionspublic void extend(Membrane template)
Membrane
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
getProperties
in interface Membrane
public void delete()
Membrane
Close all the tunnels and set current membrane deleted
public boolean isDeleted()
Membrane
public void newStepInit()
Membrane
$
and initialize
this membrane for a new simulationnewStepInit
in interface Membrane
public void addTunnel(Tunnel t)
Membrane
public Tunnel getTunnel(Tunnel.TunnelType type, java.lang.String target)
Membrane
public java.util.List<Tunnel> getTunnels()
Membrane
getTunnels
in interface Membrane
public void addChild(java.lang.Class<?> tunnelClass, Membrane child)
Membrane
public void addListener(MembraneListener listener)
Membrane
addListener
in interface Membrane
listener
- a membrane listenerpublic void removeListener(MembraneListener listener)
Membrane
removeListener
in interface Membrane
listener
- the listener you want to removepublic void startChecking(Membrane membrane)
MembraneListener
startChecking
in interface MembraneListener
membrane
- this membranepublic void endChecking(Membrane membrane)
MembraneListener
endChecking
in interface MembraneListener
membrane
- this membranepublic void startFetching(Membrane membrane)
MembraneListener
startFetching
in interface MembraneListener
membrane
- this membranepublic void endFetching(Membrane membrane)
MembraneListener
endFetching
in interface MembraneListener
membrane
- this membranepublic void startSetting(Membrane membrane)
MembraneListener
startSetting
in interface MembraneListener
membrane
- this membranepublic void endSetting(Membrane membrane)
MembraneListener
endSetting
in interface MembraneListener
membrane
- this membrane