/* Generated By:JavaCC: Do not edit this line. XfuzzyConfig.java */
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// PARSER DE LA CONFIGURACION DE LAS DISTINTAS HERRAMIENTAS //
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
package xfuzzy;
import xfuzzy.lang.*;
import xfuzzy.xfplot.*;
import xfuzzy.xfsim.*;
import xfuzzy.xfdm.*;
import xfuzzy.xfsl.*;
import java.io.*;
import java.util.Vector;
public class XfuzzyConfig implements XfuzzyConfigConstants {
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// MIEMBROS PRIVADOS //
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
private int error;
private String errorMsg;
private boolean end;
private XfdmConfig xfdmcfg;
private XfslConfig xfslcfg;
private XfsimConfig xfsimcfg;
private XfplotConfig xfplotcfg;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// CONSTRUCTOR //
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
public XfuzzyConfig() {
this.error = 0;
this.errorMsg = "";
this.xfdmcfg = null;
this.xfslcfg = null;
this.xfsimcfg = null;
this.xfplotcfg = null;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// METODOS PUBLICOS //
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//-------------------------------------------------------------//
// Analiza un fichero para leer una configuracion de Xfdm //
//-------------------------------------------------------------//
public XfdmConfig parseXfdmConfig(File file) {
initParse(file);
this.xfdmcfg = new XfdmConfig();
try { tryConfiguration(); }
catch(ParseException ex) { return null; }
if(error == 0) return this.xfdmcfg;
return null;
}
//-------------------------------------------------------------//
// Analiza un fichero para leer una configuracion de Xfsl //
//-------------------------------------------------------------//
public XfslConfig parseXfslConfig(File file) {
initParse(file);
this.xfslcfg = new XfslConfig();
try { tryConfiguration(); }
catch(ParseException ex) { return null; }
if(error == 0) return this.xfslcfg;
return null;
}
//-------------------------------------------------------------//
// Analiza un fichero para leer una configuracion de Xfsim //
//-------------------------------------------------------------//
public boolean parseXfsimConfig(Xfsim xfsim, File file) {
initParse(file);
this.xfsimcfg = xfsim.getConfiguration();
try { tryConfiguration(); } catch(ParseException ex) { }
return ( error == 0 );
}
//-------------------------------------------------------------//
// Analiza un fichero para leer una configuracion de Xfplot //
//-------------------------------------------------------------//
public boolean parseXfplotConfig(XfplotConfig config, File file) {
initParse(file);
this.xfplotcfg = config;
try { tryConfiguration(); } catch(ParseException ex) { }
return ( error == 0 );
}
//-------------------------------------------------------------//
// Devuelve el conjunto de errores cometidos en una lectura //
//-------------------------------------------------------------//
public String resume() {
String eol = System.getProperty("line.separator", "\u005cn");
String msg = this.errorMsg + this.error;
if(this.error == 1) msg += " error."; else msg += " errors.";
return msg+eol;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// METODOS PRIVADOS //
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//-------------------------------------------------------------//
// Inicializa las variables internas de un analisis //
//-------------------------------------------------------------//
private void initParse(File file) {
error = 0;
errorMsg = "";
InputStream stream;
try { stream = new FileInputStream(file); }
catch (Exception e) {
errorMsg += "Can't open file "+file.getAbsolutePath();
error ++;
return;
}
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new XfuzzyConfigTokenManager(jj_input_stream);
ReInit(stream);
}
//-------------------------------------------------------------//
// Obtiene una lista de numeros a partir de un Vector //
//-------------------------------------------------------------//
private double[] getParams(Vector v) {
double[] param = new double[v.size()];
for(int i=0; i<param.length; i++)
param[i] = Double.parseDouble((String) v.elementAt(i) );
return param;
}
//-------------------------------------------------------------//
// Almacena una excepcion (error sintactico) //
//-------------------------------------------------------------//
private void exception(ParseException e) {
String eol = System.getProperty("line.separator", "\u005cn");
Token t = e.currentToken.next;
this.error ++;
this.errorMsg += "Configuration ["+this.error+"]. ";
this.errorMsg += "Parse error at line "+t.beginLine+" : ";
this.errorMsg += "Encountered \u005c""+t.image+"\u005c""+" while expecting ";
int expected[] = new int[e.expectedTokenSequences.length];
for(int i=0; i<expected.length; i++)
expected[i] = e.expectedTokenSequences[i][0];
if(expected.length == 1) this.errorMsg += e.tokenImage[expected[0]]+"."+eol;
else {
this.errorMsg += "one of :\u005cn "+e.tokenImage[expected[0]];
for(int i=1; i<expected.length; i++)
this.errorMsg += ",\u005cn "+e.tokenImage[expected[i]];
this.errorMsg += "."+eol;
}
}
//-------------------------------------------------------------//
// Almacena una excepcion (error lexico) //
//-------------------------------------------------------------//
private void exception(TokenMgrError e) {
String eol = System.getProperty("line.separator", "\u005cn");
this.error ++;
this.errorMsg += "Configuration ["+this.error+"]. "+e.getMessage()+eol;
}
//-------------------------------------------------------------//
// Almacena una excepcion (generica) //
//-------------------------------------------------------------//
private void exception(Exception e) {
String eol = System.getProperty("line.separator", "\u005cn");
this.error ++;
this.errorMsg += "Configuration ["+this.error+"]. "+e.getMessage()+eol;
}
//=============================================================//
// TRATAMIENTO DE LA CONFIGURACION DE XFSL //
//=============================================================//
//-------------------------------------------------------------//
// Introduce el fichero de entrenamiento //
//-------------------------------------------------------------//
private void xfslTrainingFile(Token tid) throws XflException {
if(xfslcfg == null) return;
File file = new File(tid.image.substring(1,tid.image.length()-1));
if(!file.exists()) throw new XflException(31);
xfslcfg.trainingfile = file;
}
//-------------------------------------------------------------//
// Introduce el fichero de test //
//-------------------------------------------------------------//
private void xfslTestFile(Token tid) throws XflException {
if(xfslcfg == null) return;
File file = new File(tid.image.substring(1,tid.image.length()-1));
if(!file.exists()) throw new XflException(31);
xfslcfg.testfile = file;
}
//-------------------------------------------------------------//
// Introduce la descripcion de un historico //
//-------------------------------------------------------------//
private void xfslLogFile(Token tid, Vector v) {
if(xfslcfg == null) return;
File file = new File(tid.image.substring(1,tid.image.length()-1));
xfslcfg.logfile = new XfslLog(file,v);
}
//-------------------------------------------------------------//
// Introduce el fichero de salida //
//-------------------------------------------------------------//
private void xfslOutputFile(Token tid) {
if(xfslcfg == null) return;
File file = new File(tid.image.substring(1,tid.image.length()-1));
xfslcfg.outputfile = file;
}
//-------------------------------------------------------------//
// Introduce el algoritmo de aprendizaje //
//-------------------------------------------------------------//
private void xfslAlgorithm(Token tid, double[] param) throws XflException {
if(xfslcfg == null) return;
xfslcfg.algorithm = XfslAlgorithm.create(tid.image,param);
}
//-------------------------------------------------------------//
// Introduce una opcion del algoritmo de aprendizaje //
//-------------------------------------------------------------//
private void xfslOption(Token tid, double[] param) throws XflException {
if(xfslcfg == null) return;
if(xfslcfg.algorithm != null) xfslcfg.algorithm.setOption(tid.image,param);
else throw new XflException(30);
}
//-------------------------------------------------------------//
// Introduce la funcion de error //
//-------------------------------------------------------------//
private void xfslErrorFunction(Token tid, double[] param) throws XflException {
if(xfslcfg == null) return;
xfslcfg.errorfunction = new XfslErrorFunction(tid.image,param);
}
//-------------------------------------------------------------//
// Introduce un metodo de simplificacion (como preprocesado) //
//-------------------------------------------------------------//
private void xfslPreprocessing(Token tid, double[] param) {
if(xfslcfg == null) return;
xfslcfg.preprocessing.set(tid.image, param);
}
//-------------------------------------------------------------//
// Introduce un metodo de simplificacion (como postprocesado) //
//-------------------------------------------------------------//
private void xfslPostprocessing(Token tid, double[] param) {
if(xfslcfg == null) return;
xfslcfg.postprocessing.set(tid.image, param);
}
//-------------------------------------------------------------//
// Introduce una condicion de finalizacion //
//-------------------------------------------------------------//
private void xfslEndCondition(Token tid, double[] param) {
if(xfslcfg == null) return;
xfslcfg.endcondition.set(tid.image, param);
}
//-------------------------------------------------------------//
// Introduce una seleccion de parametros a ajustar //
//-------------------------------------------------------------//
private void xfslEnable(Token tid) {
if(xfslcfg == null) return;
xfslcfg.addSetting(tid.image, true);
}
//-------------------------------------------------------------//
// Introduce una seleccion de parametros a no ajustar //
//-------------------------------------------------------------//
private void xfslDisable(Token tid) {
if(xfslcfg == null) return;
xfslcfg.addSetting(tid.image, false);
}
//=============================================================//
// TRATAMIENTO DE LA CONFIGURACION DE XFSIM //
//=============================================================//
//-------------------------------------------------------------//
// Introduce el fichero ".class" con el modelo de planta //
//-------------------------------------------------------------//
private void xfsimPlantModel(Token tid) throws XflException {
if(xfsimcfg == null) return;
File file = new File(tid.image.substring(1,tid.image.length()-1));
if(!file.exists()) throw new XflException(31);
xfsimcfg.setPlantModel(file);
}
//-------------------------------------------------------------//
// Introduce los valores iniciales de las variables de estado //
//-------------------------------------------------------------//
private void xfsimInit(double[] param) {
if(xfsimcfg == null) return;
xfsimcfg.init = param;
}
//-------------------------------------------------------------//
// Introduce una condicion de finalizacion //
//-------------------------------------------------------------//
private void xfsimAddLimit(Token tid, Token tn, int kind) {
if(xfsimcfg == null) return;
xfsimcfg.limit.add(tid.image,Double.parseDouble(tn.image),kind);
}
//-------------------------------------------------------------//
// Introduce la descripcion de un historico //
//-------------------------------------------------------------//
private void xfsimLogFile(Token tid, Vector v) {
if(xfsimcfg == null) return;
File log = new File(tid.image.substring(1,tid.image.length()-1));
xfsimcfg.addLogFile(log,v);
}
//-------------------------------------------------------------//
// Introduce la descripcion de una representacion grafica //
//-------------------------------------------------------------//
private void xfsimPlot(Token tx, Token ty, Token tk) {
if(xfsimcfg == null) return;
xfsimcfg.addPlot(tx.image,ty.image,Integer.parseInt(tk.image));
}
//=============================================================//
// TRATAMIENTO DE LA CONFIGURACION DE XFPLOT //
//=============================================================//
//-------------------------------------------------------------//
// Introduce una representacion grafica en 2D //
//-------------------------------------------------------------//
private void xfplotGraph2D(Token tx, Token ty) throws Exception {
if(xfplotcfg == null) return;
xfplotcfg.setVariables(tx.image,ty.image);
}
//-------------------------------------------------------------//
// Introduce una representacion grafica en 3D //
//-------------------------------------------------------------//
private void xfplotGraph3D(Token tx, Token ty, Token tk) throws Exception {
if(xfplotcfg == null) return;
xfplotcfg.setVariables(tx.image,ty.image,tk.image);
}
//-------------------------------------------------------------//
// Introduce los valores de las variables no seleccionadas //
//-------------------------------------------------------------//
private void xfplotValues(double[] param) throws Exception {
if(xfplotcfg == null) return;
xfplotcfg.setInputValues(param);
}
//-------------------------------------------------------------//
// Introduce los valores de las barras de deslizamiento //
//-------------------------------------------------------------//
private void xfplotPerspective(Token tx, Token ty) throws Exception {
if(xfplotcfg == null) return;
int horiz = Integer.parseInt(tx.image);
int vert = Integer.parseInt(ty.image);
xfplotcfg.setSlides(horiz,vert);
}
//-------------------------------------------------------------//
// Introduce el numero de divisiones de los ejes //
//-------------------------------------------------------------//
private void xfplotSamples(Token tid) throws Exception {
if(xfplotcfg == null) return;
xfplotcfg.setSamples(Integer.parseInt(tid.image));
}
//-------------------------------------------------------------//
// Introduce el codigo del modelo de colores de la grafica 3D //
//-------------------------------------------------------------//
private void xfplotColorMode(Token tid) throws Exception {
if(xfplotcfg == null) return;
xfplotcfg.setColorMode(Integer.parseInt(tid.image));
}
//=============================================================//
// TRATAMIENTO DE LA CONFIGURACION DE XFDM //
//=============================================================//
//-------------------------------------------------------------//
// Introduce el fichero de patrones //
//-------------------------------------------------------------//
private void xfdmPatternFile(Token tid) throws XflException {
if(xfdmcfg == null) return;
File file = new File(tid.image.substring(1,tid.image.length()-1));
if(!file.exists()) throw new XflException(31);
xfdmcfg.patternfile = file;
}
//-------------------------------------------------------------//
// Introduce el numero de variables de entrada //
//-------------------------------------------------------------//
private void xfdmInputs(Token tid) throws Exception {
if(xfdmcfg == null) return;
xfdmcfg.numinputs = Integer.parseInt(tid.image);
}
//-------------------------------------------------------------//
// Introduce el numero de variables de salida //
//-------------------------------------------------------------//
private void xfdmOutputs(Token tid) throws Exception {
if(xfdmcfg == null) return;
xfdmcfg.numoutputs = Integer.parseInt(tid.image);
}
//-------------------------------------------------------------//
// Introduce el estilo de las variables de entrada //
//-------------------------------------------------------------//
private void xfdmInput(Token tid, double param[]) throws Exception {
if(xfdmcfg == null) return;
if(!XfdmInputStyle.paramTest(param)) throw new XflException(35);
if(tid.image.equals("ANY")) {
xfdmcfg.commonstyle = new XfdmInputStyle(tid.image,param);
} else {
if(xfdmcfg.inputstyle == null) xfdmcfg.inputstyle = new XfdmInputStyle[0];
XfdmInputStyle aux[] = new XfdmInputStyle[xfdmcfg.inputstyle.length+1];
System.arraycopy(xfdmcfg.inputstyle,0,aux,0,aux.length-1);
aux[aux.length-1] = new XfdmInputStyle(tid.image,param);
xfdmcfg.inputstyle = aux;
}
}
//-------------------------------------------------------------//
// Introduce el estilo del sistema //
//-------------------------------------------------------------//
private void xfdmSystem(Token tid, Token to, Token ta, Token ts, Token tb)
throws Exception {
if(xfdmcfg == null) return;
int conj = Integer.parseInt(ta.image);
int style = Integer.parseInt(ts.image);
boolean bool = tb.image.equals("1");
xfdmcfg.systemstyle = new XfdmSystemStyle(tid.image,to.image,conj,style,bool);
}
//-------------------------------------------------------------//
// Introduce el algoritmo de aprendizaje //
//-------------------------------------------------------------//
private void xfdmAlgorithm(Token tid, double[] param) throws XflException {
if(xfdmcfg == null) return;
xfdmcfg.algorithm = XfdmAlgorithm.create(tid.image,param);
}
final public void endline() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 0:
jj_consume_token(0);
end = true;
break;
case EOL:
jj_consume_token(EOL);
break;
case CEOL:
jj_consume_token(CEOL);
break;
default:
jj_la1[0] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// SINTAXIS DE CUALQUIER FICHERO DE CONFIGURACION //
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
final public void tryDirective() throws ParseException {
try {
directive();
} catch (ParseException e) {
exception(e); skipline();
} catch (XflException e) {
exception(e); skipline();
} catch (Exception e) {
exception(e); skipline();
}
}
final public void directive() throws ParseException, XflException, Exception {
Token tid, tn, tx, ty, tk;
double[] param;
Vector v;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case XFSL_TRAININGFILE:
jj_consume_token(XFSL_TRAININGFILE);
jj_consume_token(45);
tid = jj_consume_token(FILE);
jj_consume_token(46);
endline();
xfslTrainingFile(tid);
break;
case XFSL_TESTFILE:
jj_consume_token(XFSL_TESTFILE);
jj_consume_token(45);
tid = jj_consume_token(FILE);
jj_consume_token(46);
endline();
xfslTestFile(tid);
break;
case XFSL_LOGFILE:
jj_consume_token(XFSL_LOGFILE);
jj_consume_token(45);
tid = jj_consume_token(FILE);
v = listOfNames();
jj_consume_token(46);
endline();
xfslLogFile(tid, v);
break;
case XFSL_OUTPUTFILE:
jj_consume_token(XFSL_OUTPUTFILE);
jj_consume_token(45);
tid = jj_consume_token(FILE);
jj_consume_token(46);
endline();
xfslOutputFile(tid);
break;
case XFSL_ALGORITHM:
jj_consume_token(XFSL_ALGORITHM);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfslAlgorithm(tid, param);
break;
case XFSL_OPTION:
jj_consume_token(XFSL_OPTION);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfslOption(tid, param);
break;
case XFSL_ERRORFUNCTION:
jj_consume_token(XFSL_ERRORFUNCTION);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfslErrorFunction(tid, param);
break;
case XFSL_PREPROCESSING:
jj_consume_token(XFSL_PREPROCESSING);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfslPreprocessing(tid, param);
break;
case XFSL_POSTPROCESSING:
jj_consume_token(XFSL_POSTPROCESSING);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfslPostprocessing(tid, param);
break;
case XFSL_ENDCONDITION:
jj_consume_token(XFSL_ENDCONDITION);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfslEndCondition(tid, param);
break;
case XFSL_ENABLE:
jj_consume_token(XFSL_ENABLE);
jj_consume_token(45);
tid = jj_consume_token(PARAM);
jj_consume_token(46);
endline();
xfslEnable(tid);
break;
case XFSL_DISABLE:
jj_consume_token(XFSL_DISABLE);
jj_consume_token(45);
tid = jj_consume_token(PARAM);
jj_consume_token(46);
endline();
xfslDisable(tid);
break;
case XFSIM_PLANT:
jj_consume_token(XFSIM_PLANT);
jj_consume_token(45);
tid = jj_consume_token(FILE);
jj_consume_token(46);
endline();
xfsimPlantModel(tid);
break;
case XFSIM_INIT:
jj_consume_token(XFSIM_INIT);
jj_consume_token(45);
param = listOfParams();
jj_consume_token(46);
endline();
xfsimInit(param);
break;
case XFSIM_LIMIT:
jj_consume_token(XFSIM_LIMIT);
jj_consume_token(45);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
xfsimLimit();
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 47:
;
break;
default:
jj_la1[1] = jj_gen;
break label_1;
}
jj_consume_token(47);
xfsimLimit();
}
break;
default:
jj_la1[2] = jj_gen;
;
}
jj_consume_token(46);
endline();
break;
case XFSIM_LOG:
jj_consume_token(XFSIM_LOG);
jj_consume_token(45);
tid = jj_consume_token(FILE);
v = listOfNames();
jj_consume_token(46);
endline();
xfsimLogFile(tid, v);
break;
case XFSIM_PLOT:
jj_consume_token(XFSIM_PLOT);
jj_consume_token(45);
tx = jj_consume_token(ID);
jj_consume_token(48);
ty = jj_consume_token(ID);
jj_consume_token(48);
tk = jj_consume_token(NUMBER);
jj_consume_token(46);
endline();
xfsimPlot(tx,ty,tk);
break;
case XFPLOT_GRAPH3D:
jj_consume_token(XFPLOT_GRAPH3D);
jj_consume_token(45);
tx = jj_consume_token(ID);
jj_consume_token(48);
ty = jj_consume_token(ID);
jj_consume_token(48);
tk = jj_consume_token(ID);
jj_consume_token(46);
endline();
xfplotGraph3D(tx, ty, tk);
break;
case XFPLOT_GRAPH2D:
jj_consume_token(XFPLOT_GRAPH2D);
jj_consume_token(45);
tx = jj_consume_token(ID);
jj_consume_token(48);
ty = jj_consume_token(ID);
jj_consume_token(46);
endline();
xfplotGraph2D(tx, ty);
break;
case XFPLOT_VALUES:
jj_consume_token(XFPLOT_VALUES);
jj_consume_token(45);
param = listOfParams();
jj_consume_token(46);
endline();
xfplotValues(param);
break;
case XFPLOT_PERSPECTIVE:
jj_consume_token(XFPLOT_PERSPECTIVE);
jj_consume_token(45);
tx = jj_consume_token(NUMBER);
jj_consume_token(48);
ty = jj_consume_token(NUMBER);
jj_consume_token(46);
endline();
xfplotPerspective(tx, ty);
break;
case XFPLOT_SAMPLES:
jj_consume_token(XFPLOT_SAMPLES);
jj_consume_token(45);
tid = jj_consume_token(NUMBER);
jj_consume_token(46);
endline();
xfplotSamples(tid);
break;
case XFPLOT_COLORMODE:
jj_consume_token(XFPLOT_COLORMODE);
jj_consume_token(45);
tid = jj_consume_token(NUMBER);
jj_consume_token(46);
endline();
xfplotColorMode(tid);
break;
case XFDM_PATTERN:
jj_consume_token(XFDM_PATTERN);
jj_consume_token(45);
tid = jj_consume_token(FILE);
jj_consume_token(46);
endline();
xfdmPatternFile(tid);
break;
case XFDM_INPUTS:
jj_consume_token(XFDM_INPUTS);
jj_consume_token(45);
tid = jj_consume_token(NUMBER);
jj_consume_token(46);
endline();
xfdmInputs(tid);
break;
case XFDM_OUTPUTS:
jj_consume_token(XFDM_OUTPUTS);
jj_consume_token(45);
tid = jj_consume_token(NUMBER);
jj_consume_token(46);
endline();
xfdmOutputs(tid);
break;
case XFDM_INPUT:
jj_consume_token(XFDM_INPUT);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfdmInput(tid,param);
break;
case XFDM_SYSTEM:
jj_consume_token(XFDM_SYSTEM);
jj_consume_token(45);
tid = jj_consume_token(ID);
jj_consume_token(48);
tn = jj_consume_token(ID);
jj_consume_token(48);
tk = jj_consume_token(NUMBER);
jj_consume_token(48);
tx = jj_consume_token(NUMBER);
jj_consume_token(48);
ty = jj_consume_token(NUMBER);
jj_consume_token(46);
endline();
xfdmSystem(tid,tn,tk,tx,ty);
break;
case XFDM_ALGORITHM:
jj_consume_token(XFDM_ALGORITHM);
jj_consume_token(45);
tid = jj_consume_token(ID);
param = listOfParamsWithComma();
jj_consume_token(46);
endline();
xfdmAlgorithm(tid, param);
break;
case 0:
case EOL:
case CEOL:
endline();
break;
default:
jj_la1[3] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
final public double[] listOfParamsWithComma() throws ParseException {
Token tn;
Vector v = new Vector();
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 48:
;
break;
default:
jj_la1[4] = jj_gen;
break label_2;
}
jj_consume_token(48);
tn = jj_consume_token(NUMBER);
v.addElement(tn.image);
}
{if (true) return getParams(v);}
throw new Error("Missing return statement in function");
}
final public double[] listOfParams() throws ParseException {
Token tn;
Vector v = new Vector();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NUMBER:
tn = jj_consume_token(NUMBER);
v.addElement(tn.image);
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 48:
;
break;
default:
jj_la1[5] = jj_gen;
break label_3;
}
jj_consume_token(48);
tn = jj_consume_token(NUMBER);
v.addElement(tn.image);
}
break;
default:
jj_la1[6] = jj_gen;
;
}
{if (true) return getParams(v);}
throw new Error("Missing return statement in function");
}
final public Vector listOfNames() throws ParseException {
Token tn;
Vector v = new Vector();
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 48:
;
break;
default:
jj_la1[7] = jj_gen;
break label_4;
}
jj_consume_token(48);
tn = jj_consume_token(ID);
v.addElement(tn.image);
}
{if (true) return v;}
throw new Error("Missing return statement in function");
}
final public void xfsimLimit() throws ParseException {
Token tid,tn;
int kind = -1;
tid = jj_consume_token(ID);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 49:
jj_consume_token(49);
kind=0;
break;
case 50:
jj_consume_token(50);
kind = 1;
break;
default:
jj_la1[8] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
tn = jj_consume_token(NUMBER);
xfsimAddLimit(tid,tn,kind);
}
void tryConfiguration() throws ParseException {
end = false;
while(!end) {
try { tryDirective(); }
catch (ParseException e) { exception(e); skipline(); }
catch (TokenMgrError e) { exception(e); end = true; }
}
}
void skipline() throws ParseException {
Token t;
do { t = getNextToken(); }
while(t.kind != EOF && t.kind != EOL && t.kind != CEOL);
}
/** Generated Token Manager. */
public XfuzzyConfigTokenManager token_source;
SimpleCharStream jj_input_stream;
/** Current token. */
public Token token;
/** Next token. */
public Token jj_nt;
private int jj_ntk;
private int jj_gen;
final private int[] jj_la1 = new int[9];
static private int[] jj_la1_0;
static private int[] jj_la1_1;
static {
jj_la1_init_0();
jj_la1_init_1();
}
private static void jj_la1_init_0() {
jj_la1_0 = new int[] {0x1,0x0,0x0,0xffffffc1,0x0,0x0,0x0,0x0,0x0,};
}
private static void jj_la1_init_1() {
jj_la1_1 = new int[] {0x28,0x8000,0x40,0x2f,0x10000,0x10000,0x200,0x10000,0x60000,};
}
/** Constructor with InputStream. */
public XfuzzyConfig(java.io.InputStream stream) {
this(stream, null);
}
/** Constructor with InputStream and supplied encoding */
public XfuzzyConfig(java.io.InputStream stream, String encoding) {
try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source = new XfuzzyConfigTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 9; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream) {
ReInit(stream, null);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream, String encoding) {
try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 9; i++) jj_la1[i] = -1;
}
/** Constructor. */
public XfuzzyConfig(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new XfuzzyConfigTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 9; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(java.io.Reader stream) {
jj_input_stream.ReInit(stream, 1, 1);
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 9; i++) jj_la1[i] = -1;
}
/** Constructor with generated Token Manager. */
public XfuzzyConfig(XfuzzyConfigTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 9; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(XfuzzyConfigTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 9; i++) jj_la1[i] = -1;
}
private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
return token;
}
token = oldToken;
jj_kind = kind;
throw generateParseException();
}
/** Get the next Token. */
final public Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
jj_gen++;
return token;
}
/** Get the specific Token. */
final public Token getToken(int index) {
Token t = token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
else t = t.next = token_source.getNextToken();
}
return t;
}
private int jj_ntk() {
if ((jj_nt=token.next) == null)
return (jj_ntk = (token.next=token_source.getNextToken()).kind);
else
return (jj_ntk = jj_nt.kind);
}
private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
private int[] jj_expentry;
private int jj_kind = -1;
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[51];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 9; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1<<j)) != 0) {
la1tokens[j] = true;
}
if ((jj_la1_1[i] & (1<<j)) != 0) {
la1tokens[32+j] = true;
}
}
}
}
for (int i = 0; i < 51; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
jj_expentries.add(jj_expentry);
}
}
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = jj_expentries.get(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
/** Enable tracing. */
final public void enable_tracing() {
}
/** Disable tracing. */
final public void disable_tracing() {
}
}