fable.python
Class ColumnFile

java.lang.Object
  extended by fable.python.ColumnFile

public class ColumnFile
extends java.lang.Object

This is a python module interface in java for columnfile.py. Use it to parse a file with columns

columnfile represents an ascii file with titles begining "#" and multiple lines of data. An equals sign "=" on a "#" line implies a parameter = value pair

Author:
SUCHET

Field Summary
 java.lang.String[] titles
           
 
Constructor Summary
ColumnFile()
          Class constructor
ColumnFile(FableJep jep_as_parameter)
          Class constructor column_object already exists in jep_as_parameter
ColumnFile(java.lang.String _fileName)
          Class constructor specifying file to parse.
 
Method Summary
 void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
          Add a listener to this columnFile.
 void AddUnitCell(float[] values)
           
 void displayComputedData(java.lang.String[] xyLabel)
          This method is called from transformer to display last computation i.e.
 void fireAddColumnFile()
          Sends a PropertyChangeEvent to all ColumnFile listeners when a new column is added in python object.
 void fireAddUnitCell()
          Sends a PropertyChangeEvent to ColumnFile listeners when unit cells have been added in python object.
 void fireColumnHasBeenUpdated()
          Sends a PropertyChangeEvent to all ColumnFile listeners when a column have been updated in python object.
 void fireRemoveAll()
          This methods sends an event to all ColumnFile listeners, and espacially views, to remove all dots in plot.
 float getColumnFileCell(int index, java.lang.String colName)
           
 java.lang.String getColumnfileId()
          This method returns the name of the id for a columnfile.....
 int getColumnIDIndex()
          This method is used to get the index of the column that have columnFile if.
 java.util.HashMap<java.lang.String,double[]> getColumnstoPlot()
           
 float[] getData()
           
 java.lang.String getFileName()
          Return the short file name.
 java.lang.String getFullFileName()
          Return the full file name.
 int getNCols()
           
 int getNRows()
           
 float[] getRowAt(int index)
          This method return a row at index
 float[] getSortedIndex(int columnIndex)
          This methods have been created (thanks to Jon for its help in python), to sort columns in table viewer, as it is now virtual.
 java.lang.String[] getTitles()
           
 float[] getUnitCell()
           
 void keepDots(java.lang.String key1, double key1min, double key1max, java.lang.String key2, double key2min, double key2max)
          keep all dots selected in the zone and remove others
 void keepRow(java.lang.Object[] rows, java.lang.String id)
          This methods remove selected rows from columnfile.
 void loadColumnFile(java.lang.String _fileName)
          open a new column file in the current jep Init sort index, based on the file id, or on the first column if it is not defined.
 void loadRows()
          This method load a big array of float from python object.
 void removeDots(java.lang.String key1, double key1min, double key1max, java.lang.String key2, double key2min, double key2max)
          remove all dots between these values
 void removePropertyrChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
          remove a listener from this columnFile.
 void removeRow(java.lang.Object[] idlist, java.lang.String id)
          This methods remove selected rows from columnfile.
 boolean saveColumnFile(java.lang.String filename)
          This function is used to save a column file object, for example if spots have been removed for the original file.
 void setFileName(java.lang.String name)
          For example, in transformer, colmnfile object exists in python object transformer.
 void setPythonObject(FableJep jep_as_parameter)
           
 void setSortedIndex(int index, int dir)
           
 void update()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

titles

public java.lang.String[] titles
Constructor Detail

ColumnFile

public ColumnFile()
           throws java.lang.Throwable
Class constructor

Throws:
jep.JepException
java.lang.Throwable

ColumnFile

public ColumnFile(FableJep jep_as_parameter)
           throws jep.JepException
Class constructor column_object already exists in jep_as_parameter

Parameters:
jep_as_parameter -
Throws:
jep.JepException

ColumnFile

public ColumnFile(java.lang.String _fileName)
           throws java.lang.Throwable
Class constructor specifying file to parse.

Creates a new column_object python object. Use it if you don' t have a columnfile object in your jep

Parameters:
FileName -
Throws:
jep.JepException
java.lang.Throwable
Method Detail

loadColumnFile

public void loadColumnFile(java.lang.String _fileName)
open a new column file in the current jep Init sort index, based on the file id, or on the first column if it is not defined.

Parameters:
_fileName - - name of column file to open
Throws:
jep.JepException

setFileName

public void setFileName(java.lang.String name)
For example, in transformer, colmnfile object exists in python object transformer. So we don't create a new columnfile like it is created in contructor. And filename haven' t been set.

Parameters:
name -

getFullFileName

public java.lang.String getFullFileName()
Return the full file name.

Returns:

getFileName

public java.lang.String getFileName()
Return the short file name.

Returns:

setPythonObject

public void setPythonObject(FableJep jep_as_parameter)
                     throws jep.JepException
Throws:
jep.JepException

loadRows

public void loadRows()
This method load a big array of float from python object.


getColumnfileId

public java.lang.String getColumnfileId()
This method returns the name of the id for a columnfile..... To be improved, no ?

Returns:
columnfile id (spot3d_id if file type is flt.)

getColumnIDIndex

public int getColumnIDIndex()
This method is used to get the index of the column that have columnFile if. For example, for a flt file, id=spot3d_id and index is the last column.

Returns:
the index of the column in titles[] where key = file id. If index is not found, return value is -1.

getSortedIndex

public float[] getSortedIndex(int columnIndex)
This methods have been created (thanks to Jon for its help in python), to sort columns in table viewer, as it is now virtual. In fact, the content provider ILazyContentProvider is not compatible with a sort set on the table.
Numpy module for python side of this method must have been imported previously.

Parameters:
the - index of the column to sort
Returns:
a table with sorted index

saveColumnFile

public boolean saveColumnFile(java.lang.String filename)
This function is used to save a column file object, for example if spots have been removed for the original file.

Parameters:
filename - the name of the file to save this column file object.
Returns:
true if no error occured while saving this file.

getColumnstoPlot

public java.util.HashMap<java.lang.String,double[]> getColumnstoPlot()
Returns:
A HashMap with keys for column label and double[] for values to plot.

getColumnFileCell

public float getColumnFileCell(int index,
                               java.lang.String colName)
Parameters:
index - the number of the row.
colName - the name of the column to get index.
Returns:
the value of the cell at for this index row and for this column.

update

public void update()

AddUnitCell

public void AddUnitCell(float[] values)

getUnitCell

public float[] getUnitCell()

getNRows

public int getNRows()

getNCols

public int getNCols()

getTitles

public java.lang.String[] getTitles()

addPropertyChangeListener

public void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Add a listener to this columnFile.

Parameters:
listener -

removePropertyrChangeListener

public void removePropertyrChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
remove a listener from this columnFile.

Parameters:
listener -

fireAddColumnFile

public void fireAddColumnFile()
Sends a PropertyChangeEvent to all ColumnFile listeners when a new column is added in python object.


fireColumnHasBeenUpdated

public void fireColumnHasBeenUpdated()
Sends a PropertyChangeEvent to all ColumnFile listeners when a column have been updated in python object.


fireAddUnitCell

public void fireAddUnitCell()
Sends a PropertyChangeEvent to ColumnFile listeners when unit cells have been added in python object.
This method is very specific to filtered peaks file and for their calibration.


removeDots

public void removeDots(java.lang.String key1,
                       double key1min,
                       double key1max,
                       java.lang.String key2,
                       double key2min,
                       double key2max)
                throws jep.JepException
remove all dots between these values

Parameters:
key1min - min value for key1
key1max - max value for key1
key2min - min value for key2
key2max - max value for key2
Throws:
jep.JepException

removeRow

public void removeRow(java.lang.Object[] idlist,
                      java.lang.String id)
This methods remove selected rows from columnfile.

Parameters:
idlist - a table of id selected in a tableViewer.
id - columnFile id.

keepRow

public void keepRow(java.lang.Object[] rows,
                    java.lang.String id)
This methods remove selected rows from columnfile.

Parameters:
rows - a table of id selected in a tableViewer.
id - columnFile id.

keepDots

public void keepDots(java.lang.String key1,
                     double key1min,
                     double key1max,
                     java.lang.String key2,
                     double key2min,
                     double key2max)
              throws jep.JepException
keep all dots selected in the zone and remove others

Parameters:
key1min - min value for key1
key1max - max value for key1
key2min - min value for key2
key2max - max value for key2
Throws:
jep.JepException

displayComputedData

public void displayComputedData(java.lang.String[] xyLabel)
This method is called from transformer to display last computation i.e. tth and eta

Parameters:
xyLabel -

fireRemoveAll

public void fireRemoveAll()
This methods sends an event to all ColumnFile listeners, and espacially views, to remove all dots in plot.


getData

public float[] getData()

setSortedIndex

public void setSortedIndex(int index,
                           int dir)

getRowAt

public float[] getRowAt(int index)
This method return a row at index

Parameters:
index -
Returns: