Hallo,
i have following java code for classes Deftemplate and Fact working with
array.
my program will not work.After running there are no facts .What ist wrong here
in sytax and code ?
Thanks.
La


/*
 * Created on 06.08.2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package Parameter;

import jess.*;
import java.io.*;
//import java.lang.*;
/**
 * @author hong
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class ParameterInFact
{
        public static void main(String[] unused)throws IOException ,
        JessException
        {
                Rete r = new Rete();


                BufferedReader lesen = new BufferedReader( new
                InputStreamReader(System.in));

                //Eingabe den Namen vom Fact
                System.out.println("Fact-Name ?:");
                String factName =lesen.readLine();//Gibt factName= name ein

                System.out.println("How many Slots ?:");
                String _anzahl =lesen.readLine();
                //String slotname[];
                Integer i1 = new Integer(_anzahl);
            int anzahl = i1.intValue();
            String[] slotName = new  String[anzahl];
            String[] slotWert = new  String[anzahl];
            String[] slotType = new  String[anzahl];
                //Deftemplate
                Deftemplate dt = new Deftemplate(factName," Nur ein Name ",r);
                for (int i= 0;i < anzahl ;i++)
                {
                        System.out.println("Ein SlotNamen ein geben !");
                    slotName[i] =lesen.readLine();
                    System.out.println("Ein Wert ein geben !");
                    slotWert[i] =lesen.readLine();
                    System.out.println("Ein SlotType ein geben !");
                    slotType[i] =lesen.readLine();
                    if(slotType[i]=="int")
                    {
                    Value zero = new Value(0,RU.INTEGER);
                        dt.addSlot(slotName[i],zero,"INTEGER");
                        System.out.println("Bin hier");

                    }
                    if(slotType[i]=="double")
                    {
                            Value zero = new Value(0,RU.FLOAT);
                                dt.addSlot(slotName[i],zero,"FLOAT");
                                System.out.println("Bin hier");

                    }
                    if(slotType[i]=="String")
                    {
                            Value zero = new Value(0,RU.STRING);
                                dt.addSlot(slotName[i],zero,"STRING");
                                System.out.println("Bin hier");

                    }

                }

                r.addDeftemplate(dt);

                //Deffacts

                Fact f = new Fact(factName,r);



                for(int i = 0;i< anzahl;i++)
                {
                        System.out.println(slotType[i]);
                        if(slotType[i]== "int")
                        {
                    Integer i2 = new Integer(slotWert[i]);
                        int iwert= i2.intValue();
                        f.setSlotValue(slotName[i],new
                        Value(iwert,RU.INTEGER));
                        System.out.println("Bin hier");
                        }
                    else;
                        if(slotType[i]== "double")
                        {
                    Double d1 = new Double(slotWert[i]);
                    double dwert =d1.doubleValue();
                        f.setSlotValue(slotName[i],new Value(dwert,RU.FLOAT));
                        System.out.println("Bin hier");
                        }
                        else;
                        if(slotType[i]== "String")
                        {
                        f.setSlotValue(slotName[i],new
                        Value(slotWert[i],RU.STRING));
                        System.out.println("Bin hier");
                        }
                        //else;

                }


                System.out.println("Bin hier");
                r.assertFact(f);
                r.executeCommand("(facts)");

        }
}

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to