+++ /dev/null
-package com.example.furt.myapplication;
-
-import android.view.View;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class touchParserHandler implements View.OnClickListener
-{
- int type; //0=and 1=or 2=impl 3=not 4=literal
- char l; //for literals
- touchParserHandler(int t,char l)
- {
- type=t;
- this.l=l;
- }
- public void onClick(View view)
- {
- if(!parserDialog.F.toString().contains("_"))
- {
- Toast.makeText(DrawActivity.rootNode.view.getContext(),"Formula completa! Premere \"Undo\" per modificare", Toast.LENGTH_SHORT).show();
- return;
- }
- parserDialog.undo.add(parserDialog.F.duplicate());
- parserDialog.formulaLayout.removeAllViews();
- if(type==0)
- {
- UndefinedFormula newCursor=new UndefinedFormula();
- newCursor.currentF=true;
- Formula newF=new FormulaAnd(newCursor,new UndefinedFormula());
- if ((parserDialog.F).toString().equals("_"))
- {
- parserDialog.F=newF;
- }
- else {
- parserDialog.F.Fill(newF);
- parserDialog.F.setCursor();
- }
- }
- else if(type==1)
- {
- UndefinedFormula newCursor=new UndefinedFormula();
- newCursor.currentF=true;
- Formula newF=new FormulaOr(newCursor,new UndefinedFormula());
- if ((parserDialog.F).toString().equals("_"))
- {
- parserDialog.F=newF;
- }
- else
- parserDialog.F.Fill(newF);
- }
- else if(type==2)
- {
- UndefinedFormula newCursor=new UndefinedFormula();
- newCursor.currentF=true;
- Formula newF=new FormulaImpl(newCursor,new UndefinedFormula());
- if ((parserDialog.F).toString().equals("_"))
- {
- parserDialog.F=newF;
- }
- else {
- parserDialog.F.Fill(newF);
- parserDialog.F.setCursor();
- }
- }
- else if(type==3)
- {
- UndefinedFormula newCursor=new UndefinedFormula();
- newCursor.currentF=true;
- Formula newF=new FormulaNot(newCursor);
- if ((parserDialog.F).toString().equals("_"))
- {
- parserDialog.F=newF;
- }
- else {
- parserDialog.F.Fill(newF);
- parserDialog.F.setCursor();
- }
- }
- else if(type==4)
- {
- Formula newF;
- if(l=='⊥')
- newF=new FormulaBOT();
- else if(l=='T')
- newF=new FormulaTOP();
- else
- newF=new Literal(l);
- if ((parserDialog.F).toString().equals("_"))
- {
- parserDialog.F=newF;
- }
- else {
- parserDialog.F.Fill(newF);
- parserDialog.F.setCursor();
- }
- }
- TextView FView=new TextView(parserDialog.formulaLayout.getContext());
- FView.setText(parserDialog.F.toString());
- FView.setTextSize(DrawActivity.textSize);
- parserDialog.formulaLayout.addView(FView);
- }
-}