Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013

ch.unibe.iam.scg.archie.model
Class DataSet

java.lang.Object
  extended by ch.unibe.iam.scg.archie.model.DataSet
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<java.lang.Comparable<?>[]>

public class DataSet
extends java.lang.Object
implements java.lang.Iterable<java.lang.Comparable<?>[]>, java.lang.Cloneable

Holds objects (which implement the comparable interface) in tabular form. A List of Strings serves as table headings. Cells are denoted by their x and y coordinates. Headings have to be set before content.

IMPORTANT: The dataset's content has to be composed out of data types that implement the Comparable interface. This is to ensure that the contents of the dataset can be sorted properly.

Example Structure of a DataSet:
      | Heading1| Heading2 |
       ====================
      | Column0 | Column1  |
       --------------------
 Row0 | 0,0     | 0,1      | 
 Row1 | 1,0     | 1,1      |
 
$Id$


Constructor Summary
DataSet()
          Constructs an empty DataSet.
DataSet(java.util.List<java.lang.Comparable<?>[]> content, java.util.List<java.lang.String> headings)
          Constructs a DataSet with a list of objects arrays and a heading list.
 
Method Summary
 void addRow(java.lang.Comparable<?>[] row)
          Adds an additional row to the dataSet and fills it with the provided row content.
 DataSet clone()
           
 java.lang.Comparable<?> getCell(int x, int y)
           
 java.lang.Comparable<?>[] getColumn(int y)
           
 java.util.List<java.lang.Comparable<?>[]> getContent()
           
 java.util.List<java.lang.String> getHeadings()
           
 java.lang.Comparable<?>[] getRow(int x)
           
 boolean isEmpty()
          Checks if the dataset contains any real data or is empty.
 java.util.Iterator<java.lang.Comparable<?>[]> iterator()
           
 void setCell(int x, int y, java.lang.Comparable<?> value)
           
 void setContent(java.util.List<java.lang.Comparable<?>[]> content)
          DataSet can be empty, but not null.
 void setHeadings(java.util.List<java.lang.String> headings)
          Set headings.
 void setRow(int x, java.lang.Comparable<?>[] obj)
           
 java.lang.String toString()
          Creates a string representation of this DataSet.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSet

public DataSet()
Constructs an empty DataSet. Needs to be filled before it can be used.


DataSet

public DataSet(java.util.List<java.lang.Comparable<?>[]> content,
               java.util.List<java.lang.String> headings)
        throws java.lang.IllegalArgumentException
Constructs a DataSet with a list of objects arrays and a heading list.

Parameters:
content -
headings -
Throws:
java.lang.IllegalArgumentException
Method Detail

setCell

public void setCell(int x,
                    int y,
                    java.lang.Comparable<?> value)
Parameters:
x - Row index.
y - Column index.
value - Content.

getCell

public java.lang.Comparable<?> getCell(int x,
                                       int y)
Parameters:
x - Row index.
y - Column index.
Returns:
Comparable at specified location, null if list is empty.

getRow

public java.lang.Comparable<?>[] getRow(int x)
Parameters:
x - Row index.
Returns:
Comparable Array of specified row.

setRow

public void setRow(int x,
                   java.lang.Comparable<?>[] obj)
Parameters:
x - Row index.
obj - content.

getColumn

public java.lang.Comparable<?>[] getColumn(int y)
Parameters:
y - Column index.
Returns:
Comparable Array of specified column.

addRow

public void addRow(java.lang.Comparable<?>[] row)
Adds an additional row to the dataSet and fills it with the provided row content.

Parameters:
row - Comparable Array

iterator

public java.util.Iterator<java.lang.Comparable<?>[]> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.lang.Comparable<?>[]>
Returns:
Iterator over content.

getContent

public java.util.List<java.lang.Comparable<?>[]> getContent()
Returns:
Content

setContent

public void setContent(java.util.List<java.lang.Comparable<?>[]> content)
DataSet can be empty, but not null.

Parameters:
content -

getHeadings

public java.util.List<java.lang.String> getHeadings()
Returns:
List of table headings.

setHeadings

public void setHeadings(java.util.List<java.lang.String> headings)
Set headings. We assume that headings get set before content. Precondition checking for same row length gets done by setContent.

Parameters:
headings - List

toString

public java.lang.String toString()
Creates a string representation of this DataSet. This method is expensive and should only be used for debugging purposes.

Overrides:
toString in class java.lang.Object
Returns:
String representation of this DataSet.

isEmpty

public boolean isEmpty()
Checks if the dataset contains any real data or is empty.

Returns:
True if the dataset's content is empty, false else.

clone

public DataSet clone()
Overrides:
clone in class java.lang.Object
Returns:
a clone of this dataSet.

Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013