|
IBM Rational Software Modeler Release 6.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.xtools.patterns.core.AbstractPatternInstance
com.ibm.xtools.patterns.framework.AbstractPatternInstance
This class extends the pattern service AbstractPatternInstance abstract class on the pattern author's behalf. Pattern instance is perhaps the key abstraction in the patterns framework and provides the glue 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 is 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 get representation name and expand. If this class or a closely-related subclass (such as the UML2-specific pattern instance class) is not extended and instantiated in the pattern definition's create instance factory method then the default pattern instance is used instead.
Nested Class Summary | |
protected static class |
AbstractPatternInstance.Default
The default pattern instance class to use for pattern instances. |
protected static class |
AbstractPatternInstance.PatternParameterValueQueue
A simple queue implementation that is strongly-typed for pattern parameter values. |
Field Summary | |
protected AbstractPatternStore.Instance |
store
The concrete pattern instance store in effect for this library and therefore this pattern instance. |
Constructor Summary | |
protected |
AbstractPatternInstance(AbstractPatternDefinition owningPatternDefinition,
Object representation)
Constructs a new abstract pattern instance from a current pattern instance representation model element, this version of the constructor does not create a pattern instance representation. |
protected |
AbstractPatternInstance(AbstractPatternDefinition owningPatternDefinition,
Object targetObject,
AbstractPatternResult createdElements,
MultiStatus status)
Constructs a new abstract pattern instance and updates last creation date. |
Method Summary | |
void |
accept(Visitor visitor)
Enable visitation of this entity. |
IStatus |
addArgument(IParameterDescriptor descriptor,
AbstractParameterArgument argument)
Adds an argument and returns the status of the adding an argument operation. |
IStatus |
addArguments(IParameterDescriptor descriptor,
AbstractParameterArgument[] arguments)
Adds arguments and returns the status of the adding arguments operation. |
boolean |
addParameterValue(IParameterDescriptor descriptor,
Object value,
MultiStatus status)
|
boolean |
addParameterValues(IParameterDescriptor descriptor,
Object[] values,
MultiStatus status)
|
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. |
IStatus |
createArguments(IParameterDescriptor descriptor,
IPatternMetatype metatype)
Creates the arguments for the given parameter of the pattern applied in this instance. |
IStatus |
createArgumentsUsingPairs(IParameterDescriptor descriptor,
IPatternMetatype metatype,
AbstractParameterArgument.Pair[] pairs)
Uses the given collection of argument pairs in creating arguments for the given parameter. |
IStatus |
createSomeArguments()
Creates arguments for all parameters of the pattern application represented by this instance for which argument creation is applicable. |
protected boolean |
expand()
A hotspot instance-directed expand method. |
IStatus |
expandPattern(AbstractPatternResult results)
Expands the pattern represented by this instance based on the current arguments supplied for the parameters. |
boolean |
expandPattern(MultiStatus status)
|
Object |
getBoundElement()
Returns the object that is the bound element in the pattern applied in this instance. |
Date |
getCreationTime()
Returns the time when this pattern application instance was created. |
AbstractParameterArgument[] |
getDefaultArguments(IParameterDescriptor parameter)
Returns the default arguments, if any, for the given parameter of the pattern applied in this instance. |
AbstractParameterArgument[] |
getFirstArgumentCandidates(IParameterDescriptor descriptor,
IPatternMetatype metatype,
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. |
Date |
getLastExpansionTime()
Returns the latest expansion time for this pattern application instance. |
AbstractPatternDefinition |
getOwningPatternDefinition()
Retrieves the owning pattern definition as the appropriate non-interface type. |
AbstractParameterArgument[] |
getParameterArguments(IParameterDescriptor parameter)
Returns the arguments supplied for the given parameter. |
int |
getParameterValueCount(AbstractPatternParameter parameter)
Given a parameter return how many values are currently bound to it. |
Object[] |
getParameterValues(IParameterDescriptor parameter)
|
IPatternDescriptor |
getPatternDescriptor()
Returns the descriptor for the pattern. |
Object |
getRepresentation()
|
String |
getRepresentationName()
The get representation name method is invoked when a name for a newly created representation element is needed. |
AbstractParameterArgument[] |
getSecondArgumentCandidates(IParameterDescriptor descriptor,
IPatternMetatype metatype,
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. |
AbstractParameterArgument[] |
getSecondArgumentCandidatesForFirstArgumentValue(IParameterDescriptor descriptor,
IPatternMetatype metatype,
AbstractParameterArgument firstValue,
MultiStatus status)
Returns the collection of arguments that are candidates for the second argument in an argument pair given a particular value for the first argument in the pair. |
boolean |
getTraceabilityEnabled()
Checks whether traceability is enabled for the application of the pattern represented by this instance. |
boolean |
getUnapplyRemovesBoundElement()
Checks whether unapplying this instance will remove (delete) the bound element. |
protected void |
initialize()
A hot-spot method that is defaulted with no implementation. |
boolean |
maintainParameterValue(IParameterDescriptor descriptor,
Object value,
MultiStatus status)
Enqueue a maintained parameter value for the given parameter. |
IStatus |
reapplyPattern(AbstractPatternResult results)
Reapplies the pattern represented by this instance. |
boolean |
removeAllParameterValues(IParameterDescriptor descriptor)
Remove all parameter values for the identifying parameter descriptor |
IStatus |
removeArgument(IParameterDescriptor descriptor,
AbstractParameterArgument argument)
Removes the argument and returns the status of the removing the argument operation. |
IStatus |
removeArguments(IParameterDescriptor descriptor,
AbstractParameterArgument[] arguments)
Removes arguments and returns the status of removing the arguments operation. |
boolean |
removeParameterValue(IParameterDescriptor descriptor,
Object value,
MultiStatus status)
|
boolean |
removeParameterValues(IParameterDescriptor descriptor,
Object[] values,
MultiStatus status)
|
IStatus |
replaceArgument(IParameterDescriptor descriptor,
AbstractParameterArgument oldArgument,
AbstractParameterArgument newArgument)
Replaces an argument and returns the status of replacing an argument operation. |
IStatus |
replaceArguments(IParameterDescriptor descriptor,
AbstractParameterArgument oldArgument,
AbstractParameterArgument[] newArguments)
Replaces arguments and returns the status of replacing the arguments operation. |
boolean |
resetDefaultParameterValues(IParameterDescriptor descriptor,
MultiStatus status)
|
boolean |
resetDefaultParameterValues(MultiStatus status)
|
IStatus |
setTraceabilityEnabled(boolean enableTraceability)
Sets whether traceability is enabled for the application of the pattern represented by this instance. |
IStatus |
setUnapplyRemovesBoundElement(boolean removeBoundElement)
Sets whether unapplying this instance will remove (delete) the bound element. |
IStatus |
unapplyPattern(AbstractPatternResult results)
Unapplies the pattern represented by this instance. |
protected boolean |
unapplyPattern(MultiStatus status)
A hotspot method that provides a default implementation for unapplying a pattern instance using traceability. |
IStatus |
usesPairsToCreateArguments(IParameterDescriptor descriptor,
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. |
IStatus |
validatePattern()
Checks whether the application of the pattern represented by this instance is complete and semantically valid. |
boolean |
validatePattern(MultiStatus status)
|
IStatus |
validToAddArgument(IParameterDescriptor descriptor,
AbstractParameterArgument argument)
Returns the validation status for adding an argument operation. |
IStatus |
validToAddArguments(IParameterDescriptor descriptor,
AbstractParameterArgument[] arguments)
Returns the validation status for the adding arguments operation. |
IStatus |
validToCreateArguments(IParameterDescriptor descriptor,
IPatternMetatype metatype)
Indicates whether arguments can be created for the given parameter of the pattern applied in this instance. |
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. |
IStatus |
validToRemoveArgument(IParameterDescriptor parameter,
AbstractParameterArgument argument)
Returns the validation status for removing an argument operation. |
IStatus |
validToRemoveArguments(IParameterDescriptor parameter,
AbstractParameterArgument[] arguments)
Returns the validation status for the remove the arguments operation. |
IStatus |
validToReplaceArgument(IParameterDescriptor parameter,
AbstractParameterArgument oldArgument,
AbstractParameterArgument newArgument)
Returns the validation status for replacing an argument operation. |
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 |
Field Detail |
protected final AbstractPatternStore.Instance store
Constructor Detail |
protected AbstractPatternInstance(AbstractPatternDefinition owningPatternDefinition, Object representation)
owningPatternDefinition
- the definition that governs this persistent store pattern
instance representationrepresentation
- the representation used as a seed to reconsitute this abstract
pattern instanceprotected AbstractPatternInstance(AbstractPatternDefinition owningPatternDefinition, Object targetObject, AbstractPatternResult createdElements, MultiStatus status)
owningPatternDefinition
- the definition that governs this instancetargetObject
- the target object is the context when creating the new pattern
instance representationcreatedElements
- if any additional model elements are created they are returned
herestatus
- the status generated by the construction of the pattern
instance is return hereMethod Detail |
public void accept(Visitor visitor)
accept
in interface Visitable
public IStatus validToAddArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)
AbstractPatternInstance
validToAddArgument
in class AbstractPatternInstance
descriptor
- 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.
public IStatus validToAddArguments(IParameterDescriptor descriptor, AbstractParameterArgument[] arguments)
AbstractPatternInstance
validToAddArguments
in class AbstractPatternInstance
descriptor
- 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.
public IStatus addArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)
AbstractPatternInstance
addArgument
in class AbstractPatternInstance
descriptor
- 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.
public IStatus addArguments(IParameterDescriptor descriptor, AbstractParameterArgument[] arguments)
AbstractPatternInstance
addArguments
in class AbstractPatternInstance
descriptor
- 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.
public final boolean addParameterValue(IParameterDescriptor descriptor, Object value, MultiStatus status)
public final boolean addParameterValues(IParameterDescriptor descriptor, Object[] values, MultiStatus status)
public final boolean maintainParameterValue(IParameterDescriptor descriptor, Object value, MultiStatus status)
descriptor
- The descriptor for the parametervalue
- The value to be enqueuedstatus
- The status produced by the operation
public IStatus canCompletePattern()
AbstractPatternInstance
canCompletePattern
in class AbstractPatternInstance
public IStatus validToCreateArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)
AbstractPatternInstance
validToCreateArguments
in class AbstractPatternInstance
descriptor
- 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.
public IStatus validToCreateSomeArguments()
AbstractPatternInstance
validToCreateSomeArguments
in class AbstractPatternInstance
public IStatus createArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)
AbstractPatternInstance
createArguments
in class AbstractPatternInstance
descriptor
- 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.
public IStatus usesPairsToCreateArguments(IParameterDescriptor descriptor, IPatternMetatype metatype)
AbstractPatternInstance
usesPairsToCreateArguments
in class AbstractPatternInstance
descriptor
- 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.
public AbstractParameterArgument[] getFirstArgumentCandidates(IParameterDescriptor descriptor, IPatternMetatype metatype, MultiStatus status)
AbstractPatternInstance
getFirstArgumentCandidates
in class AbstractPatternInstance
descriptor
- 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.
public AbstractParameterArgument[] getSecondArgumentCandidates(IParameterDescriptor descriptor, IPatternMetatype metatype, MultiStatus status)
AbstractPatternInstance
getSecondArgumentCandidates
in class AbstractPatternInstance
descriptor
- 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.
public AbstractParameterArgument[] getSecondArgumentCandidatesForFirstArgumentValue(IParameterDescriptor descriptor, IPatternMetatype metatype, AbstractParameterArgument firstValue, MultiStatus status)
AbstractPatternInstance
getSecondArgumentCandidatesForFirstArgumentValue
in class AbstractPatternInstance
descriptor
- The descriptor of the parameter of the pattern applied
in this instance for which second argument candidates
are to be returned.metatype
- The desired type of the arguments to be created.firstValue
- The value for the first argument in the argument pair.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.
public IStatus createArgumentsUsingPairs(IParameterDescriptor descriptor, IPatternMetatype metatype, AbstractParameterArgument.Pair[] pairs)
AbstractPatternInstance
createArgumentsUsingPairs
in class AbstractPatternInstance
descriptor
- 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
public IStatus createSomeArguments()
AbstractPatternInstance
createSomeArguments
in class AbstractPatternInstance
protected boolean expand()
public IStatus expandPattern(AbstractPatternResult results)
AbstractPatternInstance
expandPattern
in class AbstractPatternInstance
results
- The results of the expanding the pattern.
public final boolean expandPattern(MultiStatus status)
public final Object getBoundElement()
AbstractPatternInstance
getBoundElement
in class AbstractPatternInstance
null
.public AbstractParameterArgument[] getDefaultArguments(IParameterDescriptor parameter)
AbstractPatternInstance
getDefaultArguments
in class AbstractPatternInstance
parameter
- The descriptor of the parameter of the pattern applied
in this instance for which the default arguments are
to be returned.
public final AbstractPatternDefinition getOwningPatternDefinition()
public AbstractParameterArgument[] getParameterArguments(IParameterDescriptor parameter)
AbstractPatternInstance
getParameterArguments
in class AbstractPatternInstance
parameter
- The descriptor of the parameter of the pattern applied
in this instance for which the arguments are to be returned.
public final int getParameterValueCount(AbstractPatternParameter parameter)
parameter
- the parameter determines which values to count
public final Object[] getParameterValues(IParameterDescriptor parameter)
public final IPatternDescriptor getPatternDescriptor()
AbstractPatternInstance
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.
getPatternDescriptor
in class AbstractPatternInstance
public final Object getRepresentation()
public String getRepresentationName()
protected void initialize()
public IStatus reapplyPattern(AbstractPatternResult results)
AbstractPatternInstance
reapplyPattern
in class AbstractPatternInstance
results
- The results of the reapplying the pattern.
public IStatus validToRemoveArgument(IParameterDescriptor parameter, AbstractParameterArgument argument)
AbstractPatternInstance
validToRemoveArgument
in class AbstractPatternInstance
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.
public IStatus removeArgument(IParameterDescriptor descriptor, AbstractParameterArgument argument)
AbstractPatternInstance
removeArgument
in class AbstractPatternInstance
descriptor
- 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.
public IStatus validToRemoveArguments(IParameterDescriptor parameter, AbstractParameterArgument[] arguments)
AbstractPatternInstance
validToRemoveArguments
in class AbstractPatternInstance
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.
public IStatus removeArguments(IParameterDescriptor descriptor, AbstractParameterArgument[] arguments)
AbstractPatternInstance
removeArguments
in class AbstractPatternInstance
descriptor
- 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.
public final boolean removeParameterValue(IParameterDescriptor descriptor, Object value, MultiStatus status)
public final boolean removeParameterValues(IParameterDescriptor descriptor, Object[] values, MultiStatus status)
public boolean removeAllParameterValues(IParameterDescriptor descriptor)
descriptor
- the parameter descriptor identifying the parameter values to
remove
public IStatus validToReplaceArgument(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)
AbstractPatternInstance
validToReplaceArgument
in class AbstractPatternInstance
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.
public IStatus replaceArgument(IParameterDescriptor descriptor, AbstractParameterArgument oldArgument, AbstractParameterArgument newArgument)
AbstractPatternInstance
replaceArgument
in class AbstractPatternInstance
descriptor
- 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.
public IStatus validToReplaceArguments(IParameterDescriptor parameter, AbstractParameterArgument oldArgument, AbstractParameterArgument[] newArguments)
AbstractPatternInstance
validToReplaceArguments
in class AbstractPatternInstance
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.
public IStatus replaceArguments(IParameterDescriptor descriptor, AbstractParameterArgument oldArgument, AbstractParameterArgument[] newArguments)
AbstractPatternInstance
replaceArguments
in class AbstractPatternInstance
descriptor
- 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.
public final boolean resetDefaultParameterValues(IParameterDescriptor descriptor, MultiStatus status)
public final boolean resetDefaultParameterValues(MultiStatus status)
public IStatus unapplyPattern(AbstractPatternResult results)
AbstractPatternInstance
unapplyPattern
in class AbstractPatternInstance
results
- The results of the unapplying the pattern.
protected boolean unapplyPattern(MultiStatus status)
public IStatus validatePattern()
AbstractPatternInstance
validatePattern
in class AbstractPatternInstance
public boolean validatePattern(MultiStatus status)
public final Date getCreationTime()
AbstractPatternInstance
getCreationTime
in class AbstractPatternInstance
public final Date getLastExpansionTime()
AbstractPatternInstance
getLastExpansionTime
in class AbstractPatternInstance
public boolean getTraceabilityEnabled()
AbstractPatternInstance
getTraceabilityEnabled
in class AbstractPatternInstance
true
if traceability is enabled for the application
of the pattern represented by this instance; otherwise, it returns false
.public IStatus setTraceabilityEnabled(boolean enableTraceability)
AbstractPatternInstance
setTraceabilityEnabled
in class AbstractPatternInstance
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.
public boolean getUnapplyRemovesBoundElement()
true
if unapplying the pattern instance will remove
(delete) the bound element for the instance; otherwise, it returns false
.public IStatus setUnapplyRemovesBoundElement(boolean removeBoundElement)
removeBoundElement
- The boolean indication of whether to set removal of the bound element
for this instance when the pattern instance is unapplied.
|
IBM Rational Software Modeler Release 6.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2004. All rights reserved.