agentland.device.light
Class LightManagerAgent

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.MultiDeviceAgent
                                                  |
                                                  +--agentland.device.AbstractDeviceManagerAgent
                                                        |
                                                        +--agentland.device.light.LightManagerAgent
All Implemented Interfaces:
AbstractDeviceManager, Agent, Device, DeviceManager, DimmableLight, Good, Light, LightManager, Managed, MetagluePrimitives, MultiDevice, Remote, Serializable, Spy

public class LightManagerAgent
extends AbstractDeviceManagerAgent
implements LightManager

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class agentland.device.AbstractDeviceManagerAgent
devices, managedDevices
 
Fields inherited from class agentland.device.MultiDeviceAgent
grammars, nameResolver, nameResolverID
 
Fields inherited from class agentland.device.DeviceAgent
defaultState, fName, names, states
 
Fields inherited from class agentland.resource.ManagedAgent
rm, society
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
LightManagerAgent()
           
 
Method Summary
protected  boolean brighten(Device dev, int delta)
           
 boolean brighten(int delta)
          Brighten by certain percentage
 boolean brighten(String name, int delta)
           
protected  boolean dim(Device dev, int delta)
           
 boolean dim(int delta)
          Dim by certain percentage
 boolean dim(String name, int delta)
           
protected  String[] getDefaultNames()
          Override this method to set the default names for your device; this method is only called if we cannot defrost names set previously
protected  String[] getWatchedOccupations()
          This isn't really used yet.
 UncertainValue isOn()
           
 UncertainValue isOn(String name)
           
 UncertainValue level()
          Returns the dim level of this light (in percent)
 UncertainValue level(String name)
           
protected  boolean setLevel(Device dev, int level)
           
 boolean setLevel(int level)
          level is expressed as percentage (0-100)
 boolean setLevel(String name, int level)
           
 boolean turnOff()
           
 boolean turnOff(String name)
           
 boolean turnOn()
           
 boolean turnOn(String name)
           
 
Methods inherited from class agentland.device.AbstractDeviceManagerAgent
addDevice, addSecretDevice, addSpies, callMethod, callMethod, callMethod, devices, devices, getAllAgentIDs, getAllNames, getDeviceIDs, getDevices, getPresent, registerKnown, removeDevice, setUpNaming
 
Methods inherited from class agentland.device.MultiDeviceAgent
addManagedGrammar, getNameResolver, removeManagedGrammar, setNameResolver, updateGrammar, updateGrammars
 
Methods inherited from class agentland.device.DeviceAgent
addName, createStateChangeNotification, ensureState, 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 class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agentland.device.AbstractDeviceManager
addSecretDevice, getDeviceIDs
 
Methods inherited from interface agentland.device.DeviceManager
addDevice, getDevices, removeDevice
 
Methods inherited from interface agentland.device.MultiDevice
addManagedGrammar, getNameResolver, removeManagedGrammar
 
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.resource.Managed
getNeed, replace, replace, resources, yank, yank
 
Methods inherited from interface agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.util.Spy
tell
 

Constructor Detail

LightManagerAgent

public LightManagerAgent()
                  throws RemoteException
Method Detail

getWatchedOccupations

protected String[] getWatchedOccupations()
Description copied from class: AbstractDeviceManagerAgent
This isn't really used yet. In theory, you should override this method so that it returns an array of occupations that your manager manages. Than, if you want, all agents of this occupation would be automatically pulled in to your manager when they are started. But, as I said, this has not been implemented.
Overrides:
getWatchedOccupations in class AbstractDeviceManagerAgent

getDefaultNames

protected String[] getDefaultNames()
Description copied from class: DeviceAgent
Override this method to set the default names for your device; this method is only called if we cannot defrost names set previously
Overrides:
getDefaultNames in class DeviceAgent
Following copied from class: agentland.device.DeviceAgent
Returns:
a Vector value

turnOn

public boolean turnOn()
               throws RemoteException
Specified by:
turnOn in interface Light

turnOn

public boolean turnOn(String name)
               throws RemoteException
Specified by:
turnOn in interface LightManager

turnOff

public boolean turnOff()
                throws RemoteException
Specified by:
turnOff in interface Light

turnOff

public boolean turnOff(String name)
                throws RemoteException
Specified by:
turnOff in interface LightManager

isOn

public UncertainValue isOn()
                    throws RemoteException
Specified by:
isOn in interface Light

isOn

public UncertainValue isOn(String name)
                    throws RemoteException
Specified by:
isOn in interface LightManager

setLevel

public boolean setLevel(int level)
                 throws RemoteException
level is expressed as percentage (0-100)
Specified by:
setLevel in interface DimmableLight

setLevel

public boolean setLevel(String name,
                        int level)
                 throws RemoteException
Specified by:
setLevel in interface LightManager

dim

public boolean dim(int delta)
            throws RemoteException
Dim by certain percentage
Specified by:
dim in interface DimmableLight

dim

public boolean dim(String name,
                   int delta)
            throws RemoteException
Specified by:
dim in interface LightManager

brighten

public boolean brighten(int delta)
                 throws RemoteException
Brighten by certain percentage
Specified by:
brighten in interface DimmableLight

brighten

public boolean brighten(String name,
                        int delta)
                 throws RemoteException
Specified by:
brighten in interface LightManager

level

public UncertainValue level()
                     throws RemoteException
Returns the dim level of this light (in percent)
Specified by:
level in interface DimmableLight

level

public UncertainValue level(String name)
                     throws RemoteException
Specified by:
level in interface LightManager

setLevel

protected boolean setLevel(Device dev,
                           int level)
                    throws RemoteException

dim

protected boolean dim(Device dev,
                      int delta)
               throws RemoteException

brighten

protected boolean brighten(Device dev,
                           int delta)
                    throws RemoteException