Index: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskInfo.java
===================================================================
--- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskInfo.java	(revision 1287)
+++ trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskInfo.java	(revision 1423)
@@ -15,6 +15,10 @@
 package de.ugoe.cs.autoquest.tasktrees.treeimpl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric;
 
 /**
@@ -41,11 +45,11 @@
      */
     private ITask task;
-
-    /**
-     * <p>
-     * the number of occurrences of this task
-     * </p>
-     */
-    private int count;
+    
+    /**
+     * <p>
+     * all available measures for the task
+     * </p>
+     */
+    private ArrayList<Measure> measures = new ArrayList<Measure>();
 
     /**
@@ -69,9 +73,38 @@
 
     /* (non-Javadoc)
-     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo#getCount()
-     */
-    @Override
-    public int getCount() {
-        return count;
+     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo#getMeasures()
+     */
+    @Override
+    public IMeasure[] getMeasures() {
+        measures.trimToSize();
+        return measures.toArray(new IMeasure[measures.size()]);
+    }
+
+    /* (non-Javadoc)
+     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo#getMeasureValue(java.lang.String)
+     */
+    @Override
+    public int getMeasureValue(TaskMetric metric) {
+        Measure measure = getMeasure(metric);
+        
+        if (measure == null) {
+            throw new IllegalArgumentException("unknown metric " + metric);
+        }
+        
+        return measure.getValue();
+    }
+
+    /* (non-Javadoc)
+     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo#getMeasureValue(java.lang.String, de.ugoe.cs.autoquest.tasktrees.treeifc.ITask)
+     */
+    @Override
+    public int getMeasureValue(TaskMetric metric, ITask context) {
+        Measure measure = getMeasure(metric);
+        
+        if (measure == null) {
+            throw new IllegalArgumentException("unknown metric " + metric);
+        }
+        
+        return measure.getValue(context);
     }
 
@@ -86,9 +119,192 @@
     /**
      * <p>
-     * used to increase the counter of occurrences of this task by one
-     * </p>
-     */
-    void increaseCount() {
-        count++;
-    }
+     * must be called to indicate that a new new measures for the provided metric are about to
+     * be calculated and added.
+     * </p>
+     *
+     * @param metric the metric for which measures are about to be provided
+     */
+    void addMeasure(TaskMetric metric) {
+        Measure measure = getMeasure(metric);
+        
+        if (measure != null) {
+            throw new IllegalArgumentException("measure for metric " + metric + " already exists.");
+        }
+        
+        measure = new Measure(metric);
+        measures.add(measure);
+    }
+
+    /**
+     * <p>
+     * sets a specific value for a measure of a specific metric in the provided context of the task
+     * </p>
+     * 
+     * @param metric  the metric to which the value belongs
+     * @param context the context of the task in which the measure was recorded
+     * @param value   the value of the measure
+     */
+    void setCount(TaskMetric metric, ITask context, int value) {
+        Measure measure = getMeasure(metric);
+        
+        if (measure == null) {
+            throw new IllegalArgumentException("unknown metric. Please create a measure " +
+                                               "for the metric before using it.");
+        }
+        
+        measure.set(context, value);
+    }
+
+    /**
+     * <p>
+     * increases a specific value for a measure of a specific metric in the provided context of the
+     * task
+     * </p>
+     * 
+     * @param metric    the metric to which the value belongs
+     * @param context   the context of the task in which the measure was recorded
+     * @param increment the increment to be added to the value of the measure
+     */
+    void increaseCount(TaskMetric metric, ITask context, int increment) {
+        Measure measure = getMeasure(metric);
+        
+        if (measure == null) {
+            throw new IllegalArgumentException("unknown metric. Please create a measure " +
+                                               "for the metric before using it.");
+        }
+        
+        measure.increase(context, increment);
+    }
+
+    /**
+     * <p>
+     * convenience method to internally determine the measure for a specific metric
+     * </p>
+     */
+    private Measure getMeasure(TaskMetric metric) {
+        for (Measure candidate : measures) {
+            if (candidate.getMetric().equals(metric)) {
+                return candidate;
+            }
+        }
+        
+        return null;
+    }
+
+    /**
+     * <p>
+     * implementation for the measure interface of the task info interface. Does nothing fancy
+     * except implementing the interface
+     * </p>
+     * 
+     * @author Patrick Harms
+     */
+    private static class Measure implements IMeasure {
+
+        /**
+         * <p>
+         * the metric to which the measure belongs
+         * </p>
+         */
+        private TaskMetric metric;
+        
+        /**
+         * <p>
+         * the observed values for the difference contexts of the task
+         * </p>
+         */
+        private HashMap<ITask, Integer> values;
+        
+        /**
+         * <p>
+         * the context free value of the measure independent of the task context
+         * </p>
+         */
+        private int contextFreeValue = 0;
+        
+        /**
+         * <p>
+         * initializes the measure with a specific metric
+         * </p>
+         */
+        private Measure(TaskMetric metric) {
+            super();
+            this.metric = metric;
+        }
+
+        /* (non-Javadoc)
+         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo.IMeasure#getMetric()
+         */
+        @Override
+        public TaskMetric getMetric() {
+            return metric;
+        }
+
+        /* (non-Javadoc)
+         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo.IMeasure#getValue()
+         */
+        @Override
+        public int getValue() {
+            return contextFreeValue;
+        }
+
+        /* (non-Javadoc)
+         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo.IMeasure#getValue(de.ugoe.cs.autoquest.tasktrees.treeifc.ITask)
+         */
+        @Override
+        public int getValue(ITask context) {
+            if ((context != null) && (values != null)) {
+                Integer currentValue = values.get(context);
+                
+                if (currentValue != null) {
+                    return currentValue;
+                }
+            }
+            
+            return Integer.MIN_VALUE;
+        }
+
+        /**
+         * <p>
+         * sets the value of the measure context free as well as specific to the provided context
+         * </p>
+         */
+        private void set(ITask context, int value) {
+            contextFreeValue = value;
+            
+            if (context != null) {
+                if (values == null) {
+                    values = new HashMap<ITask, Integer>();
+                }
+                
+                values.put(context, value);
+            }
+        }
+
+        /**
+         * <p>
+         * increases the value of the measure context free as well as specific to the provided
+         * context according to the provided increment
+         * </p>
+         */
+        private void increase(ITask context, int increment) {
+            contextFreeValue += increment;
+            
+            if (context != null) {
+                if (values == null) {
+                    values = new HashMap<ITask, Integer>();
+                }
+                
+                Integer currentValue = values.get(context);
+                
+                if (currentValue == null) {
+                    currentValue = 0;
+                }
+                
+                values.put(context, currentValue + increment);
+            }
+        }
+
+    }
+
 }
