예제 #1
0
 /**
  * Construct an actor with the specified container and name.
  *
  * @param container The container.
  * @param name The name of this actor.
  * @exception IllegalActionException If the entity cannot be contained by the proposed container.
  * @exception NameDuplicationException If the container already has an actor with this name.
  */
 public PoissonClock(CompositeEntity container, String name)
     throws NameDuplicationException, IllegalActionException {
   super(container, name);
   meanTime = new Parameter(this, "meanTime");
   meanTime.setExpression("1.0");
   meanTime.setTypeEquals(BaseType.DOUBLE);
   values = new Parameter(this, "values");
   values.setExpression("{1, 0}");
   output.setTypeAtLeast(ArrayType.elementType(values));
   attributeChanged(values);
   fireAtStart = new Parameter(this, "fireAtStart");
   fireAtStart.setExpression("true");
   fireAtStart.setTypeEquals(BaseType.BOOLEAN);
   stopTime = new Parameter(this, "stopTime");
   stopTime.setExpression("Infinity");
   stopTime.setTypeEquals(BaseType.DOUBLE);
   _attachText(
       "_iconDescription",
       "<svg>\n"
           + "<rect x=\"-20\" y=\"-20\" "
           + "width=\"40\" height=\"40\" "
           + "style=\"fill:lightGrey\"/>\n"
           + "<circle cx=\"0\" cy=\"0\" r=\"17\""
           + "style=\"fill:white\"/>\n"
           + "<line x1=\"0\" y1=\"-15\" x2=\"0\" y2=\"-13\"/>\n"
           + "<line x1=\"0\" y1=\"14\" x2=\"0\" y2=\"16\"/>\n"
           + "<line x1=\"-15\" y1=\"0\" x2=\"-13\" y2=\"0\"/>\n"
           + "<line x1=\"14\" y1=\"0\" x2=\"16\" y2=\"0\"/>\n"
           + "<line x1=\"0\" y1=\"-8\" x2=\"0\" y2=\"0\"/>\n"
           + "<line x1=\"0\" y1=\"0\" x2=\"11.26\" y2=\"-6.5\"/>\n"
           + "</svg>\n");
 }
예제 #2
0
 /**
  * Clone the actor into the specified workspace. This calls the base class and then creates new
  * ports and parameters.
  *
  * @param workspace The workspace for the new object.
  * @return A new actor.
  * @exception CloneNotSupportedException If a derived class contains an attribute that cannot be
  *     cloned.
  */
 public Object clone(Workspace workspace) throws CloneNotSupportedException {
   ArrayToSequence newObject = (ArrayToSequence) super.clone(workspace);
   try {
     newObject.output.setTypeAtLeast(ArrayType.elementType(newObject.input));
   } catch (IllegalActionException e) {
     throw new InternalErrorException(e);
   }
   return newObject;
 }
예제 #3
0
 /**
  * Clone the actor into the specified workspace. This calls the base class and then sets the
  * parameter public members to refer to the parameters of the new actor.
  *
  * @param workspace The workspace for the new object.
  * @return A new actor.
  * @exception CloneNotSupportedException If a derived class contains an attribute that cannot be
  *     cloned.
  */
 @Override
 public Object clone(Workspace workspace) throws CloneNotSupportedException {
   PoissonClock newObject = (PoissonClock) super.clone(workspace);
   try {
     newObject.output.setTypeAtLeast(ArrayType.elementType(newObject.values));
   } catch (IllegalActionException e) {
     throw new InternalErrorException(e);
   }
   return newObject;
 }
예제 #4
0
  /**
   * Clone the actor into the specified workspace. This calls the base class and then sets up the
   * type constraints.
   *
   * @param workspace The workspace for the new object.
   * @return A new actor.
   * @exception CloneNotSupportedException If a derived class contains an attribute that cannot be
   *     cloned.
   */
  public Object clone(Workspace workspace) throws CloneNotSupportedException {
    LookupTable newObject = (LookupTable) (super.clone(workspace));

    try {
      newObject.output.setTypeAtLeast(ArrayType.elementType(newObject.table));
    } catch (IllegalActionException e) {
      // Should have been caught before this.
      throw new InternalErrorException(e);
    }
    return newObject;
  }
예제 #5
0
  /**
   * Construct an actor with the given container and name.
   *
   * @param container The container.
   * @param name The name of this actor.
   * @exception IllegalActionException If the actor cannot be contained by the proposed container.
   * @exception NameDuplicationException If the container already has an actor with this name.
   */
  public LookupTable(CompositeEntity container, String name)
      throws NameDuplicationException, IllegalActionException {
    super(container, name);

    // Set parameters.
    table = new Parameter(this, "table");
    table.setExpression("{0, 1}");

    // Set type constraints.
    input.setTypeEquals(BaseType.INT);
    output.setTypeAtLeast(ArrayType.elementType(table));
  }
예제 #6
0
  /**
   * Override the base class to set the type constraints.
   *
   * @param workspace The workspace for the cloned object.
   * @exception CloneNotSupportedException If cloned ports cannot have as their container the cloned
   *     entity (this should not occur), or if one of the attributes cannot be cloned.
   * @return A new ResourcePool actor.
   */
  public Object clone(Workspace workspace) throws CloneNotSupportedException {
    ResourcePool newObject = (ResourcePool) super.clone(workspace);
    // set type constraints.
    try {
      newObject.grant.setTypeAtLeast(ArrayType.elementType(newObject.initialPool));
    } catch (IllegalActionException e) {
      throw new InternalErrorException(e);
    }
    newObject.grant.setTypeAtLeast(newObject.release);

    return newObject;
  }
예제 #7
0
  /**
   * Construct an actor with the given container and name.
   *
   * @param container The container.
   * @param name The name of this actor.
   * @exception IllegalActionException If the actor cannot be contained by the proposed container.
   * @exception NameDuplicationException If the container already has an actor with this name.
   */
  public SampleDelay(CompositeEntity container, String name)
      throws IllegalActionException, NameDuplicationException {
    super(container, name);

    initialOutputs = new Parameter(this, "initialOutputs");
    initialOutputs.setExpression("{0}");

    output_tokenInitProduction.setExpression("initialOutputs.length()");

    // set type constraints.
    output.setTypeAtLeast(ArrayType.elementType(initialOutputs));
    output.setTypeAtLeast(input);
  }
예제 #8
0
  /**
   * Clone the actor into the specified workspace. This calls the base class and then resets the
   * type constraints.
   *
   * @param workspace The workspace for the new object.
   * @return A new actor.
   * @exception CloneNotSupportedException If a derived class contains an attribute that cannot be
   *     cloned.
   */
  public Object clone(Workspace workspace) throws CloneNotSupportedException {
    SampleDelay newObject = (SampleDelay) (super.clone(workspace));

    // set the type constraints
    try {
      newObject.output.setTypeAtLeast(ArrayType.elementType(newObject.initialOutputs));
    } catch (IllegalActionException e) {
      throw new InternalErrorException(e);
    }
    newObject.output.setTypeAtLeast(newObject.input);

    return newObject;
  }
예제 #9
0
  /**
   * Construct an actor in the specified container with the specified name. The name must be unique
   * within the container or an exception is thrown. The container argument must not be null, or a
   * NullPointerException will be thrown.
   *
   * @param container The container.
   * @param name The name.
   * @exception IllegalActionException If the actor cannot be contained by the proposed container.
   * @exception NameDuplicationException If the name coincides with an actor already in the
   *     container.
   */
  public ResourcePool(CompositeEntity container, String name)
      throws IllegalActionException, NameDuplicationException {
    super(container, name);

    grant = new TypedIOPort(this, "grant", false, true);
    grant.setMultiport(true);

    release = new TypedIOPort(this, "release", true, false);
    release.setMultiport(true);

    initialPool = new Parameter(this, "initialPool");
    initialPool.setExpression("{1}");

    // Set type constraints.
    grant.setTypeAtLeast(ArrayType.elementType(initialPool));
    grant.setTypeAtLeast(release);
  }
예제 #10
0
파일: Sequence.java 프로젝트: blickly/ptii
  /**
   * Construct an actor in the specified container with the specified name.
   *
   * @param container The container.
   * @param name The name of this actor within the container.
   * @exception IllegalActionException If the actor cannot be contained by the proposed container.
   * @exception NameDuplicationException If the name coincides with an actor already in the
   *     container.
   */
  public Sequence(CompositeEntity container, String name)
      throws IllegalActionException, NameDuplicationException {
    super(container, name);

    // set values parameter
    values = new Parameter(this, "values");
    values.setExpression("{1}");

    // Set the Repeat Flag.
    repeat = new Parameter(this, "repeat", BooleanToken.FALSE);
    repeat.setTypeEquals(BaseType.BOOLEAN);

    holdLastOutput = new Parameter(this, "holdLastOutput", BooleanToken.FALSE);
    holdLastOutput.setTypeEquals(BaseType.BOOLEAN);

    enable = new TypedIOPort(this, "enable", true, false);
    enable.setTypeEquals(BaseType.BOOLEAN);

    output = new TypedIOPort(this, "output", false, true);

    // set type constraint
    output.setTypeAtLeast(ArrayType.elementType(values));
  }
예제 #11
0
  /**
   * Construct an actor with the given container and name.
   *
   * @param container The container.
   * @param name The name of this actor.
   * @exception IllegalActionException If the actor cannot be contained by the proposed container.
   * @exception NameDuplicationException If the container already has an actor with this name.
   */
  public ArrayToSequence(CompositeEntity container, String name)
      throws NameDuplicationException, IllegalActionException {
    super(container, name);

    // Set type constraints.
    output.setTypeAtLeast(ArrayType.elementType(input));

    // Set parameters.
    arrayLength = new Parameter(this, "arrayLength");
    arrayLength.setExpression("1");
    enforceArrayLength = new Parameter(this, "enforceArrayLength");
    enforceArrayLength.setExpression("true");
    enforceArrayLength.setTypeEquals(BaseType.BOOLEAN);

    output_tokenProductionRate.setExpression("arrayLength");

    // Set the icon.
    _attachText(
        "_iconDescription",
        "<svg>\n"
            + "<polygon points=\"-15,-15 15,15 15,-15 -15,15\" "
            + "style=\"fill:white\"/>\n"
            + "</svg>\n");
  }