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, setNameequals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChildren, getMemClass, getMemInstanceOf, getNeighbors, getParent, isPredefinedMem, registMemClass, removeTunnelgetName, getNameDim, setNameaddDimension, addDimension, fix, get, getDimensions, getDimensionSize, isFixed, predictPossibleValuepublic PMembrane(java.lang.String name)
name - membrane namepublic PMembrane()
public java.lang.Number getNumOf(Obj object)
Membranepublic void addObject(Obj object, java.lang.Number num)
Membranepublic boolean reduceObject(Obj object, java.lang.Number num)
MembranereduceObject in interface Membraneobject - the object which will be reducednum - the reduced quantitytruepublic java.util.Map<Obj,java.lang.Number> getObjects()
MembranegetObjects in interface Membranepublic java.util.HashMap<Rule,java.lang.Integer> getUsableRules() throws UnpredictableDimensionException, java.lang.CloneNotSupportedException
MembranegetUsableRules in interface MembraneUnpredictableDimensionException - 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
Membranefetch in interface MembraneTunnelNotExistException - If one rule want to get a neighbor of this membrane and no tunnel
was foundpublic java.util.Map<Rule,java.lang.Integer> setProducts()
MembranesetProducts in interface Membranepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(java.lang.String space,
boolean withObject,
boolean withProp,
boolean withRule,
boolean withSubmembrane,
boolean withTunnel)
toString in interface Membranespace - 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)
MembranesetProperty in interface MembranepropertyName - the name of propertypropertyValue - the value of propertypublic java.lang.Object getProperty(java.lang.String propertyName)
MembranegetProperty in interface MembranepropertyName - the name of propertynull will be returned.public java.util.List<Rule> getRules()
Membranepublic void addDimension(java.lang.String formula)
Dimensionali+1 and i+1 should be added to a.addDimension in interface DimensionaladdDimension in class BasicNameformula - dimensionspublic void extend(Membrane template)
Membranepublic java.util.Map<java.lang.String,java.lang.Object> getProperties()
getProperties in interface Membranepublic void delete()
MembraneClose all the tunnels and set current membrane deleted
public boolean isDeleted()
Membranepublic void newStepInit()
Membrane$ and initialize
this membrane for a new simulationnewStepInit in interface Membranepublic void addTunnel(Tunnel t)
Membranepublic Tunnel getTunnel(Tunnel.TunnelType type, java.lang.String target)
Membranepublic java.util.List<Tunnel> getTunnels()
MembranegetTunnels in interface Membranepublic void addChild(java.lang.Class<?> tunnelClass,
Membrane child)
Membranepublic void addListener(MembraneListener listener)
MembraneaddListener in interface Membranelistener - a membrane listenerpublic void removeListener(MembraneListener listener)
MembraneremoveListener in interface Membranelistener - the listener you want to removepublic void startChecking(Membrane membrane)
MembraneListenerstartChecking in interface MembraneListenermembrane - this membranepublic void endChecking(Membrane membrane)
MembraneListenerendChecking in interface MembraneListenermembrane - this membranepublic void startFetching(Membrane membrane)
MembraneListenerstartFetching in interface MembraneListenermembrane - this membranepublic void endFetching(Membrane membrane)
MembraneListenerendFetching in interface MembraneListenermembrane - this membranepublic void startSetting(Membrane membrane)
MembraneListenerstartSetting in interface MembraneListenermembrane - this membranepublic void endSetting(Membrane membrane)
MembraneListenerendSetting in interface MembraneListenermembrane - this membrane