agentland.device
Class BaseMuxAgent
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--metaglue.AgentAgent
|
+--agentland.util.GoodAgent
|
+--agentland.resource.ManagedAgent
|
+--agentland.device.DeviceAgent
|
+--agentland.device.BaseMuxAgent
- All Implemented Interfaces:
- Agent, BaseMux, Connectable, Device, Good, Managed, MetagluePrimitives, Mux, NamedMux, Remote, Serializable, Spy
- Direct Known Subclasses:
- AudioMuxAgent, AutoPatchVideoMuxAgent, CrossPointMuxAgent
- public abstract class BaseMuxAgent
- extends DeviceAgent
- implements BaseMux
- See Also:
- Serialized Form
Method Summary |
boolean |
connect(String in,
String out)
This method first tries to resolve the parameters as names of
the inputs and outputs. |
protected void |
connectionSet(int input,
int output,
int certainty)
This method should be called by children whenever they set a
connection -- this method will keep track of the state changes,
etc |
protected int |
findPositionInVector(Vector v,
Object o)
Finds the index of the Object in the Vector. |
UncertainValue |
getInput(int output)
Returns the number of the input connected to the output
specified as a parameter for this method. |
String |
getInputName(int position)
Gets the name of the input connected to the given input number. |
Vector |
getInputs()
Get the names of the inputs. |
String |
getOutputName(int position)
Gets the name of the output connected to the given output number. |
Vector |
getOutputs()
Get the names of the outputs. |
protected int |
getVectorIndex(int number)
Gets the vector index for an input or output with the given number. |
boolean |
resetNames()
|
protected int |
resolveInputName(String name)
returns the name of an input corresponding to a given name |
protected int |
resolveOutputName(String name)
returns the name of an output corresponding to a given name |
boolean |
setInputName(int position,
String inName)
Sets the name of the input connected to the given input number. |
boolean |
setOutputName(int position,
String outName)
Assign outName to the output with the given number. |
Methods inherited from class agentland.device.DeviceAgent |
addName, createStateChangeNotification, ensureState, getDefaultNames, getDefaultStateName, getName, getNames, getState, getState, getStateNames, hasName, quietException, resetAllStates, resetName, resetState, resetState, setDefaultStateName, setName, setState, throwException, updateState, updateState, updateState, updateState, updateState, updateState, updateState, updateState |
Methods inherited from class agentland.resource.ManagedAgent |
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, yank, yank, yank |
Methods inherited from class agentland.util.GoodAgent |
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell |
Methods inherited from class metaglue.AgentAgent |
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou |
Methods inherited from interface agentland.device.Device |
addName, getName, getNames, getState, getState, getStateNames, hasName, resetAllStates, resetName, resetState, resetState, setName, setState |
Methods inherited from interface agentland.util.Spy |
tell |
BaseMuxAgent
public BaseMuxAgent()
throws RemoteException
connectionSet
protected void connectionSet(int input,
int output,
int certainty)
throws RemoteException
- This method should be called by children whenever they set a
connection -- this method will keep track of the state changes,
etc
getInput
public UncertainValue getInput(int output)
throws RemoteException
- Returns the number of the input connected to the output
specified as a parameter for this method. Returns an
UncertainValue -- it tells you the answer and how sure it is of
it.
- Specified by:
getInput
in interface Mux
connect
public boolean connect(String in,
String out)
throws RemoteException
- This method first tries to resolve the parameters as names of
the inputs and outputs. If this fails, it tries to convert them
into integers and see if this works. So you can call
connect("VCR", "middle projector") or connect("1", "14") or a
mix of the two.
- Specified by:
connect
in interface NamedMux
- Following copied from interface:
agentland.resource.connect.Connectable
- Returns:
- true or false if connect successful.
resetNames
public boolean resetNames()
throws RemoteException
- Specified by:
resetNames
in interface NamedMux
setInputName
public boolean setInputName(int position,
String inName)
throws RemoteException
- Sets the name of the input connected to the given input number.
- Specified by:
setInputName
in interface NamedMux
- Parameters:
position
- an int
between 1 and getNumInputs()
- Returns:
- the corresponding input's name
- Throws:
RemoteException
- if an error occurs
setOutputName
public boolean setOutputName(int position,
String outName)
throws RemoteException
- Assign outName to the output with the given number.
- Specified by:
setOutputName
in interface NamedMux
- Parameters:
position
- an int
between 1 and getNumOutputs()
outName
- a String
value- Returns:
true
if successful- Throws:
RemoteException
- if an error occurs
getInputs
public Vector getInputs()
throws RemoteException
- Get the names of the inputs.
- Specified by:
getInputs
in interface NamedMux
- Returns:
- a
Vector
of input names - Throws:
RemoteException
- if an error occurs
getOutputs
public Vector getOutputs()
throws RemoteException
- Get the names of the outputs.
- Specified by:
getOutputs
in interface NamedMux
- Returns:
- a
Vector
of output names - Throws:
RemoteException
- if an error occurs
getInputName
public String getInputName(int position)
throws RemoteException
- Gets the name of the input connected to the given input number.
- Specified by:
getInputName
in interface NamedMux
- Parameters:
position
- an int
between 1 and getNumInputs()
- Returns:
- the corresponding input's name
- Throws:
RemoteException
- if an error occurs
getOutputName
public String getOutputName(int position)
throws RemoteException
- Gets the name of the output connected to the given output number.
- Specified by:
getOutputName
in interface NamedMux
- Parameters:
position
- an int
between 1 and getNumOutputs()
- Returns:
- the corresponding output's name
- Throws:
RemoteException
- if an error occurs
resolveInputName
protected int resolveInputName(String name)
- returns the name of an input corresponding to a given name
- Parameters:
name
- a String
value- Returns:
- the input number or -1 if not found
resolveOutputName
protected int resolveOutputName(String name)
- returns the name of an output corresponding to a given name
- Parameters:
name
- a String
value- Returns:
- the output number or -1 if not found
findPositionInVector
protected int findPositionInVector(Vector v,
Object o)
- Finds the index of the Object in the Vector.
- Parameters:
v
- a Vector
valueo
- an Object
value- Returns:
- the index of
o
in v
getVectorIndex
protected int getVectorIndex(int number)
- Gets the vector index for an input or output with the given number.
- Parameters:
number
- the input or output number, should be >= 1- Returns:
- the vector index