| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
RwiElement is the generic representative of a model's part (package, node,
member, diagram and link). Each element has a set of properties, access to which can be obtained
via methods inherited from RwiPropertyMap.
RwiElement can be linked to other elements using RwiLinks. Enumeration of
outgoing links from this element is returned by outgoingLinks method.
Every RwiElement can produce a copy of itself which can be pasted later into
any RwiContainer. Also it is possible to cut or delete RwiElement from
its container:
RwiElement justCopiedMember=someRwiMemberToBeCopied.copy();
RwiElement justCutMember=someRwiMemberToBeCut.cut();
someRwiElementToBeDeleted.delete();
rwiNodeOne.paste(jusCopiedMember,null,true);
rwiNodeTwo.paste(justCutMember,null,true);
Every RwiElement's derivative inherits the accept(RwiVisitor) method which
runs visitor's visitXXX method corresponding to the kind of the element.
RwiElement and its derivatives provide two different methods for creating new RwiElements:
createXXX and createXXXByPattern (for example,
createOutgoingLink and
createOutgoingLinkByPattern). The difference between them is
that only createXXXByPattern method should be used for generation new source code-represented
elements (like classes, attributes etc.) or changes that affect the syntax constructions in the
source code (like adding extends or implements keywords).
For example, let's suppose myNodeForClass represents the following class:
public class MyClass {
}
and myNodeForInterface represents the following interface:
public interface MyInterface {
}
Now, the execution of
myNodeForClass.createOutgoingLink(RwiShapeType.IMPLEMENTATION, myNodeForInterface);
will make the following changes in MyClass:
public class MyClass {
/**
* @shapeType ImplementationLink
*/
/*# private MyInterface attribute1; */
}
Note, that this just created a PURE element, but MyClass still doesn't
implement MyInterface.
The execution of
myNodeForClass.createOutgoingLinkByPattern(RwiPattern.DEFAULT_IMPLEMENTATIONLINK, myNodeForInterface);
will make the following changes in MyClass:
public class MyClass implements MyInterface{
}| Method Summary | |
Object | accept(RwiVisitor visitor)"Accepts" a visitor, calling up its visitXXX method corresponding to the kind of the element. |
boolean | canCreateIncomingLink(String shapeType)Checks whether it is possible to create an incoming link to this element |
boolean | canCreateOutgoingLink(String shapeType, RwiElement destination)Checks whether it is possible to create an outgoing link from this element to the specified RwiElement. |
boolean | canCreateOutgoingLink(String shapeType)Checks whether it is possible to create an outgoing link from this element |
boolean | canCreateOutgoingLinkByPattern(String patternName, RwiElement destination)Checks whether it is possible to create an outgoing link using a specific pattern. |
boolean | canCut()Checks whether this elements can be cut. |
boolean | canDelete()Checks whether it is possible to delete this element. |
Enumeration | codeElements()Returns an enumeration of the low-level API objects representing this RwiElement. |
RwiElement | copy()Creates a copy of this element. |
RwiLink | createOutgoingLink(String shapeType, RwiElement destination)Creates an outgoing link type from this element to the specified RwiElement. |
RwiLink | createOutgoingLinkByPattern(String patternName, RwiElement destination)Creates an outgoing link using specific pattern. |
RwiElement | cut()Cuts this element from its containter for later use. |
void | delete()Deletes this element. |
Object | getCodeElement()Returns single a low-level API object representing this RwiElement. |
long | getTimeStamp() |
String | getUniqueName()Returns a string containing the unique name for this element. |
boolean | isDeleted() |
RwiLinkEnumeration | outgoingLinks()Returns enumeration of outgoing links from this element. |
| Methods inherited from interface com.togethersoft.openapi.rwi.RwiPropertyMap |
addProperty, canAddProperty, canSetProperty, canSetProperty, getProperty, hasProperty, isPropertyReadable, isPropertyWritable, properties, properties, setProperty, setProperty |
| Method Detail |
public Object accept(RwiVisitor visitor)
visitXXX method corresponding to the kind of the element.
For example, this will run visitNode method in someRwiVisitor for a node someRwiNode:
someRwiNode.accept(someRwiVisitor);
RwiVisitor type visitorpublic boolean canCreateIncomingLink(String shapeType)
true if it is possible to create an incoming link to this element,
false otherwisepublic boolean canCreateOutgoingLink(String shapeType, RwiElement destination)
RwiElement.RwiElement which will be a destination for the linktrue if it is possible to create an outgoing link from this element to the specified
RwiElement, false otherwisepublic boolean canCreateOutgoingLink(String shapeType)
true if it is possible to create an outgoing link from this element,
false otherwisepublic boolean canCreateOutgoingLinkByPattern(String patternName, RwiElement destination)
RwiPattern interface.RwiElement which will be a destination for the linktrue if the link can be created, false otherwisepublic boolean canCut()
true if this element can be cut, false otherwisepublic boolean canDelete()
true if it can be deleted, false otherwisepublic Enumeration codeElements()
RwiElement.
Normally, this method is used only when you want to use SCI API.
It is possible by given enumeration of SCI objects to find RwiElement being represented by them.
public RwiElement copy()
public RwiLink createOutgoingLink(String shapeType, RwiElement destination)
RwiElement.RwiElement which will be a destination for the linkpublic RwiLink createOutgoingLinkByPattern(String patternName, RwiElement destination)
RwiPattern interface.RwiElement which will be a destination for the linkpublic RwiElement cut()
public void delete()
public Object getCodeElement()
RwiElement.
Normally, this method is used only when you want to use SCI API. This method
returns the following SCI ojbects:
RwiPackages representing directories, this method returns com.togethersoft.openapi.sci.SciPackage object.
RwiNodes representing classes, this method returns com.togethersoft.openapi.sci.SciClass object.
RwiMembers representing attributes, this method returns com.togethersoft.openapi.sci.SciAttribute object.
RwiMembers representing operations, this method returns com.togethersoft.openapi.sci.SciOperation object.
RwiLinks which are represented by the source code-based elements, this method returns com.togethersoft.openapi.sci.SciMember
or com.togethersoft.openapi.sci.SciInheritance object.
RwiElement being represented by it.public long getTimeStamp()
public String getUniqueName()
RwiModel.findElement method to find the element by this
information.public boolean isDeleted()
public RwiLinkEnumeration outgoingLinks()
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||