View Javadoc

1   /*$Id: MutableScriptStarTable.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.RowListStarTable;
18  import uk.ac.starlink.table.StarTable;
19  
20  /*** Extension of the standard starlink read-write table that supports the extra scripting methods.
21   * See RowListStarTable javadoc <a href="http://www.star.bristol.ac.uk/~mbt/stil/javadocs/uk/ac/starlink/table/RowListStarTable.html">http://www.star.bristol.ac.uk/~mbt/stil/javadocs/uk/ac/starlink/table/RowListStarTable.html</a>
22   * @author Noel Winstanley nw@jb.man.ac.uk 07-Dec-2004
23   *
24   */
25  public class MutableScriptStarTable extends RowListStarTable implements
26          ScriptStarTable {
27  
28      public ScriptStarTable addColumn(ColumnInfo meta, Object colValue) {
29          return this.methods.addColumn(meta, colValue); 
30      }
31      public MutableScriptStarTable asMutableTable() throws IOException {
32          return this.methods.asMutableTable();
33      }
34      public Iterator columnIterator(int col) throws IOException {
35          return this.methods.columnIterator(col);
36      }
37      public Iterator iterator() throws IOException {
38          return this.methods.iterator();
39      } 
40      public ScriptStarTable removeColumn(int index) {
41          return this.methods.removeColumn(index);
42      }
43      /*** Construct a new MutableScriptStarTable
44       * @param arg0
45       */
46      public MutableScriptStarTable(ColumnInfo[] arg0) {
47          super(arg0);
48      }
49  
50      /*** Construct a new MutableScriptStarTable
51       * @param arg0
52       */
53      public MutableScriptStarTable(StarTable arg0) {
54          super(arg0);
55      }
56      protected final ExtraTableMethods methods = new ExtraTableMethodsImpl() {
57          public MutableScriptStarTable asMutableTable() {//oberridden - returns self.
58              return MutableScriptStarTable.this;
59          }
60          protected StarTable getTable() {
61              return MutableScriptStarTable.this;
62          }
63      };
64  
65  
66  }
67  
68  
69  /* 
70  $Log: MutableScriptStarTable.java,v $
71  Revision 1.2  2004/12/07 16:50:33  jdt
72  merges from scripting-nww-805
73  
74  Revision 1.1.2.1  2004/12/07 14:47:58  nw
75  got table manipulation working.
76   
77  */