1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.layer0.utils.representation;
\r
14 import org.simantics.db.ReadGraph;
\r
15 import org.simantics.db.exception.DatabaseException;
\r
18 * An interface for fetching string representations for a resource. Also
\r
19 * supports handling of vector-valued resources.
\r
21 * @author Tuukka Lehtonen
\r
23 public interface StringRepresentation2 {
\r
26 * @return a string representation of the underlying resource
\r
28 String get(ReadGraph g) throws DatabaseException;
\r
31 * If the underlying resource contains a value, this method can be used
\r
32 * retrieve its array size.
\r
34 * @return -1 if there is no value, >= 0 otherwise.
\r
36 int getArraySize(ReadGraph g) throws DatabaseException;
\r
39 * If the underlying resource contains a value, this method can be used to
\r
40 * get a string representation of one of its indices.
\r
45 String get(ReadGraph g, int index) throws DatabaseException;
\r
48 * If the underlying resource contains a value, this method can be used to
\r
49 * get a string representation of the specified sequential range of indices.
\r
55 String get(ReadGraph g, int start, int size) throws DatabaseException;
\r