]> matita.cs.unibo.it Git - logicplayer.git/blob - mainActivity/app/src/main/java/com/example/furt/myapplication/RuleIntroduction.java
Ported to latest version of Android SDK
[logicplayer.git] / mainActivity / app / src / main / java / com / example / furt / myapplication / RuleIntroduction.java
1 package com.example.furt.myapplication;
2
3 //Regole di introduzione per la deduzione top-down: la formula รจ sempre applicabile, per cui la regola si limita
4 //a chiamare la callback e restituire il sottoalbero di nodi conseguente all'applicazione della regola
5 public class RuleIntroduction implements IntroductionRule
6 {
7     int priority;
8     Node tempRule;
9     String ruleName;
10     public RuleIntroduction(String name,int p)
11     {
12         ruleName=name; priority=p;
13     }
14     public Node createNodes(askFormula ask)
15     {
16         Formula C=ask.Ask();
17         for (Node n:tempRule.Children)
18         {
19             if (n.F.toString().equals(" ")) //undefined formula
20                 n.F=C;
21             n.ruleName=ruleName;
22         }
23         tempRule.ruleName=ruleName;
24         return tempRule;
25     }
26     public int getPriority()
27     {
28         return priority;
29     }
30 }