org.nodal.nav
Class PathOp

java.lang.Object
  extended byorg.nodal.nav.PathOp
All Implemented Interfaces:
PathOperator
Direct Known Subclasses:
AuthorityOp, OpaqueOp, SchemeOp

public abstract class PathOp
extends java.lang.Object
implements PathOperator


Nested Class Summary
static class PathOp.Factory
          An abstract Factory class for PathOp instances.
 
Field Summary
protected static java.lang.String[] NO_ARGS
           
 
Constructor Summary
PathOp()
           
 
Method Summary
 Path applyTo(Path path)
          Apply this PathOp to the given Path.
 java.lang.Object arg(int i)
          Default implementation of i-th argument.
abstract  Getter bindFrom(Path pg)
          Apply this PathOp to the binding of a bound Path.
 java.lang.String encoded()
          Default implementation of encoded for PathOp-derived classes.
protected  Path findDir(Path path)
          Find the closest directory containing this Path.
 boolean isAbsolute()
          In general, a PathOp is relative.
abstract  boolean isDocumentOp()
          Is this PathOperator a document-level operator?
abstract  boolean isFragmentOp()
          Is this PathOperator a fragment-level operator?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nodal.nav.PathOperator
args, functionName
 

Field Detail

NO_ARGS

protected static java.lang.String[] NO_ARGS
Constructor Detail

PathOp

public PathOp()
Method Detail

isDocumentOp

public abstract boolean isDocumentOp()
Description copied from interface: PathOperator
Is this PathOperator a document-level operator?

All Path operators either select a Document or a location within a Document. Those that select Documents are referred to as "document" operators.

PathOperators may work on both levels (e.g. DerefOp)

Specified by:
isDocumentOp in interface PathOperator

isFragmentOp

public abstract boolean isFragmentOp()
Description copied from interface: PathOperator
Is this PathOperator a fragment-level operator?

All Path operators either select a Document or a location within a Document. Those that operate inside Documents are referred to as "fragment" operators.

PathOperators may work on both levels (e.g. DerefOp)

Specified by:
isFragmentOp in interface PathOperator

isAbsolute

public boolean isAbsolute()
In general, a PathOp is relative.

Specified by:
isAbsolute in interface PathOperator

applyTo

public Path applyTo(Path path)
             throws Path.Failure
Apply this PathOp to the given Path. The method call this.applyTo(p) is an inversion of the call p.apply(this).

Specified by:
applyTo in interface PathOperator
Returns:
a new Path made by applying this PathOp to the end
Throws:
Path.Failure

bindFrom

public abstract Getter bindFrom(Path pg)
                         throws Path.Failure
Apply this PathOp to the binding of a bound Path.

Specified by:
bindFrom in interface PathOperator
Parameters:
pg - the parent Path for this operator
Returns:
a Getter that is the binding of this operator on the parent Path.
Throws:
Path.Failure - if there is a type mismatch when accessing the Getter

encoded

public java.lang.String encoded()
Default implementation of encoded for PathOp-derived classes.

Specified by:
encoded in interface PathOperator
Returns:
the encoded String representing this PathOperator

findDir

protected Path findDir(Path path)
Find the closest directory containing this Path. Amounts to a search up the chain of ancestry for an AsDirectoryOp PathOperator.

Parameters:
path - the Path to search in
Returns:
the closest directory Path above this point

arg

public java.lang.Object arg(int i)
Default implementation of i-th argument.

Specified by:
arg in interface PathOperator
Parameters:
i - the index of the argument requested
Returns:
the value of the argument requested