com.togethersoft.openapi.sci
Interface SciContainer

All Known Subinterfaces:
SciClass, SciCodeBlock, SciCompoundMember, SciDelegate, SciExpressionList, SciFile, SciInheritanceList, SciJavaImportList, SciNetAttributeSection, SciPackage, SciParameterList, SciScope, SciTagList, SciThrowList

public interface SciContainer

A generic container for the SCI model objects.


The objects() method gives an enumeration of all SciObjects in this container:

SciObjectEnumeration objectsEnum=someContainer.objects();

For example, the objects method in SciClass(extends this interface) returns
an enumeration of SciMembers or inner classes.


This interface has the method paste for pasting the SciObjects, inherited by all of
its derivatives. If you want to paste a copy of an existing SciObject, or SciObject
itself, you can obtain it using
SciObject's methods copy or
cut respectively:


SciFunction copiedFunction = (SciFunction)someSciFunction.copy(); //getting a copy of a function
someSciClass.paste(copiedFunction, null, false); //pasting it into SciClass

If you want to paste a new object, you should first create this object using SciFactory
or SciGenericFactory:

import com.togethersoft.openapi.sci.SciModelAccess;
...
SciAttribute newAttribute = SciModelAccess.getModel().getFactory(SciLanguage.JAVA).newAttribute(); //creating a new attribute with default name and type
newAttribute.setName("myLastName"); //setting the name
newAttribute.getType().setText("String"); //setting the type
someSciClass.paste(newAttribute, null, false); //pasting it into someSciClass

Author:
TogetherSoft
Since: Together 3.0
See Also: SciModel, SciFactory, SciGenericFactory

Method Summary
 booleancanPaste(SciObject object, SciObject anchor, boolean before)
          Returns true if the object can be pasted into this container in the specified place,
false otherwise.
 SciObjectEnumerationobjects()
          Returns an enumeration of all SciObjects in this container
 SciObjectpaste(SciObject object, SciObject anchor, boolean before)
          Pastes the object into this containter.

Method Detail

canPaste

public boolean canPaste(SciObject object, SciObject anchor, boolean before)
Returns true if the object can be pasted into this container in the specified place,
false otherwise. false can be returned either if
the object can't be pasted at all, or if it just can't be pasted in the specified place.
Parameters:
object the SciObject to check whether it can be pasted
anchor the SciObject that the object
will be pasted before or after. If anchor is null, then the object will be pasted
in a valid place chosen by this container.
before The boolean flag. If true, the new object will be
pasted before the anchor. If false, it will be pasted after it. If anchor
is null, then the value of this parameter does not matter.
Returns: true if the object can be pasted, false otherwise

objects

public SciObjectEnumeration objects()
Returns an enumeration of all SciObjects in this container
Returns: an enumeration of all SciObjects in this container

paste

public SciObject paste(SciObject object, SciObject anchor, boolean before)
Pastes the object into this containter.
Parameters:
object the SciObject which needs be to pasted
anchor The SciObject before or after the object
will be pasted. If anchor is null, then the object will be pasted
in a valid place chosen by this container.
before The boolean flag. If true, the new object will be
pasted before the anchor. If false, it will be pasted after it. If anchor
is null, then the value of this parameter does not matter.
Returns: new just pasted object into this container