An AbstractSensor object consists of two attributes:
on is a boolean flag indicating if a sensor is
triggered. This flag will be set or cleared by the
component that owns the sensor.count is the total number of times that a sensor
has been triggered.| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private final Object | |
| private final String | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| pack-priv abstract void | |
| public long | Returns: the total number of times that this sensor has been triggered.Returns the total number of times that this sensor has been triggered. |
| public String | |
| public boolean | Returns: true if the sensor is currently on;
false otherwise.Tests if this sensor is currently on. |
| public String | |
| public void | |
| public void | |
| public void | |
| pack-priv abstract void | |
| pack-priv abstract void |
| count | back to summary |
|---|---|
| private long count | |
| lock | back to summary |
|---|---|
| private final Object lock | |
| name | back to summary |
|---|---|
| private final String name | |
| on | back to summary |
|---|---|
| private boolean on | |
| Sensor | back to summary |
|---|---|
| public Sensor(String name) Constructs a
| |
| clear | back to summary |
|---|---|
| public void clear() Clears this sensor. | |
| clear | back to summary |
|---|---|
| public void clear(int increment) Clears this sensor
and increments the count with the input | |
| clearAction | back to summary |
|---|---|
| pack-priv abstract void clearAction() | |
| getCount | back to summary |
|---|---|
| public long getCount() Returns the total number of times that this sensor has been triggered.
| |
| getName | back to summary |
|---|---|
| public String getName() Returns the name of this sensor.
| |
| isOn | back to summary |
|---|---|
| public boolean isOn() Tests if this sensor is currently on.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| trigger | back to summary |
|---|---|
| public void trigger() Triggers this sensor. This method first sets this sensor on and increments its sensor count. | |
| trigger | back to summary |
|---|---|
| public void trigger(int increment) Triggers this sensor. This method sets this sensor on
and increments the count with the input | |
| trigger | back to summary |
|---|---|
| public void trigger(int increment, MemoryUsage usage) Triggers this sensor piggybacking a memory usage object.
This method sets this sensor on
and increments the count with the input | |
| triggerAction | back to summary |
|---|---|
| pack-priv abstract void triggerAction() | |
| triggerAction | back to summary |
|---|---|
| pack-priv abstract void triggerAction(MemoryUsage u) | |