Back to project page AnkiStats.
The source code is released under:
GNU General Public License
If you think the Android project AnkiStats listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.wildplot.android.parsing.AtomTypes; /*w w w . j a va 2 s . c om*/ import com.wildplot.android.parsing.ExpressionFormatException; import com.wildplot.android.parsing.Atom; import com.wildplot.android.parsing.TreeElement; /** * @author Michael Goldbach */ public class NumberAtom implements TreeElement { public Atom.AtomType getAtomType() { return atomType; } private Atom.AtomType atomType = Atom.AtomType.NUMBER; private Double value; public NumberAtom(String factorString) { try { this.value = Double.parseDouble(factorString); } catch (NumberFormatException e) { atomType = Atom.AtomType.INVALID; } } @Override public double getValue() throws ExpressionFormatException{ if (atomType != Atom.AtomType.INVALID) return value; else throw new ExpressionFormatException("Number is Invalid, cannot parse"); } @Override public boolean isVariable() throws ExpressionFormatException{ if (atomType != Atom.AtomType.INVALID) return false; else throw new ExpressionFormatException("Number is Invalid, cannot parse"); } }