[Dive4elements-commits] [PATCH 1 of 5] Doc
Wald Commits
scm-commit at wald.intevation.org
Fri Nov 30 11:58:23 CET 2012
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1354186100 -3600
# Node ID 2970046fcdca4594fc4e1c0eacd3e47abf9a3fcb
# Parent 047c965ea5423c30e64ea3d6dd673f6948d903b6
Doc.
diff -r 047c965ea542 -r 2970046fcdca flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Fri Nov 30 11:32:29 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Thu Nov 29 11:48:20 2012 +0100
@@ -13,9 +13,12 @@
import org.apache.log4j.Logger;
+
+/** Resolves functions (e.g. dc:contains) in Datacage/Meta-Data system. */
public class FunctionResolver
implements XPathFunctionResolver
{
+ /** Home logger. */
private static Logger log = Logger.getLogger(FunctionResolver.class);
public static final String FUNCTION_NAMESPACE_URI = "dc";
@@ -79,12 +82,19 @@
});
}
+ /** List of functions. */
protected List<Entry> functions;
public FunctionResolver() {
functions = new ArrayList<Entry>();
}
+ /**
+ * Create a new function.
+ * @param name Name of the function.
+ * @param arity Number of arguments for function.
+ * @param function the function itself.
+ */
public void addFunction(String name, int arity, XPathFunction function) {
functions.add(new Entry(name, function, arity));
}
diff -r 047c965ea542 -r 2970046fcdca flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/StackFrames.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/StackFrames.java Fri Nov 30 11:32:29 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/StackFrames.java Thu Nov 29 11:48:20 2012 +0100
@@ -13,11 +13,17 @@
import org.apache.log4j.Logger;
+
+/**
+ * Maintains stack of 'frames' which are maps from string to object.
+ * Used for variables in datacage/meta-data system.
+ */
public class StackFrames
implements XPathVariableResolver
{
private static Logger log = Logger.getLogger(StackFrames.class);
+ /** The frames (used like a stack). */
protected List<Map<String, Object>> frames;
public StackFrames() {
@@ -31,14 +37,17 @@
}
}
+ /** Push a new String->Object map. */
public void enter() {
frames.add(new HashMap<String, Object>());
}
+ /** Pop/Remove last String->Object map. */
public void leave() {
frames.remove(frames.size()-1);
}
+ /** Put Key/Value in last String->Object map. */
public void put(String key, Object value) {
int N = frames.size();
if (N > 0) {
@@ -46,6 +55,7 @@
}
}
+ /** Put multiple Key/Values in last String->Object map. */
public void put(String [] keys, Object [] values) {
Map<String, Object> top = frames.get(frames.size()-1);
for (int i = 0; i < keys.length; ++i) {
@@ -53,6 +63,7 @@
}
}
+ /** Check last frame (string->object map) for key. */
public boolean containsKey(String key) {
key = key.toUpperCase();
for (int i = frames.size()-1; i >= 0; --i) {
@@ -73,6 +84,8 @@
return get(key, null);
}
+ /** result[0] is modified with value when true returned.
+ * @return false if key not found in any frame. */
public boolean getStore(String key, Object [] result) {
key = key.toUpperCase();
More information about the Dive4elements-commits
mailing list