ModelingProgram
Keywords: uk.ac.ic.doc.automed.reps.ModelingProgram,ModelingProgram class

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

## uk.ac.ic.doc.automed.reps
Class ModelingProgram

    java.lang.Object
      |
      +--uk.ac.ic.doc.automed.reps.ModelingProgram

public class ModelingProgram
extends java.lang.Object

Class representing the graphical representation of a Construct.

See Also:
  `ModelingStatement`, `ConstructWithModelingProgram`, `Construct`

Constructor Summary
`ModelingProgram()` Constructs a new, empty ModelingProgram

Method Summary
`void` | `add(int pc, ModelingStatement stmnt)` Inserts the specified statement at the specified position(program counter) in this program.
`void` | `add(ModelingStatement stmnt)` Appends the specified statement to the end of this ModelingProgram.
`void` | `clear()` Removes all of the statements from this ModelingProgram.
`java.lang.Object` | `clone()` Returns a deep copy of this `ModelingProgram` instance.
`protected static ModelingProgram` | `getModelingProgramByCID(int cid)` Returns the ModelingProgram of a Construct.
`ModelingStatement` | `getModelingStatementAt(int pc)` Returns the statement at the specified program counter in this program.
`ModelingStatement[]` | `getModelingStatements()` Returns an array containing all of the statements in this program in the correct order.
`boolean` | `isEmpty()` Tests if this program is empty.
`void` | `print()`
`ModelingStatement` | `remove(int pc)` Removes the stamement at the specified program counter in this program.
`ModelingStatement` | `set(int pc, ModelingStatement stmnt)` Replaces the statement at the specified program counter in this program with the specified statement.
`int` | `size()` Returns the number of statements in this program.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ModelingProgram

    public ModelingProgram()

  Constructs a new, empty ModelingProgram

Method Detail

### add

    public void add(int pc,
                    ModelingStatement stmnt)
             throws AutoRepException

  Inserts the specified statement at the specified position(program counter) in this program. Shifts the statement currently at that position (if any) and any subsequent statements to the right (adds one to their program counters).

  Parameters:
    `pc` - the program counter in the program
    `stmnt` - the statement to be added
  Throws:
    `AutoRepException` - if pc is out of range `(pc<1 || pc>size())`

### add

    public void add(ModelingStatement stmnt)

  Appends the specified statement to the end of this ModelingProgram.

  Parameters:
    `stmnt` - statement to be appended to this modeling program

### clear

    public void clear()

  Removes all of the statements from this ModelingProgram. The program will be empty after this call returns.

### clone

    public java.lang.Object clone()

  Returns a deep copy of this `ModelingProgram` instance.

  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    a clone of this `ModelingProgram` instance.

### getModelingStatementAt

    public ModelingStatement getModelingStatementAt(int pc)
                                             throws AutoRepException

  Returns the statement at the specified program counter in this program.

  Parameters:
    `pc` - program counter of statement to return
  Returns:
    the statement at the specified program counter in this program.
  Throws:
    `AutoRepException` - if pc is out of range `(pc<1 || pc>size())`

### isEmpty

    public boolean isEmpty()

  Tests if this program is empty.

  Returns:
    `true` if this program has no statements; `false` otherwise.

### remove

    public ModelingStatement remove(int pc)
                             throws AutoRepException

  Removes the stamement at the specified program counter in this program. Shifts any subsequent statements to the left (subtracts one from their program counters).

  Parameters:
    `pc` - the progam counter of the statement to removed
  Returns:
    the statement that was removed from the program.
  Throws:
    `AutoRepException` - if pc is out of range `(pc<1 || pc>size())`

### set

    public ModelingStatement set(int pc,
                                 ModelingStatement stmnt)
                          throws AutoRepException

  Replaces the statement at the specified program counter in this program with the specified statement.

  Parameters:
    `pc` - program counter of statement to replace
    `stmnt` - statement to be stored at the specified program counter.
  Returns:
    the statement previously at the specified position.
  Throws:
    `AutoRepException` - if pc is out of range `(pc<1 || pc>size())`

### size

    public int size()

  Returns the number of statements in this program.

  Returns:
    the number of statements in this program.

### getModelingStatements

    public ModelingStatement[] getModelingStatements()

  Returns an array containing all of the statements in this program in the correct order.

  Returns:
    an array containing all of the statements in this program in the correct order.

### getModelingProgramByCID

    protected static ModelingProgram getModelingProgramByCID(int cid)
                                                      throws AutoRepException,
                                                             SchemaModelingRepositoryException,
                                                             RepositoryAccessException

  Returns the ModelingProgram of a Construct.

  Parameters:
    `cid` - ID of the Construct
  Returns:
    the ModelingProgram of a Construct, `null` if the Construct doesn't have a graphical representation
  Throws:
    `RepositoryAccessException` - if the repositories cannot be accessed
    `AutoRepException`
    `SchemaModelingRepositoryException`

### print

    public void print()

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