private void writeVariable(DataOutputStream stream, Variable variable, int numScores)
     throws IOException {
   stream.writeUTF(variable.getName());
   stream.writeByte(variable.getCardinality());
   for (String instantiation : variable.getInstantiations()) stream.writeUTF(instantiation);
   stream.writeInt(numScores);
 }
Exemplo n.º 2
0
    public JIPList getSingletonVariables() {
      Hashtable<String, Variable> svar = m_parser.getSingletonVariables();

      JIPList singletonVars = null;

      //        	Hashtable<String, JIPVariable> sjvar = new Hashtable<String, JIPVariable>();

      for (String key : svar.keySet()) {
        Variable var = svar.get(key);
        if (!var.isAnonymous())
          singletonVars =
              JIPList.create(
                  JIPFunctor.create(
                      "=",
                      JIPCons.create(
                          JIPAtom.create(var.getName()),
                          JIPCons.create(new JIPVariable(var), null))),
                  singletonVars);

        //        		sjvar.put(key, new JIPVariable(var));
      }
      if (singletonVars == null) return JIPList.NIL;
      else return singletonVars; // .reverse();
    }