1 /*
2 * The baseCode project
3 *
4 * Copyright (c) 2007-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.io.excel;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 /**
25 * This class is to determine what information is put in the spreadsheet and its column position
26 *
27 * @author lfrench
28 */
29 public class SpreadSheetSchema {
30 protected Map<String, Integer> positions;
31
32 // ?geoLabel ?description ?CUI ?SUI ?mapping ?phrase ?mentionLabel
33 public SpreadSheetSchema() {
34 positions = new HashMap<String, Integer>();
35 }
36
37 public SpreadSheetSchema( Map<String, Integer> positions ) {
38 this.positions = positions;
39 }
40
41 public String[] getHeaderRow() {
42 String[] result = new String[positions.size()];
43 for ( String key : positions.keySet() ) {
44 result[positions.get( key )] = key;
45 }
46 return result;
47 }
48
49 public Integer getPosition( String varName ) {
50 return positions.get( varName );
51 }
52
53 }