1 4 package com.openedit.store.excelconvert; 5 6 import java.util.HashMap ; 7 import java.util.Iterator ; 8 import java.util.Map ; 9 10 public class Header 11 { 12 protected Map fieldHeaderNames; 13 14 public Map getHeaderNames() 15 { 16 if (fieldHeaderNames == null) 17 { 18 fieldHeaderNames = new HashMap (); 19 } 20 return fieldHeaderNames; 21 } 22 public void setHeaders(String [] inHeaders) 23 { 24 for (int i = 0; i < inHeaders.length; i++) 25 { 26 Integer integer = new Integer (i); 27 getHeaderNames().put(integer,inHeaders[i]); 28 } 29 } 30 31 public int getIndex(String inName) 32 { 33 Map headerNames = getHeaderNames(); 34 for (Iterator iter = headerNames.keySet().iterator(); iter.hasNext();) 35 { 36 Integer index = (Integer )iter.next(); 37 String name = (String ) headerNames.get(index); 38 if ( name.equals(inName)) 39 { 40 return index.intValue(); 41 } 42 } 43 return -1; 44 } 45 public String getColumn(int inIndex) 46 { 47 String name = (String )getHeaderNames().get(new Integer (inIndex)); 48 if ( name != null) 49 { 50 return name; 51 } 52 return null; 53 } 54 public int getSize() 55 { 56 return getHeaderNames().size(); 57 } 58 public void addCol(int inCol, String inStringCellValue) 59 { 60 Integer integer = new Integer (inCol); 61 getHeaderNames().put(integer,inStringCellValue); 62 63 } 64 65 } 66 | Popular Tags |