Trull

edu.luc.cs.trull
Class Emit

java.lang.Object
  extended by edu.luc.cs.trull.EmptyComponent
      extended by edu.luc.cs.trull.TerminatingComponent
          extended by edu.luc.cs.trull.AbstractComponent
              extended by edu.luc.cs.trull.EmitComponent
                  extended by edu.luc.cs.trull.Emit
All Implemented Interfaces:
Component, PropertyChangeSource, Startable, Suspendable, Terminating, java.beans.PropertyChangeListener, java.util.EventListener
Direct Known Subclasses:
EconomyControl.EmitAwake, EconomyControl.EmitSleep, OfficeControl.EmitSetTemp

public class Emit
extends EmitComponent

A basic component for unconditional event emission. When started, the component schedules an event for emission; as soon as the event has been scheduled, the component terminates immediately.


Field Summary
private  EventFunction generator
          The function on events used to generate the data value of the event to be emitted.
private  java.lang.String label
          The label (property name) of the event to be emitted.
private static org.apache.log4j.Logger logger
           
 
Constructor Summary
Emit()
          Constructs an Emit component.
Emit(java.lang.String label)
          Constructs an Emit component that fires an event with the given String label (property name) and no data.
Emit(java.lang.String label, EventFunction generator)
          Constructs an Emit component that fires an event with the given String label and whose data value (new property value) is computed dynamically using the given generator.
Emit(java.lang.String label, java.lang.Object value)
          Constructs an Emit component that fires an event with the given String label and the given constant data.
 
Method Summary
 java.lang.String getLabel()
          Returns the label (property name) of the event to be emitted.
 EventFunction getValueGenerator()
          Returns the generator for the data value (new property value) of the event to be emitted.
 void setLabel(java.lang.String label)
          Sets the label (property name) of the event to be emitted.
 void setValueGenerator(EventFunction generator)
          Sets the generator for the data value (new property value) of the event to be emitted.
 void start(java.beans.PropertyChangeEvent incoming)
          Starts this startable component.
 
Methods inherited from class edu.luc.cs.trull.EmitComponent
eventEmitter, eventEmitterCached, eventEmitterUncached, resume, scheduleEvent, scheduleEvent, scheduleEvent, stop, suspend
 
Methods inherited from class edu.luc.cs.trull.AbstractComponent
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getExternalListeners, getPropertyChangeListeners, removePropertyChangeListener
 
Methods inherited from class edu.luc.cs.trull.TerminatingComponent
fireTermination, getParent, getTermEvent, scheduleTermination, setTerminationListener
 
Methods inherited from class edu.luc.cs.trull.EmptyComponent
getTerminationListener, propertyChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generator

private EventFunction generator
The function on events used to generate the data value of the event to be emitted.


label

private java.lang.String label
The label (property name) of the event to be emitted.


logger

private static final org.apache.log4j.Logger logger
Constructor Detail

Emit

public Emit()
Constructs an Emit component. Specific properties can be changed later.


Emit

public Emit(java.lang.String label)
Constructs an Emit component that fires an event with the given String label (property name) and no data.

Parameters:
label - the label of the event to be fired.

Emit

public Emit(java.lang.String label,
            EventFunction generator)
Constructs an Emit component that fires an event with the given String label and whose data value (new property value) is computed dynamically using the given generator.

Parameters:
label - the label of the event to be emitted.
generator - the generator for the data value of the event to be emitted.

Emit

public Emit(java.lang.String label,
            java.lang.Object value)
Constructs an Emit component that fires an event with the given String label and the given constant data.

Parameters:
label - the label of the event to be emitted.
value - the data value (new property value) of the event to be emitted.
Method Detail

getLabel

public java.lang.String getLabel()
Returns the label (property name) of the event to be emitted.


getValueGenerator

public EventFunction getValueGenerator()
Returns the generator for the data value (new property value) of the event to be emitted.


setLabel

public void setLabel(java.lang.String label)
Sets the label (property name) of the event to be emitted.


setValueGenerator

public void setValueGenerator(EventFunction generator)
Sets the generator for the data value (new property value) of the event to be emitted.


start

public void start(java.beans.PropertyChangeEvent incoming)
Description copied from interface: Startable
Starts this startable component.

Specified by:
start in interface Startable
Overrides:
start in class EmitComponent
Parameters:
incoming - the event that triggered the invocation of this method. May be null.

Trull

http://www.cs.luc.edu/trull/