1 /*
2 * The baseCode project
3 *
4 * Copyright (c) 2008-2019 University of British Columbia
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19 package ubic.basecode.dataStructure.matrix;
20
21 import java.util.Iterator;
22 import java.util.List;
23
24 /**
25 * @author ?
26 *
27 */
28 public interface Matrix3D<R, C, S, V> {
29 /**
30 * Add a column name associated with an index.
31 *
32 * @param s a column name
33 * @param index int the column index associated with this name
34 */
35 public void addColumnName( C s, int index );
36
37 /**
38 * Add a row name associated with a row index.
39 *
40 * @param s row name
41 * @param index
42 */
43 public void addRowName( R s, int index );
44
45 /**
46 * Add a slice name
47 *
48 * @param s name of the slice
49 * @param index
50 */
51 public void addSliceName( S s, int index );
52
53 /**
54 * Get the number of columns the matrix has.
55 *
56 * @return int
57 */
58 public int columns();
59
60 /**
61 * Check if the matrix contains a column name
62 *
63 * @param colName
64 * @return true if the matrix contains the column name
65 */
66 public boolean containsColumnName( C columnName );
67
68 /**
69 * Check if the matrix contains a row name
70 *
71 * @param rowName
72 * @return true if the matrix contains the row name
73 */
74 public boolean containsRowName( R rowName );
75
76 /**
77 * Check if the matrix contains a slice name
78 *
79 * @param stripeName
80 * @return true if the matrix contains the slice name
81 */
82 public boolean containsSliceName( S sliceName );
83
84 /**
85 * Get the index of a column by name.
86 *
87 * @param s name
88 * @return column index
89 */
90 public int getColIndexByName( C s );
91
92 /**
93 * Get the column name for an index.
94 *
95 * @param i column index
96 * @return column name
97 */
98 public C getColName( int i );
99
100 public Iterator<C> getColNameIterator();
101
102 /**
103 * @return List of Object
104 */
105 public List<C> getColNames();
106
107 public V getObject( int slice, int row, int column );
108
109 /**
110 * Get the index of a row by name.
111 *
112 * @param s name
113 * @return row index
114 */
115 public int getRowIndexByName( R s );
116
117 /**
118 * Get the row name for an index
119 *
120 * @param i row index
121 * @return name of the row
122 */
123 public R getRowName( int i );
124
125 /**
126 * @return java.util.Iterator
127 */
128 public Iterator<R> getRowNameIterator();
129
130 /**
131 * @return List of Object
132 */
133 public List<R> getRowNames();
134
135 /**
136 * Get a slice index
137 *
138 * @param s name
139 * @return slice index
140 */
141 public int getSliceIndexByName( S s );
142
143 /**
144 * Get a slice name
145 *
146 * @param i index
147 * @return slice name
148 */
149 public S getSliceName( int i );
150
151 public Iterator<S> getSliceNameIterator();
152
153 public List<S> getSliceNames();
154
155 /**
156 * Check if this matrix has a valid set of column names.
157 *
158 * @return boolean
159 */
160 public boolean hasColNames();
161
162 /**
163 * @param r row name
164 * @return whether the row exists
165 */
166 public boolean hasRow( R r );
167
168 /**
169 * @return boolean
170 */
171 public boolean hasRowNames();
172
173 public boolean hasSliceNames();
174
175 /**
176 * Check if the value at a given index is missing.
177 *
178 * @param slice
179 * @param row
180 * @param column
181 * @return true if the value is missing, false otherwise.
182 */
183 public boolean isMissing( int slice, int row, int column );
184
185 /**
186 * Return the number of missing values in the matrix.
187 *
188 * @return number missing
189 */
190 public int numMissing();
191
192 /**
193 * Get the number of rows the matrix has
194 *
195 * @return int
196 */
197 public int rows();
198
199 /**
200 * @param v List a vector of Strings.
201 */
202 public void setColumnNames( List<C> v );
203
204 /**
205 * @param v List a vector of Strings.
206 */
207 public void setRowNames( List<R> v );
208
209 public void setSliceNames( List<S> v );
210
211 public int slices();
212
213 }