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 SciContainer

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

public interface SciContainer

A generic container for the SCI model objects.

The `objects()` method gives an enumeration of all `SciObject`s 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 method `paste` for pasting the `SciObject`s, inherited by all of its derivatives. If you wish to paste a copy of existing `SciObject`, or `SciObject` itself, you can obtian 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 wish 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
See Also: SciModel, SciFactory, SciGenericFactory

Method Summary
`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.
`SciObjectEnumeration` | `objects()` Returns an enumeration of all `SciObject`s in this container
`SciObject` | `paste(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 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` before or after the `objecet` will be pasted. If `anchor` is `null`, then the object will be pasted in the valid place choosen by this container.
    before - The boolean flag. If `true`, then new object will be pasted befor the `anchor`. If `false` - after. 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 `SciObject`s in this container
  Returns: an enumeration of all `SciObject`s 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 the valid place choosen by this container.
    before - The boolean flag. If `true`, then new object will be pasted before the `anchor`. If `false` - after. If `anchor` is `null`, then the value of this parameter does not matter.
  Returns: new just pasted object into this container

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