]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.layer0.utils/src/org/simantics/layer0/utils/representation/StringRepresentation2.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.layer0.utils / src / org / simantics / layer0 / utils / representation / StringRepresentation2.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.layer0.utils.representation;\r
13 \r
14 import org.simantics.db.ReadGraph;\r
15 import org.simantics.db.exception.DatabaseException;\r
16 \r
17 /**\r
18  * An interface for fetching string representations for a resource. Also\r
19  * supports handling of vector-valued resources.\r
20  * \r
21  * @author Tuukka Lehtonen\r
22  */\r
23 public interface StringRepresentation2 {\r
24 \r
25     /**\r
26      * @return a string representation of the underlying resource\r
27      */\r
28     String get(ReadGraph g) throws DatabaseException;\r
29 \r
30     /**\r
31      * If the underlying resource contains a value, this method can be used\r
32      * retrieve its array size.\r
33      * \r
34      * @return -1 if there is no value, >= 0 otherwise.\r
35      */\r
36     int getArraySize(ReadGraph g) throws DatabaseException;\r
37 \r
38     /**\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
41      * \r
42      * @param index\r
43      * @return\r
44      */\r
45     String get(ReadGraph g, int index) throws DatabaseException;\r
46 \r
47     /**\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
50      * \r
51      * @param start\r
52      * @param size\r
53      * @return\r
54      */\r
55     String get(ReadGraph g, int start, int size) throws DatabaseException;\r
56 \r
57 }\r