当前位置: 首页>>代码示例>>Java>>正文


Java IndexedEntry.index方法代码示例

本文整理汇总了Java中kodkod.util.ints.IndexedEntry.index方法的典型用法代码示例。如果您正苦于以下问题:Java IndexedEntry.index方法的具体用法?Java IndexedEntry.index怎么用?Java IndexedEntry.index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kodkod.util.ints.IndexedEntry的用法示例。


在下文中一共展示了IndexedEntry.index方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cross

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Returns the cross product of this and other matrix, using conjunction
 * instead of multiplication.
 *
 * @return { m: BooleanMatrix | m = this x other }
 * @throws NullPointerException other = null
 * @throws IllegalArgumentException this.factory != other.factory
 */
public final BooleanMatrix cross(final BooleanMatrix other) {
	checkFactory(this.factory, other.factory);

	final BooleanMatrix ret = new BooleanMatrix(dims.cross(other.dims), factory, cells, other.cells);
	ret.mergeDefConds(this, other);

	if (cells.isEmpty() || other.cells.isEmpty())
		return ret;

	final int ocap = other.dims.capacity();
	for (IndexedEntry<BooleanValue> e0 : cells) {
		int i = ocap * e0.index();
		for (IndexedEntry<BooleanValue> e1 : other.cells) {
			BooleanValue conjunction = factory.and(e0.value(), e1.value());
			if (conjunction != FALSE)
				ret.cells.put(i + e1.index(), conjunction);
		}
	}

	return ret;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:30,代码来源:BooleanMatrix.java

示例2: override

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Overrides the values in this matrix with those in <code>other</code>.
 * Specifically, for each index i of the returned matrix m, m.elements[i] is
 * true iff other.elements[i] is true or this.elements[i] is true and all
 * elements of <code>other</code> that are in the same row as i are false.
 * 
 * @return {m: BooleanMatrix | m.dimensions = this.dimensions && all i:
 *         [0..m.capacity()) | m.elements[i] = other.elements[i] ||
 *         this.elements[i] && !OR(other.elements[row(i)]) } where
 *         other.elements[row(i)] selects all elements of <code>other</code>
 *         that are in the same row as i.
 * @throws NullPointerException other = null
 * @throws IllegalArgumentException other.dimensions != this.dimensions
 */
public final BooleanMatrix override(BooleanMatrix other) {
	checkFactory(this.factory, other.factory);
	checkDimensions(this.dims, other.dims);
	if (other.cells.isEmpty())
		return this.clone();

	final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
	ret.mergeDefConds(this, other);

	ret.cells.putAll(other.cells);
	final int rowLength = dims.capacity() / dims.dimension(0);
	int row = -1;
	BooleanValue rowVal = BooleanConstant.TRUE;
	for (IndexedEntry<BooleanValue> e0 : cells) {
		int e0row = e0.index() / rowLength;
		if (row != e0row) {
			row = e0row;
			rowVal = other.nand(row * rowLength, (row + 1) * rowLength);
		}
		ret.fastSet(e0.index(), factory.or(ret.fastGet(e0.index()), factory.and(e0.value(), rowVal)));
	}
	return ret;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:38,代码来源:BooleanMatrix.java

示例3: cross

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Returns the cross product of this and other matrix, using conjunction instead of 
 * multiplication.
 * 
 * @return { m: BooleanMatrix | m = this x other }
 * @throws NullPointerException  other = null
 * @throws IllegalArgumentException  this.factory != other.factory
 */
public final BooleanMatrix cross(final BooleanMatrix other) {
    checkFactory(this.factory, other.factory);
    
    final BooleanMatrix ret =  new BooleanMatrix(dims.cross(other.dims), factory, cells, other.cells);
    ret.mergeDefConds(this, other);
    
    if (cells.isEmpty() || other.cells.isEmpty()) return ret;
    
    final int ocap = other.dims.capacity();
    for(IndexedEntry<BooleanValue> e0 : cells) {
        int i = ocap * e0.index();
        for(IndexedEntry<BooleanValue> e1: other.cells) {
            BooleanValue conjunction = factory.and(e0.value(), e1.value());
            if (conjunction != FALSE)
                ret.cells.put(i + e1.index(), conjunction);
        }
    }
    
    return ret;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:29,代码来源:BooleanMatrix.java

示例4: override

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Overrides the values in this matrix with those in <code>other</code>.
 * Specifically, for each index i of the returned matrix m,
 * m.elements[i] is true iff other.elements[i] is true or
 * this.elements[i] is true and all elements of <code>other</code> 
 * that are in the same row as i are false.
 * @return {m: BooleanMatrix | m.dimensions = this.dimensions &&
 *                             all i: [0..m.capacity()) | m.elements[i] = 
 *                               other.elements[i] || 
 *                               this.elements[i] && !OR(other.elements[row(i)]) }
 * where other.elements[row(i)] selects all elements of <code>other</code>
 * that are in the same row as i.  
 * @throws NullPointerException  other = null
 * @throws IllegalArgumentException  other.dimensions != this.dimensions
 */
public final BooleanMatrix override(BooleanMatrix other) {
    checkFactory(this.factory, other.factory); checkDimensions(this.dims, other.dims);
    if (other.cells.isEmpty()) return this.clone();
    
    final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
    ret.mergeDefConds(this, other);
    
    ret.cells.putAll(other.cells);
    final int rowLength = dims.capacity() / dims.dimension(0);
    int row = -1;
    BooleanValue rowVal = BooleanConstant.TRUE;
    for(IndexedEntry<BooleanValue> e0 : cells) {
        int e0row = e0.index() / rowLength;
        if (row != e0row) {
            row = e0row;
            rowVal = other.nand(row*rowLength, (row+1)*rowLength);
        }
        ret.fastSet(e0.index(), factory.or(ret.fastGet(e0.index()), 
                   factory.and(e0.value(), rowVal)));
    }
    return ret;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:38,代码来源:BooleanMatrix.java

示例5: cross

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
    * Returns the cross product of this and other matrix, using conjunction instead of 
    * multiplication.
    * 
    * @return { m: BooleanMatrix | m = this x other }
    * @throws NullPointerException  other = null
    * @throws IllegalArgumentException  this.factory != other.factory
    */
public final BooleanMatrix cross(final BooleanMatrix other) {
	checkFactory(this.factory, other.factory);
	
	final BooleanMatrix ret =  new BooleanMatrix(dims.cross(other.dims), factory, cells, other.cells);
	if (cells.isEmpty() || other.cells.isEmpty()) return ret;
	
	final int ocap = other.dims.capacity();
	for(IndexedEntry<BooleanValue> e0 : cells) {
		int i = ocap * e0.index();
		for(IndexedEntry<BooleanValue> e1: other.cells) {
			BooleanValue conjunction = factory.and(e0.value(), e1.value());
			if (conjunction != FALSE)
				ret.cells.put(i + e1.index(), conjunction);
		}
	}
	return ret;
}
 
开发者ID:emina,项目名称:kodkod,代码行数:26,代码来源:BooleanMatrix.java

示例6: override

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Overrides the values in this matrix with those in <code>other</code>.
 * Specifically, for each index i of the returned matrix m,
 * m.elements[i] is true iff other.elements[i] is true or
 * this.elements[i] is true and all elements of <code>other</code> 
 * that are in the same row as i are false.
 * @return {m: BooleanMatrix | m.dimensions = this.dimensions &&
 *                             all i: [0..m.capacity()) | m.elements[i] = 
 *                               other.elements[i] || 
 *                               this.elements[i] && !OR(other.elements[row(i)]) }
 * where other.elements[row(i)] selects all elements of <code>other</code>
 * that are in the same row as i.  
 * @throws NullPointerException  other = null
 * @throws IllegalArgumentException  other.dimensions != this.dimensions
 */
public final BooleanMatrix override(BooleanMatrix other) {
	checkFactory(this.factory, other.factory); 
	checkDimensions(this.dims, other.dims);
	if (other.cells.isEmpty()) return this.clone();
	final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
	ret.cells.putAll(other.cells);
	final int rowLength = dims.capacity() / dims.dimension(0);
	int row = -1;
	BooleanValue rowVal = BooleanConstant.TRUE;
	for(IndexedEntry<BooleanValue> e0 : cells) {
		int e0row = e0.index() / rowLength;
		if (row != e0row) {
			row = e0row;
			rowVal = other.nand(row*rowLength, (row+1)*rowLength);
		}
		ret.fastSet(e0.index(), factory.or(ret.fastGet(e0.index()), 
				   factory.and(e0.value(), rowVal)));
	}
	return ret;
}
 
开发者ID:emina,项目名称:kodkod,代码行数:36,代码来源:BooleanMatrix.java

示例7: dot

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Returns the dot product of this and other matrix, using conjunction
 * instead of multiplication and disjunction instead of addition.
 *
 * @return { m: BooleanMatrix | m = this*other }
 * @throws NullPointerException other = null
 * @throws IllegalArgumentException this.factory != other.factory
 * @throws IllegalArgumentException dimensions incompatible for
 *             multiplication
 */
public final BooleanMatrix dot(final BooleanMatrix other) {
	checkFactory(this.factory, other.factory);

	final BooleanMatrix ret = new BooleanMatrix(dims.dot(other.dims), factory, cells, other.cells);
	ret.mergeDefConds(this, other);

	if (cells.isEmpty() || other.cells.isEmpty())
		return ret;

	final SparseSequence<BooleanValue> mutableCells = ret.clone().cells;
	final int b = other.dims.dimension(0);
	final int c = other.dims.capacity() / b;

	for (IndexedEntry<BooleanValue> e0 : cells) {
		int i = e0.index();
		BooleanValue iVal = e0.value();
		int rowHead = (i % b) * c, rowTail = rowHead + c - 1;
		for (Iterator<IndexedEntry<BooleanValue>> iter1 = other.cells.iterator(rowHead, rowTail); iter1
				.hasNext();) {
			IndexedEntry<BooleanValue> e1 = iter1.next();
			BooleanValue retVal = factory.and(iVal, e1.value());
			if (retVal != FALSE) {
				int k = (i / b) * c + e1.index() % c;
				if (retVal == TRUE)
					mutableCells.put(k, TRUE);
				else {
					BooleanValue kVal = mutableCells.get(k);
					if (kVal != TRUE) {
						if (kVal == null) {
							kVal = BooleanAccumulator.treeGate(OR);
							mutableCells.put(k, kVal);
						}
						((BooleanAccumulator) kVal).add(retVal);
					}
				}
			}
		}
	}

	// make mutable gates immutable
	for (IndexedEntry<BooleanValue> e : mutableCells) {
		if (e.value() != TRUE) {
			ret.fastSet(e.index(), factory.accumulate((BooleanAccumulator) e.value()));
		} else {
			ret.fastSet(e.index(), TRUE);
		}
	}

	return ret;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:61,代码来源:BooleanMatrix.java

示例8: generateSBP

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Generates a lex leader symmetry breaking predicate for this.symmetries
 * (if any), using the specified leaf interpreter and
 * options.symmetryBreaking. It also invokes
 * options.reporter().generatingSBP() if a non-constant predicate is
 * generated.
 * 
 * @requires interpreter.relations in this.bounds.relations
 * @ensures options.reporter().generatingSBP() if a non-constant predicate
 *          is generated.
 * @return a symmetry breaking predicate for this.symmetries
 */
public final BooleanValue generateSBP(LeafInterpreter interpreter, Options options) {
	final int predLength = options.symmetryBreaking();
	if (symmetries.isEmpty() || predLength == 0)
		return BooleanConstant.TRUE;
	options.reporter().generatingSBP();

	final List<RelationParts> relParts = relParts();
	final BooleanFactory factory = interpreter.factory();
	final BooleanAccumulator sbp = BooleanAccumulator.treeGate(Operator.AND);
	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;

				if (!rparts.representatives.contains(sym.min()))
					continue; // r does not range over sym

				BooleanMatrix m = interpreter.interpret(r);
				for (IndexedEntry<BooleanValue> entry : m) {
					int permIndex = permutation(r.arity(), entry.index(), prevIndex, curIndex);
					BooleanValue permValue = m.get(permIndex);
					if (permIndex == entry.index() || atSameIndex(original, permValue, permuted, entry.value()))
						continue;

					original.add(entry.value());
					permuted.add(permValue);
				}
			}

			sbp.add(leq(factory, original, permuted));
			original.clear();
			permuted.clear();
			prevIndex = curIndex;
		}
	}
	symmetries.clear(); // no symmetries left to break (this is
						// conservative)
	return factory.accumulate(sbp);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:61,代码来源:SymmetryBreaker.java

示例9: dot

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Returns the dot product of this and other matrix, using conjunction instead of 
 * multiplication and disjunction instead of addition.
 * 
 * @return { m: BooleanMatrix | m = this*other }
 * @throws NullPointerException  other = null
 * @throws IllegalArgumentException  this.factory != other.factory
 * @throws IllegalArgumentException  dimensions incompatible for multiplication
 */
public final BooleanMatrix dot(final BooleanMatrix other) {  
    checkFactory(this.factory, other.factory);
    
    final BooleanMatrix ret =  new BooleanMatrix(dims.dot(other.dims), factory, cells, other.cells);
    ret.mergeDefConds(this, other);
    
    if (cells.isEmpty() || other.cells.isEmpty()) return ret;
    
    final SparseSequence<BooleanValue> mutableCells = ret.clone().cells;
    final int b = other.dims.dimension(0); 
    final int c = other.dims.capacity() / b; 
    
    for(IndexedEntry<BooleanValue> e0 : cells) {
        int i = e0.index();
        BooleanValue iVal = e0.value();
        int rowHead = (i % b)*c, rowTail = rowHead + c - 1;
        for(Iterator<IndexedEntry<BooleanValue>> iter1 = other.cells.iterator(rowHead, rowTail); iter1.hasNext();) {
            IndexedEntry<BooleanValue> e1 = iter1.next();
            BooleanValue retVal = factory.and(iVal, e1.value());
            if (retVal != FALSE) {
                int k = (i / b)*c + e1.index()%c;
                if (retVal==TRUE) mutableCells.put(k, TRUE);
                else {
                    BooleanValue kVal = mutableCells.get(k);
                    if (kVal != TRUE) {
                        if (kVal==null) {
                            kVal = BooleanAccumulator.treeGate(OR);
                            mutableCells.put(k, kVal);
                        } 
                        ((BooleanAccumulator) kVal).add(retVal);
                    }
                }
            }
        }       
    }
    
    // make mutable gates immutable
    for(IndexedEntry<BooleanValue> e : mutableCells) {
        if (e.value()!=TRUE) {
            ret.fastSet(e.index(), factory.accumulate((BooleanAccumulator) e.value()));
        } else {
            ret.fastSet(e.index(), TRUE);
        }
    }
    
    return ret;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:57,代码来源:BooleanMatrix.java

示例10: generateSBP

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Generates a lex leader symmetry breaking predicate for this.symmetries 
 * (if any), using the specified leaf interpreter and the specified predicate length.
 * @requires interpreter.relations in this.bounds.relations
 * @return a symmetry breaking predicate for this.symmetries
 */
final BooleanValue generateSBP(LeafInterpreter interpreter, int predLength) {
	if (symmetries.isEmpty() || predLength==0) return BooleanConstant.TRUE;
	
	final List<RelationParts> relParts = relParts();
	final BooleanFactory factory = interpreter.factory();
	final BooleanAccumulator sbp = BooleanAccumulator.treeGate(Operator.AND);
	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;
				
				if (!rparts.representatives.contains(sym.min())) continue;  // r does not range over sym
				
				BooleanMatrix m = interpreter.interpret(r);
				for(IndexedEntry<BooleanValue> entry : m) {
					int permIndex = permutation(r.arity(), entry.index(), prevIndex, curIndex);
					BooleanValue permValue = m.get(permIndex);
					if (permIndex==entry.index() || atSameIndex(original, permValue, permuted, entry.value()))
						continue;
					
					original.add(entry.value());
					permuted.add(permValue);			
				}
			}
							
			sbp.add(leq(factory, original, permuted));
			original.clear();
			permuted.clear();
			prevIndex = curIndex;
		}
	}
	
	return factory.accumulate(sbp);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:49,代码来源:SymmetryBreaker.java

示例11: dot

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
    * Returns the dot product of this and other matrix, using conjunction instead of 
    * multiplication and disjunction instead of addition.
    * 
    * @return { m: BooleanMatrix | m = this*other }
    * @throws NullPointerException  other = null
    * @throws IllegalArgumentException  this.factory != other.factory
    * @throws IllegalArgumentException  dimensions incompatible for multiplication
    */
public final BooleanMatrix dot(final BooleanMatrix other) {  
	checkFactory(this.factory, other.factory);
	
	final BooleanMatrix ret =  new BooleanMatrix(dims.dot(other.dims), factory, cells, other.cells);
	if (cells.isEmpty() || other.cells.isEmpty()) return ret;
	
	final SparseSequence<BooleanValue> mutableCells = ret.clone().cells;
	final int b = other.dims.dimension(0); 
	final int c = other.dims.capacity() / b; 
	
	for(IndexedEntry<BooleanValue> e0 : cells) {
		int i = e0.index();
		BooleanValue iVal = e0.value();
		int rowHead = (i % b)*c, rowTail = rowHead + c - 1;
		for(Iterator<IndexedEntry<BooleanValue>> iter1 = other.cells.iterator(rowHead, rowTail); iter1.hasNext();) {
			IndexedEntry<BooleanValue> e1 = iter1.next();
			BooleanValue retVal = factory.and(iVal, e1.value());
			if (retVal != FALSE) {
				int k = (i / b)*c + e1.index()%c;
				if (retVal==TRUE) mutableCells.put(k, TRUE);
				else {
					BooleanValue kVal = mutableCells.get(k);
					if (kVal != TRUE) {
						if (kVal==null) {
							kVal = BooleanAccumulator.treeGate(OR);
							mutableCells.put(k, kVal);
						} 
						((BooleanAccumulator) kVal).add(retVal);
					}
				}
			}
		}		
	}
	
	// make mutable gates immutable
	for(IndexedEntry<BooleanValue> e : mutableCells) {
		if (e.value()!=TRUE) {
			ret.fastSet(e.index(), factory.accumulate((BooleanAccumulator) e.value()));
		} else {
			ret.fastSet(e.index(), TRUE);
		}
	}
	return ret;
}
 
开发者ID:emina,项目名称:kodkod,代码行数:54,代码来源:BooleanMatrix.java

示例12: generateSBP

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/**
 * Generates a lex leader symmetry breaking predicate for this.symmetries 
 * (if any), using the specified leaf interpreter and options.symmetryBreaking.
 * It also invokes options.reporter().generatingSBP() if a non-constant predicate
 * is generated.
 * @requires interpreter.relations in this.bounds.relations
 * @ensures options.reporter().generatingSBP() if a non-constant predicate is generated.
 * @return a symmetry breaking predicate for this.symmetries
 */
final BooleanValue generateSBP(LeafInterpreter interpreter, Options options) {
	final int predLength = options.symmetryBreaking();
	if (symmetries.isEmpty() || predLength==0) return BooleanConstant.TRUE;
	options.reporter().generatingSBP();
	
	final List<RelationParts> relParts = relParts();
	final BooleanFactory factory = interpreter.factory();
	final BooleanAccumulator sbp = BooleanAccumulator.treeGate(Operator.AND);
	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;
				
				if (!rparts.representatives.contains(sym.min())) continue;  // r does not range over sym
				
				BooleanMatrix m = interpreter.interpret(r);
				for(IndexedEntry<BooleanValue> entry : m) {
					int permIndex = permutation(r.arity(), entry.index(), prevIndex, curIndex);
					BooleanValue permValue = m.get(permIndex);
					if (permIndex==entry.index() || atSameIndex(original, permValue, permuted, entry.value()))
						continue;
					
					original.add(entry.value());
					permuted.add(permValue);			
				}
			}
							
			sbp.add(leq(factory, original, permuted));
			original.clear();
			permuted.clear();
			prevIndex = curIndex;
		}
	}
	symmetries.clear(); // no symmetries left to break (this is conservative)
	return factory.accumulate(sbp);
}
 
开发者ID:emina,项目名称:kodkod,代码行数:54,代码来源:SymmetryBreaker.java

示例13: execute

import kodkod.util.ints.IndexedEntry; //导入方法依赖的package包/类
/** 
		 * Translates the method in the topmost frame of this.env, pops the frame
		 * off and returns it, along with return, exception, etc., values wrapped
		 * in a Result object.
		 * @effects adds translations of callInfo.allInstructions() to this.env.top, and pops it off
		 * @return Result object storing the translation of the method in the topmost
		 * frame of this.env, as computed by this translation visitor
		 **/
		@SuppressWarnings("unchecked")
		protected final MethodTranslation execute() { 
			
			
			final int spaces = env.callStack().size();
			final String indent = repeat("  ", spaces);
			
			/*
			System.out.println();
			System.out.println(indent+"----------all instructions for "+callInfo.cgNode()+"------------");
			System.out.println(prettyPrint(env.top().callInfo().cgNode().getIR(), spaces*2));
			System.out.println(indent+"----------end all instructions for "+callInfo.cgNode()+"------------");
			System.out.println(indent+"----------relevant instructions for "+callInfo.cgNode()+"------------");
					
			for(Iterator<? extends IndexedEntry<SSAInstruction>> itr = callInfo.relevantInstructions(); itr.hasNext(); ) { 
				IndexedEntry<SSAInstruction> inst = itr.next();
				System.out.println(indent+inst.index() + ":: "+inst.value());
			}
			
			System.out.println(indent+"----------end relevant instructions for "+callInfo.cgNode()+"------------");
			*/
			
			for(Iterator<? extends IndexedEntry<SSAInstruction>> itr = callInfo.relevantInstructions(); itr.hasNext(); ) { 
				IndexedEntry<SSAInstruction> inst = itr.next();
//				System.out.println(indent+"TRANSLATING "+inst.index() + ":: "+inst.value());
				this.instIdx = inst.index();
				inst.value().visit(this);
			}
			
//			System.out.println(indent+"------------------------------------\n");
			
//			System.out.println("----------def use------------");
//			DefUse du = env.top().callInfo().cgNode().getDU();
//			for(int i = 1; i <= env.top().callInfo().cgNode().getIR().getSymbolTable().getMaxValueNumber(); i++) {
//				System.out.println(i + " = " + env.localUse(i) + "; definer: " + du.getDef(i));
//			}
//			System.out.println("-----------------------------");
//			System.out.println();
			
			return new MethodTranslation() {
				
				final Formula exitGuard = guardHandler.normalExitGuard();
				// if returnValue phi is empty, then the return instruction(s) have been sliced out
				// and therefore irrelevant, so we set the return value to null
				final Object returnValue = returnPhi==null || returnPhi.size()==0 ? null : returnPhi.value(); 
				final Expression exceptionValue = exceptionPhi.size()==0 ? null : exceptionPhi.value(); 
				final Frame frame = env.pop();

				public Set<Formula> assertions() { return assertions; }
				public Set<Formula> assumptions() { return assumes; }
				public Expression exceptionValue() { return exceptionValue; }
				public Frame frame() { return frame; }
				public Formula normalExitGuard() { return exitGuard; }
				public <T> T returnValue() { return (T) returnValue; }
				public Set<TranslationWarning> warnings() { return warnings; } 
			};
		}
 
开发者ID:wala,项目名称:MemSAT,代码行数:66,代码来源:Translator.java


注:本文中的kodkod.util.ints.IndexedEntry.index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。