SciDAVis  1.D4
Classes | Public Member Functions | Private Slots | Private Attributes | Friends
Column Class Reference

Aspect that manages a column. More...

#include <Column.h>

Inheritance diagram for Column:
AbstractColumn AbstractAspect

List of all members.

Classes

class  Private
 Private data class of Column. More...

Public Member Functions

ColumnStringIOasStringColumn () const
 Return a wrapper column object used for String I/O.
void clear ()
 Clear the whole column.
 Column (const QString &name, SciDAVis::ColumnMode mode)
 Ctor.
 Column (const QString &name, QVector< qreal > data, IntervalAttribute< bool > validity=IntervalAttribute< bool >())
 Ctor.
 Column (const QString &name, QStringList data, IntervalAttribute< bool > validity=IntervalAttribute< bool >())
 Ctor.
 Column (const QString &name, QList< QDateTime > data, IntervalAttribute< bool > validity=IntervalAttribute< bool >())
 Ctor.
SciDAVis::ColumnMode columnMode () const
 Return the column mode.
bool copy (const AbstractColumn *other)
 Copy another column of the same type.
bool copy (const AbstractColumn *source, int source_start, int dest_start, int num_rows)
 Copies a part of another column of the same type.
SciDAVis::ColumnDataType dataType () const
 Return the data type of the column.
void insertRows (int before, int count)
 Insert some empty (or initialized with zero) rows.
bool isReadOnly () const
 Return whether the object is read-only.
void notifyReplacement (const AbstractColumn *replacement)
 This must be called before the column is replaced by another.
AbstractSimpleFilteroutputFilter () const
 Return the output filter (for data type -> string conversion)
SciDAVis::PlotDesignation plotDesignation () const
 Return the column plot designation.
void removeRows (int first, int count)
 Remove 'count' rows starting from row 'first'.
int rowCount () const
 Return the data vector size.
void setColumnMode (SciDAVis::ColumnMode mode, AbstractFilter *conversion_filter=0)
 Set the column mode.
void setPlotDesignation (SciDAVis::PlotDesignation pd)
 Set the column plot designation.
 ~Column ()
 Dtor.
aspect related functions
virtual QIcon icon () const
 Return an icon to be used for decorating the views and table column headers.
IntervalAttribute related functions
bool isInvalid (int row) const
 Return whether a certain row contains an invalid value.
bool isInvalid (Interval< int > i) const
 Return whether a certain interval of rows contains only invalid values.
QList< Interval< int > > invalidIntervals () const
 Return all intervals of invalid rows.
bool isMasked (int row) const
 Return whether a certain row is masked.
bool isMasked (Interval< int > i) const
 Return whether a certain interval of rows rows is fully masked.
QList< Interval< int > > maskedIntervals () const
 Return all intervals of masked rows.
void clearValidity ()
 Clear all validity information.
void clearMasks ()
 Clear all masking information.
void setInvalid (Interval< int > i, bool invalid=true)
 Set an interval invalid or valid.
void setInvalid (int row, bool invalid=true)
 Overloaded function for convenience.
void setMasked (Interval< int > i, bool mask=true)
 Set an interval masked.
void setMasked (int row, bool mask=true)
 Overloaded function for convenience.
Formula related functions
QString formula (int row) const
 Return the formula associated with row 'row'.
QList< Interval< int > > formulaIntervals () const
 Return the intervals that have associated formulas.
void setFormula (Interval< int > i, QString formula)
 Set a formula string for an interval of rows.
void setFormula (int row, QString formula)
 Overloaded function for convenience.
void clearFormulas ()
 Clear all formulas.
type specific functions
QString textAt (int row) const
 Return the content of row 'row'.
void setTextAt (int row, const QString &new_value)
 Set the content of row 'row'.
void replaceTexts (int first, const QStringList &new_values)
 Replace a range of values.
QDate dateAt (int row) const
 Return the date part of row 'row'.
void setDateAt (int row, const QDate &new_value)
 Set the content of row 'row'.
QTime timeAt (int row) const
 Return the time part of row 'row'.
void setTimeAt (int row, const QTime &new_value)
 Set the content of row 'row'.
QDateTime dateTimeAt (int row) const
 Return the QDateTime in row 'row'.
void setDateTimeAt (int row, const QDateTime &new_value)
 Set the content of row 'row'.
void replaceDateTimes (int first, const QList< QDateTime > &new_values)
 Replace a range of values.
double valueAt (int row) const
 Return the double value in row 'row'.
void setValueAt (int row, double new_value)
 Set the content of row 'row'.
virtual void replaceValues (int first, const QVector< qreal > &new_values)
 Replace a range of values.
- Public Member Functions inherited from AbstractColumn
 AbstractColumn (const QString &name)
 Ctor.
virtual void setColumnMode (SciDAVis::ColumnMode mode)
 Set the column mode.
virtual ~AbstractColumn ()
 Dtor.
virtual void replaceValues (int first, const QVector< double > &new_values)
 Set the content of row 'row'.
- Public Member Functions inherited from AbstractAspect
 AbstractAspect (const QString &name)
void addChild (AbstractAspect *child)
 Add the given Aspect to my list of children.
QString caption () const
QString captionSpec () const
 Return the specification string used for constructing the caption().
AbstractAspectchild (int index) const
 Get a child by its position in my list of children.
int childCount () const
 Return the number of child Aspects.
QString comment () const
virtual QMenu * createContextMenu () const
 Return a new context menu.
QDateTime creationTime () const
QList< AbstractAspect * > descendantsThatInherit (const char *class_name)
 Get all descendents that inherit the given class.
future::Folderfolder ()
 Return the folder the Aspect is contained in or 0 if not.
void importV0x0001XXCreationTime (const QString &str)
int index () const
 Return my position in my parent's list of children.
int indexOfChild (const AbstractAspect *child) const
 Return the position of child in my list of children.
void insertChild (AbstractAspect *child, int index)
 Insert the given Aspect at a specific position in my list of children.
bool isDescendantOf (AbstractAspect *other)
 Return whether the there is a path upwards to the given aspect.
void moveChild (int from, int to)
 Change the positon of a child in my list of children.
QString name () const
AbstractAspectparentAspect () const
 Return my parent Aspect or 0 if I currently don't have one.
virtual QString path () const
 Return the path that leads from the top-most Aspect (usually a Project) to me.
virtual const Projectproject () const
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one.
virtual Projectproject ()
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one.
virtual void removeAllChildAspects ()
 Remove all child aspects.
void removeChild (AbstractAspect *child, bool detach=false)
 Remove the given Aspect from my list of children.
void removeChild (int index)
 Remove the Aspect at the given index from my list of children.
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child, int d_new_index)
 Move a child to another aspect and transfer ownership.
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child)
 Move a child to another aspect and transfer ownership.
virtual ~AbstractAspect ()
virtual QUndoStack * undoStack () const
 Return the undo stack of the Project, or 0 if this Aspect is not part of a Project.
void exec (QUndoCommand *command)
 Execute the given command, pushing it on the undoStack() if available.
void beginMacro (const QString &text)
 Begin an undo stack macro (series of commands)
void endMacro ()
 End the undo stack macro.

Private Slots

void notifyDisplayChange ()

Private Attributes

Privated_column_private
 Pointer to the private data object.
ColumnStringIOd_string_io

Friends

class ColumnStringIO
class Private

XML related functions

void save (QXmlStreamWriter *writer) const
 Save the column as XML.
bool load (XmlStreamReader *reader)
 Load the column from XML.
bool XmlReadInputFilter (XmlStreamReader *reader)
 Read XML input filter element.
bool XmlReadOutputFilter (XmlStreamReader *reader)
 Read XML output filter element.
bool XmlReadMask (XmlStreamReader *reader)
 Read XML mask element.
bool XmlReadFormula (XmlStreamReader *reader)
 Read XML formula element.
bool XmlReadRow (XmlStreamReader *reader)
 Read XML row element.

Additional Inherited Members

- Signals inherited from AbstractColumn
void aboutToBeDestroyed (const AbstractColumn *source)
 Emitted shortly before this data source is deleted.
void aboutToBeReplaced (const AbstractColumn *source, const AbstractColumn *new_col)
 The column will be replaced.
void dataAboutToChange (const AbstractColumn *source)
 Data (including validity) of the column will be changed.
void dataChanged (const AbstractColumn *source)
 Data (including validity) of the column has changed.
void maskingAboutToChange (const AbstractColumn *source)
 IntervalAttribute related signal.
void maskingChanged (const AbstractColumn *source)
 IntervalAttribute related signal.
void modeAboutToChange (const AbstractColumn *source)
 Column mode (possibly also the data type) will be changed.
void modeChanged (const AbstractColumn *source)
 Column mode (possibly also the data type) changed.
void plotDesignationAboutToChange (const AbstractColumn *source)
 Column plot designation will be changed.
void plotDesignationChanged (const AbstractColumn *source)
 Column plot designation changed.
void rowsAboutToBeInserted (const AbstractColumn *source, int before, int count)
 Rows will be inserted.
void rowsAboutToBeRemoved (const AbstractColumn *source, int first, int count)
 Rows will be deleted.
void rowsInserted (const AbstractColumn *source, int before, int count)
 Rows have been inserted.
void rowsRemoved (const AbstractColumn *source, int first, int count)
 Rows have been deleted.
- Signals inherited from AbstractAspect
void aspectAboutToBeAdded (const AbstractAspect *parent, int index)
 Emit this when a parent aspect is about to get a new child inserted.
void aspectAboutToBeRemoved (const AbstractAspect *aspect)
 Emit this from an aspect about to be removed from its parent's children.
void aspectAboutToBeRemoved (const AbstractAspect *parent, int index)
 Emit this from a parent before removing its child.
void aspectAdded (const AbstractAspect *aspect)
 Emit this from a newly added aspect.
void aspectAdded (const AbstractAspect *parent, int index)
 Emit this from a parent after adding a new child to it.
void aspectDescriptionAboutToChange (const AbstractAspect *aspect)
 Emit this before the name, comment or caption spec is changed.
void aspectDescriptionChanged (const AbstractAspect *aspect)
 Emit this when the name, comment or caption spec changed.
void aspectRemoved (const AbstractAspect *parent, int index)
 Emit this from the parent after removing a child.
void statusInfo (const QString &text)
 Emit this to give status information to the user.

Detailed Description

Aspect that manages a column.

This class represents a column, i.e., (mathematically) a 1D vector of values with a header. It provides a public reading and (undo aware) writing interface as defined in AbstractColumn. It manages special attributes of column rows such as masking and a validity flag. A column can have one of currently three data types: double, QString, or QDateTime. The string representation of the values can differ depending on the mode of the column.

Column inherits from AbstractAspect and is intended to be a child of the corresponding Table in the aspect hierarchy. Columns don't have a view as they are intended to be displayed inside a table.


Constructor & Destructor Documentation

Column::Column ( const QString &  name,
SciDAVis::ColumnMode  mode 
)

Ctor.

Parameters:
namethe column name (= aspect name)
modeinitial column mode

References AbstractAspect::addChild(), ColumnStringIO, d_column_private, d_string_io, AbstractFilter::input(), Column::Private::inputFilter(), outputFilter(), and Private.

Referenced by Column::Private::setColumnMode().

Column::Column ( const QString &  name,
QVector< qreal >  data,
IntervalAttribute< bool >  validity = IntervalAttribute<bool>() 
)

Ctor.

Parameters:
namethe column name (= aspect name)
datainitial data vector
validitya list of invalid intervals (optional)

References AbstractAspect::addChild(), ColumnStringIO, d_column_private, d_string_io, AbstractFilter::input(), Column::Private::inputFilter(), SciDAVis::Numeric, outputFilter(), Private, and SciDAVis::TypeDouble.

Column::Column ( const QString &  name,
QStringList  data,
IntervalAttribute< bool >  validity = IntervalAttribute<bool>() 
)

Ctor.

Parameters:
namethe column name (= aspect name)
datainitial data vector
validitya list of invalid intervals (optional)

References AbstractAspect::addChild(), ColumnStringIO, d_column_private, d_string_io, AbstractFilter::input(), Column::Private::inputFilter(), outputFilter(), Private, SciDAVis::Text, and SciDAVis::TypeQString.

Column::Column ( const QString &  name,
QList< QDateTime >  data,
IntervalAttribute< bool >  validity = IntervalAttribute<bool>() 
)

Ctor.

Parameters:
namethe column name (= aspect name)
datainitial data vector
validitya list of invalid intervals (optional)

References AbstractAspect::addChild(), ColumnStringIO, d_column_private, d_string_io, SciDAVis::DateTime, AbstractFilter::input(), Column::Private::inputFilter(), outputFilter(), Private, and SciDAVis::TypeQDateTime.

Column::~Column ( )

Dtor.

References d_column_private, and d_string_io.


Member Function Documentation

ColumnStringIO* Column::asStringColumn ( ) const
inline
void Column::clear ( )
virtual
void Column::clearFormulas ( )
virtual

Clear all formulas.

Reimplemented from AbstractColumn.

References d_column_private, and AbstractAspect::exec().

Referenced by future::Table::clearSelectedColumns(), and load().

void Column::clearMasks ( )
virtual

Clear all masking information.

Reimplemented from AbstractColumn.

References d_column_private, and AbstractAspect::exec().

Referenced by future::Table::clearMasks(), and load().

void Column::clearValidity ( )
virtual

Clear all validity information.

Reimplemented from AbstractColumn.

References d_column_private, and AbstractAspect::exec().

Referenced by load().

SciDAVis::ColumnMode Column::columnMode ( ) const
virtual
bool Column::copy ( const AbstractColumn other)
virtual

Copy another column of the same type.

This function will return false if the data type of 'other' is not the same as the type of 'this'. The validity information for the rows is also copied. Use a filter to convert a column to another type.

Reimplemented from AbstractColumn.

References d_column_private, AbstractColumn::dataType(), dataType(), and AbstractAspect::exec().

Referenced by future::Table::copy(), ColumnStringIO::copy(), Table::importASCII(), ApplicationWindow::importASCII(), AsciiTableImportFilter::importAspect(), ColumnFullCopyCmd::redo(), ColumnPartialCopyCmd::redo(), ColumnRemoveRowsCmd::redo(), Column::Private::setColumnMode(), ColumnStringIO::setTextAt(), and future::Table::sortColumns().

bool Column::copy ( const AbstractColumn source,
int  source_start,
int  dest_start,
int  num_rows 
)
virtual

Copies a part of another column of the same type.

This function will return false if the data type of 'other' is not the same as the type of 'this'. The validity information for the rows is also copied.

Parameters:
otherpointer to the column to copy
src_startfirst row to copy in the column to copy
dest_startfirst row to copy in
num_rowsthe number of rows to copy

Reimplemented from AbstractColumn.

References d_column_private, AbstractColumn::dataType(), dataType(), and AbstractAspect::exec().

SciDAVis::ColumnDataType Column::dataType ( ) const
virtual
QDate Column::dateAt ( int  row) const
virtual

Return the date part of row 'row'.

Use this only when dataType() is QDateTime

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::dateAt().

Referenced by DataCurve::convertData(), setTimeAt(), and Column::Private::setTimeAt().

QDateTime Column::dateTimeAt ( int  row) const
virtual
QString Column::formula ( int  row) const
virtual
QList< Interval< int > > Column::formulaIntervals ( ) const
virtual

Return the intervals that have associated formulas.

This can be used to make a list of formulas with their intervals. Here is some example code:

QStringList list;
QList< Interval<int> > intervals = my_column.formulaIntervals();
foreach(Interval<int> interval, intervals)
list << QString(interval.toString() + ": " + my_column.formula(interval.start()));

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::formulaIntervals().

Referenced by future::Table::copy(), Table::handleAspectDescriptionChange(), Table::recalculate(), and save().

QIcon Column::icon ( ) const
virtual

Return an icon to be used for decorating the views and table column headers.

Reimplemented from AbstractAspect.

References dataType(), SciDAVis::TypeDouble, SciDAVis::TypeQDateTime, and SciDAVis::TypeQString.

void Column::insertRows ( int  before,
int  count 
)
virtual

Insert some empty (or initialized with zero) rows.

Reimplemented from AbstractColumn.

References d_column_private, and AbstractAspect::exec().

Referenced by Table::applyFormula(), and future::Table::insertRows().

QList< Interval< int > > Column::invalidIntervals ( ) const
virtual

Return all intervals of invalid rows.

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::invalidIntervals().

bool Column::isInvalid ( int  row) const
virtual
bool Column::isInvalid ( Interval< int >  i) const
virtual

Return whether a certain interval of rows contains only invalid values.

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::isInvalid().

bool Column::isMasked ( int  row) const
virtual

Return whether a certain row is masked.

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::isMasked().

Referenced by TableModel::data(), and future::Table::sortColumns().

bool Column::isMasked ( Interval< int >  i) const
virtual

Return whether a certain interval of rows rows is fully masked.

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::isMasked().

bool Column::isReadOnly ( ) const
inlinevirtual

Return whether the object is read-only.

Reimplemented from AbstractColumn.

bool Column::load ( XmlStreamReader reader)
virtual
QList< Interval< int > > Column::maskedIntervals ( ) const
virtual

Return all intervals of masked rows.

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::maskedIntervals().

Referenced by future::Table::copy(), and save().

void Column::notifyDisplayChange ( )
privateslot
void Column::notifyReplacement ( const AbstractColumn replacement)
virtual

This must be called before the column is replaced by another.

Reimplemented from AbstractColumn.

References AbstractColumn::aboutToBeReplaced().

AbstractSimpleFilter * Column::outputFilter ( ) const

Return the output filter (for data type -> string conversion)

This method is mainly used to get a filter that can convert the column's data type to strings (usualy to display in a view).

References d_column_private, and Column::Private::outputFilter().

Referenced by TableView::applyType(), Column(), Table::columnFormat(), DataCurve::convertData(), future::Table::copySelection(), ImportOPJ::importTables(), save(), TableView::setColumnForControlTabs(), Column::Private::setColumnMode(), setColumnMode(), TableStatistics::TableStatistics(), future::Table::text(), and XmlReadOutputFilter().

SciDAVis::PlotDesignation Column::plotDesignation ( ) const
virtual
void Column::removeRows ( int  first,
int  count 
)
virtual

Remove 'count' rows starting from row 'first'.

Reimplemented from AbstractColumn.

References d_column_private, and AbstractAspect::exec().

Referenced by Column::Private::clear(), future::Table::clearSelectedCells(), load(), future::Table::removeRows(), and future::Table::setRowCount().

void Column::replaceDateTimes ( int  first,
const QList< QDateTime > &  new_values 
)
virtual

Replace a range of values.

Use this only when dataType() is QDateTime

Reimplemented from AbstractColumn.

References d_column_private, and AbstractAspect::exec().

Referenced by future::Table::fillSelectedCellsWithRandomNumbers().

void Column::replaceTexts ( int  first,
const QStringList &  new_values 
)
virtual

Replace a range of values.

Use this only when dataType() is QString

Reimplemented from AbstractColumn.

References d_column_private, and AbstractAspect::exec().

Referenced by future::Table::fillSelectedCellsWithRandomNumbers(), and future::Table::fillSelectedCellsWithRowNumbers().

void Column::replaceValues ( int  first,
const QVector< qreal > &  new_values 
)
virtual
int Column::rowCount ( ) const
virtual
void Column::save ( QXmlStreamWriter *  writer) const
virtual
void Column::setColumnMode ( SciDAVis::ColumnMode  mode,
AbstractFilter conversion_filter = 0 
)
void Column::setDateAt ( int  row,
const QDate &  new_value 
)

Set the content of row 'row'.

Use this only when dataType() is QDateTime

References setDateTimeAt(), and timeAt().

void Column::setDateTimeAt ( int  row,
const QDateTime &  new_value 
)

Set the content of row 'row'.

Use this only when dataType() is QDateTime

References d_column_private, and AbstractAspect::exec().

Referenced by Table::clearCell(), setDateAt(), Column::Private::setDateAt(), setTimeAt(), Column::Private::setTimeAt(), and XmlReadRow().

void Column::setFormula ( Interval< int >  i,
QString  formula 
)
void Column::setFormula ( int  row,
QString  formula 
)

Overloaded function for convenience.

References setFormula().

void Column::setInvalid ( Interval< int >  i,
bool  invalid = true 
)

Set an interval invalid or valid.

Parameters:
ithe interval
invalidtrue: set invalid, false: set valid

References d_column_private, and AbstractAspect::exec().

Referenced by Table::clearCell(), future::Table::pasteIntoSelection(), DataPickerTool::removePoint(), setInvalid(), Column::Private::setInvalid(), TableStatistics::update(), and XmlReadRow().

void Column::setInvalid ( int  row,
bool  invalid = true 
)

Overloaded function for convenience.

References setInvalid().

void Column::setMasked ( Interval< int >  i,
bool  mask = true 
)
void Column::setMasked ( int  row,
bool  mask = true 
)

Overloaded function for convenience.

References setMasked().

void Column::setPlotDesignation ( SciDAVis::PlotDesignation  pd)
void Column::setTextAt ( int  row,
const QString &  new_value 
)
void Column::setTimeAt ( int  row,
const QTime &  new_value 
)

Set the content of row 'row'.

Use this only when dataType() is QDateTime

References dateAt(), and setDateTimeAt().

void Column::setValueAt ( int  row,
double  new_value 
)
QString Column::textAt ( int  row) const
virtual
QTime Column::timeAt ( int  row) const
virtual

Return the time part of row 'row'.

Use this only when dataType() is QDateTime

Reimplemented from AbstractColumn.

References d_column_private, and Column::Private::timeAt().

Referenced by DataCurve::convertData(), setDateAt(), and Column::Private::setDateAt().

double Column::valueAt ( int  row) const
virtual
bool Column::XmlReadFormula ( XmlStreamReader reader)
private

Read XML formula element.

References XmlStreamReader::raiseError(), XmlStreamReader::readAttributeInt(), and setFormula().

Referenced by load().

bool Column::XmlReadInputFilter ( XmlStreamReader reader)
private
bool Column::XmlReadMask ( XmlStreamReader reader)
private
bool Column::XmlReadOutputFilter ( XmlStreamReader reader)
private

Read XML output filter element.

References AbstractSimpleFilter::load(), outputFilter(), and XmlStreamReader::skipToNextTag().

Referenced by load().

bool Column::XmlReadRow ( XmlStreamReader reader)
private

Friends And Related Function Documentation

friend class ColumnStringIO
friend

Referenced by Column().

friend class Private
friend

Reimplemented from AbstractAspect.

Referenced by Column().


Member Data Documentation

Private* Column::d_column_private
private
ColumnStringIO* Column::d_string_io
private

The documentation for this class was generated from the following files: