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.graph.representation.old;
14 import java.util.TreeMap;
16 import org.simantics.databoard.Bindings;
17 import org.simantics.databoard.binding.Binding;
18 import org.simantics.databoard.binding.mutable.Variant;
19 import org.simantics.databoard.serialization.Serializer;
20 import org.simantics.graph.representation.External;
21 import org.simantics.graph.representation.Identity;
22 import org.simantics.graph.representation.Internal;
23 import org.simantics.graph.representation.Root;
24 import org.simantics.graph.tests.conversion.TransferableGraph0;
28 * Transferable graph datatype.
29 * See <a href="https://www.simantics.org/wiki/index.php/Graph_exchange_format">specification</a>.
30 * @author Hannu Niemist�
32 * @deprecated superceded by {@link TransferableGraph0}
35 public class OldTransferableGraph1 {
36 public static Binding BINDING = Bindings.getBindingUnchecked(OldTransferableGraph1.class);
37 public static Serializer SERIALIZER = Bindings.getSerializerUnchecked(BINDING);
39 public int resourceCount;
40 public Identity[] identities;
41 public int[] statements;
42 public OldValue1[] values;
43 public TreeMap<String, Variant> extensions;
45 public OldTransferableGraph1() {}
47 public OldTransferableGraph1(int resourceCount, Identity[] identities,
48 int[] statements, OldValue1[] values) {
49 this(resourceCount, identities, statements, values,
50 new TreeMap<String, Variant>());
53 public OldTransferableGraph1(int resourceCount, Identity[] identities,
54 int[] statements, OldValue1[] values, TreeMap<String, Variant> extensions) {
55 this.resourceCount = resourceCount;
56 this.identities = identities;
57 this.statements = statements;
59 this.extensions = extensions;
63 System.out.println("Identities");
64 for(Identity id : identities) {
65 System.out.print(" " + id.resource + " = ");
66 if(id.definition instanceof Root) {
67 Root def = (Root)id.definition;
68 System.out.println("ROOT(" + def.name + ")");
70 else if(id.definition instanceof External) {
71 External def = (External)id.definition;
72 System.out.println("EXTERNAL(" + def.parent + ", " + def.name + ")");
74 else if(id.definition instanceof Internal) {
75 Internal def = (Internal)id.definition;
76 System.out.println("INTERNAL(" + def.parent + ", " + def.name + ")");
79 System.out.println("Statements:");
80 for(int i=0;i<statements.length;i+=4)
81 System.out.println(" " +
83 statements[i+1] + " " +
84 statements[i+2] + " " +