public class GraphUpdater
extends Object
implements Runnable
CanvasPanel.userFinishedEditingText(java.lang.String)
Modifier and Type | Field and Description |
---|---|
private GNode |
GNodeToUpdate |
static Hashtable |
GraphObjectAttributes
Contains an entry for each actor consisting of a ArrayList with
properties we care about.
|
private GraphObject |
GraphObjectToUpdate |
private Graph |
GraphToUpdate |
static Hashtable |
InputSignatures
Contains an entry for each actor, specifying its input concepts in order
|
static Hashtable |
OutputSignatures
Contains an entry for each actor, specifying its input concepts in order
|
EditFrame |
ownerFrame
The editframe whose canvas panel spawned this updater thread.
|
static Hashtable |
pluginInstances
key is specific charger.obj.Actor, entry is the plugin instance
associated with this actor
|
static Hashtable |
pluginRegistry
key is actor name, entry is Class object corresponding to the plugin
|
Constructor and Description |
---|
GraphUpdater(EditFrame ef,
GraphObject go)
Creates an instance of the updater for a given graph object.
|
Modifier and Type | Method and Description |
---|---|
static void |
AddStringAsConceptType(ArrayList<Concept> cons,
String s) |
static void |
compareGraphObjectList(ArrayList defs,
ArrayList actuals,
String whichList)
Compares a list of graph objects to another.
|
static ArrayList<Concept> |
createConceptList(int numberOfConcepts,
String typeLabel)
Convenience method for actor builders.
|
void |
fireActor(Actor a,
ArrayList inputs,
ArrayList outputs)
Actually "fires" the given actor.
|
static String[] |
getActorNames()
Similar to getting the concept or relation names in effect, but since the
actors are all registered with Global, that's the easiest place to get them.
|
static String[] |
getPluginList()
Gets the names of all the plugins.
|
static boolean |
hasAttribute(GraphObject go,
Object attr)
Checks to see if the graph object has an executable procedure associated
with it.
|
static boolean |
hasAttribute(String actorName,
Object attr)
Checks to see if the graph object has an executable procedure associated
with it.
|
void |
initiateActorUpdate(Actor a)
Sets up an actor for execution by first seeing if it is executable and
then finding its associated input and output concepts which it passes to
the actual updater.
|
static boolean |
isExecutable(Actor a)
Tells whether the given actor is executable; i.e., can be activated.
|
void |
propagate(GNode gn)
Notifies this graph updater that a particular node has changed and
requires updating.
|
static void |
registerActorSignature(String actorName,
ArrayList inputs,
ArrayList outputs,
ArrayList attributes)
Records each actor's input and output signature for actor activation.
|
static void |
registerPlugin(Class pluginClass) |
static void |
registerPlugins(String[] plugins)
Load plugins from an array of plugin class names.
|
static void |
registerPrimitives()
Stores the signatures and attributes for all primitive actors.
|
void |
run()
Spawn an updater based on the originating node that changed.
|
private void |
setGNode(GNode gn) |
private void |
setGraph(Graph g) |
private void |
setGraphObject(GraphObject go) |
static void |
shutdownAllActors()
With no arguments, find all the edit frames and shut down all the actors!
Note: does not shut down actors for any graph that is not in a frame.
|
static void |
shutdownAllActors(Graph g)
For a given graph, stop all its actors.
|
static void |
startupAllActors()
With no arguments, find all the edit frames and start up all the actors!
Note: doesn't start up actors for any graph that is not in a frame.
|
static void |
startupAllActors(Graph g)
For a given graph, start up all its actors.
|
void |
updateCoref(GNode gn,
Coref c)
If a referent is changed, then we update the referents of any
coreferenced concepts.
|
void |
updateGEdge(GEdge gn)
Performs whatever update or validate routine required for the given edge.
|
void |
updateGNode(GNode gn)
Performs whatever update or validate routine required for the given node.
|
void |
updateGraph(Graph g)
For all concepts or graphs in a graph, update each of them.
|
void |
updateGraphObject(GraphObject go)
General routine for verifying/updating/validating any node.
|
static void |
verifyActor(String actorNamePassed,
ArrayList inputs,
ArrayList outputs)
Given an actor's actual signature, verifies that it matches the actor's
definition signature.
|
void |
WaitWhenAnimating(int milliseconds)
Given any graph object on which to wait, pause the current thread for the
AnimationDelay interval.
|
private Graph GraphToUpdate
private GNode GNodeToUpdate
private GraphObject GraphObjectToUpdate
public static Hashtable InputSignatures
public static Hashtable OutputSignatures
public static Hashtable GraphObjectAttributes
"executable" | actor has an executable definition, either built-in or defined |
"commutative" | order of actor's inputs and outputs does not matter |
"primitive" | if a primitive, to be executed by GraphUpdater; otherwise, look for plugin |
"varyingInputCardinality" | number of inputs may vary |
"varyingOutputCardinality" | number of inputs may vary |
"autonomous" | acts on its own, tells updaters that this actor may fire on its own, without waiting for an input to change. |
"trigger" | always fire when the updater has the opportunity, regardless of actual changes. |
public static Hashtable pluginRegistry
public static Hashtable pluginInstances
public EditFrame ownerFrame
public GraphUpdater(EditFrame ef, GraphObject go)
ef
- If the graph is in an editing window, the updater may use it
(especially for animation)go
- The original object that changed, causing the need for
updating. The node may not have actually changed; the updater pretends
that it has.public void run()
run
in interface Runnable
private void setGraph(Graph g)
private void setGNode(GNode gn)
private void setGraphObject(GraphObject go)
public void WaitWhenAnimating(int milliseconds)
milliseconds
- the wait time between "ticks"public static void registerActorSignature(String actorName, ArrayList inputs, ArrayList outputs, ArrayList attributes)
actorName
- Name by which the actor will be known throughout the
systeminputs
- List of input concepts (or graph), each with a constraining
type (or "T" )outputs
- List of output concepts (or graph), each with a
constraining type (or "T")attributes
- List of strings indicating various properties of the
actorGraphObjectAttributes
public static void startupAllActors(Graph g)
public static void startupAllActors()
public static void shutdownAllActors(Graph g)
pluginInstances
public static void shutdownAllActors()
public void propagate(GNode gn) throws CGActorException
gn
- Node that needs updating.CGActorException
public static void registerPrimitives()
public static String[] getPluginList()
public static void registerPlugins(String[] plugins)
public static void registerPlugin(Class pluginClass)
public void updateGraph(Graph g)
public void updateGraphObject(GraphObject go)
go
- Object to be updated, insert your own code if you want to
provide behavior.public void updateGNode(GNode gn) throws CGActorException
gn
- the node to be updatedCGActorException
public void updateGEdge(GEdge gn) throws CGActorException
CGActorException
public void updateCoref(GNode gn, Coref c) throws CGActorException
gn
- The node that was changedc
- The coref that points us to a new node that is subject to being
changed.CGActorException
public void initiateActorUpdate(Actor a) throws CGActorException
CGActorException
public static void verifyActor(String actorNamePassed, ArrayList inputs, ArrayList outputs) throws CGActorException
actorNamePassed
- Label from actual actor that appears in graph.inputs
- The list of input concepts that appear.outputs
- The list of output concepts that appear.CGActorException
compareGraphObjectList(java.util.ArrayList, java.util.ArrayList, java.lang.String)
public static void compareGraphObjectList(ArrayList defs, ArrayList actuals, String whichList) throws CGGraphFormationError
defs
- Pattern list of objectsactuals
- List of objects to be checked against the patternCGGraphFormationError
CGGraphFormationError
public void fireActor(Actor a, ArrayList inputs, ArrayList outputs) throws CGActorException
CGActorException
ActorPrimitive
public static boolean hasAttribute(GraphObject go, Object attr)
public static boolean hasAttribute(String actorName, Object attr)
public static boolean isExecutable(Actor a)
public static ArrayList<Concept> createConceptList(int numberOfConcepts, String typeLabel)
numberOfConcepts
- how many concepts desired in this listtypeLabel
- what label each of the concepts will have.ActorPlugin.getPluginActorInputConceptList()
,
ActorPlugin.getPluginActorOutputConceptList()
public static void AddStringAsConceptType(ArrayList<Concept> cons, String s)
public static String[] getActorNames()