Java API ReferenceClass Hierarchy | All Classes | All Fields and Methods

com.ibm.xtools.patterns.framework

Class AbstractPatternInstance

+-- AbstractPatternInstance
      +-- AbstractPatternInstance

abstract public Class AbstractPatternInstance
extends AbstractPatternInstance

Extends the pattern service AbstractPatternInstance abstract class.

The pattern instance represents the key abstraction in the patterns framework that holds together the definition, the parameters, the parameter values and the run-time expansion behavior.

The pattern parameter value action queue is held within this class, and contains the queue of work associated with an external expand invocation. Other methods involving parameter adds and removes as well as validation for parameter values are included.

Pattern implementations can extend this base class with their own pattern instance class specific to a given pattern. The typical methods that are overridden are getRepresentationName() and expandPattern(AbstractPatternResult) .

If this class or a closely-related subclass (such as the UML2-specific pattern instance class) is not extended and instantiated in the create instance of the pattern definition factory method, then the default pattern instance is used instead.


Constructor summary
AbstractPatternInstance()

The default constructor for AbstractPatternInstance class that is provided automatically by the compiler.

Method summary
voidaccept(Visitor visitor)

Enables visitation of this entity.

IStatusaddArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)

Adds the argument to the pattern parameter.

IStatusaddArguments(IParameterDescriptor descriptor, AbstractParameterArgument arguments)

Adds the arguments to the pattern parameter.

booleanaddParameterValue(IParameterDescriptor descriptor, Object value, MultiStatus status)

Adds the value of the pattern parameter.

booleanaddParameterValues(IParameterDescriptor descriptor, Object values, MultiStatus status)

Adds the values of the pattern parameter.

IStatuscanCompletePattern()

Checks whether correct and sufficient arguments have been provided for the parameters of the pattern represented by this instance so that expansion will produce a complete and semantically valid application of the pattern.

IStatuscreateArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)

Create arguments for the given parameter of the pattern applied in this instance.

IStatuscreateArgumentsUsingPairs(IParameterDescriptor descriptor, IPatternMetatype metatype, Pair pairs)

Indicates whether argument pairs must be supplied in order to create arguments for the given parameter of the pattern applied in this instance.

IStatuscreateSomeArguments()

Creates specific arguments.

IStatusexpandPattern(AbstractPatternResult results)

Expands the pattern represented by this instance based on the current arguments supplied for the parameters.

ObjectgetBoundElement()

Retrieves the object that is the bound element in the pattern applied in this instance.

DategetCreationTime()

Retrieves the creation time value.

AbstractParameterArgumentgetDefaultArguments(IParameterDescriptor parameter)

Retrieves the default arguments, if any, for the given parameter of the pattern applied in this instance.

AbstractParameterArgumentgetFirstArgumentCandidates(IParameterDescriptor descriptor, IPatternMetatype metatype, MultiStatus status)

Retrieves the first argument candidates, if any, for the given parameter of the pattern applied in this instance.

DategetLastExpansionTime()

Retrieves the last creation time value.

AbstractPatternDefinitiongetOwningPatternDefinition()

Retrieves the owning pattern definition as the appropriate non-interface type.

AbstractParameterArgumentgetParameterArguments(IParameterDescriptor parameter)

Retrieves the arguments that have been supplied for the given parameter.

intgetParameterValueCount(AbstractPatternParameter parameter)

Retrieves for a given a parameter how many values are currently bound to it.

ObjectgetParameterValues(IParameterDescriptor parameter)

Retrieves the parameter values that are currently bound to it.

IPatternDescriptorgetPatternDescriptor()

Retrieves the pattern descriptor.

ObjectgetRepresentation()

Retrieves the representation object for this pattern instance in the model.

StringgetRepresentationName()

Invokes the representation name method when a name for a newly created representation element is needed.

AbstractParameterArgumentgetSecondArgumentCandidates(IParameterDescriptor descriptor, IPatternMetatype metatype, MultiStatus status)

Retrieves the second argument candidate values.

AbstractParameterArgumentgetSecondArgumentCandidatesForFirstArgumentValue(IParameterDescriptor descriptor, IPatternMetatype metatype, AbstractParameterArgument firstValue, MultiStatus status)

Retrieves the second argument candidate for first argument values.

booleangetTraceabilityEnabled()

Retrieves whether the object is traceable.

IStatusreapplyPattern(AbstractPatternResult results)

Reapplies the pattern represented by this instance.

booleanremoveAllParameterValues(IParameterDescriptor descriptor)

Removes all parameter values for the identifying parameter descriptor.

IStatusremoveArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)

Removes the argument.

IStatusremoveArguments(IParameterDescriptor descriptor, AbstractParameterArgument arguments)

Removes the specified arguments.

booleanremoveParameterValue(IParameterDescriptor descriptor, Object value, MultiStatus status)

Removes the parameter value.

booleanremoveParameterValues(IParameterDescriptor descriptor, Object values, MultiStatus status)

Removes the parameter values.

IStatusreplaceArgument(IParameterDescriptor descriptor, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)

Replaces the specified argument.

IStatusreplaceArguments(IParameterDescriptor descriptor, AbstractParameterArgument oldArgument, AbstractParameterArgument newArguments)

Replaces the specified arguments.

booleanresetDefaultParameterValues(IParameterDescriptor descriptor, MultiStatus status)

Resets the default parameter values.

booleanresetDefaultParameterValues(MultiStatus status)

Resets the default parameter values.

IStatussetTraceabilityEnabled(boolean enableTraceability)

Sets the object traceability.

IStatusunapplyPattern(AbstractPatternResult results)

Removes the pattern represented by this instance.

IStatususesPairsToCreateArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)

Indicates to use argument pairs to create arguments for the given parameter of the pattern applied in this instance.

IStatusvalidatePattern()

Indicates whether the pattern is valid.

booleanvalidatePattern(MultiStatus status)

Returns whether the pattern is valid.

IStatusvalidToAddArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)

Indicates whether the argument can be added.

IStatusvalidToAddArguments(IParameterDescriptor descriptor, AbstractParameterArgument arguments)

Indicates whether the arguments can be added.

IStatusvalidToCreateArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)

Indicates whether the argument can be created.

IStatusvalidToCreateSomeArguments()

Indicates whether specific arguments can be created.

IStatusvalidToRemoveArgument(IParameterDescriptor parameter, AbstractParameterArgument argument)

Indicates whether the argument can be removed.

IStatusvalidToRemoveArguments(IParameterDescriptor parameter, AbstractParameterArgument arguments)

Indicates whether the arguments can be removed.

IStatusvalidToReplaceArgument(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)

Indicates whether the argument can be replaced.

IStatusvalidToReplaceArguments(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument newArguments)

Indicates whether the arguments can be replaced.

Constructor detail

AbstractPatternInstance

public AbstractPatternInstance()

The default constructor for AbstractPatternInstance class that is provided automatically by the compiler.


Method detail

accept

public void accept(Visitor visitor)

Enables visitation of this entity.

Parameters:

visitor
- The visitor of the entity.

addArgument

public IStatus addArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)

Adds the argument to the pattern parameter.

Parameters:

descriptor
- The descriptor of the element.
argument
- The argument to be added.

Returns:

Return an IStatus object.

addArguments

public IStatus addArguments(IParameterDescriptor descriptor, AbstractParameterArgument arguments)

Adds the arguments to the pattern parameter.

Parameters:

descriptor
- The descriptor of the parameter.
arguments
- The arguments to be added.

Returns:

Return an IStatus object.

addParameterValue

final public boolean addParameterValue(IParameterDescriptor descriptor, Object value, MultiStatus status)

Adds the value of the pattern parameter.

Parameters:

descriptor
- The descriptor of the element.
value
- The value of the pattern parameter.
status
- The status of the operation.

Returns:

A boolean value of true if the value is added. Otherwise, it returns a value of false.

addParameterValues

final public boolean addParameterValues(IParameterDescriptor descriptor, Object values, MultiStatus status)

Adds the values of the pattern parameter.

Parameters:

descriptor
- The descriptor of the element.
values
-
status
- The status of the operation.

Returns:

A boolean value of true if the values are added. Otherwise, it returns a value of false.

canCompletePattern

public IStatus canCompletePattern()

Checks whether correct and sufficient arguments have been provided for the parameters of the pattern represented by this instance so that expansion will produce a complete and semantically valid application of the pattern.

Returns:

An IStatus object.

createArguments

public IStatus createArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)

Create arguments for the given parameter of the pattern applied in this instance.

Parameters:

descriptor
- The descriptor of the argument.
metatype
- The metatype of the argument.

Returns:

An IStatus object.

createArgumentsUsingPairs

public IStatus createArgumentsUsingPairs(IParameterDescriptor descriptor, IPatternMetatype metatype, Pair pairs)

Indicates whether argument pairs must be supplied in order to create arguments for the given parameter of the pattern applied in this instance.

Parameters:

descriptor
- The descriptor of the element.
metatype
- The metatype of the arguments.
pairs
- The pairs of arguments.

Returns:

The status representing the outcome of the operation.

Use IStatus.isOk() or IStatus.matches()to branch on the return value. Either an ERROR or CANCEL status may be used to indicate that pairs are not used or create arguments. An INFO status may be used to convey information to the caller about the semantics of the pairs used as arguments; the message in the status should be appropriate, for example, to be displayed in a dialog prompting the user to select pairs as arguments.


createSomeArguments

public IStatus createSomeArguments()

Creates specific arguments.

Returns:

The status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

expandPattern

public IStatus expandPattern(AbstractPatternResult results)

Expands the pattern represented by this instance based on the current arguments supplied for the parameters.

Parameters:

results
- The status of the operation.

Returns:

The status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

getBoundElement

final public Object getBoundElement()

Retrieves the object that is the bound element in the pattern applied in this instance.

Returns:

The object bound to the pattern applied in this instance, if any; if no object is bound to the applied pattern, returns a value of null.

getCreationTime

final public Date getCreationTime()

Retrieves the creation time value.

Returns:

A date object representing the creation time value.

getDefaultArguments

public AbstractParameterArgument getDefaultArguments(IParameterDescriptor parameter)

Retrieves the default arguments, if any, for the given parameter of the pattern applied in this instance.

Parameters:

parameter
- The given parameter.

Returns:

The default arguments for the given parameter in this instance.

getFirstArgumentCandidates

public AbstractParameterArgument getFirstArgumentCandidates(IParameterDescriptor descriptor, IPatternMetatype metatype, MultiStatus status)

Retrieves the first argument candidates, if any, for the given parameter of the pattern applied in this instance.

Parameters:

descriptor
- The descriptor of the element.
metatype
- The metatype of the argument.
status
- The status of the operation.

Returns:

An array of AbstractParameterArgument objects.

getLastExpansionTime

final public Date getLastExpansionTime()

Retrieves the last creation time value.

Returns:

A date object representing the last creation time value.

getOwningPatternDefinition

final public AbstractPatternDefinition getOwningPatternDefinition()

Retrieves the owning pattern definition as the appropriate non-interface type.

Used for framework collaborating classes that need more than just the interface that is exposed to the pattern service.

Returns:

The definition that owns this instance.

getParameterArguments

public AbstractParameterArgument getParameterArguments(IParameterDescriptor parameter)

Retrieves the arguments that have been supplied for the given parameter.

Parameters:

parameter
- The descriptor of the parameter of the pattern applied in this instance for which the arguments are to be returned.

Returns:

The arguments, if any, which have been supplied for the given parameter; if no arguments have been supplied returns a zero-length array.

getParameterValueCount

final public int getParameterValueCount(AbstractPatternParameter parameter)

Retrieves for a given a parameter how many values are currently bound to it.

Parameters:

parameter
- The parameter for which to count the bound values.

Returns:

The size or length of the parameter values list.

getParameterValues

final public Object getParameterValues(IParameterDescriptor parameter)

Retrieves the parameter values that are currently bound to it.

Parameters:

parameter
- The parameter for which to count the current bound values.

Returns:

An array of the parameter current bound values.

getPatternDescriptor

final public IPatternDescriptor getPatternDescriptor()

Retrieves the pattern descriptor.

Returns:

The descriptor for the pattern that was applied in this instance.

getRepresentation

final public Object getRepresentation()

Retrieves the representation object for this pattern instance in the model.

Returns:

The representation object for this pattern instance in the model.

The representation object is the object that is used for persisting pattern instances within the current pattern instance store


getRepresentationName

public String getRepresentationName()

Invokes the representation name method when a name for a newly created representation element is needed.

Returns:

A name to assign to the representation element in the model.

The name can be unique per instance, but based on a pattern definition name.


getSecondArgumentCandidates

public AbstractParameterArgument getSecondArgumentCandidates(IParameterDescriptor descriptor, IPatternMetatype metatype, MultiStatus status)

Retrieves the second argument candidate values.

Parameters:

descriptor
- The descriptor of the element.
metatype
- The metatype of the argument.
status
- The status of the operation.

Returns:

An array of AbstractParameterArgument objects.

getSecondArgumentCandidatesForFirstArgumentValue

public AbstractParameterArgument getSecondArgumentCandidatesForFirstArgumentValue(IParameterDescriptor descriptor, IPatternMetatype metatype, AbstractParameterArgument firstValue, MultiStatus status)

Retrieves the second argument candidate for first argument values.

Parameters:

descriptor
- The descriptor of the element.
metatype
- The metatype of the argument.
firstValue
- The first argument value.
status
- The status of the operation.

Returns:

An array of AbstractParameterArgument objects.

getTraceabilityEnabled

public boolean getTraceabilityEnabled()

Retrieves whether the object is traceable.

Returns:

A boolean value of true if this object traceability is enabled. Otherwise, it returns a value of false.

reapplyPattern

public IStatus reapplyPattern(AbstractPatternResult results)

Reapplies the pattern represented by this instance.

Parameters:

results
- The results of reapplying the pattern.

Returns:

The status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

removeAllParameterValues

public boolean removeAllParameterValues(IParameterDescriptor descriptor)

Removes all parameter values for the identifying parameter descriptor.

Parameters:

descriptor
- The parameter descriptor identifying the parameter values to remove.

Returns:

A boolean value of true indicates success of removing all the parameter values. Otherwise, it returns a value of false.

removeArgument

public IStatus removeArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)

Removes the argument.

Parameters:

descriptor
- The descriptor of the argument.
argument
- The argument to be removed.

Returns:

The status representing the outcome of the operation.

removeArguments

public IStatus removeArguments(IParameterDescriptor descriptor, AbstractParameterArgument arguments)

Removes the specified arguments.

Parameters:

descriptor
- The descriptor of the argument.
arguments
- The arguments to be removed.

Returns:

The status representing the outcome of the operation.

removeParameterValue

final public boolean removeParameterValue(IParameterDescriptor descriptor, Object value, MultiStatus status)

Removes the parameter value.

Parameters:

descriptor
- The descriptor of the parameter value.
value
- The value to be removed.
status
- The status of the operation.

Returns:

A boolean value of true if the value is removed. Otherwise, it returns a value of false.

removeParameterValues

final public boolean removeParameterValues(IParameterDescriptor descriptor, Object values, MultiStatus status)

Removes the parameter values.

Parameters:

descriptor
- The descriptor of the parameter values.
values
- The values to be removed.
status
- The status of the operation.

Returns:

A boolean value of true if the values are removed. Otherwise, it returns a value of false.

replaceArgument

public IStatus replaceArgument(IParameterDescriptor descriptor, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)

Replaces the specified argument.

Parameters:

descriptor
- The descriptor of the argument.
oldArgument
- The argument to be replaced.
newArgument
- The new argument.

Returns:

The status representing the outcome of the operation.

replaceArguments

public IStatus replaceArguments(IParameterDescriptor descriptor, AbstractParameterArgument oldArgument, AbstractParameterArgument newArguments)

Replaces the specified arguments.

Parameters:

descriptor
- The descriptor of the argument.
oldArgument
- The argument to be replaced.
newArguments
- The new arguments.

Returns:

The status representing the outcome of the operation.

resetDefaultParameterValues

final public boolean resetDefaultParameterValues(IParameterDescriptor descriptor, MultiStatus status)

Resets the default parameter values.

Parameters:

descriptor
- The descriptor of the parameter value.
status
- The status of the operation.

Returns:

A boolean value of true indicates success of resetting the default parameter values. Otherwise, it returns a value of false.

resetDefaultParameterValues

final public boolean resetDefaultParameterValues(MultiStatus status)

Resets the default parameter values.

Parameters:

status
- The status of the operation.

Returns:

A boolean value of true indicates success of resetting the default parameter values and multistatus. Otherwise, it returns a value of false.

setTraceabilityEnabled

public IStatus setTraceabilityEnabled(boolean enableTraceability)

Sets the object traceability.

Parameters:

enableTraceability
- The object traceability.

Returns:

A boolean value of true if this object traceability is enabled. Otherwise, it returns a value of false.

unapplyPattern

public IStatus unapplyPattern(AbstractPatternResult results)

Removes the pattern represented by this instance.

Parameters:

results
- The results of the operation.

Returns:

The status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

usesPairsToCreateArguments

public IStatus usesPairsToCreateArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)

Indicates to use argument pairs to create arguments for the given parameter of the pattern applied in this instance.

Parameters:

descriptor
- The descriptor of the element.
metatype
- The metatype for the arguments.

Returns:

The status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

validatePattern

public IStatus validatePattern()

Indicates whether the pattern is valid.

Returns:

The status representing the outcome of the operation.

validatePattern

public boolean validatePattern(MultiStatus status)

Returns whether the pattern is valid.

Parameters:

status
- The status of the operation.

Returns:

The status representing the outcome of the operation.

validToAddArgument

public IStatus validToAddArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)

Indicates whether the argument can be added.

Parameters:

descriptor
- The descriptor of the argument.
argument
- The argument to be added.

Returns:

The status representing the outcome of the operation.

validToAddArguments

public IStatus validToAddArguments(IParameterDescriptor descriptor, AbstractParameterArgument arguments)

Indicates whether the arguments can be added.

Parameters:

descriptor
- The descriptor of the argument.
arguments
- The arguments to be added.

Returns:

The status representing the outcome of the operation.

validToCreateArguments

public IStatus validToCreateArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)

Indicates whether the argument can be created.

Parameters:

descriptor
- The descriptor of the argument.
metatype
- The metatype of the argument.

Returns:

The status representing the outcome of the operation.

validToCreateSomeArguments

public IStatus validToCreateSomeArguments()

Indicates whether specific arguments can be created.

Returns:

The status representing the outcome of the operation.

validToRemoveArgument

public IStatus validToRemoveArgument(IParameterDescriptor parameter, AbstractParameterArgument argument)

Indicates whether the argument can be removed.

Parameters:

parameter
- The parameter containing the argument.
argument
- The argument to be removed.

Returns:

The status representing the outcome of the operation.

validToRemoveArguments

public IStatus validToRemoveArguments(IParameterDescriptor parameter, AbstractParameterArgument arguments)

Indicates whether the arguments can be removed.

Parameters:

parameter
- The parameter containing the arguments.
arguments
- The arguments to be removed.

Returns:

The status representing the outcome of the operation.

validToReplaceArgument

public IStatus validToReplaceArgument(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)

Indicates whether the argument can be replaced.

Parameters:

parameter
- The parameter containing the argument.
oldArgument
- The argument to be replaced.
newArgument
- The new argument.

Returns:

The status representing the outcome of the operation.

validToReplaceArguments

public IStatus validToReplaceArguments(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument newArguments)

Indicates whether the arguments can be replaced.

Parameters:

parameter
- The parameter containing the arguments.
oldArgument
- The argument to be replaced.
newArguments
-

Returns:

The status representing the outcome of the operation.


Feedback