pl.edu.agh.cast.importer.base.converter.rules
Class AbstractDirectedGraphConversionRule

java.lang.Object
  extended by pl.edu.agh.cast.importer.base.converter.rules.AbstractDirectedGraphConversionRule
All Implemented Interfaces:
IConversionRule
Direct Known Subclasses:
DirectedGraphConversionRule

public abstract class AbstractDirectedGraphConversionRule
extends Object
implements IConversionRule

Source and target nodes' conversion for two String columns and one Direction column.

Author:
AGH CAST Team

Field Summary
protected static int COLUMN_INDEX_UNDEFINED
          Value which marks that column index is undefined.
protected  int columnAIndex
          The index of the column holding the node A.
protected  int columnBIndex
          The index of the column holding the node B.
protected  int directionColumnIndex
          The index of the column holding the direction.
 
Constructor Summary
AbstractDirectedGraphConversionRule()
          The default constructor.
 
Method Summary
protected  void checkRowNullEmpty(DataRow row, String nodeName)
           
 void clear()
          Clears the conversion rule's configuration.
 void clearDirectionColumnIndex()
          Clears the direction column index.
 void clearNodeAColumnIndex()
          Clears the node A column index.
 void clearNodeBColumnIndex()
          Clears the node B column index.
protected  void copyFields(AbstractDirectedGraphConversionRule copy)
          Copies all required fields of AbstractDirectedGraphConversionRule to the given instance of conversion rule.
 int getColumnAIndex()
           
 int getColumnBIndex()
           
 int getDirectionColumnIndex()
           
protected  DirectionDataType getDirectionValue(DataRow row)
           
 String getFormat()
          Retrieves the domain field format.
 String getSourceNode(DataRow row)
          Returns source node.
protected  String getStringColumnValue(DataRow row, int columnIdx)
           
 String getTargetNode(DataRow row)
          Returns target node.
 boolean isComplete()
          Checks whether current conversion rule is fully configured - all necessary parameters are present and the the conversion process can be performed.
 void setColumnAIndex(int columnAIndex)
           
 void setColumnBIndex(int columnBIndex)
           
 void setDirectionColumnIndex(int directionColumnIndex)
           
 void setFormat(String format)
          Sets the domain field format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.importer.base.converter.rules.IConversionRule
createCopy
 

Field Detail

COLUMN_INDEX_UNDEFINED

protected static final int COLUMN_INDEX_UNDEFINED
Value which marks that column index is undefined.

See Also:
Constant Field Values

columnAIndex

protected int columnAIndex
The index of the column holding the node A.


columnBIndex

protected int columnBIndex
The index of the column holding the node B.


directionColumnIndex

protected int directionColumnIndex
The index of the column holding the direction.

Constructor Detail

AbstractDirectedGraphConversionRule

public AbstractDirectedGraphConversionRule()
The default constructor.

Method Detail

clear

public void clear()
Clears the conversion rule's configuration.

Specified by:
clear in interface IConversionRule
See Also:
IConversionRule.clear()

isComplete

public boolean isComplete()
Checks whether current conversion rule is fully configured - all necessary parameters are present and the the conversion process can be performed.

Specified by:
isComplete in interface IConversionRule
Returns:
flag indicating the rule's completion state
See Also:
IConversionRule.isComplete()

getSourceNode

public String getSourceNode(DataRow row)
                     throws ConversionRuleException,
                            IllegalArgumentException
Returns source node.

Parameters:
row - input row
Returns:
source node
Throws:
ConversionRuleException
IllegalArgumentException

getTargetNode

public String getTargetNode(DataRow row)
                     throws ConversionRuleException,
                            IllegalArgumentException
Returns target node.

Parameters:
row - input row
Returns:
target node
Throws:
ConversionRuleException
IllegalArgumentException

copyFields

protected void copyFields(AbstractDirectedGraphConversionRule copy)
Copies all required fields of AbstractDirectedGraphConversionRule to the given instance of conversion rule.

Parameters:
copy - a conversion rule instance which is to be copy of this rule

clearNodeAColumnIndex

public void clearNodeAColumnIndex()
Clears the node A column index.


clearNodeBColumnIndex

public void clearNodeBColumnIndex()
Clears the node B column index.


clearDirectionColumnIndex

public void clearDirectionColumnIndex()
Clears the direction column index.


getDirectionValue

protected DirectionDataType getDirectionValue(DataRow row)
                                       throws EmptyValueConversionRuleException,
                                              WrongValueConversionRuleException
Throws:
EmptyValueConversionRuleException
WrongValueConversionRuleException

getStringColumnValue

protected String getStringColumnValue(DataRow row,
                                      int columnIdx)
                               throws EmptyValueConversionRuleException,
                                      WrongValueConversionRuleException
Throws:
EmptyValueConversionRuleException
WrongValueConversionRuleException

checkRowNullEmpty

protected void checkRowNullEmpty(DataRow row,
                                 String nodeName)

setFormat

public void setFormat(String format)
Sets the domain field format.

Specified by:
setFormat in interface IConversionRule
Parameters:
format - the field format
See Also:
IConversionRule.setFormat(java.lang.String)

getFormat

public String getFormat()
Retrieves the domain field format.

Specified by:
getFormat in interface IConversionRule
Returns:
the field format
See Also:
pl.edu.agh.cast.importer.base.converter.rules.IConversionRule#getFormats()

getColumnAIndex

public int getColumnAIndex()

setColumnAIndex

public void setColumnAIndex(int columnAIndex)

getColumnBIndex

public int getColumnBIndex()

setColumnBIndex

public void setColumnBIndex(int columnBIndex)

getDirectionColumnIndex

public int getDirectionColumnIndex()

setDirectionColumnIndex

public void setDirectionColumnIndex(int directionColumnIndex)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.