protected FunctionalTemplate(String string){
  string=string.trim();
  String funcName=string.substring(0,string.indexOf('('));
  function=Settings.getFunction(funcName);
  StringBuilder curParam=new StringBuilder();
  int openParams=0;
  for (int i=funcName.length() + 1; i < string.length() - 1; i++) {
    char c=string.charAt(i);
    if (c == '(') {
      openParams++;
    }
 else     if (c == ')') {
      openParams--;
    }
 else     if (openParams == 0 && c == ',') {
      Template param=Template.create(curParam.toString());
      parameters.add(param);
      slots.addAll(param.getSlots());
      curParam=new StringBuilder();
      continue;
    }
    curParam.append(c);
  }
  Template param=Template.create(curParam.toString());
  parameters.add(param);
  slots.addAll(param.getSlots());
}

protected FunctionalTemplate ( String string ) { string = string . trim ( ) ; String funcName = string . substring ( 0 , string . indexOf ( '(' ) ) ; function = Settings . getFunction ( funcName ) ; StringBuilder curParam = new StringBuilder ( ) ; int openParams = 0 ; for ( int i = funcName . length ( ) + 1 ; i < string . length ( ) - 1 ; i ++ ) { char c = string . charAt ( i ) ; if ( c == '(' ) { openParams ++ ; } else if ( c == ')' ) { openParams -- ; } else if ( openParams == 0 && c == ',' ) { Template param = Template . create ( curParam . toString ( ) ) ; parameters . add ( param ) ; slots . addAll ( param . getSlots ( ) ) ; curParam = new StringBuilder ( ) ; continue ; } curParam . append ( c ) ; } Template param = Template . create ( curParam . toString ( ) ) ; parameters . add ( param ) ; slots . addAll ( param . getSlots ( ) ) ; }
creates a new string template .
