1 package baseCode.dataStructure.matrix;
2
3 import java.util.Iterator;
4 import java.util.List;
5 import java.util.Vector;
6
7 /***
8 * <p>
9 * Copyright (c) 2004
10 * </p>
11 * <p>
12 * Institution:: Columbia University
13 * </p>
14 *
15 * @author Paul Pavlidis
16 * @version $Id: NamedMatrix.java,v 1.4 2005/03/18 02:53:38 pavlidis Exp $
17 */
18 public interface NamedMatrix {
19
20 /***
21 * Add a column name associated with an index.
22 *
23 * @param s String a column name
24 * @param index int the column index associated with this name
25 */
26 public void addColumnName( String s, int index );
27
28 /***
29 * Add a row name associated with a row index.
30 *
31 * @param s String
32 * @param index int
33 */
34 public void addRowName( String s, int index );
35
36 /***
37 * Get the index of a row by name..
38 *
39 * @param s String
40 * @return int
41 */
42 public int getRowIndexByName( String s );
43
44 /***
45 * Get the index of a column by name.
46 *
47 * @param s String
48 * @return int
49 */
50 public int getColIndexByName( String s );
51
52 /***
53 * Get the row name for an index
54 *
55 * @param i int
56 * @return java.lang.String
57 */
58 public String getRowName( int i );
59
60 /***
61 * Gte the column name for an index.
62 *
63 * @param i int
64 * @return java.lang.String
65 */
66 public String getColName( int i );
67
68 /***
69 * @return boolean
70 */
71 public boolean hasRowNames();
72
73 /***
74 * Check if this matrix has a valid set of column names.
75 *
76 * @return boolean
77 */
78 public boolean hasColNames();
79
80 /***
81 * @param v List a vector of Strings.
82 */
83 public void setRowNames( List v );
84
85 /***
86 * @param v List a vector of Strings.
87 */
88 public void setColumnNames( List v );
89
90 /***
91 * @return List of Strings
92 */
93 public List getColNames();
94
95 /***
96 * @return List of Strings
97 */
98 public List getRowNames();
99
100 /***
101 * @param r String
102 * @return boolean
103 */
104 public boolean hasRow( String r );
105
106 /***
107 * @return java.util.Iterator
108 */
109 public Iterator getRowNameMapIterator();
110
111 /***
112 * Get the number of rows the matrix has
113 *
114 * @return int
115 */
116 public int rows();
117
118 /***
119 * Get the number of columns the matrix has.
120 *
121 * @return int
122 */
123 public int columns();
124
125 /***
126 * Set a value in the matrix.
127 *
128 * @param i int
129 * @param j int
130 * @param val Object
131 */
132 public void set( int i, int j, Object val );
133
134 /***
135 * Get a row in the matrix as a generic Object[]. This exists so NamedMatrices can be used more generically.
136 *
137 * @param i int row
138 * @return Object[]
139 */
140 public Object[] getRowObj( int i );
141
142 /***
143 * @param i int column
144 * @return Object[]
145 */
146 public Object[] getColObj( int i );
147
148 /***
149 * Check if the value at a given index is missing.
150 *
151 * @param i row
152 * @param j column
153 * @return true if the value is missing, false otherwise.
154 */
155 public boolean isMissing( int i, int j );
156
157 /***
158 * Return the number of missing values in the matrix.
159 *
160 * @return
161 */
162 public int numMissing();
163
164 /***
165 * @param rowName
166 * @return
167 */
168 public boolean containsRowName( String rowName );
169
170 /***
171 * @param columnName
172 * @return
173 */
174 public boolean containsColumnName( String columnName );
175
176 /***
177 * @return
178 */
179
180
181
182 }