Ejemplo n.º 1
0
 /**
  * Method to add a Parameter to this NodeInst. Overridden in IconNodeInst
  *
  * @param param the Variable to delete.
  */
 public void addParameter(Variable param) {
   if (!isParam(param.getKey())) {
     throw new IllegalArgumentException("Parameter " + param + " is not defined on " + getProto());
   }
   Cell icon = (Cell) getProto();
   Variable iconParam = icon.getParameter(param.getKey());
   param = composeInstParam(iconParam, param);
   if (setD(getD().withParam(param), true)) // check for side-effects of the change
   {
     checkPossibleVariableEffects(param.getKey());
   }
 }
Ejemplo n.º 2
0
 /**
  * Method to add a Variable on this IconNodeInst. It may add a repaired copy of this Variable in
  * some cases.
  *
  * @param var Variable to add.
  */
 @Override
 public void addVar(Variable var) {
   if (isParam(var.getKey())) {
     throw new IllegalArgumentException(this + " already has a variable with name " + var);
   }
   super.addVar(var.withParam(false).withInherit(false));
 }
Ejemplo n.º 3
0
 /**
  * Method to copy all variables from another ElectricObject to this ElectricObject.
  *
  * @param other the other ElectricObject from which to copy Variables.
  */
 @Override
 public void copyVarsFrom(ElectricObject other) {
   checkChanging();
   for (Iterator<Variable> it = other.getParametersAndVariables(); it.hasNext(); ) {
     Variable var = it.next();
     if (isParam(var.getKey())) {
       addParameter(var.withParam(true));
     } else {
       addVar(var.withParam(false));
     }
   }
 }
Ejemplo n.º 4
0
  /**
   * Method to return an Iterator over all Parameters on this IconNodeInst. This may also include
   * any parameters on the defaultVarOwner object that are not on this object.
   *
   * @return an Iterator over all Parameters on this IconNodeInst.
   */
  @Override
  public Iterator<Variable> getParameters() {
    Cell icon = (Cell) getProto();
    if (!icon.hasParameters()) {
      return ArrayIterator.emptyIterator();
    }

    ArrayList<Variable> params = new ArrayList<Variable>();
    // get all parameters on this object
    for (Iterator<Variable> it = icon.getParameters(); it.hasNext(); ) {
      Variable iconParam = it.next();
      Variable instVar = getD().getDefinedParameter((Variable.AttrKey) iconParam.getKey());
      params.add(composeInstParam(iconParam, instVar));
    }
    return params.iterator();
  }