예제 #1
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");
    }
  }
예제 #2
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);
  }