⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bifv01.java

📁 java编写的贝叶斯网络分类器(貌似没有模型构建和参数学习过程)
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    t = jj_consume_token(WORD);
          {if (true) return(t.image);}
    throw new Error("Missing return statement in function");
  }

/* Fill a Probability list of properties */
  final public void ProbabilityContent(IFProbabilityFunction upf) throws ParseException {
String s = null;
Vector properties = new Vector();
IFProbabilityEntry e = null;
Vector entries = new Vector();
Vector defs = new Vector();
Vector tabs = new Vector();
double def[] = null;
double tab[] = null;
    jj_consume_token(22);
    label_6:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DEFAULTVALUE:
      case TABLEVALUES:
      case PROPERTYSTRING:
      case 27:
        ;
        break;
      default:
        jj_la1[10] = jj_gen;
        break label_6;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case PROPERTYSTRING:
        s = Property();
          properties.addElement(s);
        break;
      case DEFAULTVALUE:
        def = ProbabilityDefaultEntry();
      defs.addElement(def);
        break;
      case 27:
        e = ProbabilityEntry();
          entries.addElement(e);
        break;
      case TABLEVALUES:
        tab = ProbabilityTable();
      tabs.addElement(tab);
        break;
      default:
        jj_la1[11] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    jj_consume_token(23);
          upf.set_properties(properties);
          upf.set_defaults(defs);
          upf.set_entries(entries);
          upf.set_tables(tabs);
  }

  final public IFProbabilityEntry ProbabilityEntry() throws ParseException {
String s[];
double d[];
    s = ProbabilityValuesList();
    d = FloatingPointList();
    jj_consume_token(26);
          {if (true) return( new IFProbabilityEntry(s, d) );}
    throw new Error("Missing return statement in function");
  }

/* Parse the list of Probability values in an entry */
  final public String[] ProbabilityValuesList() throws ParseException {
int i;
Enumeration e;
String variable_name;
String vs[];
Vector v_list = new Vector();
    jj_consume_token(27);
    variable_name = ProbabilityVariableValue();
          v_list.addElement(variable_name);
    label_7:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case WORD:
      case NUMBER:
        ;
        break;
      default:
        jj_la1[12] = jj_gen;
        break label_7;
      }
      variable_name = ProbabilityVariableValue();
          v_list.addElement(variable_name);
    }
    jj_consume_token(28);
          vs = new String[v_list.size()];
          for (e=v_list.elements(), i=0; e.hasMoreElements(); i++)
                vs[i] = (String)(e.nextElement());
          {if (true) return(vs);}
    throw new Error("Missing return statement in function");
  }

  final public double[] ProbabilityDefaultEntry() throws ParseException {
double d[];
    jj_consume_token(DEFAULTVALUE);
    d = FloatingPointList();
    jj_consume_token(26);
          {if (true) return(d);}
    throw new Error("Missing return statement in function");
  }

  final public double[] ProbabilityTable() throws ParseException {
double d[];
    jj_consume_token(TABLEVALUES);
    d = FloatingPointList();
    jj_consume_token(26);
          {if (true) return(d);}
    throw new Error("Missing return statement in function");
  }

/* ====================================================== */
/*          Some general purpose non-terminals            */
/* ====================================================== */

/* Pick a list of non-negative floating numbers */
  final public double[] FloatingPointList() throws ParseException {
int i;
Double d;
double ds[];
Vector d_list = new Vector();
Enumeration e;
    d = FloatingPointNumber();
          d_list.addElement(d);
    label_8:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case NUMBER:
        ;
        break;
      default:
        jj_la1[13] = jj_gen;
        break label_8;
      }
      d = FloatingPointNumber();
          d_list.addElement(d);
    }
          ds = new double[d_list.size()];
          for (e=d_list.elements(), i=0; e.hasMoreElements(); i++) {
                d = (Double)(e.nextElement());
                ds[i] = d.doubleValue();
          }
          {if (true) return(ds);}
    throw new Error("Missing return statement in function");
  }

/* Pick a non-negative floating number; necessary to allow *
 * ignored characters and comments to exist in the middle  *
 * of a FloatingPointList()                                */
  final public Double FloatingPointNumber() throws ParseException {
Token t;
    t = jj_consume_token(NUMBER);
          {if (true) return( Double.valueOf(t.image) );}
    throw new Error("Missing return statement in function");
  }

/* Property definition */
  final public String Property() throws ParseException {
int k;
Token t;
String s;
    t = jj_consume_token(PROPERTYSTRING);
          s = t.image;
          k = s.indexOf(' ');
          {if (true) return(s.substring(k, s.length() - 1));}
    throw new Error("Missing return statement in function");
  }

  public BIFv01TokenManager token_source;
  ASCII_CharStream jj_input_stream;
  public Token token, jj_nt;
  private int jj_ntk;
  private int jj_gen;
  final private int[] jj_la1 = new int[14];
  final private int[] jj_la1_0 = {0x600,0x600,0x10000,0x11000,0x11000,0x120000,0x120000,0x20000000,0x20000,0x20000000,0x801c000,0x801c000,0x120000,0x100000,};

  public BIFv01(java.io.InputStream stream) {
    jj_input_stream = new ASCII_CharStream(stream, 1, 1);
    token_source = new BIFv01TokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
  }

  public void ReInit(java.io.InputStream 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 < 14; i++) jj_la1[i] = -1;
  }

  public BIFv01(BIFv01TokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
  }

  public void ReInit(BIFv01TokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
  }

  final 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();
  }

  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;
  }

  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;
  }

  final 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.Vector jj_expentries = new java.util.Vector();
  private int[] jj_expentry;
  private int jj_kind = -1;

  final public ParseException generateParseException() {
    jj_expentries.removeAllElements();
    boolean[] la1tokens = new boolean[30];
    for (int i = 0; i < 30; i++) {
      la1tokens[i] = false;
    }
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 14; 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;
          }
        }
      }
    }
    for (int i = 0; i < 30; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.addElement(jj_expentry);
      }
    }
    int[][] exptokseq = new int[jj_expentries.size()][];
    for (int i = 0; i < jj_expentries.size(); i++) {
      exptokseq[i] = (int[])jj_expentries.elementAt(i);
    }
    return new ParseException(token, exptokseq, tokenImage);
  }

  final public void enable_tracing() {
  }

  final public void disable_tracing() {
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -