public class SensorImpl extends java.lang.Object implements SensorUpdate, CompositeSensorUpdate
Modifier and Type | Field and Description |
---|---|
java.util.Map<java.lang.Object,java.util.concurrent.LinkedBlockingQueue<ReadCycle>> |
tagSubscriberToQueueMap
Map with the subscriber as key and it's queue as value.
|
Constructor and Description |
---|
SensorImpl(java.lang.String name,
java.util.Collection<SensorUpdate> childNodes,
java.lang.Boolean immutable) |
Modifier and Type | Method and Description |
---|---|
void |
addChild(SensorUpdate child)
Add a new child sensor.
|
void |
addReceiver(Sensor receiver)
Add a sensor to the list of sensors that receive sensor reads from this
sensor.
|
java.util.Set<java.lang.String> |
getChildren()
Get the names of child sensors this sensor has.
|
java.lang.String |
getName()
Get the name of the sensor.
|
java.lang.Boolean |
isImmutable()
Check if the sensor is immutable.
|
java.lang.Boolean |
isInUse()
Check if the sensor is in use.
|
EsperEventContainer |
receive(java.lang.Object object)
Objects subscribed to the sensor use this method to acquire the read
results.
|
void |
removeChild(SensorUpdate child)
Remove a child sensor.
|
void |
removeChildren(java.util.Collection<SensorUpdate> children)
Remove several child sensors.
|
void |
removeReceiver(Sensor receiver)
Remove a sensor from the list of sensors that receive sensor reads from
this sensor.
|
void |
send(ReadCycle cycle)
Send sensor results to this sensor.
|
void |
sendEvent(java.lang.Object event)
Send a non ReadCycle event to esper.
|
void |
setName(java.lang.String name) |
void |
subscribe(java.lang.Object object)
Subscribe an object to the sensor.
|
void |
unsubscribe(java.lang.Object object)
Unsubscribe an object from the sensor.
|
public final java.util.Map<java.lang.Object,java.util.concurrent.LinkedBlockingQueue<ReadCycle>> tagSubscriberToQueueMap
public SensorImpl(java.lang.String name, java.util.Collection<SensorUpdate> childNodes, java.lang.Boolean immutable)
name
- childNodes
- immutable
- public java.lang.String getName()
Sensor
public void setName(java.lang.String name) throws ImmutableException, InUseException
setName
in interface SensorUpdate
ImmutableException
InUseException
public java.util.Set<java.lang.String> getChildren()
CompositeSensor
getChildren
in interface CompositeSensor
public void addChild(SensorUpdate child) throws ImmutableException, InUseException
CompositeSensorUpdate
addChild
in interface CompositeSensorUpdate
ImmutableException
InUseException
public void removeChild(SensorUpdate child) throws ImmutableException, InUseException
CompositeSensorUpdate
removeChild
in interface CompositeSensorUpdate
ImmutableException
InUseException
public void removeChildren(java.util.Collection<SensorUpdate> children) throws ImmutableException, InUseException
CompositeSensorUpdate
removeChildren
in interface CompositeSensorUpdate
ImmutableException
InUseException
public void subscribe(java.lang.Object object) throws DuplicateSubscriptionException
SensorUpdate
subscribe
in interface SensorUpdate
DuplicateSubscriptionException
public void unsubscribe(java.lang.Object object) throws NotSubscribedException
SensorUpdate
unsubscribe
in interface SensorUpdate
NotSubscribedException
public void addReceiver(Sensor receiver)
SensorUpdate
addReceiver
in interface SensorUpdate
public void removeReceiver(Sensor receiver)
SensorUpdate
removeReceiver
in interface SensorUpdate
public java.lang.Boolean isImmutable()
Sensor
isImmutable
in interface Sensor
public java.lang.Boolean isInUse()
Sensor
public void send(ReadCycle cycle)
Sensor
public void sendEvent(java.lang.Object event)
Sensor
public EsperEventContainer receive(java.lang.Object object) throws NotSubscribedException
Sensor
receive
in interface Sensor
NotSubscribedException