com.togethersoft.openapi.sci
Interface SciObject

All Known Subinterfaces:
SciAccessor, SciAssertStatement, SciAssignmentExpression, SciAttribute, SciCaseStatement, SciCatchBlockStatement, SciClass, SciCodeBlock, SciComment, SciCompoundMember, SciCompoundStatement, SciConstantExpression, SciDeclarationStatement, SciDelegate, SciDirectInitExpression, SciElement, SciEventHandlingStatement, SciExpression, SciExpressionListStatement, SciExpressionStatement, SciFile, SciFunction, SciFunctionCallExpression, SciIfStatement, SciInheritance, SciInitializer, SciJavaImport, SciLoopStatement, SciMember, SciMemberAccessExpression, SciMemberDefinition, SciNetAttribute, SciNetAttributeSection, SciNewExpression, SciOperation, SciPackage, SciParameter, SciParametrizedCompoundStatement, 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
Since: Together 3.0

Method Summary
 booleancanCut()
          Checks whether it is possible to cut this SciObject.
 booleancanDelete()
          Checks whether it is possible to delete this SciObject.
 booleancanReplace(SciObject newObject)
          Checks whether it is possible to replace this SciObject with the specified
SciObject.
 SciObjectcopy()
          Copies this SciObject.
 SciObjectcut()
          Cuts this SciObject.
 voiddelete()
          Deletes this SciObject.
 SciFilegetContainingFile()
          Returns an SciFile object this object is contained in.
 SciScopegetContainingScope()
          Returns a containing scope for this object.
 StringgetLanguage()
          Returns a string with the name of the source code language for this object.
 SciTextPositionsgetPositions()
          Returns SciTextPositions instance, which contains the start and the end offsets
of the text of this object in the file.
 StringgetText()
          Returns a string with object's source code.
 ObjectgetUserProperty(Object key)
          Returns the value to which the specified key is mapped in this SciObject.
 booleanisReadOnly()
          Returns true if this object is read-only, false otherwise.
 SciObjectreplace(SciObject newObject)
          Replaces this SciObject with the specified SciObject.
 voidsetUserProperty(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 SciFiles, SciCodeBlocks,
and SciClasses.
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 that has 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