Search in sources :

Example 1 with BoolPtg

use of org.apache.poi.ss.formula.ptg.BoolPtg in project poi by apache.

the class TestFormulaParserIf method testYN.

public void testYN() {
    Ptg[] ptgs = parseFormula("IF(TRUE,\"Y\",\"N\")");
    assertEquals(7, ptgs.length);
    BoolPtg flag = (BoolPtg) ptgs[0];
    AttrPtg funif = (AttrPtg) ptgs[1];
    StringPtg y = (StringPtg) ptgs[2];
    AttrPtg goto1 = (AttrPtg) ptgs[3];
    StringPtg n = (StringPtg) ptgs[4];
    assertEquals(true, flag.getValue());
    assertEquals("Y", y.getValue());
    assertEquals("N", n.getValue());
    assertEquals("IF", funif.toFormulaString());
    assertTrue("tAttrSkip ptg exists", goto1.isSkip());
}
Also used : IntPtg(org.apache.poi.ss.formula.ptg.IntPtg) Ptg(org.apache.poi.ss.formula.ptg.Ptg) LessEqualPtg(org.apache.poi.ss.formula.ptg.LessEqualPtg) FuncVarPtg(org.apache.poi.ss.formula.ptg.FuncVarPtg) RefPtg(org.apache.poi.ss.formula.ptg.RefPtg) NotEqualPtg(org.apache.poi.ss.formula.ptg.NotEqualPtg) FuncPtg(org.apache.poi.ss.formula.ptg.FuncPtg) AttrPtg(org.apache.poi.ss.formula.ptg.AttrPtg) AddPtg(org.apache.poi.ss.formula.ptg.AddPtg) MultiplyPtg(org.apache.poi.ss.formula.ptg.MultiplyPtg) StringPtg(org.apache.poi.ss.formula.ptg.StringPtg) LessThanPtg(org.apache.poi.ss.formula.ptg.LessThanPtg) BoolPtg(org.apache.poi.ss.formula.ptg.BoolPtg) BoolPtg(org.apache.poi.ss.formula.ptg.BoolPtg) StringPtg(org.apache.poi.ss.formula.ptg.StringPtg) AttrPtg(org.apache.poi.ss.formula.ptg.AttrPtg)

Example 2 with BoolPtg

use of org.apache.poi.ss.formula.ptg.BoolPtg in project poi by apache.

the class TestFormulaParser method testTRUE.

@Test
public void testTRUE() {
    Ptg[] ptgs = parseFormula("TRUE");
    assertEquals(1, ptgs.length);
    BoolPtg flag = (BoolPtg) ptgs[0];
    assertEquals(true, flag.getValue());
}
Also used : NumberPtg(org.apache.poi.ss.formula.ptg.NumberPtg) ArrayPtg(org.apache.poi.ss.formula.ptg.ArrayPtg) AttrPtg(org.apache.poi.ss.formula.ptg.AttrPtg) PercentPtg(org.apache.poi.ss.formula.ptg.PercentPtg) RangePtg(org.apache.poi.ss.formula.ptg.RangePtg) AddPtg(org.apache.poi.ss.formula.ptg.AddPtg) EqualPtg(org.apache.poi.ss.formula.ptg.EqualPtg) UnaryMinusPtg(org.apache.poi.ss.formula.ptg.UnaryMinusPtg) NameXPtg(org.apache.poi.ss.formula.ptg.NameXPtg) RefPtg(org.apache.poi.ss.formula.ptg.RefPtg) DividePtg(org.apache.poi.ss.formula.ptg.DividePtg) GreaterThanPtg(org.apache.poi.ss.formula.ptg.GreaterThanPtg) MultiplyPtg(org.apache.poi.ss.formula.ptg.MultiplyPtg) Ref3DPtg(org.apache.poi.ss.formula.ptg.Ref3DPtg) StringPtg(org.apache.poi.ss.formula.ptg.StringPtg) ErrPtg(org.apache.poi.ss.formula.ptg.ErrPtg) Ptg(org.apache.poi.ss.formula.ptg.Ptg) Area3DPtg(org.apache.poi.ss.formula.ptg.Area3DPtg) NamePtg(org.apache.poi.ss.formula.ptg.NamePtg) MemAreaPtg(org.apache.poi.ss.formula.ptg.MemAreaPtg) ConcatPtg(org.apache.poi.ss.formula.ptg.ConcatPtg) UnaryPlusPtg(org.apache.poi.ss.formula.ptg.UnaryPlusPtg) BoolPtg(org.apache.poi.ss.formula.ptg.BoolPtg) IntersectionPtg(org.apache.poi.ss.formula.ptg.IntersectionPtg) AbstractFunctionPtg(org.apache.poi.ss.formula.ptg.AbstractFunctionPtg) IntPtg(org.apache.poi.ss.formula.ptg.IntPtg) UnionPtg(org.apache.poi.ss.formula.ptg.UnionPtg) FuncVarPtg(org.apache.poi.ss.formula.ptg.FuncVarPtg) SubtractPtg(org.apache.poi.ss.formula.ptg.SubtractPtg) FuncPtg(org.apache.poi.ss.formula.ptg.FuncPtg) MissingArgPtg(org.apache.poi.ss.formula.ptg.MissingArgPtg) MemFuncPtg(org.apache.poi.ss.formula.ptg.MemFuncPtg) PowerPtg(org.apache.poi.ss.formula.ptg.PowerPtg) AreaPtg(org.apache.poi.ss.formula.ptg.AreaPtg) ParenthesisPtg(org.apache.poi.ss.formula.ptg.ParenthesisPtg) BoolPtg(org.apache.poi.ss.formula.ptg.BoolPtg) Test(org.junit.Test)

Aggregations

AddPtg (org.apache.poi.ss.formula.ptg.AddPtg)2 AttrPtg (org.apache.poi.ss.formula.ptg.AttrPtg)2 BoolPtg (org.apache.poi.ss.formula.ptg.BoolPtg)2 FuncPtg (org.apache.poi.ss.formula.ptg.FuncPtg)2 FuncVarPtg (org.apache.poi.ss.formula.ptg.FuncVarPtg)2 IntPtg (org.apache.poi.ss.formula.ptg.IntPtg)2 MultiplyPtg (org.apache.poi.ss.formula.ptg.MultiplyPtg)2 Ptg (org.apache.poi.ss.formula.ptg.Ptg)2 RefPtg (org.apache.poi.ss.formula.ptg.RefPtg)2 StringPtg (org.apache.poi.ss.formula.ptg.StringPtg)2 AbstractFunctionPtg (org.apache.poi.ss.formula.ptg.AbstractFunctionPtg)1 Area3DPtg (org.apache.poi.ss.formula.ptg.Area3DPtg)1 AreaPtg (org.apache.poi.ss.formula.ptg.AreaPtg)1 ArrayPtg (org.apache.poi.ss.formula.ptg.ArrayPtg)1 ConcatPtg (org.apache.poi.ss.formula.ptg.ConcatPtg)1 DividePtg (org.apache.poi.ss.formula.ptg.DividePtg)1 EqualPtg (org.apache.poi.ss.formula.ptg.EqualPtg)1 ErrPtg (org.apache.poi.ss.formula.ptg.ErrPtg)1 GreaterThanPtg (org.apache.poi.ss.formula.ptg.GreaterThanPtg)1 IntersectionPtg (org.apache.poi.ss.formula.ptg.IntersectionPtg)1