View Javadoc
1   /**
2    * Copyright (C) 2010-14 pvmanager developers. See COPYRIGHT.TXT
3    * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4    */
5   package org.epics.vtype;
6   
7   import java.util.List;
8   import org.epics.util.array.ListNumber;
9   
10  /**
11   * A table. Tables are collections of columns, each of which is composed
12   * of a String representing the name of the column and a list of a particular
13   * type (all elements of the same column must be of the same type).
14   *
15   * @author carcassi
16   */
17  public interface VTable extends VType {
18  
19      /**
20       * The number of columns in the table.
21       *
22       * @return the number of columns
23       */
24      int getColumnCount();
25      
26      /**
27       * The number of rows in the table.
28       * <p>
29       * Currently, it is not clear whether all columns actually have the same
30       * number of rows, that is if all arrays have the same length. In the
31       * case of variable row, this will return the maximum row count, that is
32       * the length of the longest array/column.
33       * 
34       * @return the number of rows
35       */
36      int getRowCount();
37  
38      /**
39       * The type of the elements in the column. The column array will be
40       * an array of the given type. For primitive types, this function will return
41       * the TYPE class (such as {@link Double#TYPE}, while {@link #getColumnData(int) }
42       * will return a {@link ListNumber}.
43       *
44       * @param column the column index
45       * @return the type of this column
46       */
47      Class<?> getColumnType(int column);
48  
49      /**
50       * The name of the given column.
51       *
52       * @param column the column index
53       * @return the name of the column
54       */
55      String getColumnName(int column);
56  
57      /**
58       * The data for the given column.
59       * <p>
60       * The data is going to be a {@link List} in case of objects
61       * or a {@link ListNumber} in case of a numeric primitive.
62       *
63       * @param column the column index
64       * @return the data of the column
65       */
66      Object getColumnData(int column);
67  }