• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConstantExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中kodkod.ast.ConstantExpression的典型用法代码示例。如果您正苦于以下问题:Java ConstantExpression类的具体用法?Java ConstantExpression怎么用?Java ConstantExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: interpret

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Returns a {@link kodkod.engine.bool.BooleanMatrix matrix} m of
 * {@link kodkod.engine.bool.BooleanValue boolean formulas} representing the
 * specified constant expression.
 * 
 * @return { m: BooleanMatrix | let dset = [0..this.universe.size()^c.arity)
 *         | m.dimensions.dimensions = [0..c.arity) ->one
 *         this.universe.size() && c = UNIV => m.elements[dset] = TRUE, c =
 *         NONE => m.elements[dset] = FALSE, c = IDEN => (all i: dset |
 *         (some j: int | i = j*(1+this.universe.size())) => m.elements[i] =
 *         TRUE, m.elements[i] = FALSE), c = INT => (all i: dset | (some j:
 *         int | this.interpret(j)=i) => m.elements[i] = TRUE, m.elements[i]
 *         = FALSE }
 */
public final BooleanMatrix interpret(ConstantExpression c) {
	final int univSize = universe().size();
	if (c == Expression.UNIV) {
		final IntSet all = Ints.rangeSet(Ints.range(0, univSize - 1));
		return factory().matrix(Dimensions.square(univSize, 1), all, all);
	} else if (c == Expression.IDEN) {
		final Dimensions dim2 = Dimensions.square(univSize, 2);
		final IntSet iden = Ints.bestSet(dim2.capacity());
		for (int i = 0; i < univSize; i++) {
			iden.add(i * univSize + i);
		}
		return factory().matrix(dim2, iden, iden);
	} else if (c == Expression.NONE) {
		return factory().matrix(Dimensions.square(univSize, 1), Ints.EMPTY_SET, Ints.EMPTY_SET);
	} else if (c == Expression.INTS) {
		final IntSet ints = Ints.bestSet(univSize);
		for (IntIterator iter = ints().iterator(); iter.hasNext();) {
			ints.add(interpret(iter.next()));
		}
		return factory().matrix(Dimensions.square(univSize, 1), ints, ints);
	} else {
		throw new IllegalArgumentException("unknown constant expression: " + c);
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:39,代码来源:LeafInterpreter.java


示例2: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Calls lookup(unaryExpr) and returns the cached value, if any. If a
 * translation has not been cached, translates the expression, calls
 * cache(...) on it and returns it.
 * 
 * @return let t = lookup(unaryExpr) | some t => t, let op =
 *         (unaryExpr.op).(TRANSPOSE->transpose + CLOSURE->closure +
 *         REFLEXIVE_CLOSURE->(lambda(m)(m.closure().or(iden))) |
 *         cache(unaryExpr, op(unaryExpr.child))
 */
public final BooleanMatrix visit(UnaryExpression unaryExpr) {
	BooleanMatrix ret = lookup(unaryExpr);
	if (ret != null)
		return ret;

	final BooleanMatrix child = unaryExpr.expression().accept(this);
	final ExprOperator op = unaryExpr.op();

	switch (op) {
		case TRANSPOSE :
			ret = child.transpose();
			break;
		case CLOSURE :
			ret = child.closure();
			break;
		case REFLEXIVE_CLOSURE :
			ret = child.closure().or(visit((ConstantExpression) Expression.IDEN));
			break;
		default :
			throw new IllegalArgumentException("Unknown operator: " + op);
	}
	return cache(unaryExpr, ret);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:34,代码来源:FOL2BoolTranslator.java


示例3: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ConstantExpression x) {
	if (map.containsKey(x))
		return;
	String newname = null;
	if (x == Expression.NONE)
		newname = "Expression.NONE";
	else if (x == Expression.UNIV)
		newname = "Expression.UNIV";
	else if (x == Expression.IDEN)
		newname = "Expression.IDEN";
	else if (x == Expression.INTS)
		newname = "Expression.INTS";
	else
		throw new RuntimeException("Unknown kodkod ConstantExpression \"" + x + "\" encountered");
	map.put(x, newname);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:18,代码来源:TranslateKodkodToJava.java


示例4: interpret

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Returns a {@link kodkod.engine.bool.BooleanMatrix matrix} m of 
 * {@link kodkod.engine.bool.BooleanValue boolean formulas} representing
 * the specified constant expression.    
 * @return { m: BooleanMatrix | let dset = [0..this.universe.size()^c.arity) | 
 *           m.dimensions.dimensions = [0..c.arity) ->one this.universe.size() && 
 *           c = UNIV => m.elements[dset] = TRUE, c = NONE => m.elements[dset] = FALSE,
 *           c = IDEN => (all i: dset | (some j: int | i = j*(1+this.universe.size())) => m.elements[i] = TRUE, m.elements[i] = FALSE),
 *           c = INT => (all i: dset | (some j: int | this.interpret(j)=i) => m.elements[i] = TRUE, m.elements[i] = FALSE }
 */
public final BooleanMatrix interpret(ConstantExpression c) {
	final int univSize = universe().size();
	if (c==Expression.UNIV) {
		final IntSet all =  Ints.rangeSet(Ints.range(0, univSize-1));
		return factory().matrix(Dimensions.square(univSize, 1), all, all);
	} else if (c==Expression.IDEN) {
		final Dimensions dim2 = Dimensions.square(univSize, 2);
		final IntSet iden = Ints.bestSet(dim2.capacity());
		for(int i = 0; i < univSize; i++) {
			iden.add(i*univSize + i);
		}			
		return factory().matrix(dim2, iden, iden);
	} else if (c==Expression.NONE) {
		return factory().matrix(Dimensions.square(univSize, 1), Ints.EMPTY_SET, Ints.EMPTY_SET);
	} else if (c==Expression.INTS) {
		final IntSet ints = Ints.bestSet(univSize);
		for(IntIterator iter = ints().iterator(); iter.hasNext(); ) {
			ints.add(interpret(iter.next()));
		}
		return factory().matrix(Dimensions.square(univSize, 1), ints, ints);
	} else {
		throw new IllegalArgumentException("unknown constant expression: " + c);
	}
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:35,代码来源:LeafInterpreter.java


示例5: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Calls lookup(unaryExpr) and returns the cached value, if any.  
 * If a translation has not been cached, translates the expression,
 * calls cache(...) on it and returns it.
 * @return let t = lookup(unaryExpr) | some t => t, 
 *      let op = (unaryExpr.op).(TRANSPOSE->transpose + CLOSURE->closure + REFLEXIVE_CLOSURE->(lambda(m)(m.closure().or(iden))) | 
 *       cache(unaryExpr, op(unaryExpr.child))
 */
public final BooleanMatrix visit(UnaryExpression unaryExpr) {
	BooleanMatrix ret = lookup(unaryExpr);
	if (ret!=null) return ret;

	final BooleanMatrix child = unaryExpr.expression().accept(this);
	final ExprOperator op = unaryExpr.op();

	switch(op) {
	case TRANSPOSE         	: ret = child.transpose(); break;
	case CLOSURE           	: ret = child.closure(); break;
	case REFLEXIVE_CLOSURE	: ret = child.closure().or(visit((ConstantExpression)Expression.IDEN)); break;
	default : 
		throw new IllegalArgumentException("Unknown operator: " + op);
	}
	return cache(unaryExpr,ret);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:25,代码来源:FOL2BoolTranslator.java


示例6: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ConstantExpression x) {
    if (map.containsKey(x)) return;
    String newname=null;
    if (x==Expression.NONE) newname="Expression.NONE";
       else if (x==Expression.UNIV) newname="Expression.UNIV";
       else if (x==Expression.IDEN) newname="Expression.IDEN";
       else if (x==Expression.INTS) newname="Expression.INTS";
       else throw new RuntimeException("Unknown kodkod ConstantExpression \""+x+"\" encountered");
    map.put(x,newname);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:TranslateKodkodToJava.java


示例7: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public E visit(ConstantExpression constExpr) {
	start(constExpr);
	return end(constExpr, visitor.visit(constExpr));
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:6,代码来源:AspectReturnVisitor.java


示例8: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visit(ConstantExpression constExpr) {
	return constExpr;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:HOLTranslator.java


示例9: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** @ensures this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantExpression node) {
	append(node);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:PrettyPrinter.java


示例10: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
public Boolean visit(ConstantExpression constExpr) {
	return noHOL(constExpr);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:4,代码来源:AnnotatedNode.java


示例11: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Returns Collections.EMPTY_SET
 * @return Collections.EMPTY_SET
 */
@SuppressWarnings("unchecked")
public Set<T> visit(ConstantExpression constExpr) {
	return Collections.EMPTY_SET;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:9,代码来源:AbstractCollector.java


示例12: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** @ensures this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantExpression node) { append(node); }
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:3,代码来源:PrettyPrinter.java


示例13: visitIdent

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visitIdent() {
    return ConstantExpression.IDEN;
}
 
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:5,代码来源:ConstRel2KKConst.java


示例14: visitUniv

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visitUniv() {
    return ConstantExpression.UNIV;
}
 
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:5,代码来源:ConstRel2KKConst.java


示例15: visitNone

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visitNone() {
    return ConstantExpression.NONE;
}
 
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:5,代码来源:ConstRel2KKConst.java


示例16: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** @effects this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantExpression node) { append(node); }
 
开发者ID:wala,项目名称:MemSAT,代码行数:3,代码来源:PrettyPrinter.java


示例17: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Visits the given constant expression.
 **/
public void visit(ConstantExpression constExpr);
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:VoidVisitor.java


示例18: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Calls lookup(constExpr) and returns the cached value, if any. If a
 * replacement has not been cached, the constExpr is cached and returned.
 * 
 * @return constExpr
 */
public Expression visit(ConstantExpression constExpr) {
	final Expression ret = lookup(constExpr);
	return ret == null ? cache(constExpr, constExpr) : constExpr;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:11,代码来源:AbstractReplacer.java


示例19: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Does nothing.
 */
public void visit(ConstantExpression constExpr) {}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:AbstractVoidVisitor.java


示例20: visit

import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
 * Visits the given constant expression and returns the result.
 * 
 * @return the result of visiting <code>constExpr</code>
 **/
public E visit(ConstantExpression constExpr);
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:7,代码来源:ReturnVisitor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExecutionList类代码示例发布时间:2022-05-22
下一篇:
Java IJIDispatch类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap