public static Effect parseEffect(String str){
  if (str.contains(" ^ ")) {
    List<BasicEffect> effects=new ArrayList<BasicEffect>();
    for (    String split : str.split(" \\^ ")) {
      Effect subOutput=parseEffect(split);
      effects.addAll(subOutput.getSubEffects());
    }
    return new Effect(effects);
  }
 else {
    if (str.contains("Void")) {
      return new Effect(new ArrayList<BasicEffect>());
    }
    String var="";
    String val="";
    boolean exclusive=true;
    boolean negated=false;
    if (str.contains(":=")) {
      var=str.split(":=")[0];
      val=str.split(":=")[1];
      val=(val.contains("{}")) ? "None" : val;
    }
 else     if (str.contains("!=")) {
      var=str.split("!=")[0];
      val=str.split("!=")[1];
      negated=true;
    }
 else     if (str.contains("+=")) {
      var=str.split("\\+=")[0];
      val=str.split("\\+=")[1];
      exclusive=false;
    }
    Template tvar=Template.create(var);
    Template tval=Template.create(val);
    if (tvar.isUnderspecified() || tval.isUnderspecified()) {
      return new Effect(new TemplateEffect(tvar,tval,1,exclusive,negated));
    }
 else {
      return new Effect(new BasicEffect(var,ValueFactory.create(val),1,exclusive,negated));
    }
  }
}

public static Effect parseEffect ( String str ) { if ( str . contains ( " ^ " ) ) { List < BasicEffect > effects = new ArrayList < BasicEffect > ( ) ; for ( String split : str . split ( " \\^ " ) ) { Effect subOutput = parseEffect ( split ) ; effects . addAll ( subOutput . getSubEffects ( ) ) ; } return new Effect ( effects ) ; } else { if ( str . contains ( "Void" ) ) { return new Effect ( new ArrayList < BasicEffect > ( ) ) ; } String var = "" ; String val = "" ; boolean exclusive = true ; boolean negated = false ; if ( str . contains ( ":=" ) ) { var = str . split ( ":=" ) [ 0 ] ; val = str . split ( ":=" ) [ 1 ] ; val = ( val . contains ( "{}" ) ) ? "None" : val ; } else if ( str . contains ( "!=" ) ) { var = str . split ( "!=" ) [ 0 ] ; val = str . split ( "!=" ) [ 1 ] ; negated = true ; } else if ( str . contains ( "+=" ) ) { var = str . split ( "\\+=" ) [ 0 ] ; val = str . split ( "\\+=" ) [ 1 ] ; exclusive = false ; } Template tvar = Template . create ( var ) ; Template tval = Template . create ( val ) ; if ( tvar . isUnderspecified ( ) || tval . isUnderspecified ( ) ) { return new Effect ( new TemplateEffect ( tvar , tval , 1 , exclusive , negated ) ) ; } else { return new Effect ( new BasicEffect ( var , ValueFactory . create ( val ) , 1 , exclusive , negated ) ) ; } } }
parses the string representing the effect , and returns the corresponding effect .
