Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.io.gml.writer.internal.geometry.writers
Class AbstractPathMatcher

java.lang.Object
  extended by eu.esdihumboldt.hale.io.gml.writer.internal.geometry.writers.AbstractPathMatcher
Direct Known Subclasses:
AbstractGeometryWriter

public abstract class AbstractPathMatcher
extends Object

Abstract pattern based path matcher

Author:
Simon Templer
Partner:
01 / Fraunhofer Institute for Computer Graphics Research

Constructor Summary
AbstractPathMatcher()
           
 
Method Summary
 void addBasePattern(String pattern)
          Add a base pattern.
 void addVerificationPattern(Pattern pattern)
          Add a verification pattern.
 void addVerificationPattern(String pattern)
          Add a verification pattern.
static Descent descend(XMLStreamWriter writer, Pattern descendPattern, TypeDefinition elementType, QName elementName, String defaultNs, boolean unique)
          Descend the given pattern
 DefinitionPath match(TypeDefinition type, DefinitionPath basePath, String defaultNs)
          Matches the type against the encoding patterns.
protected abstract  boolean verifyEndPoint(TypeDefinition endPoint)
          Verify the verification end point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPathMatcher

public AbstractPathMatcher()
Method Detail

addBasePattern

public void addBasePattern(String pattern)
Add a base pattern. When matching the path the pattern path is appended to the base path.

Parameters:
pattern - the pattern string
See Also:
Pattern.parse(String)

addVerificationPattern

public void addVerificationPattern(String pattern)
Add a verification pattern. If a match for a base pattern is found the verification patterns will be used to verify the structure. For a path to be accepted, all verification patterns must match and the resulting end-points of the verification patterns must be valid.

Parameters:
pattern - the pattern string
See Also:
verifyEndPoint(TypeDefinition), Pattern.parse(String)

addVerificationPattern

public void addVerificationPattern(Pattern pattern)
Add a verification pattern. If a match for a base pattern is found the verification patterns will be used to verify the structure. For a path to be accepted, all verification patterns must match and the resulting end-points of the verification patterns must be valid.

Parameters:
pattern - the pattern
See Also:
verifyEndPoint(TypeDefinition), Pattern.parse(String)

match

public DefinitionPath match(TypeDefinition type,
                            DefinitionPath basePath,
                            String defaultNs)
Matches the type against the encoding patterns.

Parameters:
type - the type definition
basePath - the definition path
defaultNs - the default namespace for the patterns
Returns:
the new path if there is a match, null otherwise

descend

public static Descent descend(XMLStreamWriter writer,
                              Pattern descendPattern,
                              TypeDefinition elementType,
                              QName elementName,
                              String defaultNs,
                              boolean unique)
                       throws XMLStreamException
Descend the given pattern

Parameters:
writer - the XML stream writer
descendPattern - the pattern to descend
elementType - the type of the encompassing element
elementName - the encompassing element name
defaultNs - the pattern default namespace
unique - if the path's start element cannot be repeated
Returns:
the descent that was opened, it must be closed to close the opened elements
Throws:
XMLStreamException - if an error occurs writing the coordinates

verifyEndPoint

protected abstract boolean verifyEndPoint(TypeDefinition endPoint)
Verify the verification end point. After reaching the end-point of a verification pattern this method is called with the TypeDefinition of the end-point to assure the needed structure is present (e.g. a DirectPositionListType element). If no verification pattern is present the end-point of the matched base pattern will be verified.

Parameters:
endPoint - the end-point type definition
Returns:
if the end-point is valid

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d