View Javadoc

1   /*$Id: WrapperScriptStarTable.java,v 1.2 2004/12/07 16:50:33 jdt Exp $
2    * Created on 07-Dec-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10  **/
11  package org.astrogrid.scripting.table;
12  
13  import java.io.IOException;
14  import java.util.Iterator;
15  
16  import uk.ac.starlink.table.ColumnInfo;
17  import uk.ac.starlink.table.StarTable;
18  import uk.ac.starlink.table.WrapperStarTable;
19  
20  /*** wrap an existing StarTable to make it a script star table.
21   * uses the multiple-inheritance trick to reuse the definition of the extra methods.
22   * @author Noel Winstanley nw@jb.man.ac.uk 07-Dec-2004
23   *
24   */
25  class WrapperScriptStarTable extends WrapperStarTable implements
26          ScriptStarTable {
27  
28      /*** Construct a new WrapperScriptStarTable
29       * @param arg0
30       */
31      public WrapperScriptStarTable(StarTable arg0) {
32          super(arg0);
33      }
34  
35      protected final ExtraTableMethods methods = new ExtraTableMethodsImpl() {
36  
37          protected StarTable getTable() {
38              return WrapperScriptStarTable.this;
39          }
40      };
41  
42      public ScriptStarTable addColumn(ColumnInfo meta, Object colValue) {
43          return this.methods.addColumn(meta, colValue);
44      }
45      public MutableScriptStarTable asMutableTable() throws IOException {
46          return this.methods.asMutableTable();
47      }
48      public Iterator columnIterator(int col) throws IOException {
49          return this.methods.columnIterator(col);
50      }
51      public Iterator iterator() throws IOException {
52          return this.methods.iterator();
53      }
54      public ScriptStarTable removeColumn(int index) {
55          return this.methods.removeColumn(index);
56      }
57  }
58  
59  
60  /* 
61  $Log: WrapperScriptStarTable.java,v $
62  Revision 1.2  2004/12/07 16:50:33  jdt
63  merges from scripting-nww-805
64  
65  Revision 1.1.2.1  2004/12/07 14:47:58  nw
66  got table manipulation working.
67   
68  */