Esempio n. 1
0
 public AbstractJamochaEditor(Rete engine)
 {
     this.engine = engine;
     this.setTitle("Jamochaeditor");
     this.setSize(600, 400);
     this.setSize(new System.Drawing.Size(600, 400));
     //this.setLocationByPlatform(true);
     this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
     this.addWindowListener(new AnonymousClassWindowAdapter(this));
 }
 public AbstractJamochaEditor(Rete engine)
 {
     this.engine = engine;
     this.setTitle("Jamochaeditor");
     this.setSize(600, 400);
     this.setSize(new System.Drawing.Size(600, 400));
     //this.setLocationByPlatform(true);
     this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
     this.addWindowListener(new AnonymousClassWindowAdapter(this));
 }
Esempio n. 3
0
        public virtual ReturnVector executeFunction(Rete engine, Parameter[] params_Renamed)
        {
            System.Decimal bdval = new System.Decimal(0);
            if (params_Renamed != null)
            {
                if (params_Renamed[0] is ValueParam)
                {
                    bdval = params_Renamed[0].BigDecimalValue;
                }
                else if (params_Renamed[0] is BoundParam)
                {
                    BoundParam bp = (BoundParam)params_Renamed[0];
                    bdval = (System.Decimal)engine.getBinding(bp.VariableName);
                }
                else if (params_Renamed[0] is FunctionParam2)
                {
                    FunctionParam2 n = (FunctionParam2)params_Renamed[0];
                    n.Engine = engine;
                    n.lookUpFunction();
                    ReturnVector rval = (ReturnVector)n.Value;
                    bdval = rval.firstReturnValue().BigDecimalValue;
                }
                for (int idx = 1; idx < params_Renamed.Length; idx++)
                {
                    if (params_Renamed[idx] is ValueParam)
                    {
                        ValueParam     n  = (ValueParam)params_Renamed[idx];
                        System.Decimal bd = n.BigDecimalValue;
                        bdval = System.Decimal.Multiply(bdval, bd);
                    }
                    else if (params_Renamed[idx] is FunctionParam2)
                    {
                        FunctionParam2 n = (FunctionParam2)params_Renamed[idx];
                        n.Engine = engine;
                        n.lookUpFunction();
                        ReturnVector   rval = (ReturnVector)n.Value;
                        System.Decimal bd   = rval.firstReturnValue().BigDecimalValue;
                        if (idx == 0)
                        {
                            bdval = bd;
                        }
                        else
                        {
                            bdval = System.Decimal.Multiply(bdval, bd);
                        }
                    }
                }
            }
            DefaultReturnVector ret = new DefaultReturnVector();
            DefaultReturnValue  rv  = new DefaultReturnValue(Constants.BIG_DECIMAL, bdval);

            ret.addReturnValue(rv);
            return(ret);
        }
Esempio n. 4
0
        public virtual ReturnVector executeFunction(Rete engine, Parameter[] params_Renamed)
        {
            RootNode root = engine.RootNode;

            /*Collection firstLevel=root.getObjectTypeNodes().values();
             * for (Iterator iter = firstLevel.iterator(); iter.hasNext();) {
             * BaseNode b=(BaseNode)iter.next();
             * traverse(0,b);
             * }*/


            ViewGraphNode t          = ViewGraphNode.buildFromRete(root);
            Visualiser    visualiser = new Visualiser(engine);

            visualiser.show();
            return(new DefaultReturnVector());
        }
Esempio n. 5
0
 /// <param name="engine">the rete-engine which should become visualised
 ///
 /// </param>
 public Visualiser(Rete engine)
 {
     InitBlock();
     this.engine = engine;
     container   = new JZoomableShapeContainer();
     container.addMouseListener(this);
     radar = new JMiniRadarShapeContainer();
     radar.MasterShapeContainer    = container;
     radar.NormalizedFontHeight    = nodeVertical;
     container.RadarShapeContainer = radar;
     calculateMainContainerFont();
     even = new SimpleAttributeSet();
     odd  = new SimpleAttributeSet();
     StyleConstants.setForeground(even, System.Drawing.Color.Blue);
     System.Drawing.Color temp_Color;
     temp_Color = System.Drawing.Color.Green;
     StyleConstants.setForeground(odd, System.Drawing.Color.FromArgb(System.Convert.ToInt32(temp_Color.R * 0.7), System.Convert.ToInt32(temp_Color.G * 0.7), System.Convert.ToInt32(temp_Color.B * 0.7)));
     actAttributes = even;
     reloadView();
 }
Esempio n. 6
0
        public virtual ReturnVector executeFunction(Rete engine, Parameter[] params_Renamed)
        {
            System.Decimal bdval = new System.Decimal(0);
            bool           eval  = false;

            if (params_Renamed.Length == 1)
            {
                bdval = (System.Decimal)params_Renamed[0].getValue(engine, Constants.BIG_DECIMAL);
                double bdh = System.Decimal.ToDouble(bdval);
                if (bdh % 2 == 1)
                {
                    eval = true;
                }
            }
            DefaultReturnVector ret = new DefaultReturnVector();
            DefaultReturnValue  rv  = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, eval);

            ret.addReturnValue(rv);
            return(ret);
        }
Esempio n. 7
0
 /// <param name="engine">the rete-engine which should become visualised
 /// 
 /// </param>
 public Visualiser(Rete engine)
 {
     InitBlock();
     this.engine = engine;
     container = new JZoomableShapeContainer();
     container.addMouseListener(this);
     radar = new JMiniRadarShapeContainer();
     radar.MasterShapeContainer = container;
     radar.NormalizedFontHeight = nodeVertical;
     container.RadarShapeContainer = radar;
     calculateMainContainerFont();
     even = new SimpleAttributeSet();
     odd = new SimpleAttributeSet();
     StyleConstants.setForeground(even, System.Drawing.Color.Blue);
     System.Drawing.Color temp_Color;
     temp_Color = System.Drawing.Color.Green;
     StyleConstants.setForeground(odd, System.Drawing.Color.FromArgb(System.Convert.ToInt32(temp_Color.R * 0.7), System.Convert.ToInt32(temp_Color.G * 0.7), System.Convert.ToInt32(temp_Color.B * 0.7)));
     actAttributes = even;
     reloadView();
 }
Esempio n. 8
0
 internal Jamocha(Rete engine)
 {
     this.engine = engine;
 }
Esempio n. 9
0
 public virtual ReturnVector executeFunction(Rete engine, Parameter[] params_Renamed)
 {
     System.Decimal bdval = new System.Decimal(0);
     bool eval = false;
     if (params_Renamed.Length == 1)
     {
         bdval = (System.Decimal) params_Renamed[0].getValue(engine, Constants.BIG_DECIMAL);
         double bdh = System.Decimal.ToDouble(bdval);
         if (bdh % 2 == 1)
         {
             eval = true;
         }
     }
     DefaultReturnVector ret = new DefaultReturnVector();
     DefaultReturnValue rv = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, eval);
     ret.addReturnValue(rv);
     return ret;
 }
Esempio n. 10
0
 public virtual ReturnVector executeFunction(Rete engine, Parameter[] params_Renamed)
 {
     System.Decimal bdval = new System.Decimal(0);
     if (params_Renamed != null)
     {
         if (params_Renamed[0] is ValueParam)
         {
             bdval = params_Renamed[0].BigDecimalValue;
         }
         else if (params_Renamed[0] is BoundParam)
         {
             BoundParam bp = (BoundParam) params_Renamed[0];
             bdval = (System.Decimal) engine.getBinding(bp.VariableName);
         }
         else if (params_Renamed[0] is FunctionParam2)
         {
             FunctionParam2 n = (FunctionParam2) params_Renamed[0];
             n.Engine = engine;
             n.lookUpFunction();
             ReturnVector rval = (ReturnVector) n.Value;
             bdval = rval.firstReturnValue().BigDecimalValue;
         }
         for (int idx = 1; idx < params_Renamed.Length; idx++)
         {
             if (params_Renamed[idx] is ValueParam)
             {
                 ValueParam n = (ValueParam) params_Renamed[idx];
                 System.Decimal bd = n.BigDecimalValue;
                 bdval = System.Decimal.Multiply(bdval, bd);
             }
             else if (params_Renamed[idx] is FunctionParam2)
             {
                 FunctionParam2 n = (FunctionParam2) params_Renamed[idx];
                 n.Engine = engine;
                 n.lookUpFunction();
                 ReturnVector rval = (ReturnVector) n.Value;
                 System.Decimal bd = rval.firstReturnValue().BigDecimalValue;
                 if (idx == 0)
                 {
                     bdval = bd;
                 }
                 else
                 {
                     bdval = System.Decimal.Multiply(bdval, bd);
                 }
             }
         }
     }
     DefaultReturnVector ret = new DefaultReturnVector();
     DefaultReturnValue rv = new DefaultReturnValue(Constants.BIG_DECIMAL, bdval);
     ret.addReturnValue(rv);
     return ret;
 }
Esempio n. 11
0
 internal Jamocha(Rete engine)
 {
     this.engine = engine;
 }
Esempio n. 12
0
        public TemplateEditor(Rete engine) : base(engine)
        {
            InitBlock();
            setSize(600, 500);
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            setLayout(new BorderLayout());
            setTitle("Create new Template");
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            contentPanel = new JPanel(new BorderLayout());
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(contentPanel, BorderLayout.CENTER);
            cancelButton = new JButton("Cancel", IconLoader.getImageIcon("cancel"));
            cancelButton.addActionListener(this);
            assertButton = new JButton("Create Template", IconLoader.getImageIcon("brick_add"));
            assertButton.addActionListener(this);
            JPanel buttonPanel = new JPanel();

            //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 1));
            buttonPanel.add(cancelButton);
            buttonPanel.add(assertButton);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.SOUTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(buttonPanel, BorderLayout.SOUTH);

            nameField = new JTextField(15);
            Collection modules = engine.WorkingMemory.Modules;

            System.String[] moduleNames = new System.String[modules.size()];
            int             i           = 0;
            Iterator        itr         = modules.iterator();

            while (itr.hasNext())
            {
                System.Object obj = itr.next();
                moduleNames[i++] = ((Module)obj).ModuleName;
            }
            moduleBox = new JComboBox(moduleNames);


            addSlotButton = new JButton("Add Slot", IconLoader.getImageIcon("add"));
            addSlotButton.addActionListener(this);
            //UPGRADE_ISSUE: Field 'java.awt.Component.RIGHT_ALIGNMENT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtComponentRIGHT_ALIGNMENT_f"'
            addSlotButton.setAlignmentX(Component.RIGHT_ALIGNMENT);

            JPanel topPanel = new JPanel();

            topPanel.setBorder(BorderFactory.createTitledBorder("General Template Settings"));
            //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.LEFT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            topPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 20, 1));
            //UPGRADE_ISSUE: Constructor 'java.awt.GridLayout.GridLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridLayout"'
            JPanel innerTopPanel = new JPanel(new GridLayout(2, 2));

            innerTopPanel.add(new JLabel("Template-name:"));
            innerTopPanel.add(nameField);
            innerTopPanel.add(new JLabel("Template-Module:"));
            innerTopPanel.add(moduleBox);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.WEST' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            topPanel.add(innerTopPanel, BorderLayout.WEST);
            topPanel.add(addSlotButton);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.NORTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(topPanel, BorderLayout.NORTH);

            dumpAreaTemplate.setEditable(false);
            //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075"'
            //UPGRADE_TODO: Method 'java.awt.Font.Plain' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f"'
            dumpAreaTemplate.setFont(new System.Drawing.Font("Courier", 12, (System.Drawing.FontStyle)System.Drawing.FontStyle.Regular));
            dumpAreaTemplate.setRows(5);

            JPanel dumpAreaPanel = new JPanel();

            dumpAreaPanel.setLayout(new BoxLayout(dumpAreaPanel, BoxLayout.Y_AXIS));
            dumpAreaPanel.setBorder(BorderFactory.createTitledBorder("Template Preview"));
            dumpAreaPanel.add(new JScrollPane(dumpAreaTemplate));
            reloadButtonDumpAreaTemplate = new JButton("Reload Template Preview", IconLoader.getImageIcon("arrow_refresh"));
            reloadButtonDumpAreaTemplate.addActionListener(this);
            dumpAreaPanel.add(reloadButtonDumpAreaTemplate);

            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.SOUTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            contentPanel.add(dumpAreaPanel, BorderLayout.SOUTH);
        }
Esempio n. 13
0
        public TemplateEditor(Rete engine)
            : base(engine)
        {
            InitBlock();
            setSize(600, 500);
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            setLayout(new BorderLayout());
            setTitle("Create new Template");
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            contentPanel = new JPanel(new BorderLayout());
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(contentPanel, BorderLayout.CENTER);
            cancelButton = new JButton("Cancel", IconLoader.getImageIcon("cancel"));
            cancelButton.addActionListener(this);
            assertButton = new JButton("Create Template", IconLoader.getImageIcon("brick_add"));
            assertButton.addActionListener(this);
            JPanel buttonPanel = new JPanel();
            //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 1));
            buttonPanel.add(cancelButton);
            buttonPanel.add(assertButton);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.SOUTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(buttonPanel, BorderLayout.SOUTH);

            nameField = new JTextField(15);
            Collection modules = engine.WorkingMemory.Modules;
            System.String[] moduleNames = new System.String[modules.size()];
            int i = 0;
            Iterator itr = modules.iterator();
            while (itr.hasNext())
            {
                System.Object obj = itr.next();
                moduleNames[i++] = ((Module) obj).ModuleName;
            }
            moduleBox = new JComboBox(moduleNames);

            addSlotButton = new JButton("Add Slot", IconLoader.getImageIcon("add"));
            addSlotButton.addActionListener(this);
            //UPGRADE_ISSUE: Field 'java.awt.Component.RIGHT_ALIGNMENT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtComponentRIGHT_ALIGNMENT_f"'
            addSlotButton.setAlignmentX(Component.RIGHT_ALIGNMENT);

            JPanel topPanel = new JPanel();
            topPanel.setBorder(BorderFactory.createTitledBorder("General Template Settings"));
            //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.LEFT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            topPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 20, 1));
            //UPGRADE_ISSUE: Constructor 'java.awt.GridLayout.GridLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGridLayout"'
            JPanel innerTopPanel = new JPanel(new GridLayout(2, 2));
            innerTopPanel.add(new JLabel("Template-name:"));
            innerTopPanel.add(nameField);
            innerTopPanel.add(new JLabel("Template-Module:"));
            innerTopPanel.add(moduleBox);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.WEST' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            topPanel.add(innerTopPanel, BorderLayout.WEST);
            topPanel.add(addSlotButton);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.NORTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(topPanel, BorderLayout.NORTH);

            dumpAreaTemplate.setEditable(false);
            //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075"'
            //UPGRADE_TODO: Method 'java.awt.Font.Plain' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f"'
            dumpAreaTemplate.setFont(new System.Drawing.Font("Courier", 12, (System.Drawing.FontStyle) System.Drawing.FontStyle.Regular));
            dumpAreaTemplate.setRows(5);

            JPanel dumpAreaPanel = new JPanel();
            dumpAreaPanel.setLayout(new BoxLayout(dumpAreaPanel, BoxLayout.Y_AXIS));
            dumpAreaPanel.setBorder(BorderFactory.createTitledBorder("Template Preview"));
            dumpAreaPanel.add(new JScrollPane(dumpAreaTemplate));
            reloadButtonDumpAreaTemplate = new JButton("Reload Template Preview", IconLoader.getImageIcon("arrow_refresh"));
            reloadButtonDumpAreaTemplate.addActionListener(this);
            dumpAreaPanel.add(reloadButtonDumpAreaTemplate);

            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.SOUTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            contentPanel.add(dumpAreaPanel, BorderLayout.SOUTH);
        }