]> matita.cs.unibo.it Git - logicplayer.git/blob - mainActivity/src/com/example/furt/myapplication/GenericFormula.java
New version (to be tested).
[logicplayer.git] / mainActivity / src / com / example / furt / myapplication / GenericFormula.java
1 package com.example.furt.myapplication;
2
3 import android.graphics.Paint;
4 import android.graphics.Rect;
5
6 import java.util.ArrayList;
7 import java.util.List;
8
9 public class GenericFormula implements Formula
10 {
11     Paint p=new Paint();
12     int priority;
13     public String Draw(int p)
14     {
15         return "?";
16     } //la GenericFormula non può essere rappresentata
17     public String toString(){return Draw(0);}
18     public float size(){
19         p.setTextSize(DrawActivity.textSize);
20         return p.measureText(toString())+(float)(p.measureText(toString())*0.20);//ritorna la misura effettuata dalla classe Paint con un padding del 20% per migliorare la stima
21     }
22     public float sizeDeleted()
23     {
24         p.setTextSize(DrawActivity.textSize);
25         return p.measureText(toStringDeleted())+(float)(p.measureText(toStringDeleted())*0.20); //ritorna la misura effettuata dalla classe Paint con un padding del 20% per migliorare la stima
26     }
27     public String toStringDeleted()
28     {
29         return "["+toString()+"]";
30     }
31     public float height()
32     {
33         p.setTextSize(DrawActivity.textSize);
34         Rect bounds=new Rect();
35         p.getTextBounds(toString(),0,toString().length(),bounds);
36         return (float)((bounds.height()+((float)0.20*bounds.height()))*1.5); //l'altezza della formula va moltiplicata per l'inverso della densità dello schermo (circa 1.5)
37     }
38     public List<IntroductionRule> introductionRules(){
39         List<IntroductionRule> rules=new ArrayList<IntroductionRule>();
40         Node thisNode=new Node(this);
41         RuleIntroduction RAA=new RuleIntroduction("RAA",0);                        //R.A.A.
42         Node RAAnode=new Node(new FormulaBOT());                            //Formula=Bottom
43         List<Formula> RAAhp=new ArrayList<Formula>();                             //Tutte le ipotesi del nodo precedente
44         RAAhp.add(new FormulaNot(this));                                    //Più la negazione del nodo attuale
45         RAAnode.addHPFormula(RAAhp,true);
46         thisNode.addChild(RAAnode);
47         RAA.tempRule=thisNode;
48         rules.add(RAA);
49         /*
50         Node thisFakeNode=new Node(this);
51         RuleIntroduction fakeRAA=new RuleIntroduction("RAA",0,true);                        //fake R.A.A.
52         Node fakeRAAnode=new Node(new FormulaNot(this));                            //Formula=!F
53         thisFakeNode.addChild(fakeRAAnode);
54         fakeRAA.tempRule=thisFakeNode;
55         rules.add(fakeRAA);
56         */
57         return rules;
58     }
59     public List<EliminationRule> EliminationRules(){
60         List<EliminationRule> nodes=new ArrayList<EliminationRule>();
61         return nodes;
62     }
63
64     @Override
65     public boolean Fill(Formula F) {
66         return false;
67     }
68
69     @Override
70     public boolean setCursor() {
71         return false;
72     }
73
74     @Override
75     public Formula duplicate() {
76         return null;
77     }
78
79     @Override
80     public Object clone() throws CloneNotSupportedException {
81         return super.clone();
82     }
83 }