net.sourceforge.nrl.parser.operators
Class Operator

java.lang.Object
  extended by net.sourceforge.nrl.parser.operators.PropertyAwareObject
      extended by net.sourceforge.nrl.parser.operators.Operator
All Implemented Interfaces:
Serializable, IOperator

public class Operator
extends PropertyAwareObject
implements IOperator

A basic implementation of an operator. This supports listener notification if any fields are set.

See Also:
Serialized Form

Field Summary
static String DOCUMENTATION_CHANGED
          Event - documentation changed.
static String IMPLEMENTATION_DETAILS_CHANGED
          Event - implementation detail list changed.
static String NAME_CHANGED
          Event - name changed.
static String PARAMETERS_CHANGED
          Event - parameter list changed.
static String PURPOSE_CHANGED
          Event - purpose attribute changed.
static String RETURN_TYPE_CHANGED
          Event - return type changed.
static String RETURN_TYPE_NAME_CHANGED
          Event - return type name changed.
 
Constructor Summary
Operator()
           
 
Method Summary
 void addImplementationDetail(IImplementationDetail detail)
           
 void addParameter(IParameter param)
          Add a parameter to the end of the list.
 void addParameter(IParameter param, IParameter before)
          Add a parameter before another one.
 void clearImplementationDetail(String label)
           
 void clearParameters()
           
 String getDocumentation()
          Get the documentation string attached to this operator, if any.
 String getImplementationDetail(String label)
          Get an implementation detail associated with the operator, given its label.
 Collection<IImplementationDetail> getImplementationDetails()
          Return all implementation details associated with the operator.
 String getName()
          Return the operator name.
 NRLDataType getNRLReturnType()
          Returns the return type of the operator.
 IParameter getParameter(String name)
          Return a parameter by name
 List<IParameter> getParameters()
          Return a list of IParameter objects.
 String getPurpose()
          Return the purpose of this operator.
 IModelElement getReturnType()
          Return the return type of the operator.
 String getReturnTypeName()
          Return the name of the return type as found in the definition
 void removeParameter(IParameter param)
           
 List<NRLError> resolveModelReferences(IModelCollection models)
          Resolve all parameter type and return type references against models.
 void setDocumentation(String documentation)
           
 void setName(String name)
           
 void setNRLReturnType(NRLDataType returnType)
          Set the NRL type of the return type
 void setPurpose(String purpose)
           
 void setReturnType(IModelElement returnType)
          Set the type this operator will return.
 void setReturnTypeName(String returnTypeName)
          Set the raw name of the return type.
 
Methods inherited from class net.sourceforge.nrl.parser.operators.PropertyAwareObject
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENTATION_CHANGED

public static final String DOCUMENTATION_CHANGED
Event - documentation changed.

See Also:
Constant Field Values

NAME_CHANGED

public static final String NAME_CHANGED
Event - name changed.

See Also:
Constant Field Values

IMPLEMENTATION_DETAILS_CHANGED

public static final String IMPLEMENTATION_DETAILS_CHANGED
Event - implementation detail list changed.

See Also:
Constant Field Values

PARAMETERS_CHANGED

public static final String PARAMETERS_CHANGED
Event - parameter list changed.

See Also:
Constant Field Values

PURPOSE_CHANGED

public static final String PURPOSE_CHANGED
Event - purpose attribute changed.

See Also:
Constant Field Values

RETURN_TYPE_CHANGED

public static final String RETURN_TYPE_CHANGED
Event - return type changed.

See Also:
Constant Field Values

RETURN_TYPE_NAME_CHANGED

public static final String RETURN_TYPE_NAME_CHANGED
Event - return type name changed.

See Also:
Constant Field Values
Constructor Detail

Operator

public Operator()
Method Detail

addImplementationDetail

public void addImplementationDetail(IImplementationDetail detail)

addParameter

public void addParameter(IParameter param)
Add a parameter to the end of the list.

Parameters:
param - the parameter to add

addParameter

public void addParameter(IParameter param,
                         IParameter before)
Add a parameter before another one.

Parameters:
param - the parameter to add
before - the parameter before which to insert. If this is null, or the before parameter is not in the list, "param" is inserted at the front.

clearImplementationDetail

public void clearImplementationDetail(String label)

clearParameters

public void clearParameters()

getDocumentation

public String getDocumentation()
Description copied from interface: IOperator
Get the documentation string attached to this operator, if any.

Specified by:
getDocumentation in interface IOperator
Returns:
the documentation or null

getImplementationDetail

public String getImplementationDetail(String label)
Description copied from interface: IOperator
Get an implementation detail associated with the operator, given its label. This is used by mappings to targets like Java or rule engines to obtain supplementary mapping information.

See IImplementationDetail for more information.

Specified by:
getImplementationDetail in interface IOperator
Parameters:
label - the label
Returns:
the detail value or null if not found

getImplementationDetails

public Collection<IImplementationDetail> getImplementationDetails()
Description copied from interface: IOperator
Return all implementation details associated with the operator. This is used for mappings, see IImplementationDetail for more information.

Note that this does not return the implementation details associated with parameters of the operators - those have to be read off the individual parameters.

Specified by:
getImplementationDetails in interface IOperator
Returns:
a collection of IImplementationDetail objects

getName

public String getName()
Description copied from interface: IOperator
Return the operator name.

Specified by:
getName in interface IOperator
Returns:
the operator name

getNRLReturnType

public NRLDataType getNRLReturnType()
Description copied from interface: IOperator
Returns the return type of the operator. If it is not defined, this returns NRLDataType.UNKNOWN.

Specified by:
getNRLReturnType in interface IOperator
Returns:
the return type

getParameter

public IParameter getParameter(String name)
Description copied from interface: IOperator
Return a parameter by name

Specified by:
getParameter in interface IOperator
Parameters:
name - parameter name
Returns:
the parameter or null if not found

getParameters

public List<IParameter> getParameters()
Description copied from interface: IOperator
Return a list of IParameter objects.

Specified by:
getParameters in interface IOperator
Returns:
the parameters expected by the operator

getPurpose

public String getPurpose()
Description copied from interface: IOperator
Return the purpose of this operator. The use of this is entirely implementation-dependent.

Specified by:
getPurpose in interface IOperator
Returns:
the purpose

getReturnType

public IModelElement getReturnType()
Description copied from interface: IOperator
Return the return type of the operator. You must call IOperator.resolveModelReferences(IModelCollection) before this.

Specified by:
getReturnType in interface IOperator
Returns:
the return type or null if not specified.

getReturnTypeName

public String getReturnTypeName()
Description copied from interface: IOperator
Return the name of the return type as found in the definition

Specified by:
getReturnTypeName in interface IOperator
Returns:
the name

removeParameter

public void removeParameter(IParameter param)

resolveModelReferences

public List<NRLError> resolveModelReferences(IModelCollection models)
Description copied from interface: IOperator
Resolve all parameter type and return type references against models.

Specified by:
resolveModelReferences in interface IOperator
Parameters:
models - the models
Returns:
any errors encountered

setDocumentation

public void setDocumentation(String documentation)

setName

public void setName(String name)

setNRLReturnType

public void setNRLReturnType(NRLDataType returnType)
Description copied from interface: IOperator
Set the NRL type of the return type

Specified by:
setNRLReturnType in interface IOperator
Parameters:
returnType - the type

setPurpose

public void setPurpose(String purpose)

setReturnType

public void setReturnType(IModelElement returnType)
Description copied from interface: IOperator
Set the type this operator will return.

Specified by:
setReturnType in interface IOperator
Parameters:
returnType - the type

setReturnTypeName

public void setReturnTypeName(String returnTypeName)
Description copied from interface: IOperator
Set the raw name of the return type.

Specified by:
setReturnTypeName in interface IOperator
Parameters:
returnTypeName - the name


Copyright © 2006-2010 Christian Nentwich and others