Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.togethersoft.openapi.rwi
Interface RwiElement

All Known Subinterfaces:
  RwiContainer, RwiDiagram, RwiLink, RwiMember, RwiNode, RwiPackage

public interface RwiElement
extends RwiPropertyMap

`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 `RwiLink`s. 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{
     }

Author:
  TogetherSoft
See Also: accept(com.togethersoft.openapi.rwi.RwiVisitor), RwiVisitor

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

### accept

    public Object accept(RwiVisitor visitor)

  "Accepts" a visitor, calling up its `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);

  Parameters:
    visitor - the `RwiVisitor` type visitor
  Returns: the object returned by visitor.
  See Also:
    RwiVisitor

### canCreateIncomingLink

    public boolean canCreateIncomingLink(String shapeType)

  Checks whether it is possible to create an incoming link to this element
  Parameters:
    shapeType - the string which characterizes the type of the link
  Returns: `true` if it is possible to create an incoming link to this element, `false` otherwise

### canCreateOutgoingLink

    public boolean canCreateOutgoingLink(String shapeType, RwiElement destination)

  Checks whether it is possible to create an outgoing link from this element to the specified `RwiElement`.
  Parameters:
    shapeType - the string which characterizes the type of the link
    destination - the `RwiElement` which will be a destination for the link
  Returns: `true` if it is possible to create an outgoing link from this element to the specified `RwiElement`, `false` otherwise
  See Also:
    RwiShapeType

### canCreateOutgoingLink

    public boolean canCreateOutgoingLink(String shapeType)

  Checks whether it is possible to create an outgoing link from this element
  Parameters:
    shapeType - the string which characterizes the type of the link
  Returns: `true` if it is possible to create an outgoing link from this element, `false` otherwise

### canCreateOutgoingLinkByPattern

    public boolean canCreateOutgoingLinkByPattern(String patternName, RwiElement destination)

  Checks whether it is possible to create an outgoing link using a specific pattern.
  Parameters:
    patternName - string with the name of the pattern which is performed on this link after it has been created Some pattern names are defined in the `RwiPattern` interface.
    destination - the `RwiElement` which will be a destination for the link
  Returns: `true` if the link can be created, `false` otherwise
  See Also:
    RwiPattern

### canCut

    public boolean canCut()

  Checks whether this elements can be cut.
  Returns: `true` if this element can be cut, `false` otherwise

### canDelete

    public boolean canDelete()

  Checks whether it is possible to delete this element.
  Returns: `true` if it can be deleted, `false` otherwise

### codeElements

    public Enumeration codeElements()

  Returns an enumeration of the low-level API objects representing this `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.

  See Also:
    RwiModel.findMember(java.util.Enumeration), RwiModel.findLink(java.util.Enumeration)

### copy

    public RwiElement copy()

  Creates a copy of this element. It can be pasted later into some container.
  Returns: a copy of this element
  See Also:
    RwiContainer.paste(com.togethersoft.openapi.rwi.RwiElement,com.togethersoft.openapi.rwi.RwiElement,boolean), cut()

### createOutgoingLink

    public RwiLink createOutgoingLink(String shapeType, RwiElement destination)

  Creates an outgoing link type from this element to the specified `RwiElement`.
  Parameters:
    shapeType - the string which characterizes the type of the link
    destination - the `RwiElement` which will be a destination for the link
  Returns: new just created link
  See Also:
    RwiShapeType

### createOutgoingLinkByPattern

    public RwiLink createOutgoingLinkByPattern(String patternName, RwiElement destination)

  Creates an outgoing link using specific pattern.
  Parameters:
    patternName - string with the name of the pattern which is performed on this link after it has been created. Some pattern names are defined in the `RwiPattern` interface.
    destination - the `RwiElement` which will be a destination for the link
  Returns: new just created link
  See Also:
    RwiPattern

### cut

    public RwiElement cut()

  Cuts this element from its containter for later use. It can be pasted later into another container.
  Returns: the copy of just cut element
  See Also:
    RwiContainer.paste(com.togethersoft.openapi.rwi.RwiElement,com.togethersoft.openapi.rwi.RwiElement,boolean), delete(), copy()

### delete

    public void delete()

  Deletes this element. Note that this method doesn't return a deleted element.
  See Also:
    cut()

### getCodeElement

    public Object getCodeElement()

  Returns single a low-level API object representing this `RwiElement`. Normally, this method is used only when you want to use SCI API. This method returns the following SCI ojbects:
  - For `RwiPackage`s representing directories, this method returns com.togethersoft.openapi.sci.SciPackage object.
  - For `RwiNode`s representing classes, this method returns com.togethersoft.openapi.sci.SciClass object.
  - For `RwiMember`s representing attributes, this method returns com.togethersoft.openapi.sci.SciAttribute object.
  - For `RwiMember`s representing operations, this method returns com.togethersoft.openapi.sci.SciOperation object.
  - For `RwiLink`s which are represented by the source code-based elements, this method returns com.togethersoft.openapi.sci.SciMember or com.togethersoft.openapi.sci.SciInheritance object.
  It is possible by given SCI object to find `RwiElement` being represented by it.
  See Also:
    RwiModel.findPackage(java.lang.Object), RwiModel.findNode(java.lang.Object), RwiModel.findMember(java.lang.Object), RwiModel.findLink(java.lang.Object)

### getTimeStamp

    public long getTimeStamp()

### getUniqueName

    public String getUniqueName()

  Returns a string containing the unique name for this element. This unique name can be used in `RwiModel.findElement` method to find the element by this information.
  Returns: the string containing unique name in the model for this element.
  See Also:
    RwiModel.findElement(java.lang.String), RwiDiagram.findReference(com.togethersoft.openapi.rwi.RwiElement), RwiProperty.UNIQUE_NAME

### isDeleted

    public boolean isDeleted()

### outgoingLinks

    public RwiLinkEnumeration outgoingLinks()

  Returns enumeration of outgoing links from this element.
  Returns: enumeration of outgoing links from this element

Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD