public class ActorPrimitive
extends Object
GraphUpdater.updateGNode(charger.obj.GNode)
,
performActorOperation(charger.act.GraphUpdater, java.lang.String, java.util.ArrayList, java.util.ArrayList)
,
GraphUpdater.registerPrimitives()
,
ActorPlugin
Constructor and Description |
---|
ActorPrimitive() |
Modifier and Type | Method and Description |
---|---|
static void |
activateArithmeticPrimitive(GraphUpdater gu,
String operation,
ArrayList inputs,
ArrayList outputs)
Implements the arithmetic primitives for actors.
|
static void |
activateLogicalPrimitive(GraphUpdater gu,
String operation,
ArrayList inputs,
ArrayList outputs)
/**
Implements a set of logical primitive actors.
|
static void |
activateLookupPrimitive(GraphUpdater gu,
String actorName,
ArrayList inputs,
ArrayList outputs)
Implements a lookup primitive for actors.
|
static void |
activateUnaryPrimitive(GraphUpdater gu,
String operation,
ArrayList inputs,
ArrayList outputs) |
protected static void |
checkInOutSize(int numInputs,
int numOutputs,
ArrayList inputs,
ArrayList outputs)
Verifies that the number of input concepts and the number of output referents for the actor matches its
definition.
|
private static double |
operateOnReferents(ArrayList inputs,
NumberFormat vformat,
String operation)
Performs operations for varying input cardinality actors.
|
static void |
performActorOperation(GraphUpdater gu,
String actorName,
ArrayList inputs,
ArrayList outputs)
Calculates the output nodes' referents from the input nodes' referents.
|
private static String |
trimDecimals(double result,
int numDecimals)
trims trailing decimal places (NOT rounded!)
|
public static void performActorOperation(GraphUpdater gu, String actorName, ArrayList inputs, ArrayList outputs) throws CGActorException
gu
- The updater whose thread should be executing our updateactorName
- 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
protected static void checkInOutSize(int numInputs, int numOutputs, ArrayList inputs, ArrayList outputs) throws CGActorException
CGActorException
public static void activateArithmeticPrimitive(GraphUpdater gu, String operation, ArrayList inputs, ArrayList outputs) throws CGActorException
gu
- The updater whose thread should be executing our updateoperation
- One of the arithmetic actor names: "plus" "minus" "multiply" "divide"; also used for
"greaterthan" "greaterequal" "lessthan" "lessequal" because they need number inputs also.inputs
- List of GNodes which are the inputsoutputs
- List of GNodes which are the outputsCGActorException
performActorOperation(charger.act.GraphUpdater, java.lang.String, java.util.ArrayList, java.util.ArrayList)
public static void activateLogicalPrimitive(GraphUpdater gu, String operation, ArrayList inputs, ArrayList outputs) throws CGActorException
gu
- The updater whose thread should be executing our updateoperation
- one of "equal", "notequal" ; numeric comparisons are in activateArithmeticPrimitiveinputs
- List of GNodes which are the inputsoutputs
- List of GNodes which are the outputsCGActorException
Needs: a way to handle contexts here ...
public static void activateUnaryPrimitive(GraphUpdater gu, String operation, ArrayList inputs, ArrayList outputs) throws CGActorException
gu
- The updater whose thread should be executing our updateoperation
- one of "copy" "exp"CGActorException
public static void activateLookupPrimitive(GraphUpdater gu, String actorName, ArrayList inputs, ArrayList outputs) throws CGActorException
gu
- The updater whose thread should be executing our updateactorName
- should be "dbfind"inputs
- List of GNodes which are the inputsoutputs
- List of GNodes which are the outputsCGActorException
performActorOperation(charger.act.GraphUpdater, java.lang.String, java.util.ArrayList, java.util.ArrayList)
private static String trimDecimals(double result, int numDecimals)
result
- value whose decimal is to be roundedprivate static double operateOnReferents(ArrayList inputs, NumberFormat vformat, String operation) throws CGActorException
inputs
- The input concept to the actorvformat
- The numberic format to be used in parsing (or formatting) numbersoperation
- one of "plus"
or "multiply"
at presentCGActorException