changeset 4594:2970046fcdca

Doc.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 29 Nov 2012 11:48:20 +0100
parents 047c965ea542
children 0b48085f93aa
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/StackFrames.java
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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));
     }
--- 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();

http://dive4elements.wald.intevation.org