Java Code Examples for kodkod.instance.Instance#universe()

The following examples show how to use kodkod.instance.Instance#universe() . 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: ConfigAssure.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
/**
 * Displays an instance obtained with the given options.
 *
 * @requires inst != null and opt != null
 */
private final void display(Instance inst, Options opt) {
    final Universe univ = inst.universe();
    final Evaluator eval = new Evaluator(inst, opt);
    final TupleFactory factory = univ.factory();
    final List<TupleSet> subnets = new ArrayList<TupleSet>();

    System.out.println("address\t\tnetwork id\tmask\tdevice-interface");
    for (int i = 0, ports = univ.size() - 32; i < ports; i++) {
        final Object atom = univ.atom(i);
        final Relation p = Relation.unary(atom.toString());
        inst.add(p, factory.setOf(atom));

        System.out.print(toQuad(eval.evaluate(addr(p))) + "\t");
        System.out.print(toQuad(eval.evaluate(netid(p))) + "\t");
        System.out.print(eval.evaluate(implicitMask(p)) + "\t");
        System.out.println(p);

        final TupleSet members = eval.evaluate(subnet(p));
        if (!members.isEmpty())
            subnets.add(members);
    }

    System.out.println("\nsubnets:");
    for (TupleSet sub : subnets) {
        System.out.println(sub);
    }

}
 
Example 2
Source File: LeafInterpreter.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Returns an exact leaf interpreter based on the given instance and options.
 *
 * @return some l: LeafInterpreter | l.universe = instance.universe &&
 *         l.relations = instance.relations() && l.ints = instance.ints() &&
 *         l.lbounds = l.ubounds = instance.relationTuples() && l.ibounds =
 *         instance.intTuples && l.factory =
 *         BooleanFactory.constantFactory(options) && no l.vars
 */
static final LeafInterpreter exact(Instance instance, Options options) {
    return new LeafInterpreter(instance.universe(), instance.relationTuples(), instance.intTuples(), options);
}
 
Example 3
Source File: LeafInterpreter.java    From kodkod with MIT License 2 votes vote down vote up
/**
 * Returns an exact leaf interpreter based on the given instance and options.
 * @return some l: LeafInterpreter | l.universe = instance.universe && l.relations = instance.relations() && 
 *           l.ints = instance.ints() && l.lbounds = l.ubounds = instance.relationTuples() && 
 *           l.ibounds = instance.intTuples && l.factory = BooleanFactory.constantFactory(options) && no l.vars 
 */
static final LeafInterpreter exact(Instance instance, Options options) {
	return new LeafInterpreter(instance.universe(), instance.relationTuples(), instance.intTuples(), options);
}