Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 7529)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 7530)
@@ -28,4 +28,5 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.mappaint.Cascade;
 import org.openstreetmap.josm.gui.mappaint.Environment;
@@ -120,4 +121,9 @@
         }
 
+        /**
+         * Function associated to the numeric "+" operator.
+         * @param args arguments
+         * @return Sum of arguments
+         */
         public static float plus(float... args) {
             float res = 0;
@@ -128,4 +134,9 @@
         }
 
+        /**
+         * Function associated to the numeric "-" operator.
+         * @param args arguments
+         * @return Substraction of arguments
+         */
         public static Float minus(float... args) {
             if (args.length == 0) {
@@ -142,4 +153,9 @@
         }
 
+        /**
+         * Function associated to the numeric "*" operator.
+         * @param args arguments
+         * @return Multiplication of arguments
+         */
         public static float times(float... args) {
             float res = 1;
@@ -150,4 +166,9 @@
         }
 
+        /**
+         * Function associated to the numeric "/" operator.
+         * @param args arguments
+         * @return Division of arguments
+         */
         public static Float divided_by(float... args) {
             if (args.length == 0) {
@@ -166,4 +187,6 @@
         /**
          * Creates a list of values, e.g., for the {@code dashes} property.
+         * @param args The values to put in a list
+         * @return list of values
          * @see Arrays#asList(Object[])
          */
@@ -183,4 +206,6 @@
         /**
          * Returns the first non-null object. The name originates from the {@code COALESCE} SQL function.
+         * @param args arguments
+         * @return the first non-null object
          * @deprecated Deprecated in favour of {@link #any(Object...)} from the MapCSS standard.
          */
@@ -194,4 +219,6 @@
          * Returns the first non-null object.
          * The name originates from <a href="http://wiki.openstreetmap.org/wiki/MapCSS/0.2/eval">MapCSS standard</a>.
+         * @param args arguments
+         * @return the first non-null object
          * @see #coalesce(Object...)
          * @see Utils#firstNonNull(Object[])
@@ -204,4 +231,7 @@
         /**
          * Get the {@code n}th element of the list {@code lst} (counting starts at 0).
+         * @param lst list
+         * @param n index
+         * @return {@code n}th element of the list, or {@code null} if index out of range
          * @since 5699
          */
@@ -216,4 +246,7 @@
         /**
          * Splits string {@code toSplit} at occurrences of the separator string {@code sep} and returns a list of matches.
+         * @param sep separator string
+         * @param toSplit string to split
+         * @return list of matches
          * @see String#split(String)
          * @since 5699
@@ -225,4 +258,8 @@
         /**
          * Creates a color value with the specified amounts of {@code r}ed, {@code g}reen, {@code b}lue (arguments from 0.0 to 1.0)
+         * @param r the red component
+         * @param g the green component
+         * @param b the blue component
+         * @return color matching the given components
          * @see Color#Color(float, float, float)
          */
@@ -235,4 +272,13 @@
         }
 
+        /**
+         * Creates a color value with the specified amounts of {@code r}ed, {@code g}reen, {@code b}lue, {@code alpha} (arguments from 0.0 to 1.0)
+         * @param r the red component
+         * @param g the green component
+         * @param b the blue component
+         * @param alpha the alpha component
+         * @return color matching the given components
+         * @see Color#Color(float, float, float, float)
+         */
         public static Color rgba(float r, float g, float b, float alpha) {
             try {
@@ -260,4 +306,6 @@
         /**
          * Creates a color value from an HTML notation, i.e., {@code #rrggbb}.
+         * @param html HTML notation
+         * @return color matching the given notation
          */
         public static Color html2color(String html) {
@@ -267,4 +315,6 @@
         /**
          * Computes the HTML notation ({@code #rrggbb}) for a color value).
+         * @param c color
+         * @return HTML notation matching the given color
          */
         public static String color2html(Color c) {
@@ -274,4 +324,5 @@
         /**
          * Get the value of the red color channel in the rgb color model
+         * @param c color
          * @return the red color channel in the range [0;1]
          * @see java.awt.Color#getRed()
@@ -283,4 +334,5 @@
         /**
          * Get the value of the green color channel in the rgb color model
+         * @param c color
          * @return the green color channel in the range [0;1]
          * @see java.awt.Color#getGreen()
@@ -292,4 +344,5 @@
         /**
          * Get the value of the blue color channel in the rgb color model
+         * @param c color
          * @return the blue color channel in the range [0;1]
          * @see java.awt.Color#getBlue()
@@ -301,4 +354,5 @@
         /**
          * Get the value of the alpha channel in the rgba color model
+         * @param c color
          * @return the alpha channel in the range [0;1]
          * @see java.awt.Color#getAlpha()
@@ -310,4 +364,6 @@
         /**
          * Assembles the strings to one.
+         * @param args arguments
+         * @return assembled string
          * @see Utils#join
          */
@@ -319,4 +375,6 @@
         /**
          * Assembles the strings to one, where the first entry is used as separator.
+         * @param args arguments. First one is used as separator
+         * @return assembled string
          * @see Utils#join
          */
@@ -328,4 +386,7 @@
         /**
          * Returns the value of the property {@code key}, e.g., {@code prop("width")}.
+         * @param env the environment
+         * @param key the property key
+         * @return the property value
          */
         public static Object prop(final Environment env, String key) {
@@ -335,4 +396,7 @@
         /**
          * Returns the value of the property {@code key} from layer {@code layer}.
+         * @param env the environment
+         * @param key the property key
+         * @return the property value
          */
         public static Object prop(final Environment env, String key, String layer) {
@@ -342,4 +406,7 @@
         /**
          * Determines whether property {@code key} is set.
+         * @param env the environment
+         * @param key the property key
+         * @return {@code true} if the property is set, {@code false} otherwise
          */
         public static Boolean is_prop_set(final Environment env, String key) {
@@ -349,4 +416,7 @@
         /**
          * Determines whether property {@code key} is set on layer {@code layer}.
+         * @param env the environment
+         * @param key the property key
+         * @return {@code true} if the property is set, {@code false} otherwise
          */
         public static Boolean is_prop_set(final Environment env, String key, String layer) {
@@ -356,4 +426,7 @@
         /**
          * Gets the value of the key {@code key} from the object in question.
+         * @param env the environment
+         * @param key the OSM key
+         * @return the value for given key
          */
         public static String tag(final Environment env, String key) {
@@ -363,4 +436,7 @@
         /**
          * Gets the first non-null value of the key {@code key} from the object's parent(s).
+         * @param env the environment
+         * @param key the OSM key
+         * @return first non-null value of the key {@code key} from the object's parent(s)
          */
         public static String parent_tag(final Environment env, String key) {
@@ -380,4 +456,10 @@
         }
 
+        /**
+         * Gets the value of the key {@code key} from the object's child.
+         * @param env the environment
+         * @param key the OSM key
+         * @return the value of the key {@code key} from the object's child, or {@code null} if there is no child
+         */
         public static String child_tag(final Environment env, String key) {
             return env.child == null ? null : env.child.get(key);
@@ -386,4 +468,7 @@
         /**
          * Determines whether the object has a tag with the given key.
+         * @param env the environment
+         * @param key the OSM key
+         * @return {@code true} if the object has a tag with the given key, {@code false} otherwise
          */
         public static boolean has_tag_key(final Environment env, String key) {
@@ -393,4 +478,6 @@
         /**
          * Returns the index of node in parent way or member in parent relation.
+         * @param env the environment
+         * @return the index as float. Starts at 1
          */
         public static Float index(final Environment env) {
@@ -401,24 +488,59 @@
         }
 
+        /**
+         * Returns the role of current object in parent relation, or role of child if current object is a relation.
+         * @param env the environment
+         * @return role of current object in parent relation, or role of child if current object is a relation
+         * @see Environment#getRole()
+         */
         public static String role(final Environment env) {
             return env.getRole();
         }
 
+        /**
+         * Function associated to the logical "!" operator.
+         * @param b boolean value
+         * @return {@code true} if {@code !b}
+         */
         public static boolean not(boolean b) {
             return !b;
         }
 
+        /**
+         * Function associated to the logical ">=" operator.
+         * @param a first value
+         * @param b second value
+         * @return {@code true} if {@code a >= b}
+         */
         public static boolean greater_equal(float a, float b) {
             return a >= b;
         }
 
+        /**
+         * Function associated to the logical "<=" operator.
+         * @param a first value
+         * @param b second value
+         * @return {@code true} if {@code a <= b}
+         */
         public static boolean less_equal(float a, float b) {
             return a <= b;
         }
 
+        /**
+         * Function associated to the logical ">" operator.
+         * @param a first value
+         * @param b second value
+         * @return {@code true} if {@code a > b}
+         */
         public static boolean greater(float a, float b) {
             return a > b;
         }
 
+        /**
+         * Function associated to the logical "<" operator.
+         * @param a first value
+         * @param b second value
+         * @return {@code true} if {@code a < b}
+         */
         public static boolean less(float a, float b) {
             return a < b;
@@ -427,4 +549,7 @@
         /**
          * Determines if the objects {@code a} and {@code b} are equal.
+         * @param a First object
+         * @param b Second object
+         * @return {@code true} if objects are equal, {@code false} otherwise
          * @see Object#equals(Object)
          */
@@ -437,4 +562,8 @@
         /**
          * Determines whether the JOSM search with {@code searchStr} applies to the object.
+         * @param env the environment
+         * @param searchStr the search string
+         * @return {@code true} if the JOSM search with {@code searchStr} applies to the object
+         * @see SearchCompiler
          */
         public static Boolean JOSM_search(final Environment env, String searchStr) {
@@ -451,4 +580,7 @@
          * Obtains the JOSM'key {@link org.openstreetmap.josm.data.Preferences} string for key {@code key},
          * and defaults to {@code def} if that is null.
+         * @param key Key in JOSM preference
+         * @param def Default value
+         * @return value for key, or default value if not found
          * @see org.openstreetmap.josm.data.Preferences#get(String, String)
          */
@@ -460,4 +592,7 @@
         /**
          * Tests if string {@code target} matches pattern {@code pattern}
+         * @param pattern The regex expression
+         * @param target The character sequence to be matched
+         * @return {@code true} if, and only if, the entire region sequence matches the pattern
          * @see Pattern#matches(String, CharSequence)
          * @since 5699
@@ -469,5 +604,11 @@
         /**
          * Tests if string {@code target} matches pattern {@code pattern}
+         * @param pattern The regex expression
+         * @param target The character sequence to be matched
          * @param flags a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all")
+         * @return {@code true} if, and only if, the entire region sequence matches the pattern
+         * @see Pattern#CASE_INSENSITIVE
+         * @see Pattern#DOTALL
+         * @see Pattern#MULTILINE
          * @since 5699
          */
@@ -490,5 +631,11 @@
          * The first element (index 0) is the complete match (i.e. string).
          * Further elements correspond to the bracketed parts of the regular expression.
+         * @param pattern The regex expression
+         * @param target The character sequence to be matched
          * @param flags a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all")
+         * @return a list of capture groups if {@link Matcher#matches()}, or {@code null}.
+         * @see Pattern#CASE_INSENSITIVE
+         * @see Pattern#DOTALL
+         * @see Pattern#MULTILINE
          * @since 5701
          */
@@ -504,6 +651,5 @@
                 f |= Pattern.MULTILINE;
             }
-            Matcher m = Pattern.compile(pattern, f).matcher(target);
-            return Utils.getMatches(m);
+            return Utils.getMatches(Pattern.compile(pattern, f).matcher(target));
         }
 
@@ -512,13 +658,17 @@
          * The first element (index 0) is the complete match (i.e. string).
          * Further elements correspond to the bracketed parts of the regular expression.
+         * @param pattern The regex expression
+         * @param target The character sequence to be matched
+         * @return a list of capture groups if {@link Matcher#matches()}, or {@code null}.
          * @since 5701
          */
         public static List<String> regexp_match(String pattern, String target) {
-            Matcher m = Pattern.compile(pattern).matcher(target);
-            return Utils.getMatches(m);
+            return Utils.getMatches(Pattern.compile(pattern).matcher(target));
         }
 
         /**
          * Returns the OSM id of the current object.
+         * @param env the environment
+         * @return the OSM id of the current object
          * @see OsmPrimitive#getUniqueId()
          */
@@ -529,5 +679,7 @@
         /**
          * Translates some text for the current locale. The first argument is the text to translate,
-         * and the subsequent arguments are parameters for the string indicated by {@code {0}}, {@code {1}}, …
+         * and the subsequent arguments are parameters for the string indicated by <code>{0}</code>, <code>{1}</code>, …
+         * @param args arguments
+         * @return the translated string
          */
         @NullableArguments
@@ -564,5 +716,9 @@
         /**
          * Replaces in {@code s} every {@code} target} substring by {@code replacement}.
-         * * @see String#replace(CharSequence, CharSequence)
+         * @param s The source string
+         * @param target The sequence of char values to be replaced
+         * @param replacement The replacement sequence of char values
+         * @return The resulting string
+         * @see String#replace(CharSequence, CharSequence)
          */
         public static String replace(String s, String target, String replacement) {
@@ -722,4 +878,10 @@
         private Expression condition, firstOption, secondOption;
 
+        /**
+         * Constructs a new {@code CondOperator}.
+         * @param condition condition
+         * @param firstOption first option
+         * @param secondOption second option
+         */
         public CondOperator(Expression condition, Expression firstOption, Expression secondOption) {
             this.condition = condition;
@@ -738,8 +900,15 @@
     }
 
+    /**
+     * "And" logical operator.
+     */
     public static class AndOperator implements Expression {
 
         private List<Expression> args;
 
+        /**
+         * Constructs a new {@code AndOperator}.
+         * @param args arguments
+         */
         public AndOperator(List<Expression> args) {
             this.args = args;
@@ -758,8 +927,15 @@
     }
 
+    /**
+     * "Or" logical operator.
+     */
     public static class OrOperator implements Expression {
 
         private List<Expression> args;
 
+        /**
+         * Constructs a new {@code OrOperator}.
+         * @param args arguments
+         */
         public OrOperator(List<Expression> args) {
             this.args = args;
@@ -779,9 +955,7 @@
 
     /**
-     * Function to calculate the length of a string or list in a MapCSS eval
-     * expression.
+     * Function to calculate the length of a string or list in a MapCSS eval expression.
      *
-     * Separate implementation to support overloading for different
-     * argument types.
+     * Separate implementation to support overloading for different argument types.
      *
      * The use for calculating the length of a list is deprecated, use
@@ -792,4 +966,8 @@
         private Expression arg;
 
+        /**
+         * Constructs a new {@code LengthFunction}.
+         * @param args arguments
+         */
         public LengthFunction(Expression args) {
             this.arg = args;
@@ -816,4 +994,9 @@
         private final boolean computeMax;
 
+        /**
+         * Constructs a new {@code MinMaxFunction}.
+         * @param args arguments
+         * @param computeMax if {@code true}, compute max. If {@code false}, compute min
+         */
         public MinMaxFunction(final List<Expression> args, final boolean computeMax) {
             this.args = args;
@@ -860,4 +1043,7 @@
         private final boolean needsEnvironment;
 
+        /**
+         * Constructs a new {@code ParameterFunction}.
+         */
         public ParameterFunction(Method m, List<Expression> args, boolean needsEnvironment) {
             this.m = m;
@@ -914,5 +1100,4 @@
             return b.toString();
         }
-
     }
 
@@ -932,4 +1117,7 @@
         private final Class<?> arrayComponentType;
 
+        /**
+         * Constructs a new {@code ArrayFunction}.
+         */
         public ArrayFunction(Method m, List<Expression> args) {
             this.m = m;
@@ -964,4 +1152,5 @@
             return result;
         }
+
         @Override
         public String toString() {
@@ -976,6 +1165,4 @@
             return b.toString();
         }
-
     }
-
 }
