Package org.apache.poi.hssf.record.formula.eval

Examples of org.apache.poi.hssf.record.formula.eval.AreaEval


   
    // text (first) arg type is number, other args are strings with fractional digits
    confirmMid(new NumberEval(123456), new StringEval("3.1"), new StringEval("2.9"), "34");
   
    // startPos is 1x1 area ref, numChars is cell ref
    AreaEval aeStart = new Area2DEval(new AreaPtg("A1:A1"), new ValueEval[] { new NumberEval(2), } );
    RefEval reNumChars = new Ref2DEval(new ReferencePtg("B1"), new NumberEval(3));
    confirmMid(new StringEval("galactic"), aeStart, reNumChars, "ala");

    confirmMid(new StringEval("galactic"), new NumberEval(3.1), BlankEval.INSTANCE, "");
View Full Code Here


  }


  public void testAreaSimple() {
   
    AreaEval aeA = EvalFactory.createAreaEval("A1:A3", 1, 3);
    AreaEval aeB = EvalFactory.createAreaEval("B1:B3", 1, 3);
    ValueEval[] aValues = aeA.getValues();
    ValueEval[] bValues = aeB.getValues();
    aValues[0] = new NumberEval(2);
    aValues[1] = new NumberEval(4);
    aValues[2] = new NumberEval(5);
    bValues[0] = new NumberEval(3);
    bValues[1] = new NumberEval(6);
View Full Code Here

  /**
   * For scalar products, the terms may be 1x1 area refs
   */
  public void testOneByOneArea() {
   
    AreaEval ae = EvalFactory.createAreaEval("A1:A1", 1, 1);
    ae.getValues()[0] = new NumberEval(7);
   
    Eval[] args = {
        ae,
        new NumberEval(2),
      };
View Full Code Here

  }

 
  public void testMismatchAreaDimensions() {
   
    AreaEval aeA = EvalFactory.createAreaEval("A1:A3", 1, 3);
    AreaEval aeB = EvalFactory.createAreaEval("B1:D1", 3, 1);
   
    Eval[] args;
    args = new Eval[] { aeA, aeB, };
    assertEquals(ErrorEval.VALUE_INVALID, invokeSumproduct(args));
   
View Full Code Here

    args = new Eval[] { aeA, new NumberEval(5), };
    assertEquals(ErrorEval.VALUE_INVALID, invokeSumproduct(args));
  }
 
  public void testAreaWithErrorCell() {
    AreaEval aeA = EvalFactory.createAreaEval("A1:A2", 1, 2);
    AreaEval aeB = EvalFactory.createAreaEval("B1:B2", 1, 2);
    aeB.getValues()[1] = ErrorEval.REF_INVALID;
   
    Eval[] args = { aeA, aeB, };
    assertEquals(ErrorEval.REF_INVALID, invokeSumproduct(args));
  }
View Full Code Here

      new NumberEval(10)
      new NumberEval(10)
      new NumberEval(25)
    };
   
    AreaEval ae = createAreaEval("A1:A5", values);
   
    confirmInt(2, invokeMatch(new NumberEval(5), ae, MATCH_LARGEST_LTE));
    confirmInt(2, invokeMatch(new NumberEval(5), ae, MATCH_EXACT));
    confirmInt(4, invokeMatch(new NumberEval(10), ae, MATCH_LARGEST_LTE));
    confirmInt(3, invokeMatch(new NumberEval(10), ae, MATCH_EXACT));
View Full Code Here

      new NumberEval(10)
      new NumberEval(10)
      new NumberEval(4)
    };
   
    AreaEval ae = createAreaEval("A1:A5", values);
   
    confirmInt(2, invokeMatch(new NumberEval(10), ae, MATCH_SMALLEST_GTE));
    confirmInt(2, invokeMatch(new NumberEval(10), ae, MATCH_EXACT));
    confirmInt(4, invokeMatch(new NumberEval(9), ae, MATCH_SMALLEST_GTE));
    confirmInt(1, invokeMatch(new NumberEval(20), ae, MATCH_SMALLEST_GTE));
View Full Code Here

      new StringEval("Ed")
      new StringEval("Greg")
      new StringEval("Ian")
    };
   
    AreaEval ae = createAreaEval("A1:A5", values);
   
    // Note String comparisons are case insensitive
    confirmInt(3, invokeMatch(new StringEval("Ed"), ae, MATCH_LARGEST_LTE));
    confirmInt(3, invokeMatch(new StringEval("eD"), ae, MATCH_LARGEST_LTE));
    confirmInt(3, invokeMatch(new StringEval("Ed"), ae, MATCH_EXACT));
View Full Code Here

        BoolEval.FALSE, 
        BoolEval.TRUE, 
        BoolEval.TRUE, 
    };
   
    AreaEval ae = createAreaEval("A1:A4", values);
   
    // Note String comparisons are case insensitive
    confirmInt(2, invokeMatch(BoolEval.FALSE, ae, MATCH_LARGEST_LTE));
    confirmInt(1, invokeMatch(BoolEval.FALSE, ae, MATCH_EXACT));
    confirmInt(4, invokeMatch(BoolEval.TRUE, ae, MATCH_LARGEST_LTE));
View Full Code Here

        new NumberEval(25)
        BoolEval.TRUE, 
        new StringEval("Ed")
    };
   
    AreaEval ae = createAreaEval("A1:A13", values);
   
    assertEquals(ErrorEval.NA, invokeMatch(new StringEval("Aaron"), ae, MATCH_LARGEST_LTE));
   
    confirmInt(5, invokeMatch(BoolEval.FALSE, ae, MATCH_LARGEST_LTE));
    confirmInt(2, invokeMatch(BoolEval.FALSE, ae, MATCH_EXACT));
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.eval.AreaEval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.