org.eclipse.datatools.enablement.oda.xml.util
Class MappingPathElementTree

java.lang.Object
  extended by org.eclipse.datatools.enablement.oda.xml.util.MappingPathElementTree

public class MappingPathElementTree
extends java.lang.Object

A tree constructed by table mapping path and its column mapping paths. One path element is corresponding with a TreeNode. This tree is mainly used to accelerate the following operations: 1. Whether a path generated during xml file parsing matches table mapping path, see matchesTablePath method 2. What columns a path generated during xml file parsing can match see getMatchedColumnIndex method 3. For a table path "tp", given a not nested column path "cp", what columns cp can match see getMatchedButNotNestedColumnIndexes method 4. For a table path "tp", given a nested column path "cp", Whether cp is a valid nested column for tp see isValidNestedColumn method Notes: A nested column, generally contains "..", means this column cannot reachable just down from table path


Field Summary
static java.lang.String ASTERISK
           
static java.lang.String ATTR_MARKER
           
static java.lang.String DOUBLE_SLASH
           
static java.lang.String DOUBLE_SLASH_REPLACEMENT
           
static java.lang.String FORWARD_SLASH
           
 
Constructor Summary
MappingPathElementTree(java.lang.String tablePath, java.lang.String[] relativeColumnPaths)
           
 
Method Summary
 int[] getMatchedButNotNestedColumnIndexs(XMLPath column, XMLPath row)
          return all the indexes of matched columns which path is column and is reachable down from row
 int[] getMatchedColumnIndexs(XMLPath path)
          return all the possible matched column indexes for a XML path.
 int[] getNestedColumnIndexes()
           
 boolean isNestedColumn(int index)
          whether the column is a nested column
 boolean isValidNestedColumn(int index, XMLPath row, XMLPath column)
          whether column is row's nested column, which index is index
static boolean isValidTableMappingPath(java.lang.String tablePath)
          Whether tablePath is a valid table mapping path
 boolean matchesTablePath(XMLPath path)
          whether this xml path matches the table mapping path
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOUBLE_SLASH_REPLACEMENT

public static final java.lang.String DOUBLE_SLASH_REPLACEMENT
See Also:
Constant Field Values

FORWARD_SLASH

public static final java.lang.String FORWARD_SLASH
See Also:
Constant Field Values

DOUBLE_SLASH

public static final java.lang.String DOUBLE_SLASH
See Also:
Constant Field Values

ASTERISK

public static final java.lang.String ASTERISK
See Also:
Constant Field Values

ATTR_MARKER

public static final java.lang.String ATTR_MARKER
See Also:
Constant Field Values
Constructor Detail

MappingPathElementTree

public MappingPathElementTree(java.lang.String tablePath,
                              java.lang.String[] relativeColumnPaths)
Parameters:
tablePath: - the mapping path of the table, the result of filter condition removing and needless parent axis removing
relativeColumnPaths: - the relative column paths, the result of filter condition removing and needless parent axis removing
Method Detail

matchesTablePath

public boolean matchesTablePath(XMLPath path)
whether this xml path matches the table mapping path

Parameters:
path -

getMatchedColumnIndexs

public int[] getMatchedColumnIndexs(XMLPath path)
return all the possible matched column indexes for a XML path. ignore the absolute table path

Parameters:
path: -
Returns:

getMatchedButNotNestedColumnIndexs

public int[] getMatchedButNotNestedColumnIndexs(XMLPath column,
                                                XMLPath row)
return all the indexes of matched columns which path is column and is reachable down from row

Parameters:
column: -
row: -
Returns:

isNestedColumn

public boolean isNestedColumn(int index)
whether the column is a nested column

Parameters:
index -
Returns:

getNestedColumnIndexes

public int[] getNestedColumnIndexes()
Returns:

isValidNestedColumn

public boolean isValidNestedColumn(int index,
                                   XMLPath row,
                                   XMLPath column)
whether column is row's nested column, which index is index

Parameters:
index -
row: -
column: -
Returns:

isValidTableMappingPath

public static boolean isValidTableMappingPath(java.lang.String tablePath)
Whether tablePath is a valid table mapping path

Parameters:
tablePath: - table mapping path
Returns: