Package com.exigen.ie.constrainer

Examples of com.exigen.ie.constrainer.IntVar


      if (max < v)
        max = v;
    }
   
    try {
      IntVar constranerVar = getConstrainer().addIntVar(min, max, name, myType);
      setImpl(constranerVar);
      setMin(min);
      setMax(max);
      if(domain.length <= Math.abs(max - min)) {
        int counter = 1;
        for (int i = min+1; i < max; i++) {
          if(domain[counter] != i){
            try{
              constranerVar.removeValue(i);
            }catch (Exception e) {
              p.log("value " + i + "can not be removed from " + constranerVar);
            }
          }
          else
View Full Code Here


        remove = true;
      case IntVar.DOMAIN_PLAIN :
      default :
        break;
    }
    IntVar copy = var.constrainer().addIntVar(var.min(), var.max(), type);
    if (remove){
      for (int i=var.min(); i<= var.max(); i++){
        if (! var.contains(i))
          try{copy.removeValue(i);}catch(Failure f){}
      }
    }
    return copy;
  }
View Full Code Here

  }

  static IntExpArray createCopyOfIntExpArray(IntExpArray array){
    IntExpArray arrCopy = new IntExpArray(array.constrainer(), array.size());
    for (int i=0; i<array.size(); i++){
      IntVar varCopy;
      IntExp exp = array.get(i);
      if (exp instanceof IntVar)
        varCopy = createCopyOfIntVar((IntVar)exp);
      else
        varCopy = array.constrainer().addIntVar(exp.min(), exp.max(), IntVar.DOMAIN_PLAIN);
View Full Code Here

    else
      _valuesUsed.get(idx).setMax(oldMax-1);
  }

  void decreaseUsageCounter(int start, int end, int idx) throws Failure{
    IntVar var = (IntVar)copyOfAry.get(idx);
    for (int i=start; i<=end; i++){
      if (var.contains(i))
        decreaseUsageCounter(i);
    }
  }
View Full Code Here

  public void arrayElementMin(int oldmin, int min, int idx) throws Failure{
    if (min > _element.max())
      _index.removeValue(idx);
    else
      decreaseUsageCounter(oldmin, min-1, idx);
    IntVar varCopy = (IntVar)copyOfAry.get(idx);
    varCopy.setMin(min);
  }
View Full Code Here

  public void arrayElementMax(int oldmax, int max, int idx) throws Failure{
    if (max < _element.min())
      _index.removeValue(idx);
    else
      decreaseUsageCounter(max+1, oldmax, idx);
    IntVar varCopy = (IntVar)copyOfAry.get(idx);
    varCopy.setMax(max);
  }
View Full Code Here

    varCopy.setMax(max);
  }

  public void arrayElementRemove(int removedValue, int idx) throws Failure{
    decreaseUsageCounter(removedValue);
    IntVar varCopy = (IntVar)copyOfAry.get(idx);
    varCopy.removeValue(removedValue);
  }
View Full Code Here

    IntVar varCopy = (IntVar)copyOfAry.get(idx);
    varCopy.removeValue(removedValue);
  }

  public void arrayElementValue(int value, int idx) throws Failure{
    IntVar varCopy = (IntVar)copyOfAry.get(idx);
    if ( (value < _element.min()) || (value > _element.max()) )
      _index.removeValue(idx);
    else{
      for (int i=varCopy.min(); i < value; i++){
        if (varCopy.contains(i))
          decreaseUsageCounter(i);
      }
      for (int i=varCopy.max(); i > value; i--){
        if (varCopy.contains(i))
          decreaseUsageCounter(i);
      }
    }
    varCopy.setValue(value);
  }
View Full Code Here

TOP

Related Classes of com.exigen.ie.constrainer.IntVar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.