Package kodkod.util.ints

Examples of kodkod.util.ints.IntIterator


  public boolean equals(Object o) {
    if (o==this) return true;
    if (o instanceof Clause) {
      final Clause c = (Clause) o;
      if (size()==c.size()) {
        final IntIterator itr1 = literals(), itr2 = literals();
        while(itr1.hasNext()) {
          if (itr1.next()!=itr2.next()) return false;
        }
      }
      final int ante = numberOfAntecedents();
      if (ante > 0 && ante==c.numberOfAntecedents()) {
        final Iterator<Clause> itr1 = antecedents(), itr2 = c.antecedents();
        while(itr1.hasNext()) {
          if (!itr1.next().equals(itr2.next())) return false;
        }
      }
      return ante==0;
    }
    return false;
View Full Code Here


    int axiomCount = indices.size();
    // fill the partial[0..indices.size()-1] with the corresponding clauses from original.trace[indices]
    final int[][] originalTrace = original.trace; 
    final int[] position = new int[indices.max()+1];

    IntIterator itr = indices.iterator();
    for(int i = 0, length = indices.size(); i < length; i++) {
      int index = itr.next();
      position[index] = i;
      if (original.axiom(index)) { // just set the ith pointer to original literals
        partial[i] = originalTrace[index];
      } else { // copy the resolvent and adjust copy's antecedent indices
        int antes = originalTrace[index][0];
View Full Code Here

  private static int[][] compress(int[][] src, int axioms, IntSet reachable, IntSet core) {
    final int[][] dest = new int[reachable.size()-core.size()+axioms][];
    System.arraycopy(src, 0, dest, 0, axioms);
   
    final int[] pos = new int[src.length-axioms];
    final IntIterator srcIdxs = reachable.iterator(axioms, src.length);
    for(int i = axioms; srcIdxs.hasNext(); i++) {
      int srcIdx = srcIdxs.next();
      pos[srcIdx-axioms] = i;
      // move the resolvent and adjust its antecedent indices
      int[] resolvent = src[srcIdx];
      dest[i] = resolvent;
      for(int j = 0, lastAnte = resolvent.length; j < lastAnte; j++) {
View Full Code Here

  /**
   * {@inheritDoc}
   * @see kodkod.engine.satlab.ResolutionTrace#iterator()
   */
  public Iterator<Clause> iterator() {
    return new ClauseIterator(new IntIterator() {
      int index = 0;
      public boolean hasNext() { return index>=0 && index < trace.length; }
      public int next() {
        if (!hasNext()) throw new NoSuchElementException();
        return index++;
View Full Code Here

    int axiomCount = indices.size();
    { // fill the partial[0..indices.size()-1] with the corresponding clauses from original.trace[indices]
      final int[][] originalTrace = original.trace; 
      final int[] position = new int[originalTrace.length];
     
      IntIterator itr = indices.iterator();
      for(int i = 0, length = indices.size(); i < length; i++) {
        int index = itr.next();
        position[index] = i;
        if (original.axiom(index)) { // just set the ith pointer to original literals
          partial[i] = originalTrace[index];
        } else { // copy the resolvent and adjust copy's antecedent indices
          int resLength = originalTrace[index].length;
View Full Code Here

  /**
   * {@inheritDoc}
   * @see kodkod.engine.satlab.ResolutionTrace#iterator()
   */
  public Iterator<Clause> iterator() {
    return new ClauseIterator(new IntIterator() {
      int index = 0;
      public boolean hasNext() { return index>=0 && index < trace.length; }
      public int next() {
        if (!hasNext()) throw new NoSuchElementException();
        return index++;
View Full Code Here

   */
  private static IntSet coreClausesWithMaxVar(ResolutionTrace trace, int maxVariable) {
    final IntSet core = trace.core();
    final IntSet restricted = new IntBitSet(core.max()+1);
    final Iterator<Clause> clauses = trace.iterator(core);
    final IntIterator indices = core.iterator();
    while(clauses.hasNext()) {
      Clause clause = clauses.next();
      int index = indices.next();
      if (clause.maxVariable()==maxVariable)
        restricted.add(index);
    }
    return restricted;
  }
View Full Code Here

    final List<BooleanValue> original = new ArrayList<BooleanValue>(predLength);
    final List<BooleanValue> permuted = new ArrayList<BooleanValue>(predLength);
   
    for(IntSet sym : symmetries) {
   
      IntIterator indeces = sym.iterator();
      for(int prevIndex = indeces.next(); indeces.hasNext(); ) {
        int curIndex = indeces.next();
        for(Iterator<RelationParts> rIter = relParts.iterator(); rIter.hasNext() && original.size() < predLength;) {
         
          RelationParts rparts = rIter.next();
          Relation r = rparts.relation;
         
View Full Code Here

TOP

Related Classes of kodkod.util.ints.IntIterator

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.