/**
 *
 */
package algorithms;

import graphrep.GraphRep;

import java.util.*;

/**
 * @author nino
 */
public class ConstraintSPFactory extends SharingAlgorithmFactory {
    private final Map<String, Object> details;
    private final List<Map<String, Object>> constraints;

    /**
     * @param graph
     */
    public ConstraintSPFactory(GraphRep graph) {
        super(graph);
        constraints = new ArrayList<Map<String, Object>>();
        constraints.add(new HashMap<String, Object>(4));
        constraints.get(0).put("name", "maxAltitudeDifference");
        constraints.get(0).put("description", "The maximum difference in altitude combined over the path");

        constraints.get(0).put("type", "meter");
        constraints.get(0).put("min", 0);
        constraints.get(0).put("max", 2000);


        details = new HashMap<String, Object>(3);
        details.put("hidden", this.isHidden());
        details.put("minpoints", 2);
        details.put("maxpoints", 2);
        details.put("sourceistarget", false);

    }

    @Override
    public Map<String, Object> getDetails() {
        return details;
    }

    @Override
    public Algorithm createAlgorithm(DijkstraStructs rs) {
        return new ConstraintSP(graph, rs);
    }

    /*
      * (non-Javadoc)
      *
      * @see algorithms.AlgorithmFactory#createAlgorithm()
      */
    @Override
    public Algorithm createAlgorithm() {
        return new ConstraintSP(graph, new DijkstraStructs(
                graph.getNodeCount(), graph.getEdgeCount()));
    }

    @Override
    public String getURLSuffix() {
        return "csp";
    }

    @Override
    public String getAlgName() {
        return "Constraint Shortest Path";
    }

    @Override
    public int getVersion() {
        return 1;
    }

    @Override
    public List<Map<String, Object>> getPointConstraints() {
        return null;
    }

    @Override
    public List<Map<String, Object>> getConstraints() {
        return constraints;
    }

    @Override
    public boolean isHidden() {
        return false;
    }

}

@@ -268,16 +268,79 @@
 raints;%0A
+    private final List%3CMap%3CString, Object%3E%3E pointConstraints;%0A%0A
 %0A    /**
@@ -729,17 +729,16 @@
 path%22);%0A
-%0A
         
@@ -820,24 +820,25 @@
 n%22, 0);%0A
+%0A
         
 constrai
@@ -821,33 +821,38 @@
 %22, 0);%0A%0A        
-c
+pointC
 onstraints.get(0
@@ -849,36 +849,51 @@
 ints
-.get(0).put(%22max%22, 200
+ = new ArrayList%3CMap%3CString, Object%3E%3E(
 0);%0A%0A
-%0A
     
@@ -1956,12 +1956,24 @@
 urn 
-null
+pointConstraints
 ;%0A  

Add empty pointConstraints remove max