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.sci
Interface SciObject

All Known Subinterfaces:
  SciAssignmentExpression, SciAttribute, SciCaseStatement, SciCatchBlockStatement, SciClass, SciCodeBlock, SciCompoundStatement, SciConstantExpression, SciDeclarationStatement, SciElement, SciExpression, SciExpressionStatement, SciFile, SciFunction, SciFunctionCallExpression, SciIfStatement, SciInheritance, SciInitializer, SciJavaImport, SciLoopStatement, SciMember, SciMemberAccessExpression, SciMemberDefinition, SciNewExpression, SciOperation, SciPackage, SciParameter, SciReference, SciReferenceExpression, SciReturnStatement, SciScope, SciStatement, SciSwitchStatement, SciTag, SciThrowSpecifier, SciThrowStatement, SciTryStatement, SciType, SciTypeCastExpression, SciTypeExpression, SciVariable

public interface SciObject

A generic source code-based model's element.

It defines the functionality shared by all SCI objects.

`SciObject` can be copied, cut, replaced, or deleted. Methods `copy`, `cut`, and `replace` return `SciObject` which can be pasted later into `SciContainer` using the SciContainer.paste method.

It is possible to get the file containing this `SciObject` through the `getContainingFile` method.

It is also possible to store any `Object` instance within this `SciObject` using the `setUserProperty` method. Given a key, the associated element can be looked up using the `getUserProperty` method.

Author:
  TogetherSoft

Method Summary
`boolean` | `canCut()` Checks whether it is possible to cut this `SciObject`.
`boolean` | `canDelete()` Checks whether it is possible to delete this `SciObject`.
`boolean` | `canReplace(SciObject newObject)` Checks whether it is possible to replace this `SciObject` with the specified `SciObject`.
`SciObject` | `copy()` Copies this `SciObject`.
`SciObject` | `cut()` Cuts this `SciObject`.
`void` | `delete()` Deletes this `SciObject`.
`SciFile` | `getContainingFile()` Returns an `SciFile` object this object is contained in.
`SciScope` | `getContainingScope()` Returns a containing scope for this object.
`String` | `getLanguage()` Returns a string with the name of the source code language for this object.
`SciTextPositions` | `getPositions()` Returns `SciTextPositions` instance, which contains the start and the end offsets of the text of this object in the file.
`String` | `getText()` Returns a string with object's source code.
`Object` | `getUserProperty(Object key)` Returns the value to which the specified key is mapped in this `SciObject`.
`boolean` | `isReadOnly()` Returns `true` if this object is read-only, `false` otherwise.
`SciObject` | `replace(SciObject newObject)` Replaces this `SciObject` with the specified `SciObject`.
`void` | `setUserProperty(Object key, Object value)` Maps the specified key to the specified value in this `SciObject`.

Method Detail

### canCut

    public boolean canCut()

  Checks whether it is possible to cut this `SciObject`.
  Returns: `true` if it can be cut, `false` otherwise
  See Also:
    cut(), copy(), delete()

### canDelete

    public boolean canDelete()

  Checks whether it is possible to delete this `SciObject`.
  Parameters:
    `true` - if it is possible to delete this `SciObject`, `false` otherwise

### canReplace

    public boolean canReplace(SciObject newObject)

  Checks whether it is possible to replace this `SciObject` with the specified `SciObject`.
  Parameters:
    newObject - the `SciObject` which needs to be placed instead of this `SciObject`
  Returns: `true` if this `SciObject` can be replaced, `false` otherwise

### copy

    public SciObject copy()

  Copies this `SciObject`. It can be pasted into some container later.
  Returns: the copy of `SciObject`
  See Also:
    SciContainer.paste(com.togethersoft.openapi.sci.SciObject,com.togethersoft.openapi.sci.SciObject,boolean), cut(), delete(), replace(com.togethersoft.openapi.sci.SciObject)

### cut

    public SciObject cut()

  Cuts this `SciObject`. It can be pasted into some container later.
  Returns: just cut `SciObject`
  See Also:
    SciContainer.paste(com.togethersoft.openapi.sci.SciObject,com.togethersoft.openapi.sci.SciObject,boolean), copy(), delete(), replace(com.togethersoft.openapi.sci.SciObject)

### delete

    public void delete()

  Deletes this `SciObject`. Note that this method doesn't return the deleted object (`cut` method does).
  See Also:
    cut(), copy(), replace(com.togethersoft.openapi.sci.SciObject)

### getContainingFile

    public SciFile getContainingFile()

  Returns an `SciFile` object this object is contained in. For files and packages returns `null`.
  Returns: an `SciFile` object this object is contained in
  See Also:
    SciFile

### getContainingScope

    public SciScope getContainingScope()

  Returns a containing scope for this object. Scopes are `SciFile`s, `SciCodeBlock`s, and `SciClass`es. For files and packages returns `null`.
  Returns: a containing scope for this object.
  See Also:
    SciScope

### getLanguage

    public String getLanguage()

  Returns a string with the name of the source code language for this object.
  Returns: a string with the name of the source code language for this object
  See Also:
    SciLanguage

### getPositions

    public SciTextPositions getPositions()

  Returns `SciTextPositions` instance, which contains the start and the end offsets of the text of this object in the file. For files and packages returns `null`.
  Returns: `SciTextPositions` instance
  See Also:
    getText(), getContainingFile(), SciTextPositions

### getText

    public String getText()

  Returns a string with object's source code. This text is taken from source code file from the start to the end offsets which can be obtained using the `getPositions` method. For files and packages returns `null`.
  Returns: a string with object's source code
  See Also:
    getPositions()

### getUserProperty

    public Object getUserProperty(Object key)

  Returns the value to which the specified key is mapped in this `SciObject`.
  Parameters:
    key - the key object
  Returns: the value to which the key is mapped in this `SciObject`; `null` if the key is not mapped to any value in this `SciObject`

### isReadOnly

    public boolean isReadOnly()

  Returns `true` if this object is read-only, `false` otherwise.
  Parameters:
    `true` - if this object is read-only, `false` otherwise

### replace

    public SciObject replace(SciObject newObject)

  Replaces this `SciObject` with the specified `SciObject`.
  Parameters:
    newObject - the `SciObject` which needs to be placed instead of this `SciObject`
  Returns: the new `SciObject` have been placed instead of this `SciObject`
  See Also:
    cut(), copy(), delete()

### setUserProperty

    public void setUserProperty(Object key, Object value)

  Maps the specified key to the specified value in this `SciObject`. If the value is `null` then the property with the specified key will be deleted from this `SciObject`.
  Parameters:
    key - The key object. Cannot be `null`.
    value - the value

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