Package kodkod.util.ints

Examples of kodkod.util.ints.IntSet


        switch(castExpr.op()) {
        case INTCAST  : return cache(castExpr, Expression.INTS.accept(this));
        case BITSETCAST  :
          final BooleanFactory factory = super.interpreter.factory();
          ret = factory.matrix(Dimensions.square(super.interpreter.universe().size(), 1));
          final IntSet ints = super.interpreter.ints();
          final int msb = factory.bitwidth()-1;
          // handle all bits but the sign bit
          for(int i = 0; i < msb; i++) {
            int pow2 = 1<<i;
            if (ints.contains(pow2)) {
              ret.set(super.interpreter.interpret(pow2), BooleanConstant.TRUE);
            }
          }
          // handle the sign bit
          if (ints.contains(-1<<msb)) {
            ret.set(super.interpreter.interpret(-1<<msb), BooleanConstant.TRUE);
          }
          return cache(castExpr, ret);
        default : throw new IllegalArgumentException("Unknown operator: " + castExpr.op());
        }
View Full Code Here


    BooleanMatrix ret = lookup(castExpr);
    if (ret!=null) return ret;

    final Int child = castExpr.intExpr().accept(this);
    final BooleanFactory factory =  interpreter.factory();
    final IntSet ints = interpreter.ints();
   
    ret = factory.matrix(Dimensions.square(interpreter.universe().size(), 1));
   
    switch(castExpr.op()) {
    case INTCAST :  
      for(IntIterator iter = ints.iterator(); iter.hasNext(); ) {
        int i = iter.next();
        int atomIndex = interpreter.interpret(i);
        ret.set(atomIndex, factory.or(ret.get(atomIndex), child.eq(factory.integer(i))));
      }
      break;
    case BITSETCAST :
      final List<BooleanValue> twosComplement = child.twosComplementBits();
      final int msb = twosComplement.size()-1;
      // handle all bits but the sign bit
      for(int i = 0; i < msb; i++) {
        int pow2 = 1<<i;
        if (ints.contains(pow2)) {
          ret.set(interpreter.interpret(pow2), twosComplement.get(i));
        }
      }
      // handle the sign bit
      if (ints.contains(-1<<msb)) {
        ret.set(interpreter.interpret(-1<<msb), twosComplement.get(msb));
      }
      break;
    default :
      throw new IllegalArgumentException("Unknown cast operator: " + castExpr.op());
View Full Code Here

    if (ret!=null) return ret;
    switch(intExpr.op()) {
    case CARDINALITY :
      ret = intExpr.expression().accept(this).cardinality(); break;
    case SUM         :
      final IntSet ints = interpreter.ints();
      ret = sum(intExpr.expression().accept(this), ints.iterator(), 0, ints.size()-1); break;
    default:
      throw new IllegalArgumentException("unknown operator: " + intExpr.op());
    }
    return cache(intExpr, ret);
  }
View Full Code Here

TOP

Related Classes of kodkod.util.ints.IntSet

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.