|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.graph.impl.Edge de.grogra.graph.impl.Node de.grogra.rgg.RGG
public class RGG
This class is the base class of all instances of relational
growth grammars within GroIMP. The main class of an
rgg-file automatically extends this class.
This class declares some methods which may be overriden
by subclasses in order to respond to specific events:
init()
is invoked to initialize an RGG
instance. This happens after the compilation
of its source code and after a reset.
startup()
is invoked when an RGG instance
is loaded within GroIMP. This happens after the compilation
of its source code and after loading a project containing an RGG.
shutdown()
is invoked when an RGG instance
is unloaded within GroIMP. This happens to an old RGG instance
after compilation when this old instance is to be replaced
by the newly compiled RGG instance.
run(Object)
is invoked as a response to the invocation
of runLater(Object)
or runLater(long, Object)
.
The argument is the
argument which has been passed to runLater
. The
invocation of run
is queued in the
JobManager
of the current
workbench and executed in its thread.
reset()
.
Nested Class Summary | |
---|---|
class |
RGG.Apply
|
Nested classes/interfaces inherited from class de.grogra.graph.impl.Node |
---|
Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType |
Nested classes/interfaces inherited from interface de.grogra.util.Map |
---|
Map.Chain |
Field Summary | |
---|---|
static Node.NType |
$TYPE
|
static Node.NType.Field |
classesToIgnoreOrConsider$FIELD
|
static Node.NType.Field |
consider$FIELD
|
static Node.NType.Field |
doRun$FIELD
|
static EnumerationType |
GROUP_TYPE
|
static I18NBundle |
I18N
|
protected TurtleState |
initialTurtleState
|
static Node.NType.Field |
initialTurtleState$FIELD
|
static UIProperty |
STEPRUN
|
Fields inherited from class de.grogra.graph.impl.Node |
---|
ADDITIONAL_FIELDS, bits, DELETED, EXTENT_BIT, EXTENT_MASK, extentIndex$FIELD, extentTail$FIELD, HAS_OBSERVERS, IS_INTERPRETIVE, isInterpretive$FIELD, LAST_EXTENT_INDEX, layer$FIELD, MARK, mark$FIELD, MIME_TYPE, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELD, USED_BITS |
Fields inherited from interface de.grogra.util.Map |
---|
DEFAULT_VALUE, EMPTY_MAP |
Constructor Summary | |
---|---|
RGG()
|
Method Summary | |
---|---|
void |
addTask(ConcurrentTask task)
Adds a single task to the set of tasks of this
RGG (see getTasks() ). |
protected void |
applyInterpretation()
This method can be invoked if interpretive rules shall be applied to the current graph by the method interpret() . |
protected void |
consider(java.lang.Class... consider)
Sets the node classes which shall be considered by the methods left(Node) and right(Node) . |
static RGG |
getMainRGG(RegistryContext r)
|
protected Node.NType |
getNTypeImpl()
This method returns the Node.NType which describes the managed
fields of the class of this node. |
protected void |
getRate()
Override this to provide the rate function using the rate assignment operator :'=. |
Registry |
getRegistry()
Returns the Registry which is linked with this instance. |
static java.util.Map<java.lang.String,RGG> |
getRGGForTypeMap(RegistryContext r)
|
Node |
getRoot()
Returns the RGG root of the graph. |
Solver |
getSolver()
|
ConcurrentTasks |
getTasks()
Returns an instance of ConcurrentTasks which is associated
with this RGG . |
protected void |
ignore(java.lang.Class... ignore)
Sets the node classes which shall be ignored by the methods left(Node) and right(Node) . |
protected void |
init()
This method is invoked to initialize an RGG This happens after the compilation of its source code and after a reset. |
protected void |
initializeApplyMenu(Item d,
boolean flat,
boolean useRunCheckBox)
|
protected void |
initializeRunMenu(Item d,
boolean flat,
boolean useRunCheckBox)
|
void |
initializeTurtleState(TurtleState s)
|
protected void |
integrate()
Integrate numerically using the ODE framework for an unlimited duration of time units. |
protected void |
integrate(double duration)
Integrate numerically using the ODE framework over a duration of duration
time units. |
protected void |
interpret()
|
void |
invokeInit()
This method is used to invoke the normally protected init-method when compiler is called from outside GroIMP. |
boolean |
isAutoClearMonitors()
Get whether if all monitors should be removed automatically after integration. |
protected boolean |
isMainRGG()
Determins whether this RGG should be used as the project's main RGG. |
Node |
left(Node n)
Computes the first neighbour to the left of n which
is not an instance of one of the classes set by
ignore(Class[]) . |
protected void |
monitor(VoidToDouble g)
Install a monitor function that generates an event when the returned value changes its sign. |
protected void |
monitor(VoidToDouble g,
java.lang.Runnable r)
Install a monitor function that generates an event when the returned value changes its sign. |
protected void |
monitorPeriodic(double period,
java.lang.Runnable r)
Trigger an event in regular intervals and call the event handler. |
protected Node |
newInstance()
This method returns a new instance of the class of this node. |
float |
readChannelAt(int channel,
Parallelogram plane,
float x,
float y,
float z)
|
float |
readChannelAt(int channel,
Parallelogram plane,
Node node)
|
float |
readChannelAt(int channel,
java.lang.String plane,
Node node)
|
protected void |
reset()
This method can be invoked to reset the RGG to its initial state. |
Node |
right(Node n)
Computes the first neighbour to the right of n which
is not an instance of one of the classes set by
ignore(Class[]) . |
protected void |
run(java.lang.Object arg)
This callback method is invoked as a response to the invocation of runLater(Object) or runLater(long, Object) . |
void |
runLater(long delay,
java.lang.Object arg)
This method is used to induce an invocation of run(Object) in the thread
of the JobManager of the current workbench
after a delay of at least delay
milliseconds. |
void |
runLater(java.lang.Object arg)
This method is used to induce an invocation of run(Object) in the thread
of the JobManager of the current workbench. |
void |
setAutoClearMonitors(boolean autoClearMonitors)
Set whether if all monitors should be removed automatically after integration. |
void |
setSolver(org.apache.commons.math.ode.FirstOrderIntegrator integrator)
|
void |
setSolver(Solver solver)
|
protected void |
shutdown()
This method is invoked when an RGG instance is unloaded within GroIMP. |
static void |
shutdown(Registry r,
Type t)
|
void |
solveTasks()
This method simply invokes ConcurrentTasks.solve() on
the set of tasks of this RGG (see getTasks() ). |
protected void |
startup()
This method is invoked when an RGG instance is loaded within GroIMP. |
static void |
startup(Registry r,
Type type)
|
void |
stop()
This method can be invoked in order to stop the repeated invocation of a method. |
Selection |
toSelection(Context ctx)
Converts this object into a Selection . |
protected void |
unmonitor()
Remove all currently set monitor functions. |
Methods inherited from class de.grogra.graph.impl.Edge |
---|
addEdgeBits, getBitMark, getEdgeBits, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBits |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.grogra.persistence.PersistenceCapable |
---|
getBitMark, getObjectMark, setBitMark, setObjectMark |
Field Detail |
---|
public static final Node.NType $TYPE
public static final Node.NType.Field classesToIgnoreOrConsider$FIELD
public static final Node.NType.Field consider$FIELD
public static final Node.NType.Field doRun$FIELD
public static final EnumerationType GROUP_TYPE
public static final I18NBundle I18N
protected TurtleState initialTurtleState
public static final Node.NType.Field initialTurtleState$FIELD
public static final UIProperty STEPRUN
Constructor Detail |
---|
public RGG()
Method Detail |
---|
public void addTask(ConcurrentTask task)
task
to the set of tasks of this
RGG
(see getTasks()
). After all tasks
have been added, the method solveTasks()
has to be
invoked in order to solve the tasks concurrently using a number
of threads or even distributed computers.
task
- task to addprotected void applyInterpretation()
interpret()
. The effect
of applyInterpretation
is the following:
==>
rules are treated as interpretive rules. This
action is undone at the end of this method.
interpret()
is invoked.
protected void consider(java.lang.Class... consider)
left(Node)
and right(Node)
. This method
may be invoked as a variable arity method, i.e., with
a variable number of arguments of class Class
.
consider
- an array of classes to be consideredpublic static RGG getMainRGG(RegistryContext r)
protected Node.NType getNTypeImpl()
Node
Node.NType
which describes the managed
fields of the class of this node. This method has to be implemented
in every concrete subclass.
getNTypeImpl
in class Node
protected void getRate()
public Registry getRegistry()
RegistryContext
Registry
which is linked with this instance.
getRegistry
in interface RegistryContext
public static java.util.Map<java.lang.String,RGG> getRGGForTypeMap(RegistryContext r)
public Node getRoot()
RGGRoot
, then this instance is returned. Otherwise,
the real root is returned.
public Solver getSolver()
public ConcurrentTasks getTasks()
ConcurrentTasks
which is associated
with this RGG
.
ConcurrentTasks
for use within this
RGG
protected void ignore(java.lang.Class... ignore)
left(Node)
and right(Node)
. This method
may be invoked as a variable arity method, i.e., with
a variable number of arguments of class Class
.
ignore
- an array of classes to be ignoredprotected void init()
protected void initializeApplyMenu(Item d, boolean flat, boolean useRunCheckBox)
protected void initializeRunMenu(Item d, boolean flat, boolean useRunCheckBox)
public void initializeTurtleState(TurtleState s)
protected void integrate() throws NumericException
integrate(double)
with a duration of java.lang.Double.MAX_VALUE
.
To stop the integration a monitor must be set.
NumericException
integrate(double)
,
monitor(VoidToDouble)
protected void integrate(double duration) throws NumericException
duration
time units. The user has to provide a rate function dy/dt=f(t,y) to calculate the first
derivative of the state vector with respect to time for a given time and state pair.
The rate function f(t,y) is implemented by overriding the function getRate()
.
The user should not make any assumptions about how many times or with which parameters of
time and state the function getRate()
will be called. Since laws of physics do not
depend on the current time the parameter t of f(t,y) is hidden from the user. The state y
is provided implicitly as the attributes of the nodes in the current graph.
duration
- time duration over which to integrate
NumericException
getRate()
protected void interpret()
public void invokeInit()
public boolean isAutoClearMonitors()
protected boolean isMainRGG()
This default implementation defines an RGG to be the main RGG iff
its class declares a public
void
method
with no arguments, or an init
method. This method should
be overwritten by non-main RGGs for which this simple definition
is not sufficient.
true
iff this RGG is the main RGG of a projectpublic Node left(Node n)
n
which
is not an instance of one of the classes set by
ignore(Class[])
. The neighbours to the left
are those which are reachable by successor or branch edges
in reverse direction.
n
- where to start the search
protected void monitor(VoidToDouble g)
g
- monitor functionprotected void monitor(VoidToDouble g, java.lang.Runnable r)
g
- monitor functionr
- event handlerprotected void monitorPeriodic(double period, java.lang.Runnable r)
g
- monitor functionr
- event handlerprotected Node newInstance()
Node
newInstance
in class Node
public float readChannelAt(int channel, Parallelogram plane, float x, float y, float z)
public float readChannelAt(int channel, Parallelogram plane, Node node)
public float readChannelAt(int channel, java.lang.String plane, Node node)
protected void reset()
RGGRoot
which is connected with the real root of the
graph by a branch edge, then this instance is removed.
A new instance of RGGRoot
is created and connected with the real root
by a branch edge.
Axiom
is created
and inserted in the graph by a successor edge
from the RGGRoot
instance.
The result of this step
is a graph containing an RGGRoot
which has a single Axiom
as its
successor.
init()
is invoked. This invocation
is surrounded by transformation boundaries
(see Library.apply()
).
public Node right(Node n)
n
which
is not an instance of one of the classes set by
ignore(Class[])
. The neighbours to the right
are those which are reachable by successor edges
in forward direction.
n
- where to start the search
protected void run(java.lang.Object arg)
runLater(Object)
or runLater(long, Object)
.
arg
is the
argument which has been passed to runLater
.
The invocation is executed in the thread of
the JobManager
of the current workbench. In addition,
a write-lock on the graph is being aquired during execution.
arg
- the argument which has been passed to runLater
public void runLater(long delay, java.lang.Object arg)
run(Object)
in the thread
of the JobManager
of the current workbench
after a delay of at least delay
milliseconds.
The invocation is queued in the job manager, i.e.,
it is performed after all pending jobs have been
completed and after the delay is elapsed.
delay
- delay in millisecondsarg
- argument to pass to run(Object)
public void runLater(java.lang.Object arg)
run(Object)
in the thread
of the JobManager
of the current workbench.
The invocation is queued in the job manager, i.e.,
it is performed after all pending jobs have been
completed.
arg
- argument to pass to run(Object)
public void setAutoClearMonitors(boolean autoClearMonitors)
autoClearMonitors
- if true, all monitors should be removed after integration automaticallypublic void setSolver(org.apache.commons.math.ode.FirstOrderIntegrator integrator)
public void setSolver(Solver solver)
protected void shutdown()
super.shutdown();
should
be invoked.
public static void shutdown(Registry r, Type t)
public void solveTasks()
ConcurrentTasks.solve()
on
the set of tasks of this RGG
(see getTasks()
).
This solves all added tasks (see addTask(ConcurrentTask)
)
concurrently using the available resources (multiple processors,
distributed computers).
protected void startup()
super.startup();
should
be invoked at first.
public static void startup(Registry r, Type type)
public void stop()
public Selection toSelection(Context ctx)
Selectable
Selection
.
toSelection
in interface Selectable
ctx
- the UI context
null
if this is not possibleprotected void unmonitor()
integrate(double)
if isAutoClearMonitors()
is true.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |