package org.gcube.dataanalysis.dataminer.poolmanager.process;

import java.util.StringTokenizer;

public class AddAlgorithmCommand ***REMOVED***

  private String command;
  private String name;
  private String category;
  private String clazz;
  private String scope;
  private String algorithmType;
  private String skipJava;
  private String url;
  private String description;

  public AddAlgorithmCommand(String cmd) ***REMOVED***
    StringTokenizer st = new StringTokenizer(cmd, " ");
    if (st.hasMoreElements())
      command = st.nextToken();
    if (st.hasMoreElements())
      name = st.nextToken();
    if (st.hasMoreElements())
      category = st.nextToken();
    if (st.hasMoreElements())
      clazz = st.nextToken();
    if (st.hasMoreElements())
      scope = st.nextToken();
    if (st.hasMoreElements())
      algorithmType = st.nextToken();
    if (st.hasMoreElements())
      skipJava = st.nextToken();
    if (st.hasMoreElements())
      url = st.nextToken();
    
    String d = "";
    while (st.hasMoreElements())
      d = d + st.nextToken() + " ";
    this.setDescription(d);
    
  ***REMOVED***

  public void setDescription(String d) ***REMOVED***
    if(d!=null) ***REMOVED***
      d = d.trim();
      if(d.startsWith("\"") && d.endsWith("\"")) ***REMOVED***
        d = d.substring(1, d.length()-1).trim();
      ***REMOVED***
    ***REMOVED***
    this.description = d;
  ***REMOVED***
  
  public String getCommand() ***REMOVED***
    return command;
  ***REMOVED***

  public String getName() ***REMOVED***
    return name;
  ***REMOVED***

  public String getCategory() ***REMOVED***
    return category;
  ***REMOVED***

  public String getClazz() ***REMOVED***
    return clazz;
  ***REMOVED***

  public String getVRE() ***REMOVED***
    return scope;
  ***REMOVED***

  public String getAlgorithmType() ***REMOVED***
    return algorithmType;
  ***REMOVED***

  public String getSkipjava() ***REMOVED***
    return skipJava;
  ***REMOVED***

  public String getUrl() ***REMOVED***
    return url;
  ***REMOVED***

  public String getDescription() ***REMOVED***
    return description;
  ***REMOVED***

  public String toString() ***REMOVED***
    String out = "";
    out += String.format("%-12s: %s\n", "command", command);
    out += String.format("%-12s: %s\n", "algo name", name);
    out += String.format("%-12s: %s\n", "category", category);
    out += String.format("%-12s: %s\n", "class", clazz);
    out += String.format("%-12s: %s\n", "scope", scope);
    out += String.format("%-12s: %s\n", "algo type", algorithmType);
    out += String.format("%-12s: %s\n", "skip java", skipJava);
    out += String.format("%-12s: %s\n", "url", url);
    out += String.format("%-12s: %s\n", "description", this.description);
    return out;
  ***REMOVED***

***REMOVED***
