IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.patterns.core
Class AbstractPatternInstance

java.lang.Object
  extended bycom.ibm.xtools.patterns.core.AbstractPatternInstance
Direct Known Subclasses:
AbstractPatternInstance

public abstract class AbstractPatternInstance
extends Object

Provides operations by which the pattern is bound to an element, arguments are added, replaced, or removed for the parameters of the pattern, and the pattern is reapplied or unapplied.

A pattern instance represents an instance of an application of a pattern. To retrieve the default arguments for a given parameter of the pattern, use the getDefaultArguments method. To check if it is valid to replace arguments, use the validToReplaceArguments method. Use the validToAddArguments method, to check if it is valid to add new arguments to the parameter. To add arguments and retrieve the status of adding the arguments operation, use the addArguments method.

To expand a pattern, use the expandPattern method. To reapply or remove a pattern, use the reapplyPattern and the unapplyPattern methods. Use the validatePattern and the canCompletePattern methods to check whether the application of the pattern is correct and if the parameters have sufficient arguments.


Constructor Summary
AbstractPatternInstance()
          The default constructor for an abstract pattern instance.
 
Method Summary
abstract  org.eclipse.core.runtime.IStatus addArgument(IParameterDescriptor parameter, AbstractParameterArgument argument)
          Adds an argument and returns the status of the adding an argument operation.
abstract  org.eclipse.core.runtime.IStatus addArguments(IParameterDescriptor parameter, AbstractParameterArgument[] arguments)
          Adds arguments and returns the status of the adding arguments operation.
abstract  org.eclipse.core.runtime.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.
abstract  org.eclipse.core.runtime.IStatus createArguments(IParameterDescriptor parameter, IPatternMetatype metatype)
          Creates the arguments for the given parameter of the pattern applied in this instance.
abstract  org.eclipse.core.runtime.IStatus createArgumentsUsingPairs(IParameterDescriptor parameter, IPatternMetatype metatype, AbstractParameterArgument.Pair[] pairs)
          Uses the given collection of argument pairs in creating arguments for the given parameter.
abstract  org.eclipse.core.runtime.IStatus createSomeArguments()
          Creates arguments for all parameters of the pattern application represented by this instance for which argument creation is applicable.
abstract  org.eclipse.core.runtime.IStatus expandPattern(AbstractPatternResult results)
          Expands the pattern represented by this instance based on the current arguments supplied for the parameters.
abstract  Object getBoundElement()
          Returns the object that is the bound element in the pattern applied in this instance.
abstract  Date getCreationTime()
          Returns the time when this pattern application instance was created.
abstract  AbstractParameterArgument[] getDefaultArguments(IParameterDescriptor parameter)
          Returns the default arguments, if any, for the given parameter of the pattern applied in this instance.
abstract  AbstractParameterArgument[] getFirstArgumentCandidates(IParameterDescriptor parameter, IPatternMetatype metatype, org.eclipse.core.runtime.MultiStatus status)
          Returns the collection of arguments that are the candidates for the first argument in an argument pair used in creating an argument for the given parameter of the pattern applied in this instance.
abstract  Date getLastExpansionTime()
          Returns the latest expansion time for this pattern application instance.
abstract  AbstractParameterArgument[] getParameterArguments(IParameterDescriptor parameter)
          Returns the arguments supplied for the given parameter.
abstract  IPatternDescriptor getPatternDescriptor()
          Returns the descriptor for the pattern.
abstract  AbstractParameterArgument[] getSecondArgumentCandidates(IParameterDescriptor parameter, IPatternMetatype metatype, org.eclipse.core.runtime.MultiStatus status)
          Returns the collection of arguments that are candidates for the second argument in an argument pair used in creating an argument for the given parameter of the pattern applied in this instance.
abstract  boolean getTraceabilityEnabled()
          Checks whether traceability is enabled for the application of the pattern represented by this instance.
abstract  org.eclipse.core.runtime.IStatus reapplyPattern(AbstractPatternResult results)
          Reapplies the pattern represented by this instance.
abstract  org.eclipse.core.runtime.IStatus removeArgument(IParameterDescriptor parameter, AbstractParameterArgument argument)
          Removes the argument and returns the status of the removing the argument operation.
abstract  org.eclipse.core.runtime.IStatus removeArguments(IParameterDescriptor parameter, AbstractParameterArgument[] arguments)
          Removes arguments and returns the status of removing the arguments operation.
abstract  org.eclipse.core.runtime.IStatus replaceArgument(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)
          Replaces an argument and returns the status of replacing an argument operation.
abstract  org.eclipse.core.runtime.IStatus replaceArguments(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument[] newArguments)
          Replaces arguments and returns the status of replacing the arguments operation.
abstract  org.eclipse.core.runtime.IStatus setTraceabilityEnabled(boolean enableTraceability)
          Sets whether traceability is enabled for the application of the pattern represented by this instance.
abstract  org.eclipse.core.runtime.IStatus unapplyPattern(AbstractPatternResult results)
          Unapplies the pattern represented by this instance.
abstract  org.eclipse.core.runtime.IStatus usesPairsToCreateArguments(IParameterDescriptor parameter, IPatternMetatype metatype)
          Indicates whether the argument pairs must be supplied in order to create arguments for the given parameter of the pattern applied in this instance.
abstract  org.eclipse.core.runtime.IStatus validatePattern()
          Checks whether the application of the pattern represented by this instance is complete and semantically valid.
abstract  org.eclipse.core.runtime.IStatus validToAddArgument(IParameterDescriptor parameter, AbstractParameterArgument argument)
          Returns the validation status for adding an argument operation.
abstract  org.eclipse.core.runtime.IStatus validToAddArguments(IParameterDescriptor parameter, AbstractParameterArgument[] arguments)
          Returns the validation status for the adding arguments operation.
abstract  org.eclipse.core.runtime.IStatus validToCreateArguments(IParameterDescriptor parameter, IPatternMetatype metatype)
          Indicates whether arguments can be created for the given parameter of the pattern applied in this instance.
abstract  org.eclipse.core.runtime.IStatus validToCreateSomeArguments()
          Indicates whether for all parameters of the pattern application represented by this instance either arguments can be created for the parameter or argument creation is not applicable to the parameter.
abstract  org.eclipse.core.runtime.IStatus validToRemoveArgument(IParameterDescriptor parameter, AbstractParameterArgument argument)
          Returns the validation status for removing an argument operation.
abstract  org.eclipse.core.runtime.IStatus validToRemoveArguments(IParameterDescriptor parameter, AbstractParameterArgument[] arguments)
          Returns the validation status for the remove the arguments operation.
abstract  org.eclipse.core.runtime.IStatus validToReplaceArgument(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)
          Returns the validation status for replacing an argument operation.
abstract  org.eclipse.core.runtime.IStatus validToReplaceArguments(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument[] newArguments)
          Returns the validation status for replacing the arguments operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPatternInstance

public AbstractPatternInstance()
The default constructor for an abstract pattern instance.

Method Detail

getPatternDescriptor

public abstract IPatternDescriptor getPatternDescriptor()
Returns the descriptor for the pattern.

The descriptor includes simple information such as the name, unique id, version, the author of the pattern and complex information such as descriptors for the parameters of the pattern.

Returns:
Returns the descriptor for the pattern that was applied in this instance.

getLastExpansionTime

public abstract Date getLastExpansionTime()
Returns the latest expansion time for this pattern application instance.

Returns:
Returns the most recent time when the pattern application represented by this instance was expanded.

getCreationTime

public abstract Date getCreationTime()
Returns the time when this pattern application instance was created.

Returns:
Returns the time when the pattern application represented by this instance was created.

getBoundElement

public abstract Object getBoundElement()
Returns the object that is the bound element in the pattern applied in this instance.

Returns:
Returns the object bound to the pattern applied in this instance, if any. If no object is bound to the applied pattern, it returns null.

getParameterArguments

public abstract AbstractParameterArgument[] getParameterArguments(IParameterDescriptor parameter)
Returns the arguments 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:
Returns the arguments, if any, that have been supplied for the given parameter. If no arguments have been supplied, it returns a zero-length array.

validToAddArgument

public abstract org.eclipse.core.runtime.IStatus validToAddArgument(IParameterDescriptor parameter,
                                                                    AbstractParameterArgument argument)
Returns the validation status for adding an argument operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given argument is tested for validity.
argument - The parameter argument to be tested for validity as an argument for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

addArgument

public abstract org.eclipse.core.runtime.IStatus addArgument(IParameterDescriptor parameter,
                                                             AbstractParameterArgument argument)
Adds an argument and returns the status of the adding an argument operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given argument is supplied.
argument - The argument supplied for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

validToAddArguments

public abstract org.eclipse.core.runtime.IStatus validToAddArguments(IParameterDescriptor parameter,
                                                                     AbstractParameterArgument[] arguments)
Returns the validation status for the adding arguments operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are tested for validity.
arguments - The arguments to be tested for validity.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches()to branch on the return value.

addArguments

public abstract org.eclipse.core.runtime.IStatus addArguments(IParameterDescriptor parameter,
                                                              AbstractParameterArgument[] arguments)
Adds arguments and returns the status of the adding arguments operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are supplied.
arguments - The arguments supplied for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

validToReplaceArgument

public abstract org.eclipse.core.runtime.IStatus validToReplaceArgument(IParameterDescriptor parameter,
                                                                        AbstractParameterArgument oldArgument,
                                                                        AbstractParameterArgument newArgument)
Returns the validation status for replacing an argument operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are tested as a valid replacement.
oldArgument - The argument to be tested for validity as the replaceable argument for the given parameter.
newArgument - The argument to be tested for validity as the replacement argument for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

replaceArgument

public abstract org.eclipse.core.runtime.IStatus replaceArgument(IParameterDescriptor parameter,
                                                                 AbstractParameterArgument oldArgument,
                                                                 AbstractParameterArgument newArgument)
Replaces an argument and returns the status of replacing an argument operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are supplied for replacement.
oldArgument - The argument to be replaced for the given parameter.
newArgument - The argument to be the replacement argument for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

validToReplaceArguments

public abstract org.eclipse.core.runtime.IStatus validToReplaceArguments(IParameterDescriptor parameter,
                                                                         AbstractParameterArgument oldArgument,
                                                                         AbstractParameterArgument[] newArguments)
Returns the validation status for replacing the arguments operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are tested as a valid replacement.
oldArgument - The single argument to be tested as replaceable for the given parameter.
newArguments - The arguments to be tested as replacements for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

replaceArguments

public abstract org.eclipse.core.runtime.IStatus replaceArguments(IParameterDescriptor parameter,
                                                                  AbstractParameterArgument oldArgument,
                                                                  AbstractParameterArgument[] newArguments)
Replaces arguments and returns the status of replacing the arguments operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are supplied replacements.
oldArgument - The argument supplied as replaceable for the given parameter.
newArguments - The arguments supplied as replacements for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

validToRemoveArgument

public abstract org.eclipse.core.runtime.IStatus validToRemoveArgument(IParameterDescriptor parameter,
                                                                       AbstractParameterArgument argument)
Returns the validation status for removing an argument operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given argument is tested for removal.
argument - The argument to be tested for removal for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

removeArgument

public abstract org.eclipse.core.runtime.IStatus removeArgument(IParameterDescriptor parameter,
                                                                AbstractParameterArgument argument)
Removes the argument and returns the status of the removing the argument operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given argument is to be removed.
argument - The argument to be removed for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

validToRemoveArguments

public abstract org.eclipse.core.runtime.IStatus validToRemoveArguments(IParameterDescriptor parameter,
                                                                        AbstractParameterArgument[] arguments)
Returns the validation status for the remove the arguments operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are to be tested for removal.
arguments - The arguments to be tested for removal for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

removeArguments

public abstract org.eclipse.core.runtime.IStatus removeArguments(IParameterDescriptor parameter,
                                                                 AbstractParameterArgument[] arguments)
Removes arguments and returns the status of removing the arguments operation.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the given arguments are to be removed.
arguments - The arguments to be removed for the given parameter.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

getDefaultArguments

public abstract AbstractParameterArgument[] getDefaultArguments(IParameterDescriptor parameter)
Returns the default arguments, if any, for the given parameter of the pattern applied in this instance.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which the default arguments are to be returned.
Returns:
Returns the default arguments for the given parameter in this instance.

validToCreateArguments

public abstract org.eclipse.core.runtime.IStatus validToCreateArguments(IParameterDescriptor parameter,
                                                                        IPatternMetatype metatype)
Indicates whether arguments can be created for the given parameter of the pattern applied in this instance.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which arguments are to be created.
metatype - The desired type of the arguments to be created.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

createArguments

public abstract org.eclipse.core.runtime.IStatus createArguments(IParameterDescriptor parameter,
                                                                 IPatternMetatype metatype)
Creates the arguments for the given parameter of the pattern applied in this instance.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which arguments are to be created.
metatype - The desired type of the arguments to be created.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

usesPairsToCreateArguments

public abstract org.eclipse.core.runtime.IStatus usesPairsToCreateArguments(IParameterDescriptor parameter,
                                                                            IPatternMetatype metatype)
Indicates whether the argument pairs must be supplied in order to create arguments for the given parameter of the pattern applied in this instance.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which arguments are to be created.
metatype - The desired type of the arguments to be created.
Returns:
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 can be used to indicate that pairs are not used to create arguments. An INFO status can 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.

getFirstArgumentCandidates

public abstract AbstractParameterArgument[] getFirstArgumentCandidates(IParameterDescriptor parameter,
                                                                       IPatternMetatype metatype,
                                                                       org.eclipse.core.runtime.MultiStatus status)
Returns the collection of arguments that are the candidates for the first argument in an argument pair used in creating an argument for the given parameter of the pattern applied in this instance.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which first argument candidates are to be return.
metatype - The desired type of the arguments to be created.
status - The status produced by getting the first argument candidates. An INFO status can be used to convey information to the caller about the semantics of the first argument candidates, for example, that the first argument is source element of a relationship.
Returns:
Returns the collection of arguments that are candidates for the first argument in an argument pair.

getSecondArgumentCandidates

public abstract AbstractParameterArgument[] getSecondArgumentCandidates(IParameterDescriptor parameter,
                                                                        IPatternMetatype metatype,
                                                                        org.eclipse.core.runtime.MultiStatus status)
Returns the collection of arguments that are candidates for the second argument in an argument pair used in creating an argument for the given parameter of the pattern applied in this instance.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for which second argument candidates are to be return.
metatype - The desired type of the arguments to be created.
status - The status produced by getting the second argument candidates. An INFO status can be used to convey information to the caller about the semantics of the second argument candidates, for example, that the second argument is target element of a relationship.
Returns:
Returns the collection of arguments that are candidates for the second argument in an argument pair.

createArgumentsUsingPairs

public abstract org.eclipse.core.runtime.IStatus createArgumentsUsingPairs(IParameterDescriptor parameter,
                                                                           IPatternMetatype metatype,
                                                                           AbstractParameterArgument.Pair[] pairs)
Uses the given collection of argument pairs in creating arguments for the given parameter.

Parameters:
parameter - The descriptor of the parameter of the pattern applied in this instance for arguments are to be created.
metatype - The desired type of the arguments to be created.
pairs - The collection of argument pairs to be used in creating arguments of the given type for the given parameter
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

validToCreateSomeArguments

public abstract org.eclipse.core.runtime.IStatus validToCreateSomeArguments()
Indicates whether for all parameters of the pattern application represented by this instance either arguments can be created for the parameter or argument creation is not applicable to the parameter.

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

createSomeArguments

public abstract org.eclipse.core.runtime.IStatus createSomeArguments()
Creates arguments for all parameters of the pattern application represented by this instance for which argument creation is applicable.

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

expandPattern

public abstract org.eclipse.core.runtime.IStatus expandPattern(AbstractPatternResult results)
Expands the pattern represented by this instance based on the current arguments supplied for the parameters.

Parameters:
results - The results of the expanding the pattern.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

reapplyPattern

public abstract org.eclipse.core.runtime.IStatus reapplyPattern(AbstractPatternResult results)
Reapplies the pattern represented by this instance.

Parameters:
results - The results of the reapplying the pattern.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

unapplyPattern

public abstract org.eclipse.core.runtime.IStatus unapplyPattern(AbstractPatternResult results)
Unapplies the pattern represented by this instance.

Parameters:
results - The results of the unapplying the pattern.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

validatePattern

public abstract org.eclipse.core.runtime.IStatus validatePattern()
Checks whether the application of the pattern represented by this instance is complete and semantically valid.

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

canCompletePattern

public abstract org.eclipse.core.runtime.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:
The status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

getTraceabilityEnabled

public abstract boolean getTraceabilityEnabled()
Checks whether traceability is enabled for the application of the pattern represented by this instance.

Returns:
Returns true if traceability is enabled for the application of the pattern represented by this instance; otherwise, it returns false.

setTraceabilityEnabled

public abstract org.eclipse.core.runtime.IStatus setTraceabilityEnabled(boolean enableTraceability)
Sets whether traceability is enabled for the application of the pattern represented by this instance.

Parameters:
enableTraceability - The boolean indication of whether to set traceability enabled for the application of the pattern represented by this instance. If enableTraceability is true then traceability is to be set to enabled.
Returns:
Returns the status representing the outcome of the operation. Use IStatus.isOk() or IStatus.matches() to branch on the return value.

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.