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