ptolemy.actor.lib
Class AbsoluteValue

java.lang.Object
  |
  +--ptolemy.kernel.util.NamedObj
        |
        +--ptolemy.kernel.Entity
              |
              +--ptolemy.kernel.ComponentEntity
                    |
                    +--ptolemy.actor.AtomicActor
                          |
                          +--ptolemy.actor.TypedAtomicActor
                                |
                                +--ptolemy.actor.lib.Transformer
                                      |
                                      +--ptolemy.actor.lib.AbsoluteValue
All Implemented Interfaces:
Actor, java.lang.Cloneable, Debuggable, Executable, Nameable, java.io.Serializable, TypedActor

public class AbsoluteValue
extends Transformer

Produce an output token on each firing with a value that is equal to the absolute value of the input. The input can have any scalar type. If the input type is not Complex, the output has the same type as the input. If the input type is Complex, the output type is Double, in which case, the output value is the magnitude of the input complex.

Since:
Ptolemy II 0.3
Version:
$Id: AbsoluteValue.java,v 1.26 2002/02/21 19:20:53 cxh Exp $
Author:
Edward A. Lee
See Also:
Serialized Form

Inner classes inherited from class ptolemy.kernel.util.NamedObj
NamedObj.MoMLInfo
 
Fields inherited from class ptolemy.actor.lib.Transformer
input, output
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _debugging, _debugListeners, _uniqueNameIndex, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
AbsoluteValue(CompositeEntity container, java.lang.String name)
          Construct an actor with the given container and name.
 
Method Summary
 java.lang.Object clone(Workspace workspace)
          Clone the actor into the specified workspace.
 void fire()
          Compute the absolute value of the input.
 java.util.List typeConstraintList()
          Return the following type constraints: If the input type is Complex, the output type is no less than Double, otherwise, the output type is no less than the input; The output type is no greater than Scalar.
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, attributeTypeChanged, newPort
 
Methods inherited from class ptolemy.actor.AtomicActor
connectionsChanged, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, setContainer, stopFire, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, getContainer, isAtomic, isOpaque, setName
 
Methods inherited from class ptolemy.kernel.Entity
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, uniqueName
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _removeAttribute, _splitName, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, clone, deepContains, depthInHierarchy, description, description, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getFullName, getMoMLInfo, getName, getName, removeChangeListener, removeDebugListener, requestChange, setDeferMoMLDefinitionTo, toplevel, toString, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Actor
getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
initialize, iterate, postfire, prefire, preinitialize, stopFire, terminate, wrapup
 

Constructor Detail

AbsoluteValue

public AbsoluteValue(CompositeEntity container,
                     java.lang.String name)
              throws NameDuplicationException,
                     IllegalActionException
Construct an actor with the given container and name.
Parameters:
container - The container.
name - The name of this actor.
Throws:
IllegalActionException - If the actor cannot be contained by the proposed container.
NameDuplicationException - If the container already has an actor with this name.
Method Detail

clone

public java.lang.Object clone(Workspace workspace)
                       throws java.lang.CloneNotSupportedException
Clone the actor into the specified workspace. This calls the base class and then sets the type constraints.
Overrides:
clone in class AtomicActor
Parameters:
workspace - The workspace for the new object.
Returns:
A new actor.
Throws:
java.lang.CloneNotSupportedException - If a derived class has an attribute that cannot be cloned.

typeConstraintList

public java.util.List typeConstraintList()
Return the following type constraints: If the input type is Complex, the output type is no less than Double, otherwise, the output type is no less than the input; The output type is no greater than Scalar.
Overrides:
typeConstraintList in class TypedAtomicActor
Returns:
A list of inequalities.

fire

public void fire()
          throws IllegalActionException
Compute the absolute value of the input. If there is no input, then produce no output.
Overrides:
fire in class AtomicActor
Throws:
IllegalActionException - If there is no director.