1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.mapping.constraint.instructions;
14 import gnu.trove.map.hash.TIntIntHashMap;
15 import gnu.trove.set.hash.TIntHashSet;
17 import org.simantics.db.ReadGraph;
18 import org.simantics.db.WriteGraph;
19 import org.simantics.mapping.IContextualModification;
21 public class PrintStateInstruction implements IInstruction {
24 public PrintStateInstruction(String position) {
25 this.position = position;
28 private void print(ReadGraph g, Object[] bindings) {
29 System.out.print(position + ": ");
31 for(Object obj : bindings) {
35 System.out.print(", ");
36 System.out.print(obj);
42 public Object query(ReadGraph g, Object[] bindings) {
48 public Object next(ReadGraph g, Object[] bindings, Object continuation) {
49 return IInstruction.FAILURE;
53 public IContextualModification claim(ReadGraph g, Object[] bindings) {
59 public IContextualModification deny(ReadGraph g, Object[] bindings) {
65 public void doClaim(WriteGraph g, Object[] bindings) {
70 public void doDeny(WriteGraph g, Object[] bindings) {
75 public void collectVariables(TIntHashSet reads, TIntHashSet writes) {
76 /* Because this instruction is for debugging, it doesn't affect
77 to the set of read variables. */
81 public void mapVariables(TIntIntHashMap map) {
85 public void toString(StringBuilder b, int indent) {