本文整理汇总了Java中kodkod.util.ints.SparseSequence类的典型用法代码示例。如果您正苦于以下问题:Java SparseSequence类的具体用法?Java SparseSequence怎么用?Java SparseSequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SparseSequence类属于kodkod.util.ints包,在下文中一共展示了SparseSequence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: and
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a new matrix such that an entry in the returned matrix represents
* a conjunction of the corresponding entries in this and other matrix. The
* effect of this method is the same as calling
* this.compose(ExprOperator.Binary.AND, other).
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions && m.factory
* = this.factory && all i: [0..m.dimensions.capacity) |
* m.elements[i] = this.elements[i] AND other.elements[i] }
* @throws NullPointerException other = null
* @throws IllegalArgumentException
* !other.dimensions.equals(this.dimensions) || this.factory !=
* other.factory
*/
public final BooleanMatrix and(BooleanMatrix other) {
checkFactory(this.factory, other.factory);
checkDimensions(this.dims, other.dims);
final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
ret.mergeDefConds(this, other);
final SparseSequence<BooleanValue> s1 = other.cells;
if (cells.isEmpty() || s1.isEmpty())
return ret;
for (IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = s1.get(e0.index());
if (v1 != null)
ret.fastSet(e0.index(), factory.and(e0.value(), v1));
}
return ret;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:32,代码来源:BooleanMatrix.java
示例2: or
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a new matrix such that an entry in the returned matrix represents
* a combination of the corresponding entries in this and other matrix. The
* effect of this method is the same as calling
* this.compose(ExprOperator.Binary.OR, other).
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions && m.factory
* = this.factory && all i: [0..m.dimensions.capacity) |
* m.elements[i] = this.elements[i] OR other.elements[i] }
* @throws NullPointerException other = null
* @throws IllegalArgumentException
* !other.dimensions.equals(this.dimensions) || this.factory !=
* other.factory
*/
public final BooleanMatrix or(BooleanMatrix other) {
checkFactory(this.factory, other.factory);
checkDimensions(this.dims, other.dims);
if (this.cells.isEmpty())
return other.clone();
else if (other.cells.isEmpty())
return this.clone();
final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
ret.mergeDefConds(this, other);
final SparseSequence<BooleanValue> retSeq = ret.cells;
for (IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = other.cells.get(e0.index());
if (v1 == null)
retSeq.put(e0.index(), e0.value());
else
retSeq.put(e0.index(), factory.or(e0.value(), v1));
}
for (IndexedEntry<BooleanValue> e1 : other.cells) {
if (!cells.containsIndex(e1.index()))
retSeq.put(e1.index(), e1.value());
}
return ret;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:40,代码来源:BooleanMatrix.java
示例3: or
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a new matrix such that an entry in the returned matrix represents a
* combination of the corresponding entries in this and other matrix. The effect
* of this method is the same as calling this.compose(ExprOperator.Binary.OR, other).
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions && m.factory = this.factory &&
* all i: [0..m.dimensions.capacity) |
* m.elements[i] = this.elements[i] OR other.elements[i] }
* @throws NullPointerException other = null
* @throws IllegalArgumentException !other.dimensions.equals(this.dimensions) || this.factory != other.factory
*/
public final BooleanMatrix or(BooleanMatrix other) {
checkFactory(this.factory, other.factory); checkDimensions(this.dims, other.dims);
final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
ret.mergeDefConds(this, other);
final SparseSequence<BooleanValue> retSeq = ret.cells;
for(IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = other.cells.get(e0.index());
if (v1==null)
retSeq.put(e0.index(), e0.value());
else
retSeq.put(e0.index(), factory.or(e0.value(), v1));
}
for(IndexedEntry<BooleanValue> e1 : other.cells) {
if (!cells.containsIndex(e1.index()))
retSeq.put(e1.index(), e1.value());
}
return ret;
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:32,代码来源:BooleanMatrix.java
示例4: choice
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a boolean matrix m such that m = this if the given condition evaluates
* to TRUE and m = other otherwise.
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions &&
* all i: [0..m.dimensions.capacity) |
* m.elements[i] = condition => this.elements[i], other.elements[i] }
* @throws NullPointerException other = null || condition = null
* @throws IllegalArgumentException !other.dimensions.equals(this.dimensions) || this.factory != other.factory
*/
public final BooleanMatrix choice(BooleanValue condition, BooleanMatrix other) {
checkFactory(this.factory, other.factory); checkDimensions(this.dims, other.dims);
if (condition==TRUE) return this.clone();
else if (condition==FALSE) return other.clone();
final BooleanMatrix ret = new BooleanMatrix(dims, factory);
final SparseSequence<BooleanValue> otherCells = other.cells;
for(IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = otherCells.get(e0.index());
if (v1==null)
ret.fastSet(e0.index(), factory.and(condition, e0.value()));
else
ret.fastSet(e0.index(), factory.ite(condition, e0.value(), v1));
}
for(IndexedEntry<BooleanValue> e1 : other.cells) {
if (!cells.containsIndex(e1.index()))
ret.fastSet(e1.index(), factory.and(condition.negation(), e1.value()));
}
BooleanValue of = factory.ite(condition, defCond().getOverflow(), other.defCond().getOverflow());
BooleanValue accumOF = factory.ite(condition, defCond().getAccumOverflow(), other.defCond().getAccumOverflow());
ret.defCond().setOverflows(of, accumOF);
return ret;
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:35,代码来源:BooleanMatrix.java
示例5: or
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a new matrix such that an entry in the returned matrix represents a
* combination of the corresponding entries in this and other matrix. The effect
* of this method is the same as calling this.compose(ExprOperator.Binary.OR, other).
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions && m.factory = this.factory &&
* all i: [0..m.dimensions.capacity) |
* m.elements[i] = this.elements[i] OR other.elements[i] }
* @throws NullPointerException other = null
* @throws IllegalArgumentException !other.dimensions.equals(this.dimensions) || this.factory != other.factory
*/
public final BooleanMatrix or(BooleanMatrix other) {
checkFactory(this.factory, other.factory);
checkDimensions(this.dims, other.dims);
if (this.cells.isEmpty())
return other.clone();
else if (other.cells.isEmpty())
return this.clone();
final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
final SparseSequence<BooleanValue> retSeq = ret.cells;
for(IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = other.cells.get(e0.index());
if (v1==null)
retSeq.put(e0.index(), e0.value());
else
retSeq.put(e0.index(), factory.or(e0.value(), v1));
}
for(IndexedEntry<BooleanValue> e1 : other.cells) {
if (!cells.containsIndex(e1.index()))
retSeq.put(e1.index(), e1.value());
}
return ret;
}
开发者ID:emina,项目名称:kodkod,代码行数:35,代码来源:BooleanMatrix.java
示例6: choice
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a boolean matrix m such that m = this if the given condition evaluates
* to TRUE and m = other otherwise.
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions &&
* all i: [0..m.dimensions.capacity) |
* m.elements[i] = condition => this.elements[i], other.elements[i] }
* @throws NullPointerException other = null || condition = null
* @throws IllegalArgumentException !other.dimensions.equals(this.dimensions) || this.factory != other.factory
*/
public final BooleanMatrix choice(BooleanValue condition, BooleanMatrix other) {
checkFactory(this.factory, other.factory);
checkDimensions(this.dims, other.dims);
if (condition==TRUE) return this.clone();
else if (condition==FALSE) return other.clone();
final BooleanMatrix ret = new BooleanMatrix(dims, factory);
final SparseSequence<BooleanValue> otherCells = other.cells;
for(IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = otherCells.get(e0.index());
if (v1==null)
ret.fastSet(e0.index(), factory.and(condition, e0.value()));
else
ret.fastSet(e0.index(), factory.ite(condition, e0.value(), v1));
}
for(IndexedEntry<BooleanValue> e1 : other.cells) {
if (!cells.containsIndex(e1.index()))
ret.fastSet(e1.index(), factory.and(condition.negation(), e1.value()));
}
return ret;
}
开发者ID:emina,项目名称:kodkod,代码行数:32,代码来源:BooleanMatrix.java
示例7: Bounds
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a Bounds object with the given factory and mappings.
*/
private Bounds(TupleFactory factory, Map<Relation,TupleSet> lower, Map<Relation,TupleSet> upper,
SparseSequence<TupleSet> intbounds) {
this.factory = factory;
this.lowers = lower;
this.uppers = upper;
this.intbounds = intbounds;
this.relations = relations(lowers, uppers);
this.atom2rel = new HashMap<Object,Relation>();
for (Entry<Relation,TupleSet> e : uppers.entrySet()) {
addAtomRel(e.getKey(), e.getValue());
}
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:16,代码来源:Bounds.java
示例8: Instance
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
private Instance(Universe u, Map<Relation,TupleSet> tuples, SparseSequence<TupleSet> ints) {
if (u == null)
throw new NullPointerException("universe=null");
this.universe = u;
this.tuples = tuples;
this.ints = ints;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:8,代码来源:Instance.java
示例9: BooleanMatrix
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a new matrix with the given dimensions and factory, backed by
* a sparse sequence which can most efficiently hold the elements storable
* in the sparse sequences s0 and s1.
*
* @ensures this.dimensions' = dimensions && this.factory' = factory &&
* this.elements' = [0..dimensions.capacity)->one FALSE
*/
private BooleanMatrix(Dimensions d, BooleanFactory f, SparseSequence<BooleanValue> s0,
SparseSequence<BooleanValue> s1) {
this.dims = d;
this.factory = f;
final Class< ? > c0 = s0.getClass(), c1 = s1.getClass();
if (c0 != c1 || c0 == RangeSequence.class)
this.cells = new RangeSequence<BooleanValue>();
else if (c0 == HomogenousSequence.class)
this.cells = new HomogenousSequence<BooleanValue>(TRUE, Ints.bestSet(d.capacity()));
else
this.cells = new TreeSequence<BooleanValue>();
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:21,代码来源:BooleanMatrix.java
示例10: choice
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a boolean matrix m such that m = this if the given condition
* evaluates to TRUE and m = other otherwise.
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions && all i:
* [0..m.dimensions.capacity) | m.elements[i] = condition =>
* this.elements[i], other.elements[i] }
* @throws NullPointerException other = null || condition = null
* @throws IllegalArgumentException
* !other.dimensions.equals(this.dimensions) || this.factory !=
* other.factory
*/
public final BooleanMatrix choice(BooleanValue condition, BooleanMatrix other) {
checkFactory(this.factory, other.factory);
checkDimensions(this.dims, other.dims);
if (condition == TRUE)
return this.clone();
else if (condition == FALSE)
return other.clone();
final BooleanMatrix ret = new BooleanMatrix(dims, factory);
final SparseSequence<BooleanValue> otherCells = other.cells;
for (IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = otherCells.get(e0.index());
if (v1 == null)
ret.fastSet(e0.index(), factory.and(condition, e0.value()));
else
ret.fastSet(e0.index(), factory.ite(condition, e0.value(), v1));
}
for (IndexedEntry<BooleanValue> e1 : other.cells) {
if (!cells.containsIndex(e1.index()))
ret.fastSet(e1.index(), factory.and(condition.negation(), e1.value()));
}
BooleanValue of = factory.ite(condition, defCond().getOverflow(), other.defCond().getOverflow());
BooleanValue accumOF = factory.ite(condition, defCond().getAccumOverflow(), other.defCond().getAccumOverflow());
ret.defCond().setOverflows(of, accumOF);
return ret;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:40,代码来源:BooleanMatrix.java
示例11: LeafInterpreter
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a new LeafInterpreter using the given values.
*
* @requires lowers.keySet() = uppers.keySet()
* @ensures this.universe' = universe && this.relations' = lowers.keySet()
* && this.ints' = ints.indices && this.factory' = factory &&
* this.ubounds' = uppers && this.lbounds' = lowers &&
* this.ibounds' = ints
*/
private LeafInterpreter(Universe universe, Map<Relation,TupleSet> lowers, Map<Relation,TupleSet> uppers,
SparseSequence<TupleSet> ints, BooleanFactory factory, Map<Relation,IntRange> vars) {
this.universe = universe;
this.lowers = lowers;
this.uppers = uppers;
this.ints = ints;
this.factory = factory;
this.vars = vars;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:19,代码来源:LeafInterpreter.java
示例12: Bounds
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a Bounds object with the given factory and mappings.
*/
private Bounds(TupleFactory factory, Map<Relation, TupleSet> lower, Map<Relation, TupleSet> upper, SparseSequence<TupleSet> intbounds) {
this.factory = factory;
this.lowers = lower;
this.uppers = upper;
this.intbounds = intbounds;
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:10,代码来源:Bounds.java
示例13: BooleanMatrix
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a new matrix with the given dimensions and factory,
* backed by a sparse sequence which can most efficiently hold
* the elements storable in the sparse sequences s0 and s1.
* @ensures this.dimensions' = dimensions && this.factory' = factory &&
* this.elements' = [0..dimensions.capacity)->one FALSE
*/
private BooleanMatrix(Dimensions d, BooleanFactory f, SparseSequence<BooleanValue> s0, SparseSequence<BooleanValue> s1) {
this.dims = d;
this.factory = f;
final Class<?> c0 = s0.getClass(), c1 = s1.getClass();
if (c0!=c1 || c0==RangeSequence.class)
this.cells = new RangeSequence<BooleanValue>();
else if (c0==HomogenousSequence.class)
this.cells = new HomogenousSequence<BooleanValue>(TRUE, Ints.bestSet(d.capacity()));
else
this.cells = new TreeSequence<BooleanValue>();
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:19,代码来源:BooleanMatrix.java
示例14: and
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a new matrix such that an entry in the returned matrix represents a
* conjunction of the corresponding entries in this and other matrix. The effect
* of this method is the same as calling this.compose(ExprOperator.Binary.AND, other).
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions && m.factory = this.factory &&
* all i: [0..m.dimensions.capacity) |
* m.elements[i] = this.elements[i] AND other.elements[i] }
* @throws NullPointerException other = null
* @throws IllegalArgumentException !other.dimensions.equals(this.dimensions) || this.factory != other.factory
*/
public final BooleanMatrix and(BooleanMatrix other) {
checkFactory(this.factory, other.factory); checkDimensions(this.dims, other.dims);
final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
ret.mergeDefConds(this, other);
final SparseSequence<BooleanValue> s1 = other.cells;
for(IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = s1.get(e0.index());
if (v1!=null)
ret.fastSet(e0.index(), factory.and(e0.value(), v1));
}
return ret;
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:26,代码来源:BooleanMatrix.java
示例15: LeafInterpreter
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a new LeafInterpreter using the given values.
* @requires lowers.keySet() = uppers.keySet()
* @ensures this.universe' = universe && this.relations' = lowers.keySet() &&
* this.ints' = ints.indices && this.factory' = factory &&
* this.ubounds' = uppers && this.lbounds' = lowers &&
* this.ibounds' = ints
*/
private LeafInterpreter(Universe universe, Map<Relation, TupleSet> lowers, Map<Relation, TupleSet> uppers,
SparseSequence<TupleSet> ints, BooleanFactory factory, Map<Relation, IntRange> vars) {
this.universe = universe;
this.lowers = lowers;
this.uppers = uppers;
this.ints = ints;
this.factory = factory;
this.vars = vars;
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:LeafInterpreter.java
示例16: Bounds
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a Bounds object with the given factory and mappings.
*/
private Bounds(TupleFactory factory, Map<Relation, TupleSet> lower, Map<Relation, TupleSet> upper, SparseSequence<TupleSet> intbounds) {
this.factory = factory;
this.lowers = lower;
this.uppers = upper;
this.intbounds = intbounds;
this.relations = relations(lowers, uppers);
}
开发者ID:emina,项目名称:kodkod,代码行数:11,代码来源:Bounds.java
示例17: BooleanMatrix
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a new matrix with the given dimensions and factory,
* backed by a sparse sequence which can most efficiently hold
* the elements storable in the sparse sequences s0 and s1.
* @ensures this.dimensions' = dimensions && this.factory' = factory &&
* this.elements' = [0..dimensions.capacity)->one FALSE
*/
private BooleanMatrix(Dimensions d, BooleanFactory f, SparseSequence<BooleanValue> s0, SparseSequence<BooleanValue> s1) {
this.dims = d;
this.factory = f;
final Class<?> c0 = s0.getClass(), c1 = s1.getClass();
if (c0!=c1 || c0==RangeSequence.class)
this.cells = new RangeSequence<BooleanValue>();
else if (c0==HomogenousSequence.class)
this.cells = new HomogenousSequence<BooleanValue>(TRUE, Ints.bestSet(d.capacity()));
else
this.cells = new TreeSequence<BooleanValue>();
}
开发者ID:emina,项目名称:kodkod,代码行数:19,代码来源:BooleanMatrix.java
示例18: and
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Returns a new matrix such that an entry in the returned matrix represents a
* conjunction of the corresponding entries in this and other matrix. The effect
* of this method is the same as calling this.compose(ExprOperator.Binary.AND, other).
*
* @return { m: BooleanMatrix | m.dimensions = this.dimensions && m.factory = this.factory &&
* all i: [0..m.dimensions.capacity) |
* m.elements[i] = this.elements[i] AND other.elements[i] }
* @throws NullPointerException other = null
* @throws IllegalArgumentException !other.dimensions.equals(this.dimensions) || this.factory != other.factory
*/
public final BooleanMatrix and(BooleanMatrix other) {
checkFactory(this.factory, other.factory);
checkDimensions(this.dims, other.dims);
final BooleanMatrix ret = new BooleanMatrix(dims, factory, cells, other.cells);
final SparseSequence<BooleanValue> s1 = other.cells;
if (cells.isEmpty() || s1.isEmpty()) return ret;
for(IndexedEntry<BooleanValue> e0 : cells) {
BooleanValue v1 = s1.get(e0.index());
if (v1!=null)
ret.fastSet(e0.index(), factory.and(e0.value(), v1));
}
return ret;
}
开发者ID:emina,项目名称:kodkod,代码行数:25,代码来源:BooleanMatrix.java
示例19: Propagator
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a new propagator.
*/
private Propagator(Set<Formula> conjuncts, SparseSequence<Expression> empties, SparseSequence<IntConstant> constants) {
super(empties, constants);
this.conjuncts = conjuncts;
this.negs = new LinkedHashSet<Formula>();
for(Formula f: conjuncts) {
if (f instanceof NotFormula)
negs.add(((NotFormula)f).formula());
}
}
开发者ID:wala,项目名称:MemSAT,代码行数:13,代码来源:Propagator.java
示例20: Simplifier
import kodkod.util.ints.SparseSequence; //导入依赖的package包/类
/**
* Constructs a new simplifier that will use the given collection
* of empty expressions and integer constants. The empties sequence must map each of its indices
* to an empty expression of the same arity as the index. The constants sequence must map each of
* its indices to a Kodkod constant with the same value as the index.
*/
@SuppressWarnings("unchecked")
Simplifier(SparseSequence<Expression> empties, SparseSequence<IntConstant> constants) {
super(Collections.EMPTY_SET);
this.empties = empties;
this.constants = constants;
}
开发者ID:wala,项目名称:MemSAT,代码行数:13,代码来源:Simplifier.java
注:本文中的kodkod.util.ints.SparseSequence类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论