本文整理汇总了Java中kodkod.ast.RelationPredicate.name方法的典型用法代码示例。如果您正苦于以下问题:Java RelationPredicate.name方法的具体用法?Java RelationPredicate.name怎么用?Java RelationPredicate.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.RelationPredicate
的用法示例。
在下文中一共展示了RelationPredicate.name方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Visits the children of the predicate if this.visited(pred) returns false.
* Otherwise does nothing.
*
* @ensures pred.relation.accept(this) && (pred.name = FUNCTION =>
* pred.domain.accept(this) && pred.range.accept(this)) &&
* (pred.name = TOTAL_ORDERING => pred.ordered.accept(this) &&
* pred.first.accept(this) && pred.last.accept(this) )
*/
public void visit(RelationPredicate pred) {
if (visited(pred))
return;
pred.relation().accept(this);
if (pred.name() == RelationPredicate.Name.FUNCTION) {
final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
fp.domain().accept(this);
fp.range().accept(this);
} else if (pred.name() == RelationPredicate.Name.TOTAL_ORDERING) {
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
tp.ordered().accept(this);
tp.first().accept(this);
tp.last().accept(this);
}
}
示例2: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Calls lookup(predicate) and returns the cached value, if any. If no
* cached value exists, visits each child, caches the disjunction of the
* children's return values and returns it.
*
* @return let x = lookup(predicate) | x != null => x, cache(predicate, some
* n: predicate.children | n.accept(this))
*/
public Set<T> visit(RelationPredicate pred) {
Set<T> ret = lookup(pred);
if (ret != null)
return ret;
ret = newSet();
ret.addAll(pred.relation().accept(this));
switch (pred.name()) {
case ACYCLIC :
break;
case FUNCTION :
final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
ret.addAll(fp.domain().accept(this));
ret.addAll(fp.range().accept(this));
break;
case TOTAL_ORDERING :
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
ret.addAll(tp.ordered().accept(this));
ret.addAll(tp.first().accept(this));
ret.addAll(tp.last().accept(this));
break;
default :
throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
}
return cache(pred, ret);
}
示例3: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Calls lookup(predicate) and returns the cached value, if any. If no
* cached value exists, visits each child, caches the disjunction of the
* children's return values and returns it.
*
* @return let x = lookup(predicate) | x != null => x, cache(predicate, some
* n: predicate.children | n.accept(this))
*/
public Boolean visit(RelationPredicate predicate) {
final Boolean ret = lookup(predicate);
if (ret != null)
return ret;
if (predicate.relation().accept(this))
return cache(predicate, true);
if (predicate.name() == RelationPredicate.Name.FUNCTION) {
final RelationPredicate.Function fp = (RelationPredicate.Function) predicate;
return cache(predicate, fp.domain().accept(this) || fp.range().accept(this));
} else if (predicate.name() == RelationPredicate.Name.TOTAL_ORDERING) {
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) predicate;
return cache(predicate, tp.ordered().accept(this) || tp.first().accept(this) || tp.last().accept(this));
}
return cache(predicate, false);
}
示例4: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
public Boolean visit(RelationPredicate pred) {
Boolean ans = get(pred);
if (ans != null)
return ans;
pred.relation().accept(this);
if (pred.name() == RelationPredicate.Name.FUNCTION) {
final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
fp.domain().accept(this);
fp.range().accept(this);
} else if (pred.name() == RelationPredicate.Name.TOTAL_ORDERING) {
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
tp.ordered().accept(this);
tp.first().accept(this);
tp.last().accept(this);
}
return noHOL(pred);
}
示例5: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Calls lookup(predicate) and returns the cached value, if any.
* If no cached value exists, visits each child, caches the
* disjunction of the children's return values and returns it.
* @return let x = lookup(predicate) |
* x != null => x,
* cache(predicate, some n: predicate.children | n.accept(this))
*/
public Set<T> visit(RelationPredicate pred) {
Set<T> ret = lookup(pred);
if (ret!=null) return ret;
ret = newSet();
ret.addAll(pred.relation().accept(this));
switch(pred.name()) {
case ACYCLIC :
break;
case FUNCTION :
final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
ret.addAll(fp.domain().accept(this));
ret.addAll(fp.range().accept(this));
break;
case TOTAL_ORDERING :
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
ret.addAll(tp.ordered().accept(this));
ret.addAll(tp.first().accept(this));
ret.addAll(tp.last().accept(this));
break;
default :
throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
}
return cache(pred,ret);
}
示例6: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Calls lookup(pred) and returns the cached value, if any. If a replacement
* has not been cached, visits the formula's children. If nothing changes,
* the argument is cached and returned, otherwise a replacement formula is
* cached and returned.
*
* @return { p: RelationPredicate | p.name = pred.name && p.relation =
* pred.relation.accept(delegate) && p.name = FUNCTION =>
* p.targetMult = pred.targetMult && p.domain =
* pred.domain.accept(delegate) && p.range =
* pred.range.accept(delegate), p.name = TOTAL_ORDERING => p.ordered
* = pred.ordered.accept(delegate) && p.first =
* pred.first.accept(delegate) && p.last =
* pred.last.accept(delegate) }
*/
public Formula visit(RelationPredicate pred) {
Formula ret = lookup(pred);
if (ret != null)
return ret;
final Relation r = (Relation) pred.relation().accept(delegate);
switch (pred.name()) {
case ACYCLIC :
ret = (r == pred.relation()) ? pred : r.acyclic();
break;
case FUNCTION :
final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
final Expression domain = fp.domain().accept(delegate);
final Expression range = fp.range().accept(delegate);
ret = (r == fp.relation() && domain == fp.domain() && range == fp.range()) ? fp
: (fp.targetMult() == Multiplicity.ONE ? r.function(domain, range)
: r.partialFunction(domain, range));
break;
case TOTAL_ORDERING :
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
final Relation ordered = (Relation) tp.ordered().accept(delegate);
final Relation first = (Relation) tp.first().accept(delegate);
final Relation last = (Relation) tp.last().accept(delegate);
ret = (r == tp.relation() && ordered == tp.ordered() && first == tp.first() && last == tp.last()) ? tp
: r.totalOrder(ordered, first, last);
break;
default :
throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
}
return cache(pred, ret);
}
示例7: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* @ensures appends the tokenization of the given node to this.tokens
*/
public void visit(RelationPredicate node) {
switch (node.name()) {
case ACYCLIC :
append("acyclic");
append("[");
node.relation().accept(this);
append("]");
break;
case FUNCTION :
RelationPredicate.Function func = (RelationPredicate.Function) node;
append("function");
append("[");
func.relation().accept(this);
colon();
func.domain().accept(this);
infix("->");
keyword(func.targetMult());
func.range().accept(this);
append("]");
break;
case TOTAL_ORDERING :
RelationPredicate.TotalOrdering ord = (RelationPredicate.TotalOrdering) node;
append("ord");
append("[");
ord.relation().accept(this);
comma();
ord.ordered().accept(this);
comma();
ord.first().accept(this);
comma();
ord.last().accept(this);
append("]");
break;
default :
throw new AssertionError("unreachable");
}
}
示例8: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Calls lookup(pred) and returns the cached value, if any.
* If a replacement has not been cached, visits the formula's
* children. If nothing changes, the argument is cached and
* returned, otherwise a replacement formula is cached and returned.
* @return { p: RelationPredicate | p.name = pred.name && p.relation = pred.relation.accept(this) &&
* p.name = FUNCTION => p.targetMult = pred.targetMult &&
* p.domain = pred.domain.accept(this) &&
* p.range = pred.range.accept(this),
* p.name = TOTAL_ORDERING => p.ordered = pred.ordered.accept(this) &&
* p.first = pred.first.accept(this) &&
* p.last = pred.last.accept(this) }
*/
public Formula visit(RelationPredicate pred) {
Formula ret = lookup(pred);
if (ret!=null) return ret;
final Relation r = (Relation)pred.relation().accept(this);
switch(pred.name()) {
case ACYCLIC :
ret = (r==pred.relation()) ? pred : r.acyclic();
break;
case FUNCTION :
final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
final Expression domain = fp.domain().accept(this);
final Expression range = fp.range().accept(this);
ret = (r==fp.relation() && domain==fp.domain() && range==fp.range()) ?
fp :
(fp.targetMult()==Multiplicity.ONE ? r.function(domain, range) : r.partialFunction(domain,range));
break;
case TOTAL_ORDERING :
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
final Relation ordered = (Relation) tp.ordered().accept(this);
final Relation first = (Relation)tp.first().accept(this);
final Relation last = (Relation)tp.last().accept(this);
ret = (r==tp.relation() && ordered==tp.ordered() && first==tp.first() && last==tp.last()) ?
tp : r.totalOrder(ordered, first, last);
break;
default :
throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
}
return cache(pred,ret);
}
示例9: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Visits the children of the predicate if
* this.visited(pred) returns false. Otherwise does nothing.
* @ensures pred.relation.accept(this) &&
* (pred.name = FUNCTION => pred.domain.accept(this) && pred.range.accept(this)) &&
* (pred.name = TOTAL_ORDERING =>
* pred.ordered.accept(this) && pred.first.accept(this) && pred.last.accept(this) )
*/
public void visit(RelationPredicate pred) {
if (visited(pred)) return;
pred.relation().accept(this);
if (pred.name()==RelationPredicate.Name.FUNCTION) {
final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
fp.domain().accept(this);
fp.range().accept(this);
} else if (pred.name()==RelationPredicate.Name.TOTAL_ORDERING) {
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
tp.ordered().accept(this);
tp.first().accept(this);
tp.last().accept(this);
}
}
示例10: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/**
* Calls lookup(predicate) and returns the cached value, if any.
* If no cached value exists, visits each child, caches the
* disjunction of the children's return values and returns it.
* @return let x = lookup(predicate) |
* x != null => x,
* cache(predicate, some n: predicate.children | n.accept(this))
*/
public Boolean visit(RelationPredicate predicate) {
final Boolean ret = lookup(predicate);
if (ret!=null) return ret;
if (predicate.relation().accept(this))
return cache(predicate, true);
if (predicate.name()==RelationPredicate.Name.FUNCTION) {
final RelationPredicate.Function fp = (RelationPredicate.Function) predicate;
return cache(predicate, fp.domain().accept(this) || fp.range().accept(this));
} else if (predicate.name()==RelationPredicate.Name.TOTAL_ORDERING) {
final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) predicate;
return cache(predicate, tp.ordered().accept(this) || tp.first().accept(this) || tp.last().accept(this));
}
return cache(predicate, false);
}
示例11: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/** @ensures appends the tokenization of the given node to this.tokens */
public void visit(RelationPredicate node) {
switch(node.name()) {
case ACYCLIC :
append("acyclic");
append("[");
node.relation().accept(this);
append("]");
break;
case FUNCTION :
RelationPredicate.Function func = (RelationPredicate.Function)node;
append("function");
append("[");
func.relation().accept(this);
colon();
func.domain().accept(this);
infix("->");
keyword(func.targetMult());
func.range().accept(this);
append("]");
break;
case TOTAL_ORDERING :
RelationPredicate.TotalOrdering ord = (RelationPredicate.TotalOrdering)node;
append("ord");
append("[");
ord.relation().accept(this);
comma();
ord.ordered().accept(this);
comma();
ord.first().accept(this);
comma();
ord.last().accept(this);
append("]");
break;
default:
throw new AssertionError("unreachable");
}
}
示例12: visit
import kodkod.ast.RelationPredicate; //导入方法依赖的package包/类
/** @effects appends the tokenization of the given node to this.tokens */
public void visit(RelationPredicate node) {
if (displayed(node)) return;
final boolean oldTop = notTop();
switch(node.name()) {
case ACYCLIC :
append("acyclic");
append("[");
node.relation().accept(this);
append("]");
break;
case FUNCTION :
RelationPredicate.Function func = (RelationPredicate.Function)node;
append("function");
append("[");
func.relation().accept(this);
colon();
func.domain().accept(this);
infix("->");
keyword(func.targetMult());
func.range().accept(this);
append("]");
break;
case TOTAL_ORDERING :
RelationPredicate.TotalOrdering ord = (RelationPredicate.TotalOrdering)node;
append("ord");
append("[");
ord.relation().accept(this);
comma();
ord.ordered().accept(this);
comma();
ord.first().accept(this);
comma();
ord.last().accept(this);
append("]");
break;
default:
throw new AssertionError("unreachable");
}
top = oldTop;
}