de.zeigermann.xml.simpleImporter
Class SimplePath

java.lang.Object
  |
  +--de.zeigermann.xml.simpleImporter.SimplePath

public class SimplePath
extends Object

Rudimentary representation of a path to an XML element.
Two paths match in two cases:

  1. If they are really equal in terms of the equals(java.lang.Object) method.
  2. If the path to match to is relative, i.e. it has no leading '/' and it is the suffix of the matching path.

For example
/root/tag matches /root/tag and
/root/tag matches tag.

Author:
Olli Z.

Field Summary
protected  String path
           
 
Constructor Summary
SimplePath(SimplePath path)
          Copy ctor.
SimplePath(String path)
          Creates a path object from a string describing it.
 
Method Summary
 boolean equals(Object o)
           
 boolean matches(SimplePath matchPath)
          Finds out if the the given path matches this one.
 boolean matches(String matchPath)
          Finds out if the path represented by the given string matches this one.
 boolean matchsAny(Collection paths)
          Checks if this path matches any of the paths stored in paths collection.
 boolean matchsAny(String[] paths)
          Checks if this path matches any of the paths stored in paths collection.
static String stripEndingSlash(String path)
          Strips off ending slash from a string if there is one.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

path

protected String path
Constructor Detail

SimplePath

public SimplePath(String path)
Creates a path object from a string describing it. The describing string uses '/' characters to seperate the paths parts.


SimplePath

public SimplePath(SimplePath path)
Copy ctor.

Method Detail

stripEndingSlash

public static final String stripEndingSlash(String path)
Strips off ending slash from a string if there is one.


matchsAny

public boolean matchsAny(Collection paths)
Checks if this path matches any of the paths stored in paths collection. This means we iterate through paths and match every entry to this path.


matchsAny

public boolean matchsAny(String[] paths)
Checks if this path matches any of the paths stored in paths collection. This means we iterate through paths and match every entry to this path.


matches

public boolean matches(SimplePath matchPath)
Finds out if the the given path matches this one.


matches

public boolean matches(String matchPath)
Finds out if the path represented by the given string matches this one.

See Also:
matches(SimplePath)

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object


Copyright 2002-2003 Oliver Zeigermann. All Rights Reserved.