kodkod.ast.ConstantFormula Java Examples

The following examples show how to use kodkod.ast.ConstantFormula. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrettyPrinter.java    From kodkod with MIT License 5 votes vote down vote up
private void edge(Node n1, Node n2) { 
	if (n2 instanceof LeafExpression || n2 instanceof ConstantFormula || n2 instanceof IntConstant) {
		
	}
	graph.append(id(n1));
	graph.append("->");
	graph.append(id(n2));
	graph.append(";\n");
}
 
Example #2
Source File: TranslateKodkodToJava.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void visit(ConstantFormula x) {
    if (map.containsKey(x))
        return;
    String newname = (x.booleanValue() ? "Formula.TRUE" : "Formula.FALSE");
    map.put(x, newname);
}
 
Example #3
Source File: PrettyPrinter.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
private void edge(Node n1, Node n2) {
    if (n2 instanceof LeafExpression || n2 instanceof ConstantFormula || n2 instanceof IntConstant) {

    }
    graph.append(id(n1));
    graph.append("->");
    graph.append(id(n2));
    graph.append(";\n");
}
 
Example #4
Source File: AnnotatedNode.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visit(ConstantFormula cnst) {
    return noHOL(cnst);
}
 
Example #5
Source File: PrettyPrinter.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
/** @return true if the given formula should be parenthesized when a 
 * child of a compound parent */
private boolean parenthesize(Formula child) { 
	return !(child instanceof NotFormula || child instanceof ConstantFormula || 
			 child instanceof RelationPredicate);
}
 
Example #6
Source File: PrettyPrinter.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
/** @effects this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantFormula node) { append(node); }
 
Example #7
Source File: PrettyPrinter.java    From kodkod with MIT License 4 votes vote down vote up
/** @return true if the given formula should be parenthesized when a 
 * child of a compound parent */
private boolean parenthesize(Formula child) { 
	return !(child instanceof NotFormula || child instanceof ConstantFormula || 
			 child instanceof RelationPredicate);
}
 
Example #8
Source File: PrettyPrinter.java    From kodkod with MIT License 4 votes vote down vote up
/** @ensures this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantFormula node) { append(node); }
 
Example #9
Source File: FormulaFlattener.java    From kodkod with MIT License 4 votes vote down vote up
/** @see #visitFormula(Formula) */
public final void visit(ConstantFormula constant)	{ visitFormula(constant); }
 
Example #10
Source File: FOL2BoolTranslator.java    From kodkod with MIT License 4 votes vote down vote up
/**
 * @return constant = ConstantFormula.TRUE => BooleanConstant.TRUE, BooleanConstant.FALSE
 */
public final BooleanValue visit(ConstantFormula constant) {
	return cache(constant, BooleanConstant.constant(constant.booleanValue()));
}
 
Example #11
Source File: TrivialProof.java    From kodkod with MIT License 4 votes vote down vote up
public void visit(ConstantFormula formula) { 
	relevant.add(formula);
}
 
Example #12
Source File: AbstractCollector.java    From kodkod with MIT License 4 votes vote down vote up
/**
 * Returns Collections.EMPTY_SET
 * @return Collections.EMPTY_SET
 */
@SuppressWarnings("unchecked")
public Set<T> visit(ConstantFormula constant) {
	return Collections.EMPTY_SET;
}
 
Example #13
Source File: AspectReturnVisitor.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
@Override
public F visit(ConstantFormula constant) {
    start(constant);
    return end(constant, visitor.visit(constant));
}
 
Example #14
Source File: PrettyPrinter.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(ConstantFormula constant) {
    visit(constant, constant.booleanValue());
}
 
Example #15
Source File: PrettyPrinter.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
/** @ensures this.tokens' = concat[ this.tokens, node ] */
@Override
public void visit(ConstantFormula node) {
    append(node);
}
 
Example #16
Source File: HOLTranslator.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
@Override
public Proc visit(ConstantFormula constant) {
    return new Proc.FOL(bounds, constant);
}
 
Example #17
Source File: FormulaFlattener.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
/** @see #visitFormula(Formula) */
@Override
public final void visit(ConstantFormula constant) {
    visitFormula(constant);
}
 
Example #18
Source File: FOL2BoolTranslator.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
/**
 * @return constant = ConstantFormula.TRUE => BooleanConstant.TRUE,
 *         BooleanConstant.FALSE
 */
@Override
public final BooleanValue visit(ConstantFormula constant) {
    return cache(constant, BooleanConstant.constant(constant.booleanValue()));
}
 
Example #19
Source File: AbstractCollector.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
/**
 * Returns Collections.EMPTY_SET
 *
 * @return Collections.EMPTY_SET
 */
@Override
@SuppressWarnings("unchecked" )
public Set<T> visit(ConstantFormula constant) {
    return Collections.EMPTY_SET;
}
 
Example #20
Source File: FullNegationPropagator.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
/** @see #visitFormula(Formula) */
@Override
public final void visit(ConstantFormula constant) {
    visitFormula(constant);
}
 
Example #21
Source File: TrivialProof.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(ConstantFormula formula) {
    relevant.add(formula);
}
 
Example #22
Source File: VoidVisitor.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Visits the given constant formula.
 **/
public void visit(ConstantFormula constant);
 
Example #23
Source File: PrettyPrinter.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * @return true if the given formula should be parenthesized when a child of a
 *         compound parent
 */
private boolean parenthesize(Formula child) {
    return !(child instanceof NotFormula || child instanceof ConstantFormula || child instanceof RelationPredicate);
}
 
Example #24
Source File: AbstractReplacer.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Calls lookup(constant) and returns the cached value, if any. If a replacement
 * has not been cached, the constant is cached and returned.
 *
 * @return constant
 */
@Override
public Formula visit(ConstantFormula constant) {
    final Formula ret = lookup(constant);
    return ret == null ? cache(constant, constant) : constant;
}
 
Example #25
Source File: AbstractVoidVisitor.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Does nothing.
 */
@Override
public void visit(ConstantFormula constant) {}
 
Example #26
Source File: ReturnVisitor.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Visits the given constant formula and returns the result.
 *
 * @return the result of visiting <code>constant</code>
 **/
public F visit(ConstantFormula constant);
 
Example #27
Source File: AbstractDetector.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Returns FALSE.
 *
 * @return FALSE
 */
@Override
public Boolean visit(ConstantFormula constant) {
    return Boolean.FALSE;
}
 
Example #28
Source File: AbstractDetector.java    From kodkod with MIT License 2 votes vote down vote up
/**
 * Returns FALSE.
 * @return FALSE
 */
public Boolean visit(ConstantFormula constant) { return Boolean.FALSE; }
 
Example #29
Source File: ReturnVisitor.java    From kodkod with MIT License 2 votes vote down vote up
/** 
* Visits the given constant formula and returns the result.
* @return the result of visiting <code>constant</code> 
**/
  public F visit(ConstantFormula constant);
 
Example #30
Source File: AbstractVoidVisitor.java    From kodkod with MIT License 2 votes vote down vote up
/**
 * Does nothing.
 */
public void visit(ConstantFormula constant) {}