Exemple #1
0
  /**
   * Create a new icon with the given name in the given container. The container is required to
   * implement Settable, or an exception will be thrown.
   *
   * @param container The container for this attribute.
   * @param name The name of this attribute.
   * @exception IllegalActionException If thrown by the parent class or while setting an attribute
   * @exception NameDuplicationException If the name coincides with an attribute already in the
   *     container.
   */
  public TableIcon(NamedObj container, String name)
      throws NameDuplicationException, IllegalActionException {
    super(container, name);

    variableName = new StringParameter(this, "variableName");

    boxColor = new ColorAttribute(this, "boxColor");
    boxColor.setExpression("{1.0, 1.0, 1.0, 1.0}");

    Variable UNBOUNDED = new Variable(this, "UNBOUNDED");
    UNBOUNDED.setVisibility(Settable.NONE);
    UNBOUNDED.setExpression("0");

    maxRows = new Parameter(this, "maxRows");
    maxRows.setTypeEquals(BaseType.INT);
    maxRows.setExpression("UNBOUNDED");

    Variable ALL = new Variable(this, "ALL");
    ALL.setVisibility(Settable.NONE);
    Token emptyStringArray = new ArrayToken(BaseType.STRING);
    ALL.setToken(emptyStringArray);

    fields = new Parameter(this, "fields");
    fields.setTypeEquals(new ArrayType(BaseType.STRING));
    fields.setExpression("ALL");

    colorKey = new StringParameter(this, "colorKey");
  }
Exemple #2
0
  private void _inferFiringCounts(SymbolicScheduleElement element, String expression)
      throws IllegalActionException, NameDuplicationException {
    String recursiveExpression;

    if (expression == null) {
      recursiveExpression = element.expression();
    } else {
      recursiveExpression = expression + "*" + element.expression();
    }

    if (element instanceof SymbolicFiring) {
      SymbolicFiring firing = (SymbolicFiring) element;
      Entity actor = (Entity) firing.getActor();
      Variable parameter = (Variable) actor.getAttribute("firingsPerIteration");

      if (parameter == null) {
        parameter = new Parameter(actor, "firingsPerIteration");
        parameter.setVisibility(Settable.NOT_EDITABLE);
        parameter.setPersistent(false);
      }

      parameter.setExpression(recursiveExpression);
    } else if (element instanceof SymbolicSchedule) {
      SymbolicSchedule schedule = (SymbolicSchedule) element;

      for (Iterator i = schedule.iterator(); i.hasNext(); ) {
        _inferFiringCounts((SymbolicScheduleElement) i.next(), recursiveExpression);
      }
    } else {
      throw new RuntimeException("Unexpected Schedule Element");
    }
  }
Exemple #3
0
  /**
   * Construct an event with the given name contained by the specified composite entity. The
   * container argument must not be null, or a NullPointerException will be thrown. This event will
   * use the workspace of the container for synchronization and version counts. If the name argument
   * is null, then the name is set to the empty string. Increment the version of the workspace. This
   * constructor write-synchronizes on the workspace.
   *
   * @param container The container.
   * @param name The name of the state.
   * @exception IllegalActionException If the state cannot be contained by the proposed container.
   * @exception NameDuplicationException If the name coincides with that of an entity already in the
   *     container.
   */
  public ListDirectory(CompositeEntity container, String name)
      throws IllegalActionException, NameDuplicationException {
    super(container, name);

    directory = new FileParameter(this, "directory");
    directory.setExpression(".");
    Parameter allowFiles = new Parameter(directory, "allowFiles");
    allowFiles.setTypeEquals(BaseType.BOOLEAN);
    allowFiles.setToken(BooleanToken.FALSE);
    Parameter allowDirectories = new Parameter(directory, "allowDirectories");
    allowDirectories.setTypeEquals(BaseType.BOOLEAN);
    allowDirectories.setToken(BooleanToken.TRUE);

    filter = new StringParameter(this, "filter");
    filter.setExpression("*.xml");

    includeFiles = new Parameter(this, "includeFiles");
    includeFiles.setTypeEquals(BaseType.BOOLEAN);
    includeFiles.setExpression("true");

    includeDirectories = new Parameter(this, "includeDirectories");
    includeDirectories.setTypeEquals(BaseType.BOOLEAN);
    includeDirectories.setExpression("false");

    recursive = new Parameter(this, "recursive");
    recursive.setTypeEquals(BaseType.BOOLEAN);
    recursive.setExpression("false");

    files = new Parameter(this, "files");
    files.setExpression("{ }");
    files.setVisibility(Settable.NOT_EDITABLE);
    files.setPersistent(false);
    Variable variable = new Variable(files, "_textHeightHint");
    variable.setExpression("5");
    variable.setPersistent(false);
  }