public interface Membrane extends Name, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static java.util.HashMap<java.lang.String,Membrane> |
membraneClass |
static java.util.HashMap<java.lang.String,java.lang.Boolean> |
membraneClassStatus |
Modifier and Type | Method and Description |
---|---|
default void |
addChild(java.lang.Class<?> tunnelClass,
Membrane child)
Add a child to this membrane
|
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.
|
Membrane |
deepClone()
Deep clone a membrane
|
void |
delete()
Delete a membrane.
|
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
|
default java.util.List<Membrane> |
getChildren()
Get all the children to whom this membrane has a in tunnel
|
static Membrane |
getMemClass(java.lang.String name)
Get the template of one membrane class
|
static Membrane |
getMemInstanceOf(java.lang.String membraneName)
Create an instance of a membrane class
|
default java.util.List<Membrane> |
getNeighbors()
Get all the neighbors to whom this membrane has a go tunnel
|
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
|
default Membrane |
getParent()
Get the parent membrane of 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.Map<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.
|
static boolean |
isPredefinedMem(java.lang.String membraneName)
Check if a name is the name of one predefined membrane class
|
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
|
static void |
registMemClass(java.lang.String name,
Membrane membrane,
boolean predefined)
Register a Membrane Class
|
void |
removeListener(MembraneListener listener)
Remove a listener from this membrane
|
default void |
removeTunnel(Tunnel t)
Remove a tunnel from this membranes.
|
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
|
java.lang.String |
toString(java.lang.String space,
boolean withObject,
boolean withProp,
boolean withRule,
boolean withSubmembrane,
boolean withTunnel) |
getName, getNameDim, setName
addDimension, addDimension, addDimension, fix, get, getDimensions, getDimensionSize, isFixed, predictPossibleValue
static final java.util.HashMap<java.lang.String,Membrane> membraneClass
static final java.util.HashMap<java.lang.String,java.lang.Boolean> membraneClassStatus
static void registMemClass(java.lang.String name, Membrane membrane, boolean predefined)
name
- name of membrane classmembrane
- template of membrane classpredefined
- if it is a predefined membrane class. Predefined membrane classes
can be membranes which use Java code to implement
Membrane interface, other than use UPLanguage to
define a membrane class.static Membrane getMemInstanceOf(java.lang.String membraneName)
membraneName
- the name of membrane classnull
if membrane class required does not existstatic boolean isPredefinedMem(java.lang.String membraneName)
membraneName
- the name used to checktrue
if the name is registered as a predefined
membrane class, else return false
static Membrane getMemClass(java.lang.String name)
name
- the name of membrane classvoid newStepInit()
$
and initialize
this membrane for a new simulationjava.lang.Number getNumOf(Obj object)
object
- P objectvoid addObject(Obj object, java.lang.Number num)
object
- the new added objectnum
- the quantity of objectboolean reduceObject(Obj object, java.lang.Number num)
object
- the object which will be reducednum
- the reduced quantitytrue
java.util.Map<Obj,java.lang.Number> getObjects()
void addRule(Rule rule)
rule
- A new rulejava.util.List<Rule> getRules()
void addTunnel(Tunnel t)
t
- the tunnel between two membrane, through it the results of rules
can be set.default void removeTunnel(Tunnel t)
t
- the tunnel between two membrane, through it the results of rules
can be set.Tunnel getTunnel(Tunnel.TunnelType type, java.lang.String target)
type
- the type of the tunneltarget
- the name of the target membrane. It can be null if the type is
Out, Here, in/go all/random.java.util.List<Tunnel> getTunnels()
void delete()
Close all the tunnels and set current membrane deleted
boolean isDeleted()
true
java.util.Map<Rule,java.lang.Integer> getUsableRules() throws UnpredictableDimensionException, java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- if some rules, objects, cannot be clonedUnpredictableDimensionException
- if there exist unpredictable dimension, such as the dimension of
one rule only appears at a inhibitorjava.util.Map<Rule,java.lang.Integer> fetch() throws TunnelNotExistException
TunnelNotExistException
- If one rule want to get a neighbor of this membrane and no tunnel
was foundjava.util.Map<Rule,java.lang.Integer> setProducts()
java.lang.String toString(java.lang.String space, boolean withObject, boolean withProp, boolean withRule, boolean withSubmembrane, boolean withTunnel)
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 tunnelsMembrane deepClone()
deepClone
in interface Dimensional
deepClone
in interface Name
void setProperty(java.lang.String propertyName, java.lang.Object propertyValue)
propertyName
- the name of propertypropertyValue
- the value of propertyjava.lang.Object getProperty(java.lang.String propertyName)
propertyName
- the name of propertynull
will be returned.java.util.Map<java.lang.String,java.lang.Object> getProperties()
void addListener(MembraneListener listener)
listener
- a membrane listenervoid removeListener(MembraneListener listener)
listener
- the listener you want to removevoid extend(Membrane template)
template
- template membranedefault java.util.List<Membrane> getChildren()
default java.util.List<Membrane> getNeighbors()
default Membrane getParent()
null
if parent membrane does not existdefault void addChild(java.lang.Class<?> tunnelClass, Membrane child)
tunnelClass
- the tunnel class of the two membranechild
- child membrane