You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2008/02/03 17:08:40 UTC
svn commit: r618011 - in
/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath: ./ ri/
ri/axes/ ri/compiler/ ri/model/ ri/model/beans/ ri/model/container/
ri/model/dom/ ri/model/jdom/ xml/
Author: mbenson
Date: Sun Feb 3 08:08:38 2008
New Revision: 618011
URL: http://svn.apache.org/viewvc?rev=618011&view=rev
Log:
checkstyle
Modified:
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/AbstractFactory.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/IdentityManager.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/Variables.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/NamespaceResolver.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/AttributeContext.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/ParentContext.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/RootContext.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Constant.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NameAttributeTest.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Operation.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ProcessingInstructionTest.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/VariableReference.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodeIterator.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMPointerFactory.java
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser.java
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/AbstractFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/AbstractFactory.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/AbstractFactory.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/AbstractFactory.java Sun Feb 3 08:08:38 2008
@@ -53,8 +53,7 @@
* @return true if the object was successfully created
*/
public boolean createObject(JXPathContext context, Pointer pointer,
- Object parent, String name, int index)
- {
+ Object parent, String name, int index) {
return false;
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/IdentityManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/IdentityManager.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/IdentityManager.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/IdentityManager.java Sun Feb 3 08:08:38 2008
@@ -29,6 +29,9 @@
/**
* Finds a node by its ID.
+ * @param context JXPathContext
+ * @param id String
+ * @return Pointer
*/
Pointer getPointerByID(JXPathContext context, String id);
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java Sun Feb 3 08:08:38 2008
@@ -380,26 +380,37 @@
* @version $Revision$ $Date$
*/
public abstract class JXPathContext {
+ private static JXPathContextFactory contextFactory;
+ private static JXPathContext compilationContext;
+
+ private static final PackageFunctions GENERIC_FUNCTIONS =
+ new PackageFunctions("", null);
+
+ /** parent context */
protected JXPathContext parentContext;
+ /** context bean */
protected Object contextBean;
+ /** variables */
protected Variables vars;
+ /** functions */
protected Functions functions;
+ /** AbstractFactory */
protected AbstractFactory factory;
- private Locale locale;
- private boolean lenientSet = false;
- private boolean lenient = false;
+ /** IdentityManager */
protected IdentityManager idManager;
+ /** KeyManager */
protected KeyManager keyManager;
+ /** decimal format map */
protected HashMap decimalFormats;
- private static JXPathContextFactory contextFactory;
- private static JXPathContext compilationContext;
-
- private static final PackageFunctions GENERIC_FUNCTIONS =
- new PackageFunctions("", null);
+ private Locale locale;
+ private boolean lenientSet = false;
+ private boolean lenient = false;
/**
* Creates a new JXPathContext with the specified object as the root node.
+ * @param contextBean Object
+ * @return JXPathContext
*/
public static JXPathContext newContext(Object contextBean) {
return getContextFactory().newContext(null, contextBean);
@@ -409,16 +420,19 @@
* Creates a new JXPathContext with the specified bean as the root node and
* the specified parent context. Variables defined in a parent context can
* be referenced in XPaths passed to the child context.
+ * @param parentContext parent context
+ * @param contextBean Object
+ * @return JXPathContext
*/
public static JXPathContext newContext(
- JXPathContext parentContext,
- Object contextBean)
- {
+ JXPathContext parentContext,
+ Object contextBean) {
return getContextFactory().newContext(parentContext, contextBean);
}
/**
* Acquires a context factory and caches it.
+ * @return JXPathContextFactory
*/
private static JXPathContextFactory getContextFactory () {
if (contextFactory == null) {
@@ -428,8 +442,10 @@
}
/**
- * This constructor should remain protected - it is to be overridden by
+ * This constructor should remain protected - it is to be overridden by
* subclasses, but never explicitly invoked by clients.
+ * @param parentContext parent context
+ * @param contextBean Object
*/
protected JXPathContext(JXPathContext parentContext, Object contextBean) {
this.parentContext = parentContext;
@@ -438,6 +454,7 @@
/**
* Returns the parent context of this context or null.
+ * @return JXPathContext
*/
public JXPathContext getParentContext() {
return parentContext;
@@ -445,6 +462,7 @@
/**
* Returns the JavaBean associated with this context.
+ * @return Object
*/
public Object getContextBean() {
return contextBean;
@@ -452,6 +470,7 @@
/**
* Returns a Pointer for the context bean.
+ * @return Pointer
*/
public abstract Pointer getContextPointer();
@@ -460,11 +479,14 @@
* The supplied pointer becomes the context pointer of the new context.
* The relative context inherits variables, extension functions, locale etc
* from the parent context.
+ * @param pointer Pointer
+ * @return JXPathContext
*/
public abstract JXPathContext getRelativeContext(Pointer pointer);
/**
* Installs a custom implementation of the Variables interface.
+ * @param vars Variables
*/
public void setVariables(Variables vars) {
this.vars = vars;
@@ -475,6 +497,7 @@
* pool was specified with the <code>setVariables()</code> method,
* returns the default implementation of Variables,
* {@link BasicVariables BasicVariables}.
+ * @return Variables
*/
public Variables getVariables() {
if (vars == null) {
@@ -485,7 +508,7 @@
/**
* Install a library of extension functions.
- *
+ * @param functions Functions
* @see FunctionLibrary
*/
public void setFunctions(Functions functions) {
@@ -494,6 +517,7 @@
/**
* Returns the set of functions installed on the context.
+ * @return Functions
*/
public Functions getFunctions() {
if (functions != null) {
@@ -509,6 +533,7 @@
* Install an abstract factory that should be used by the
* <code>createPath()</code> and <code>createPathAndSetValue()</code>
* methods.
+ * @param factory AbstractFactory
*/
public void setFactory(AbstractFactory factory) {
this.factory = factory;
@@ -518,6 +543,7 @@
* Returns the AbstractFactory installed on this context.
* If none has been installed and this context has a parent context,
* returns the parent's factory. Otherwise returns null.
+ * @return AbstractFactory
*/
public AbstractFactory getFactory() {
if (factory == null && parentContext != null) {
@@ -531,6 +557,7 @@
* attribute as well as the the lang() function will be
* affected by the locale. By default, JXPath uses
* <code>Locale.getDefault()</code>
+ * @param locale Locale
*/
public synchronized void setLocale(Locale locale) {
this.locale = locale;
@@ -540,6 +567,7 @@
* Returns the locale set with setLocale. If none was set and
* the context has a parent, returns the parent's locale.
* Otherwise, returns Locale.getDefault().
+ * @return Locale
*/
public synchronized Locale getLocale() {
if (locale == null) {
@@ -558,11 +586,10 @@
* By default, JXPath uses the symbols for the current locale.
*
* @param name the format name or null for default format.
+ * @param symbols DecimalFormatSymbols
*/
- public synchronized void setDecimalFormatSymbols(
- String name,
- DecimalFormatSymbols symbols)
- {
+ public synchronized void setDecimalFormatSymbols(String name,
+ DecimalFormatSymbols symbols) {
if (decimalFormats == null) {
decimalFormats = new HashMap();
}
@@ -570,6 +597,9 @@
}
/**
+ * Get the named DecimalFormatSymbols.
+ * @param name key
+ * @return DecimalFormatSymbols
* @see #setDecimalFormatSymbols(String, DecimalFormatSymbols)
*/
public synchronized DecimalFormatSymbols getDecimalFormatSymbols(String name) {
@@ -587,6 +617,7 @@
* thrown.
* <p>
* By default, lenient = false
+ * @param lenient flag
*/
public synchronized void setLenient(boolean lenient) {
this.lenient = lenient;
@@ -594,6 +625,8 @@
}
/**
+ * Learn whether this JXPathContext is lenient.
+ * @return boolean
* @see #setLenient(boolean)
*/
public synchronized boolean isLenient() {
@@ -609,6 +642,8 @@
* when you need to evaluate the same expression multiple times
* and there is a convenient place to cache CompiledExpression
* between invocations.
+ * @param xpath to compile
+ * @return CompiledExpression
*/
public static CompiledExpression compile(String xpath) {
if (compilationContext == null) {
@@ -620,6 +655,8 @@
/**
* Overridden by each concrete implementation of JXPathContext
* to perform compilation. Is called by <code>compile()</code>.
+ * @param xpath to compile
+ * @return CompiledExpression
*/
protected abstract CompiledExpression compilePath(String xpath);
@@ -634,7 +671,7 @@
* @return the found object
*/
public Object selectSingleNode(String xpath) {
- Pointer pointer = getPointer(xpath);
+ Pointer pointer = getPointer(xpath);
return pointer == null ? null : pointer.getNode();
}
@@ -645,24 +682,29 @@
* @return a list of found objects
*/
public List selectNodes(String xpath) {
- ArrayList list = new ArrayList();
- Iterator iterator = iteratePointers(xpath);
- while (iterator.hasNext()) {
- Pointer pointer = (Pointer) iterator.next();
- list.add(pointer.getNode());
- }
- return list;
+ ArrayList list = new ArrayList();
+ Iterator iterator = iteratePointers(xpath);
+ while (iterator.hasNext()) {
+ Pointer pointer = (Pointer) iterator.next();
+ list.add(pointer.getNode());
+ }
+ return list;
}
/**
* Evaluates the xpath and returns the resulting object. Primitive
* types are wrapped into objects.
+ * @param xpath to evaluate
+ * @return Object found
*/
public abstract Object getValue(String xpath);
/**
* Evaluates the xpath, converts the result to the specified class and
* returns the resulting object.
+ * @param xpath to evaluate
+ * @param requiredType required type
+ * @return Object found
*/
public abstract Object getValue(String xpath, Class requiredType);
@@ -673,6 +715,8 @@
* <li>The xpath does not in fact describe an existing property
* <li>The property is not writable (no public, non-static set method)
* </ul>
+ * @param xpath indicating position
+ * @param value to set
*/
public abstract void setValue(String xpath, Object value);
@@ -682,6 +726,8 @@
* <p>
* Will throw an exception if the AbstractFactory fails to create
* an instance for a path element.
+ * @param xpath indicating destination to create
+ * @return pointer to new location
*/
public abstract Pointer createPath(String xpath);
@@ -698,16 +744,21 @@
* element.
* <li>The property is not writable (no public, non-static set method)
* </ul>
+ * @param xpath indicating position to create
+ * @param value to set
+ * @return pointer to new location
*/
public abstract Pointer createPathAndSetValue(String xpath, Object value);
/**
* Removes the element of the object graph described by the xpath.
+ * @param xpath indicating position to remove
*/
public abstract void removePath(String xpath);
/**
* Removes all elements of the object graph described by the xpath.
+ * @param xpath indicating positions to remove
*/
public abstract void removeAll(String xpath);
@@ -715,6 +766,8 @@
* Traverses the xpath and returns an Iterator of all results found
* for the path. If the xpath matches no properties
* in the graph, the Iterator will be empty, but not null.
+ * @param xpath to iterate
+ * @return Iterator<Object>
*/
public abstract Iterator iterate(String xpath);
@@ -723,6 +776,8 @@
* A Pointer provides easy access to a property.
* If the xpath matches no properties
* in the graph, the pointer will be null.
+ * @param xpath desired
+ * @return Pointer
*/
public abstract Pointer getPointer(String xpath);
@@ -731,12 +786,15 @@
* A Pointer provides easy access to a property.
* If the xpath matches no properties
* in the graph, the Iterator be empty, but not null.
+ * @param xpath to iterate
+ * @return Iterator<Pointer>
*/
public abstract Iterator iteratePointers(String xpath);
/**
* Install an identity manager that will be used by the context
* to look up a node by its ID.
+ * @param idManager IdentityManager to set
*/
public void setIdentityManager(IdentityManager idManager) {
this.idManager = idManager;
@@ -745,6 +803,7 @@
/**
* Returns this context's identity manager. If none has been installed,
* returns the identity manager of the parent context.
+ * @return IdentityManager
*/
public IdentityManager getIdentityManager() {
if (idManager == null && parentContext != null) {
@@ -757,6 +816,7 @@
* Locates a Node by its ID.
*
* @param id is the ID of the sought node.
+ * @return Pointer
*/
public Pointer getPointerByID(String id) {
IdentityManager manager = getIdentityManager();
@@ -771,6 +831,7 @@
/**
* Install a key manager that will be used by the context
* to look up a node by a key value.
+ * @param keyManager KeyManager
*/
public void setKeyManager(KeyManager keyManager) {
this.keyManager = keyManager;
@@ -779,6 +840,7 @@
/**
* Returns this context's key manager. If none has been installed,
* returns the key manager of the parent context.
+ * @return KeyManager
*/
public KeyManager getKeyManager() {
if (keyManager == null && parentContext != null) {
@@ -789,6 +851,9 @@
/**
* Locates a Node by a key value.
+ * @param key string
+ * @param value string
+ * @return Pointer found
*/
public Pointer getPointerByKey(String key, String value) {
KeyManager manager = getKeyManager();
@@ -802,8 +867,9 @@
/**
* Locates a NodeSet by key/value.
- * @param key
- * @param value
+ * @param key string
+ * @param value object
+ * @return NodeSet found
*/
public NodeSet getNodeSetByKey(String key, Object value) {
KeyManager manager = getKeyManager();
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/Variables.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/Variables.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/Variables.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/Variables.java Sun Feb 3 08:08:38 2008
@@ -29,12 +29,16 @@
/**
* Returns true if the specified variable is declared.
+ * @param varName variable name
+ * @return boolean
*/
boolean isDeclaredVariable(String varName);
/**
* Returns the value of the specified variable.
- * Throws IllegalArgumentException if there is no such variable.
+ * @param varName variable name
+ * @return Object value
+ * @throws IllegalArgumentException if there is no such variable.
*/
Object getVariable(String varName);
@@ -42,6 +46,8 @@
* Defines a new variable with the specified value or modifies
* the value of an existing variable.
* May throw UnsupportedOperationException.
+ * @param varName variable name
+ * @param value to declare
*/
void declareVariable(String varName, Object value);
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java Sun Feb 3 08:08:38 2008
@@ -49,14 +49,19 @@
private Source source;
/**
- * @param xmlURL is a URL for an XML file. Use getClass().getResource
- * (resourceName) to load XML from a resource file.
+ * Create a new XMLDocumentContainer.
+ * @param xmlURL a URL for an XML file. Use getClass().getResource(resourceName)
+ * to load XML from a resource file.
*/
public XMLDocumentContainer(URL xmlURL) {
this.xmlURL = xmlURL;
delegate = new DocumentContainer(xmlURL);
}
+ /**
+ * Create a new XMLDocumentContainer.
+ * @param source XML source
+ */
public XMLDocumentContainer(Source source) {
this.source = source;
if (source == null) {
@@ -66,6 +71,7 @@
/**
* Reads XML, caches it internally and returns the Document.
+ * @return Object value
*/
public Object getValue() {
if (document == null) {
@@ -97,6 +103,7 @@
/**
* Throws an UnsupportedOperationException
+ * @param value to set
*/
public void setValue(Object value) {
throw new UnsupportedOperationException();
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java Sun Feb 3 08:08:38 2008
@@ -99,16 +99,23 @@
/**
* Produces an EXPRESSION object that represents a numeric constant.
+ * @param value numeric String
+ * @return Object
*/
Object number(String value);
/**
* Produces an EXPRESSION object that represents a string constant.
+ * @param value String literal
+ * @return Object
*/
Object literal(String value);
/**
* Produces an QNAME that represents a name with an optional prefix.
+ * @param prefix String prefix
+ * @param name String name
+ * @return Object
*/
Object qname(String prefix, String name);
@@ -116,6 +123,7 @@
* Produces an EXPRESSION object representing the sum of all argumens
*
* @param arguments are EXPRESSION objects
+ * @return Object
*/
Object sum(Object[] arguments);
@@ -124,6 +132,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object minus(Object left, Object right);
@@ -133,6 +142,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object multiply(Object left, Object right);
@@ -142,6 +152,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object divide(Object left, Object right);
@@ -151,6 +162,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object mod(Object left, Object right);
@@ -160,6 +172,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object lessThan(Object left, Object right);
@@ -169,6 +182,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object lessThanOrEqual(Object left, Object right);
@@ -178,6 +192,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object greaterThan(Object left, Object right);
@@ -187,6 +202,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object greaterThanOrEqual(Object left, Object right);
@@ -196,6 +212,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object equal(Object left, Object right);
@@ -205,6 +222,7 @@
*
* @param left is an EXPRESSION object
* @param right is an EXPRESSION object
+ * @return Object
*/
Object notEqual(Object left, Object right);
@@ -212,6 +230,7 @@
* Produces an EXPRESSION object representing unary negation of the argument
*
* @param argument is an EXPRESSION object
+ * @return Object
*/
Object minus(Object argument);
@@ -219,6 +238,7 @@
* Produces an EXPRESSION object representing variable reference
*
* @param qname is a QNAME object
+ * @return Object
*/
Object variableReference(Object qname);
@@ -228,6 +248,7 @@
*
* @param code is one of FUNCTION_... constants
* @param args are EXPRESSION objects
+ * @return Object
*/
Object function(int code, Object[] args);
@@ -237,6 +258,7 @@
*
* @param name is a QNAME object (function name)
* @param args are EXPRESSION objects
+ * @return Object
*/
Object function(Object name, Object[] args);
@@ -245,21 +267,24 @@
* all arguments
*
* @param arguments are EXPRESSION objects
+ * @return Object
*/
- Object and(Object arguments[]);
+ Object and(Object[] arguments);
/**
* Produces an EXPRESSION object representing logical disjunction of
* all arguments
*
* @param arguments are EXPRESSION objects
+ * @return Object
*/
- Object or(Object arguments[]);
+ Object or(Object[] arguments);
/**
* Produces an EXPRESSION object representing union of all node sets
*
* @param arguments are EXPRESSION objects
+ * @return Object
*/
Object union(Object[] arguments);
@@ -267,6 +292,7 @@
* Produces a NODE_TEST object that represents a node name test.
*
* @param qname is a QNAME object
+ * @return Object
*/
Object nodeNameTest(Object qname);
@@ -274,6 +300,7 @@
* Produces a NODE_TEST object that represents a node type test.
*
* @param nodeType is a NODE_TEST object
+ * @return Object
*/
Object nodeTypeTest(int nodeType);
@@ -282,6 +309,7 @@
* test.
*
* @param instruction is a NODE_TEST object
+ * @return Object
*/
Object processingInstructionTest(String instruction);
@@ -291,6 +319,7 @@
* @param axis is one of the AXIS_... constants
* @param nodeTest is a NODE_TEST object
* @param predicates are EXPRESSION objects
+ * @return Object
*/
Object step(int axis, Object nodeTest, Object[] predicates);
@@ -299,6 +328,7 @@
*
* @param absolute indicates whether the path is absolute
* @param steps are STEP objects
+ * @return Object
*/
Object locationPath(boolean absolute, Object[] steps);
@@ -308,6 +338,7 @@
* @param expression is an EXPRESSION object
* @param predicates are EXPRESSION objects
* @param steps are STEP objects
+ * @return Object
*/
Object expressionPath(
Object expression,
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/NamespaceResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/NamespaceResolver.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/NamespaceResolver.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/NamespaceResolver.java Sun Feb 3 08:08:38 2008
@@ -31,16 +31,20 @@
* @version $Revision$ $Date$
*/
public class NamespaceResolver implements Cloneable {
- final protected NamespaceResolver parent;
+ /** Parent NamespaceResolver */
+ protected final NamespaceResolver parent;
+ /** namespace map */
protected HashMap namespaceMap = new HashMap();
+ /** reverse lookup map */
protected HashMap reverseMap;
+ /** pointer */
protected NodePointer pointer;
private boolean sealed;
/**
* Find the namespace prefix for the specified namespace URI and NodePointer.
- * @param pointer
- * @param namespaceURI
+ * @param pointer location
+ * @param namespaceURI to check
* @return prefix if found
* @since JXPath 1.3
*/
@@ -72,7 +76,7 @@
/**
* Create a new NamespaceResolver.
- * @param parent
+ * @param parent NamespaceResolver
*/
public NamespaceResolver(NamespaceResolver parent) {
this.parent = parent;
@@ -155,7 +159,7 @@
/**
* Get the nearest prefix found that matches an externally-registered namespace.
- * @param namespaceURI
+ * @param namespaceURI the ns URI to check.
* @return String prefix if found.
* @since JXPath 1.3
*/
@@ -175,7 +179,7 @@
/**
* Learn whether this NamespaceResolver has been sealed.
- * @return
+ * @return boolean
*/
public boolean isSealed() {
return sealed;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/AttributeContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/AttributeContext.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/AttributeContext.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/AttributeContext.java Sun Feb 3 08:08:38 2008
@@ -40,6 +40,7 @@
private NodePointer currentNodePointer;
/**
+ * Create a new AttributeContext.
* @param parentContext represents the previous step on the path
* @param nodeTest is the name of the attribute we are looking for
*/
@@ -48,16 +49,25 @@
this.nodeTest = nodeTest;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getCurrentNodePointer() {
return currentNodePointer;
}
+ /**
+ * {@inheritDoc}
+ */
public void reset() {
setStarted = false;
iterator = null;
super.reset();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean setPosition(int position) {
if (position < getCurrentPosition()) {
reset();
@@ -71,6 +81,9 @@
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean nextNode() {
super.setPosition(getCurrentPosition() + 1);
if (!setStarted) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/ParentContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/ParentContext.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/ParentContext.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/ParentContext.java Sun Feb 3 08:08:38 2008
@@ -31,33 +31,56 @@
private boolean setStarted = false;
private NodePointer currentNodePointer;
+ /**
+ * Create a new ParentContext.
+ * @param parentContext parent context
+ * @param nodeTest test
+ */
public ParentContext(EvalContext parentContext, NodeTest nodeTest) {
super(parentContext);
this.nodeTest = nodeTest;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getCurrentNodePointer() {
return currentNodePointer;
}
+ /**
+ * {@inheritDoc}
+ */
public int getCurrentPosition() {
return 1;
}
+ /**
+ * {@inheritDoc}
+ */
public int getDocumentOrder() {
return -1;
}
+ /**
+ * {@inheritDoc}
+ */
public void reset() {
super.reset();
setStarted = false;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean setPosition(int position) {
super.setPosition(position);
return position == 1;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean nextNode() {
// Each set contains exactly one node: the parent
if (setStarted) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java Sun Feb 3 08:08:38 2008
@@ -37,30 +37,47 @@
private NodePointer currentRootLocation;
private boolean reverse;
+ /**
+ * Create a new PrecedingOrFollowingContext.
+ * @param parentContext parent context
+ * @param nodeTest test
+ * @param reverse whether to iterate in reverse order
+ */
public PrecedingOrFollowingContext(
EvalContext parentContext,
NodeTest nodeTest,
- boolean reverse)
- {
+ boolean reverse) {
super(parentContext);
this.nodeTest = nodeTest;
this.reverse = reverse;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getCurrentNodePointer() {
return currentNodePointer;
}
+ /**
+ * {@inheritDoc}
+ */
public int getDocumentOrder() {
return reverse ? -1 : 1;
}
+ /**
+ * {@inheritDoc}
+ */
public void reset() {
super.reset();
stack = new Stack();
setStarted = false;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean setPosition(int position) {
if (position < this.position) {
reset();
@@ -74,6 +91,9 @@
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean nextNode() {
if (!setStarted) {
setStarted = true;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/RootContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/RootContext.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/RootContext.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/RootContext.java Sun Feb 3 08:08:38 2008
@@ -33,15 +33,18 @@
public class RootContext extends EvalContext {
private JXPathContextReferenceImpl jxpathContext;
private NodePointer pointer;
- private Object registers[];
+ private Object[] registers;
private int availableRegister = 0;
public static final Object UNKNOWN_VALUE = new Object();
private static final int MAX_REGISTER = 4;
- public RootContext(
- JXPathContextReferenceImpl jxpathContext,
- NodePointer pointer)
- {
+ /**
+ * Create a new RootContext.
+ * @param jxpathContext context
+ * @param pointer pointer
+ */
+ public RootContext(JXPathContextReferenceImpl jxpathContext,
+ NodePointer pointer) {
super(null);
this.jxpathContext = jxpathContext;
this.pointer = pointer;
@@ -50,42 +53,75 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public JXPathContext getJXPathContext() {
return jxpathContext;
}
+ /**
+ * {@inheritDoc}
+ */
public RootContext getRootContext() {
return this;
}
+ /**
+ * Get absolute root context
+ * @return EvalContext
+ */
public EvalContext getAbsoluteRootContext() {
return jxpathContext.getAbsoluteRootContext();
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getCurrentNodePointer() {
return pointer;
}
+ /**
+ * {@inheritDoc}
+ */
public Object getValue() {
return pointer;
}
+ /**
+ * {@inheritDoc}
+ */
public int getCurrentPosition() {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean nextNode() {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean nextSet() {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean setPosition(int position) {
throw new UnsupportedOperationException();
}
+ /**
+ * Get a context that points to the specified object.
+ * @param constant object
+ * @return EvalContext
+ */
public EvalContext getConstantContext(Object constant) {
if (constant instanceof NodeSet) {
return new NodeSetContext(
@@ -106,6 +142,11 @@
return new InitialContext(new RootContext(jxpathContext, pointer));
}
+ /**
+ * Get variable context.
+ * @param variableName variable name
+ * @return EvalContext
+ */
public EvalContext getVariableContext(QName variableName) {
return new InitialContext(
new RootContext(
@@ -113,10 +154,21 @@
jxpathContext.getVariablePointer(variableName)));
}
+ /**
+ * Get the specified function from the context.
+ * @param functionName QName
+ * @param parameters Object[]
+ * @return Function
+ */
public Function getFunction(QName functionName, Object[] parameters) {
return jxpathContext.getFunction(functionName, parameters);
}
+ /**
+ * Get a registered value.
+ * @param id int
+ * @return Object
+ */
public Object getRegisteredValue(int id) {
if (registers == null || id >= MAX_REGISTER || id == -1) {
return UNKNOWN_VALUE;
@@ -124,6 +176,11 @@
return registers[id];
}
+ /**
+ * Set the next registered value.
+ * @param value Object
+ * @return the id that can reclaim value.
+ */
public int setRegisteredValue(Object value) {
if (registers == null) {
registers = new Object[MAX_REGISTER];
@@ -139,6 +196,9 @@
return availableRegister - 1;
}
+ /**
+ * {@inheritDoc}
+ */
public String toString() {
return super.toString() + ":" + pointer.asPath();
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Constant.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Constant.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Constant.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Constant.java Sun Feb 3 08:08:38 2008
@@ -29,20 +29,31 @@
private Object value;
+ /**
+ * Create a new Constant.
+ * @param number constant
+ */
public Constant(Number number) {
this.value = number;
}
+ /**
+ * Create a new Constant.
+ * @param string constant
+ */
public Constant(String string) {
this.value = string;
}
+ /**
+ * {@inheritDoc}
+ */
public Object compute(EvalContext context) {
return value;
}
/**
- * Returns the value of the constant.
+ * {@inheritDoc}
*/
public Object computeValue(EvalContext context) {
return value;
@@ -50,6 +61,7 @@
/**
* Returns false
+ * @return false
*/
public boolean isContextDependent() {
return false;
@@ -57,11 +69,15 @@
/**
* Returns false
+ * @return false
*/
public boolean computeContextDependent() {
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public String toString() {
if (value instanceof Number) {
return InfoSetUtil.stringValue(value);
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java Sun Feb 3 08:08:38 2008
@@ -27,32 +27,48 @@
*/
public abstract class CoreOperation extends Operation {
- public CoreOperation(Expression args[]) {
+ /**
+ * Create a new CoreOperation.
+ * @param args Expression[]
+ */
+ public CoreOperation(Expression[] args) {
super(args);
}
+ /**
+ * {@inheritDoc}
+ */
public Object compute(EvalContext context) {
return computeValue(context);
}
+ /**
+ * {@inheritDoc}
+ */
public abstract Object computeValue(EvalContext context);
/**
* Returns the XPath symbol for this operation, e.g. "+", "div", etc.
+ * @return String symbol
*/
public abstract String getSymbol();
/**
* Returns true if the operation is not sensitive to the order of arguments,
* e.g. "=", "and" etc, and false if it is, e.g. "<=", "div".
+ * @return boolean
*/
protected abstract boolean isSymmetric();
/**
* Computes the precedence of the operation.
+ * @return int precedence
*/
protected abstract int getPrecedence();
+ /**
+ * {@inheritDoc}
+ */
public String toString() {
if (args.length == 1) {
return getSymbol() + parenthesize(args[0], false);
@@ -69,6 +85,12 @@
return buffer.toString();
}
+ /**
+ * Wrap an expression in parens if necessary.
+ * @param expression other Expression
+ * @param left whether <code>expression</code> is left of this one.
+ * @return String
+ */
private String parenthesize(Expression expression, boolean left) {
String s = expression.toString();
if (!(expression instanceof CoreOperation)) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java Sun Feb 3 08:08:38 2008
@@ -25,14 +25,25 @@
public class CoreOperationLessThanOrEqual extends
CoreOperationRelationalExpression {
+ /**
+ * Create a new CoreOperationLessThanOrEqual.
+ * @param arg1 left Expression
+ * @param arg2 right Expression
+ */
public CoreOperationLessThanOrEqual(Expression arg1, Expression arg2) {
super(new Expression[] { arg1, arg2 });
}
+ /**
+ * {@inheritDoc}
+ */
protected boolean evaluateCompare(int compare) {
return compare <= 0;
}
+ /**
+ * {@inheritDoc}
+ */
public String getSymbol() {
return "<=";
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java Sun Feb 3 08:08:38 2008
@@ -27,24 +27,41 @@
*/
public class CoreOperationMultiply extends CoreOperation {
+ /**
+ * Create a new CoreOperationMultiply.
+ * @param arg1 factor 1
+ * @param arg2 factor 2
+ */
public CoreOperationMultiply(Expression arg1, Expression arg2) {
super(new Expression[] { arg1, arg2 });
}
+ /**
+ * {@inheritDoc}
+ */
public Object computeValue(EvalContext context) {
double l = InfoSetUtil.doubleValue(args[0].computeValue(context));
double r = InfoSetUtil.doubleValue(args[1].computeValue(context));
return new Double(l * r);
}
+ /**
+ * {@inheritDoc}
+ */
protected int getPrecedence() {
return 5;
}
+ /**
+ * {@inheritDoc}
+ */
protected boolean isSymmetric() {
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public String getSymbol() {
return "*";
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java Sun Feb 3 08:08:38 2008
@@ -27,12 +27,19 @@
*/
public class CoreOperationUnion extends CoreOperation {
- public CoreOperationUnion(Expression args[]) {
+ /**
+ * Create a new CoreOperationUnion.
+ * @param args Expression[]
+ */
+ public CoreOperationUnion(Expression[] args) {
super(args);
}
+ /**
+ * {@inheritDoc}
+ */
public Object computeValue(EvalContext context) {
- EvalContext argCtxs[] = new EvalContext[args.length];
+ EvalContext[] argCtxs = new EvalContext[args.length];
for (int i = 0; i < args.length; i++) {
Object value = args[i].compute(context);
if (value instanceof EvalContext) {
@@ -45,14 +52,23 @@
return new UnionContext(context.getRootContext(), argCtxs);
}
+ /**
+ * {@inheritDoc}
+ */
protected int getPrecedence() {
return 7;
}
+ /**
+ * {@inheritDoc}
+ */
protected boolean isSymmetric() {
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public String getSymbol() {
return "|";
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NameAttributeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NameAttributeTest.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NameAttributeTest.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/NameAttributeTest.java Sun Feb 3 08:08:38 2008
@@ -27,16 +27,25 @@
*/
public class NameAttributeTest extends CoreOperationEqual {
+ /**
+ * Create a new NameAttributeTest.
+ * @param namePath Expression
+ * @param nameValue Expression
+ */
public NameAttributeTest(Expression namePath, Expression nameValue) {
super(namePath, nameValue);
}
+ /**
+ * Get the name test expression.
+ * @return Expression
+ */
public Expression getNameTestExpression() {
return args[1];
}
/**
- * @see Expression#computeContextDependent()
+ * {@inheritDoc}
*/
public boolean computeContextDependent() {
return true;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Operation.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Operation.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Operation.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/Operation.java Sun Feb 3 08:08:38 2008
@@ -22,16 +22,28 @@
*/
public abstract class Operation extends Expression {
- protected Expression args[];
+ /** Expression[] of arguments */
+ protected Expression[] args;
- public Operation(Expression args[]) {
+ /**
+ * Create a new Operation.
+ * @param args Expression[]
+ */
+ public Operation(Expression[] args) {
this.args = args;
}
+ /**
+ * Get the arguments.
+ * @return Expression[]
+ */
public Expression[] getArguments() {
return args;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean computeContextDependent() {
if (args != null) {
for (int i = 0; i < args.length; i++) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ProcessingInstructionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ProcessingInstructionTest.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ProcessingInstructionTest.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/ProcessingInstructionTest.java Sun Feb 3 08:08:38 2008
@@ -23,14 +23,25 @@
public class ProcessingInstructionTest extends NodeTest {
private String target;
+ /**
+ * Create a new ProcessingInstructionTest.
+ * @param target string
+ */
public ProcessingInstructionTest(String target) {
this.target = target;
}
+ /**
+ * Get the target.
+ * @return String
+ */
public String getTarget() {
return target;
}
+ /**
+ * {@inheritDoc}
+ */
public String toString() {
return "processing-instruction('" + target + "')";
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/VariableReference.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/VariableReference.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/VariableReference.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/VariableReference.java Sun Feb 3 08:08:38 2008
@@ -29,32 +29,54 @@
private QName varName;
+ /**
+ * Create a new VariableReference.
+ * @param varName variable name
+ */
public VariableReference(QName varName) {
this.varName = varName;
}
+ /**
+ * Get the variable name.
+ * @return QName
+ */
public QName getVariableName() {
return varName;
}
+ /**
+ * {@inheritDoc}
+ */
public String toString() {
return "$" + varName;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isContextDependent() {
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean computeContextDependent() {
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public Object compute(EvalContext context) {
return computeValue(context);
}
/**
* Returns the value of the variable.
+ * @param context EvalContext against which to compute the variable's value.
+ * @return Object
*/
public Object computeValue(EvalContext context) {
return context.getRootContext().getVariableContext(varName);
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java Sun Feb 3 08:08:38 2008
@@ -51,6 +51,7 @@
/** Index for this NodePointer */
protected int index = WHOLE_COLLECTION;
+
private boolean attribute = false;
private transient Object rootNode;
private NamespaceResolver namespaceResolver;
@@ -58,12 +59,15 @@
/**
* Allocates an entirely new NodePointer by iterating through all installed
* NodePointerFactories until it finds one that can create a pointer.
+ * @param name QName
+ * @param bean Object
+ * @param locale Locale
+ * @return NodePointer
*/
public static NodePointer newNodePointer(
QName name,
Object bean,
- Locale locale)
- {
+ Locale locale) {
NodePointer pointer = null;
if (bean == null) {
pointer = new NullPointer(name, locale);
@@ -86,12 +90,15 @@
/**
* Allocates an new child NodePointer by iterating through all installed
* NodePointerFactories until it finds one that can create a pointer.
+ * @param parent pointer
+ * @param name QName
+ * @param bean Object
+ * @return NodePointer
*/
public static NodePointer newChildNodePointer(
NodePointer parent,
QName name,
- Object bean)
- {
+ Object bean) {
NodePointerFactory[] factories =
JXPathContextReferenceImpl.getNodePointerFactories();
for (int i = 0; i < factories.length; i++) {
@@ -106,19 +113,34 @@
+ bean.getClass());
}
+ /** Parent pointer */
protected NodePointer parent;
+
+ /** Locale */
protected Locale locale;
-// private NamespaceManager namespaceManager;
+ /**
+ * Create a new NodePointer.
+ * @param parent Pointer
+ */
protected NodePointer(NodePointer parent) {
this.parent = parent;
}
+ /**
+ * Create a new NodePointer.
+ * @param parent Pointer
+ * @param locale Locale
+ */
protected NodePointer(NodePointer parent, Locale locale) {
this.parent = parent;
this.locale = locale;
}
+ /**
+ * Get the NamespaceResolver associated with this NodePointer.
+ * @return NamespaceResolver
+ */
public NamespaceResolver getNamespaceResolver() {
if (namespaceResolver == null && parent != null) {
namespaceResolver = parent.getNamespaceResolver();
@@ -126,10 +148,18 @@
return namespaceResolver;
}
+ /**
+ * Set the NamespaceResolver for this NodePointer.
+ * @param namespaceResolver NamespaceResolver
+ */
public void setNamespaceResolver(NamespaceResolver namespaceResolver) {
this.namespaceResolver = namespaceResolver;
}
+ /**
+ * Get the parent pointer.
+ * @return NodePointer
+ */
public NodePointer getParent() {
NodePointer pointer = parent;
while (pointer != null && pointer.isContainer()) {
@@ -138,12 +168,17 @@
return pointer;
}
+ /**
+ * Get the immediate parent pointer.
+ * @return NodePointer
+ */
public NodePointer getImmediateParentPointer() {
return parent;
}
/**
* Set to true if the pointer represents the "attribute::" axis.
+ * @param attribute boolean
*/
public void setAttribute(boolean attribute) {
this.attribute = attribute;
@@ -151,6 +186,7 @@
/**
* Returns true if the pointer represents the "attribute::" axis.
+ * @return boolean
*/
public boolean isAttribute() {
return attribute;
@@ -158,6 +194,7 @@
/**
* Returns true if this Pointer has no parent.
+ * @return boolean
*/
public boolean isRoot() {
return parent == null;
@@ -165,10 +202,13 @@
/**
* If true, this node does not have children
+ * @return boolean
*/
public abstract boolean isLeaf();
/**
+ * Learn whether this pointer is considered to be a node.
+ * @return boolean
* @deprecated Please use !isContainer()
*/
public boolean isNode() {
@@ -176,8 +216,9 @@
}
/**
- * If true, this node is axiliary and can only be used as an intermediate in
+ * If true, this node is auxiliary and can only be used as an intermediate in
* the chain of pointers.
+ * @return boolean
*/
public boolean isContainer() {
return false;
@@ -189,11 +230,16 @@
* is <code>WHOLE_COLLECTION</code>, which just means that the pointer
* is not indexed at all.
* Note: the index on NodePointer starts with 0, not 1.
+ * @return int
*/
public int getIndex() {
return index;
}
+ /**
+ * Set the index of this NodePointer.
+ * @param index int
+ */
public void setIndex(int index) {
this.index = index;
}
@@ -201,6 +247,7 @@
/**
* Returns <code>true</code> if the value of the pointer is an array or
* a Collection.
+ * @return boolean
*/
public abstract boolean isCollection();
@@ -208,6 +255,7 @@
* If the pointer represents a collection (or collection element),
* returns the length of the collection.
* Otherwise returns 1 (even if the value is null).
+ * @return int
*/
public abstract int getLength();
@@ -215,6 +263,7 @@
* By default, returns <code>getNode()</code>, can be overridden to
* return a "canonical" value, like for instance a DOM element should
* return its string value.
+ * @return Object value
*/
public Object getValue() {
NodePointer valuePointer = getValuePointer();
@@ -241,6 +290,7 @@
* <code>getValuePointer()</code> method should then open all those
* containers and return the pointer to the ultimate contents. It does so
* with the above recursion.
+ * @return NodePointer
*/
public NodePointer getValuePointer() {
NodePointer ivp = getImmediateValuePointer();
@@ -269,6 +319,7 @@
* If <em>address</em> is null, the pointer is not actual.
* (In JavaBeans) if <em>address</em> is not a property of the root bean,
* a Pointer for this path cannot be obtained at all - actual or otherwise.
+ * @return boolean
*/
public boolean isActual() {
return index == WHOLE_COLLECTION || index >= 0 && index < getLength();
@@ -439,8 +490,7 @@
JXPathContext context,
QName name,
int index,
- Object value)
- {
+ Object value) {
throw new JXPathException("Cannot create an object for path "
+ asPath() + "/" + name + "[" + (index + 1) + "]"
+ ", operation is not allowed for this type of node");
@@ -456,8 +506,7 @@
* @param index child index.
* @return created NodePointer
*/
- public NodePointer createChild(JXPathContext context, QName name, int index)
- {
+ public NodePointer createChild(JXPathContext context, QName name, int index) {
throw new JXPathException("Cannot create an object for path "
+ asPath() + "/" + name + "[" + (index + 1) + "]"
+ ", operation is not allowed for this type of node");
@@ -512,8 +561,7 @@
public NodeIterator childIterator(
NodeTest test,
boolean reverse,
- NodePointer startWith)
- {
+ NodePointer startWith) {
NodePointer valuePointer = getValuePointer();
return valuePointer == null || valuePointer == this ? null
: valuePointer.childIterator(test, reverse, startWith);
@@ -611,10 +659,9 @@
* @return Pointer found
*/
public Pointer getPointerByKey(
- JXPathContext context,
- String key,
- String value)
- {
+ JXPathContext context,
+ String key,
+ String value) {
return context.getPointerByKey(key, value);
}
@@ -736,8 +783,7 @@
NodePointer p1,
int depth1,
NodePointer p2,
- int depth2)
- {
+ int depth2) {
if (depth1 < depth2) {
int r = compareNodePointers(p1, depth1, p2.parent, depth2 - 1);
return r == 0 ? -1 : r;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java Sun Feb 3 08:08:38 2008
@@ -33,64 +33,112 @@
*/
public class NullElementPointer extends CollectionPointer {
+ /**
+ * Create a new NullElementPointer.
+ * @param parent parent pointer
+ * @param index int
+ */
public NullElementPointer(NodePointer parent, int index) {
super(parent, (Object) null);
this.index = index;
}
+ /**
+ * {@inheritDoc}
+ */
public QName getName() {
return null;
}
+ /**
+ * {@inheritDoc}
+ */
public Object getBaseValue() {
return null;
}
+ /**
+ * {@inheritDoc}
+ */
public Object getImmediateNode() {
return null;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isLeaf() {
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isCollection() {
return false;
}
+ /**
+ * Get the property pointer for this.
+ * @return PropertyPointer
+ */
public PropertyPointer getPropertyPointer() {
return new NullPropertyPointer(this);
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getValuePointer() {
return new NullPointer(this, getName());
}
+ /**
+ * {@inheritDoc}
+ */
public void setValue(Object value) {
throw new UnsupportedOperationException(
"Collection element does not exist: " + this);
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isActual() {
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isContainer() {
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer createPath(JXPathContext context) {
return parent.createChild(context, null, index);
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer createPath(JXPathContext context, Object value) {
return parent.createChild(context, null, index, value);
}
+ /**
+ * {@inheritDoc}
+ */
public int hashCode() {
return getImmediateParentPointer().hashCode() + index;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean equals(Object object) {
if (object == this) {
return true;
@@ -102,13 +150,19 @@
NullElementPointer other = (NullElementPointer) object;
return getImmediateParentPointer() == other.getImmediateParentPointer()
- && index == other.index;
+ && index == other.index;
}
+ /**
+ * {@inheritDoc}
+ */
public int getLength() {
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
public String asPath() {
StringBuffer buffer = new StringBuffer();
NodePointer parent = getImmediateParentPointer();
@@ -122,9 +176,7 @@
}
else if (parent != null
&& parent.getImmediateParentPointer() != null
- && parent.getImmediateParentPointer().getIndex() !=
- WHOLE_COLLECTION)
- {
+ && parent.getImmediateParentPointer().getIndex() != WHOLE_COLLECTION) {
buffer.append("/.");
}
buffer.append("[").append(index + 1).append(']');
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/container/ContainerPointerFactory.java Sun Feb 3 08:08:38 2008
@@ -30,26 +30,30 @@
* @version $Revision$ $Date$
*/
public class ContainerPointerFactory implements NodePointerFactory {
-
+ /** factory order for this factory */
public static final int CONTAINER_POINTER_FACTORY_ORDER = 200;
+ /**
+ * {@inheritDoc}
+ */
public int getOrder() {
return CONTAINER_POINTER_FACTORY_ORDER;
}
- public NodePointer createNodePointer(
- QName name,
- Object bean,
- Locale locale)
- {
- return bean instanceof Container ? new ContainerPointer((Container) bean, locale) : null;
+ /**
+ * {@inheritDoc}
+ */
+ public NodePointer createNodePointer(QName name, Object bean, Locale locale) {
+ return bean instanceof Container ? new ContainerPointer(
+ (Container) bean, locale) : null;
}
- public NodePointer createNodePointer(
- NodePointer parent,
- QName name,
- Object bean)
- {
- return bean instanceof Container ? new ContainerPointer(parent, (Container) bean) : null;
+ /**
+ * {@inheritDoc}
+ */
+ public NodePointer createNodePointer(NodePointer parent, QName name,
+ Object bean) {
+ return bean instanceof Container ? new ContainerPointer(parent,
+ (Container) bean) : null;
}
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java Sun Feb 3 08:08:38 2008
@@ -35,12 +35,18 @@
private boolean reverse;
private int position = 0;
+ /**
+ * Create a new DOMNodeIterator.
+ * @param parent parent pointer
+ * @param nodeTest test
+ * @param reverse whether to iterate in reverse
+ * @param startWith starting pointer
+ */
public DOMNodeIterator(
NodePointer parent,
NodeTest nodeTest,
boolean reverse,
- NodePointer startWith)
- {
+ NodePointer startWith) {
this.parent = parent;
this.node = (Node) parent.getNode();
if (startWith != null) {
@@ -50,6 +56,9 @@
this.reverse = reverse;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getNodePointer() {
if (position == 0) {
setPosition(1);
@@ -57,10 +66,16 @@
return child == null ? null : new DOMNodePointer(parent, child);
}
+ /**
+ * {@inheritDoc}
+ */
public int getPosition() {
return position;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean setPosition(int position) {
while (this.position < position) {
if (!next()) {
@@ -75,6 +90,10 @@
return true;
}
+ /**
+ * Set the previous position.
+ * @return whether valid
+ */
private boolean previous() {
position--;
if (!reverse) {
@@ -100,6 +119,10 @@
return child != null;
}
+ /**
+ * Set the next position.
+ * @return whether valid
+ */
private boolean next() {
position++;
if (!reverse) {
@@ -137,6 +160,10 @@
return child != null;
}
+ /**
+ * Test child.
+ * @return result of the test
+ */
private boolean testChild() {
return DOMNodePointer.testNode(child, nodeTest);
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodeIterator.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodeIterator.java Sun Feb 3 08:08:38 2008
@@ -41,10 +41,16 @@
private List children;
private Object child;
+ /**
+ * Create a new JDOMNodeIterator.
+ * @param parent pointer
+ * @param nodeTest test
+ * @param reverse whether to iterate in reverse
+ * @param startWith starting pointer
+ */
public JDOMNodeIterator(
NodePointer parent, NodeTest nodeTest,
- boolean reverse, NodePointer startWith)
- {
+ boolean reverse, NodePointer startWith) {
this.parent = parent;
if (startWith != null) {
this.child = startWith.getNode();
@@ -64,6 +70,9 @@
this.reverse = reverse;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getNodePointer() {
if (child == null) {
if (!setPosition(1)) {
@@ -75,10 +84,16 @@
return new JDOMNodePointer(parent, child);
}
+ /**
+ * {@inheritDoc}
+ */
public int getPosition() {
return position;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean setPosition(int position) {
while (this.position < position) {
if (!next()) {
@@ -98,6 +113,7 @@
* of xpaths - an iterator is always going forward, never backwards.
* So, this is implemented only for completeness and perhaps for
* those who use these iterators outside of XPath evaluation.
+ * @return boolean
*/
private boolean previous() {
position--;
@@ -120,6 +136,10 @@
return false;
}
+ /**
+ * Iterate to next pointer.
+ * @return whether valid
+ */
private boolean next() {
position++;
if (!reverse) {
@@ -160,6 +180,10 @@
}
}
+ /**
+ * Test a child node.
+ * @return whether test passes.
+ */
private boolean testChild() {
return JDOMNodePointer.testNode(parent, child, nodeTest);
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java Sun Feb 3 08:08:38 2008
@@ -101,8 +101,7 @@
public NodeIterator childIterator(
NodeTest test,
boolean reverse,
- NodePointer startWith)
- {
+ NodePointer startWith) {
return new JDOMNodeIterator(this, test, reverse, startWith);
}
@@ -188,8 +187,7 @@
*/
public int compareChildNodePointers(
NodePointer pointer1,
- NodePointer pointer2)
- {
+ NodePointer pointer2) {
Object node1 = pointer1.getBaseValue();
Object node2 = pointer2.getBaseValue();
if (node1 == node2) {
@@ -431,8 +429,7 @@
public static boolean testNode(
NodePointer pointer,
Object node,
- NodeTest test)
- {
+ NodeTest test) {
if (test == null) {
return true;
}
@@ -599,8 +596,7 @@
public NodePointer createChild(
JXPathContext context,
QName name,
- int index)
- {
+ int index) {
if (index == WHOLE_COLLECTION) {
index = 0;
}
@@ -633,8 +629,7 @@
* {@inheritDoc}
*/
public NodePointer createChild(
- JXPathContext context, QName name, int index, Object value)
- {
+ JXPathContext context, QName name, int index, Object value) {
NodePointer ptr = createChild(context, name, index);
ptr.setValue(value);
return ptr;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMPointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMPointerFactory.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMPointerFactory.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMPointerFactory.java Sun Feb 3 08:08:38 2008
@@ -32,15 +32,21 @@
*/
public class JDOMPointerFactory implements NodePointerFactory {
+ /** factory order constant */
public static final int JDOM_POINTER_FACTORY_ORDER = 110;
+ /**
+ * {@inheritDoc}
+ */
public int getOrder() {
return JDOM_POINTER_FACTORY_ORDER;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer createNodePointer(
- QName name, Object bean, Locale locale)
- {
+ QName name, Object bean, Locale locale) {
if (bean instanceof Document) {
return new JDOMNodePointer(bean, locale);
}
@@ -50,9 +56,11 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer createNodePointer(
- NodePointer parent, QName name, Object bean)
- {
+ NodePointer parent, QName name, Object bean) {
if (bean instanceof Document) {
return new JDOMNodePointer(parent, bean);
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser.java?rev=618011&r1=618010&r2=618011&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser.java Sun Feb 3 08:08:38 2008
@@ -30,6 +30,8 @@
/**
* Reads the supplied XML file and returns the resulting model,
* which is not necessarily DOM.
+ * @param stream InputStream
+ * @return Object
*/
Object parseXML(InputStream stream);
}