ptolemy.actor.lib.string
Class StringCompare

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.InstantiableNamedObj
          extended byptolemy.kernel.Entity
              extended byptolemy.kernel.ComponentEntity
                  extended byptolemy.actor.AtomicActor
                      extended byptolemy.actor.TypedAtomicActor
                          extended byptolemy.actor.lib.string.StringCompare
All Implemented Interfaces:
ptolemy.actor.Actor, ptolemy.kernel.util.Changeable, java.lang.Cloneable, ptolemy.kernel.util.Debuggable, ptolemy.kernel.util.DebugListener, ptolemy.kernel.util.Derivable, ptolemy.actor.Executable, ptolemy.kernel.util.Instantiable, ptolemy.kernel.util.ModelErrorHandler, ptolemy.kernel.util.MoMLExportable, ptolemy.kernel.util.Nameable, java.io.Serializable, ptolemy.actor.TypedActor

public class StringCompare
extends ptolemy.actor.TypedAtomicActor

Compare two strings specified either as inputs or parameters. The output is either true or false, depending on whether the comparison function is satisfied. The comparison functions are:

The strings to be compared will be taken from the inputs if they are available, and otherwise will be taken from the corresponding parameters.

Since:
Ptolemy II 4.0
Version:
$Id: StringCompare.java,v 1.11 2004/04/13 03:10:11 cxh Exp $
Author:
Vinay Krishnan, Daniel Lázaro Cuadrado (contributor: Edward A. Lee)
See Also:
Serialized Form
Accepted Rating:
Green (net)
Proposed Rating:
Green (kapokasa)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.Entity
ptolemy.kernel.Entity.ContainedObjectsIterator
 
Field Summary
 PortParameter firstString
          The input PortParameter for the first string of type string.
 ptolemy.data.expr.Parameter function
          The comparison function to be performed.
 ptolemy.data.expr.Parameter ignoreCase
          The parameter to state whether to ignore case.
 ptolemy.actor.TypedIOPort output
          The output port for the result of type BooleanToken.
 PortParameter secondString
          The input PortParameter for the second string of type string.
 
Fields inherited from class ptolemy.actor.AtomicActor
_stopRequested
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
StringCompare(ptolemy.kernel.CompositeEntity container, java.lang.String name)
          Construct an actor with the given container and name.
 
Method Summary
 void attributeChanged(ptolemy.kernel.util.Attribute attribute)
          Override the base class to determine which function is being specified.
 void fire()
          Consume exactly one input token from each input port, and compute the specified string function of the input taking into account the ignoreCase parameter.
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, attributeTypeChanged, clone, newPort, typeConstraintList
 
Methods inherited from class ptolemy.actor.AtomicActor
_createReceivers, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, removeDependency, setContainer, stop, stopFire, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, 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, getFunctionDependency, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
initialize, iterate, postfire, prefire, preinitialize, stop, stopFire, terminate, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getFullName, getName, getName
 

Field Detail

function

public ptolemy.data.expr.Parameter function
The comparison function to be performed. The choices are:


firstString

public PortParameter firstString
The input PortParameter for the first string of type string.


ignoreCase

public ptolemy.data.expr.Parameter ignoreCase
The parameter to state whether to ignore case. This is a boolean that defaults to false.


output

public ptolemy.actor.TypedIOPort output
The output port for the result of type BooleanToken.


secondString

public PortParameter secondString
The input PortParameter for the second string of type string.

Constructor Detail

StringCompare

public StringCompare(ptolemy.kernel.CompositeEntity container,
                     java.lang.String name)
              throws ptolemy.kernel.util.NameDuplicationException,
                     ptolemy.kernel.util.IllegalActionException
Construct an actor with the given container and name. Construct the two operand input PortParameters (initialized to "") and the output port which outputs the result of the various comparison functions executed by the actor. The function to be executed is decided by the parameter function, which is also initialized here to the comparison function equals. The ignoreCase parameter allows to ignore case when comparing.

Parameters:
container - The container.
name - The name of this actor.
Throws:
ptolemy.kernel.util.IllegalActionException - If the actor cannot be contained by the proposed container.
ptolemy.kernel.util.NameDuplicationException - If the container already has an actor with this name.
Method Detail

attributeChanged

public void attributeChanged(ptolemy.kernel.util.Attribute attribute)
                      throws ptolemy.kernel.util.IllegalActionException
Override the base class to determine which function is being specified.

Parameters:
attribute - The attribute that changed.
Throws:
ptolemy.kernel.util.IllegalActionException - If the function is not recognized.

fire

public void fire()
          throws ptolemy.kernel.util.IllegalActionException
Consume exactly one input token from each input port, and compute the specified string function of the input taking into account the ignoreCase parameter.

Throws:
ptolemy.kernel.util.IllegalActionException - If there is no director.