Package core

Examples of core.Formulas$ColumnsComparator


    @Test
    public void testConstructorOfStandarizationOperator() {
        CellAddressFactory caf;
        Relation input;
        StandarizationOperator standOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(1);
        input = caf.getSpaceForNewRelation(1);//(a)
        standOper = new StandarizationOperator(caf, input);
        resultFormulas = standOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('B',1), "IF(ISNA($A1),0,1)");
        expectedResult.put(new Cell('C',1), "MATCH(ROW(),$B:$B,0)");
        expectedResult.put(new Cell('D',1), "INDEX(A:A,$C1)");
        expectedResult.put(new Cell('B',2), "IF(ISNA($A2),B1,B1+1)");
        expectedResult.put(new Cell('C',2), "MATCH(ROW(),$B:$B,0)");
        expectedResult.put(new Cell('D',2), "INDEX(A:A,$C2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = standOper.getResultRelation();
        assertEquals(new Column('D'), resRelation.getFirstCol());
        assertEquals(1, resRelation.getCardinality());

        caf = new CellAddressFactory(1);
        input = caf.getSpaceForNewRelation(2);//(a,b)
        standOper = new StandarizationOperator(caf, input);
        resultFormulas = standOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "IF(ISNA($A1),0,1)");
        expectedResult.put(new Cell('D',1), "MATCH(ROW(),$C:$C,0)");
        expectedResult.put(new Cell('E',1), "INDEX(A:A,$D1)");
        expectedResult.put(new Cell('F',1), "INDEX(B:B,$D1)");
        expectedResult.put(new Cell('C',2), "IF(ISNA($A2),C1,C1+1)");
        expectedResult.put(new Cell('D',2), "MATCH(ROW(),$C:$C,0)");
        expectedResult.put(new Cell('E',2), "INDEX(A:A,$D2)");
        expectedResult.put(new Cell('F',2), "INDEX(B:B,$D2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = standOper.getResultRelation();
        assertEquals(new Column('E'), resRelation.getFirstCol());
        assertEquals(2, resRelation.getCardinality());

        caf = new CellAddressFactory(2);//zaczynamy od B
        input = caf.getSpaceForNewRelation(3);//(b,c,d)
        standOper = new StandarizationOperator(caf, input);
        resultFormulas = standOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('E',1), "IF(ISNA($B1),0,1)");
        expectedResult.put(new Cell('F',1), "MATCH(ROW(),$E:$E,0)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$F1)");
        expectedResult.put(new Cell('H',1), "INDEX(C:C,$F1)");
        expectedResult.put(new Cell('I',1), "INDEX(D:D,$F1)");
View Full Code Here


//G2  =INDEX(B:B,$E2)
        CellAddressFactory caf;
        Relation inputRelation;
        SortingAscendingOperator sortAscOper;
        SortingDescendingOperator sortDescOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(1);
        inputRelation = caf.getSpaceForNewRelation(1);//(a)
        sortAscOper = new SortingAscendingOperator(caf, inputRelation, 1);
        resultFormulas = sortAscOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('B',1), "COUNTA($A:$A)-COUNTIF($A:$A,NA())");
        expectedResult.put(new Cell('C',1), "IF(ISNA($A1),$B$1+1,IF(ISERR($A1),1+$B$1-COUNTIF($A:$A,$A1),COUNTIF($A:$A,\"<\"&$A1)+COUNTIF($A$1:$A1,$A1)))");
        expectedResult.put(new Cell('D',1), "MATCH(ROW(),$C:$C,0)");
        expectedResult.put(new Cell('E',1), "INDEX(A:A,$D1)");
        expectedResult.put(new Cell('C',2), "IF(ISNA($A2),$B$1+1,IF(ISERR($A2),1+$B$1-COUNTIF($A:$A,$A2),COUNTIF($A:$A,\"<\"&$A2)+COUNTIF($A$1:$A2,$A2)))");
        expectedResult.put(new Cell('D',2), "MATCH(ROW(),$C:$C,0)");
        expectedResult.put(new Cell('E',2), "INDEX(A:A,$D2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = sortAscOper.getResultRelation();
        assertEquals(new Column('E'), resRelation.getFirstCol());
        assertEquals(1, resRelation.getCardinality());

        caf = new CellAddressFactory(1);
        inputRelation = caf.getSpaceForNewRelation(1);//(a)
        sortDescOper = new SortingDescendingOperator(caf, inputRelation, 1);
        resultFormulas = sortDescOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('B',1), "COUNTA($A:$A)-COUNTIF($A:$A,NA())");
        expectedResult.put(new Cell('C',1), "IF(ISNA($A1),$B$1+1,IF(ISERR($A1),1+$B$1-COUNTIF($A:$A,$A1),COUNTIF($A:$A,\">\"&$A1)+COUNTIF($A$1:$A1,$A1)))");
        expectedResult.put(new Cell('D',1), "MATCH(ROW(),$C:$C,0)");
        expectedResult.put(new Cell('E',1), "INDEX(A:A,$D1)");
        expectedResult.put(new Cell('C',2), "IF(ISNA($A2),$B$1+1,IF(ISERR($A2),1+$B$1-COUNTIF($A:$A,$A2),COUNTIF($A:$A,\">\"&$A2)+COUNTIF($A$1:$A2,$A2)))");
View Full Code Here

    public void testSortingOperatorTwoRowsOnFirst() {
        CellAddressFactory caf;
        Relation inputRelation;
        SortingAscendingOperator sortAscOper;
        SortingDescendingOperator sortDescOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(1);
        inputRelation = caf.getSpaceForNewRelation(2);//(a,b)
        sortAscOper = new SortingAscendingOperator(caf, inputRelation, 1);
        resultFormulas = sortAscOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "COUNTA($A:$A)-COUNTIF($A:$A,NA())");
        expectedResult.put(new Cell('D',1), "IF(ISNA($A1),$C$1+1,IF(ISERR($A1),1+$C$1-COUNTIF($A:$A,$A1),COUNTIF($A:$A,\"<\"&$A1)+COUNTIF($A$1:$A1,$A1)))");
        expectedResult.put(new Cell('E',1), "MATCH(ROW(),$D:$D,0)");
        expectedResult.put(new Cell('F',1), "INDEX(A:A,$E1)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$E1)");
        expectedResult.put(new Cell('D',2), "IF(ISNA($A2),$C$1+1,IF(ISERR($A2),1+$C$1-COUNTIF($A:$A,$A2),COUNTIF($A:$A,\"<\"&$A2)+COUNTIF($A$1:$A2,$A2)))");
        expectedResult.put(new Cell('E',2), "MATCH(ROW(),$D:$D,0)");
        expectedResult.put(new Cell('F',2), "INDEX(A:A,$E2)");
        expectedResult.put(new Cell('G',2), "INDEX(B:B,$E2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = sortAscOper.getResultRelation();
        assertEquals(new Column('F'), resRelation.getFirstCol());
        assertEquals(2, resRelation.getCardinality());

        caf = new CellAddressFactory(1);
        inputRelation = caf.getSpaceForNewRelation(2);//(a,b)
        sortDescOper = new SortingDescendingOperator(caf, inputRelation, 1);
        resultFormulas = sortDescOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "COUNTA($A:$A)-COUNTIF($A:$A,NA())");
        expectedResult.put(new Cell('D',1), "IF(ISNA($A1),$C$1+1,IF(ISERR($A1),1+$C$1-COUNTIF($A:$A,$A1),COUNTIF($A:$A,\">\"&$A1)+COUNTIF($A$1:$A1,$A1)))");
        expectedResult.put(new Cell('E',1), "MATCH(ROW(),$D:$D,0)");
        expectedResult.put(new Cell('F',1), "INDEX(A:A,$E1)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$E1)");
View Full Code Here

    public void testSortingOperatorTwoRowsOnSecond() {
        CellAddressFactory caf;
        Relation inputRelation;
        SortingAscendingOperator sortAscOper;
        SortingDescendingOperator sortDescOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(1);
        inputRelation = caf.getSpaceForNewRelation(2);//(a,b)
        sortAscOper = new SortingAscendingOperator(caf, inputRelation, 2);
        resultFormulas = sortAscOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "COUNTA($B:$B)-COUNTIF($B:$B,NA())");
        expectedResult.put(new Cell('D',1), "IF(ISNA($B1),$C$1+1,IF(ISERR($B1),1+$C$1-COUNTIF($B:$B,$B1),COUNTIF($B:$B,\"<\"&$B1)+COUNTIF($B$1:$B1,$B1)))");
        expectedResult.put(new Cell('E',1), "MATCH(ROW(),$D:$D,0)");
        expectedResult.put(new Cell('F',1), "INDEX(A:A,$E1)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$E1)");
        expectedResult.put(new Cell('D',2), "IF(ISNA($B2),$C$1+1,IF(ISERR($B2),1+$C$1-COUNTIF($B:$B,$B2),COUNTIF($B:$B,\"<\"&$B2)+COUNTIF($B$1:$B2,$B2)))");
        expectedResult.put(new Cell('E',2), "MATCH(ROW(),$D:$D,0)");
        expectedResult.put(new Cell('F',2), "INDEX(A:A,$E2)");
        expectedResult.put(new Cell('G',2), "INDEX(B:B,$E2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = sortAscOper.getResultRelation();
        assertEquals(new Column('F'), resRelation.getFirstCol());
        assertEquals(2, resRelation.getCardinality());

        caf = new CellAddressFactory(1);
        inputRelation = caf.getSpaceForNewRelation(2);//(a,b)
        sortDescOper = new SortingDescendingOperator(caf, inputRelation, 2);
        resultFormulas = sortDescOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "COUNTA($B:$B)-COUNTIF($B:$B,NA())");
        expectedResult.put(new Cell('D',1), "IF(ISNA($B1),$C$1+1,IF(ISERR($B1),1+$C$1-COUNTIF($B:$B,$B1),COUNTIF($B:$B,\">\"&$B1)+COUNTIF($B$1:$B1,$B1)))");
        expectedResult.put(new Cell('E',1), "MATCH(ROW(),$D:$D,0)");
        expectedResult.put(new Cell('F',1), "INDEX(A:A,$E1)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$E1)");
View Full Code Here

    public void testSortingOperatorTwoRowsMoved() {
        CellAddressFactory caf;
        Relation inputRelation;
        SortingAscendingOperator sortAscOper;
        SortingDescendingOperator sortDescOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(2);
        inputRelation = caf.getSpaceForNewRelation(2);//(b,c)
        sortAscOper = new SortingAscendingOperator(caf, inputRelation, 1);
        resultFormulas = sortAscOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('D',1), "COUNTA($B:$B)-COUNTIF($B:$B,NA())");
        expectedResult.put(new Cell('E',1), "IF(ISNA($B1),$D$1+1,IF(ISERR($B1),1+$D$1-COUNTIF($B:$B,$B1),COUNTIF($B:$B,\"<\"&$B1)+COUNTIF($B$1:$B1,$B1)))");
        expectedResult.put(new Cell('F',1), "MATCH(ROW(),$E:$E,0)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$F1)");
        expectedResult.put(new Cell('H',1), "INDEX(C:C,$F1)");
        expectedResult.put(new Cell('E',2), "IF(ISNA($B2),$D$1+1,IF(ISERR($B2),1+$D$1-COUNTIF($B:$B,$B2),COUNTIF($B:$B,\"<\"&$B2)+COUNTIF($B$1:$B2,$B2)))");
        expectedResult.put(new Cell('F',2), "MATCH(ROW(),$E:$E,0)");
        expectedResult.put(new Cell('G',2), "INDEX(B:B,$F2)");
        expectedResult.put(new Cell('H',2), "INDEX(C:C,$F2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = sortAscOper.getResultRelation();
        assertEquals(new Column('G'), resRelation.getFirstCol());
        assertEquals(2, resRelation.getCardinality());

        caf = new CellAddressFactory(2);
        inputRelation = caf.getSpaceForNewRelation(2);//(b,c)
        sortDescOper = new SortingDescendingOperator(caf, inputRelation, 1);
        resultFormulas = sortDescOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('D',1), "COUNTA($B:$B)-COUNTIF($B:$B,NA())");
        expectedResult.put(new Cell('E',1), "IF(ISNA($B1),$D$1+1,IF(ISERR($B1),1+$D$1-COUNTIF($B:$B,$B1),COUNTIF($B:$B,\">\"&$B1)+COUNTIF($B$1:$B1,$B1)))");
        expectedResult.put(new Cell('F',1), "MATCH(ROW(),$E:$E,0)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$F1)");
        expectedResult.put(new Cell('H',1), "INDEX(C:C,$F1)");
View Full Code Here

    public void testConstructorOfUnionOperator() {
        //TODO czemu liczymy tylko komórki w pierwszej kolumnie pierwszego wejścia, a co jak będa nulle, błedy?
        CellAddressFactory caf;
        Relation input1, input2;
        UnionOperator unionOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(1);
        input1 = caf.getSpaceForNewRelation(1);//(a)
        input2 = caf.getSpaceForNewRelation(1);//(b)
        unionOper = new UnionOperator(caf, input1, input2);
        resultFormulas = unionOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "COUNTA($A:$A)");
        expectedResult.put(new Cell('D',1), "IF(ROW()<=$C$1,A1,INDEX(B:B,ROW()-$C$1))");
        expectedResult.put(new Cell('D',2), "IF(ROW()<=$C$1,A2,INDEX(B:B,ROW()-$C$1))");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = unionOper.getResultRelation();
        assertEquals(new Column('D'), resRelation.getFirstCol());
        assertEquals(1, resRelation.getCardinality());

        caf = new CellAddressFactory(1);
        input1 = caf.getSpaceForNewRelation(2);//(a,b)
        input2 = caf.getSpaceForNewRelation(2);//(c,d)
        unionOper = new UnionOperator(caf, input1, input2);
        resultFormulas = unionOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('E',1), "COUNTA($A:$A)");
        expectedResult.put(new Cell('F',1), "IF(ROW()<=$E$1,A1,INDEX(C:C,ROW()-$E$1))");
        expectedResult.put(new Cell('G',1), "IF(ROW()<=$E$1,B1,INDEX(D:D,ROW()-$E$1))");
        expectedResult.put(new Cell('F',2), "IF(ROW()<=$E$1,A2,INDEX(C:C,ROW()-$E$1))");
        expectedResult.put(new Cell('G',2), "IF(ROW()<=$E$1,B2,INDEX(D:D,ROW()-$E$1))");
View Full Code Here

    @Test
    public void testConstructorOfDuplicateRemovalOperator() {
        CellAddressFactory caf;
        Relation input;
        DuplicateRemovalOperator dupRemOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(1);
        input = caf.getSpaceForNewRelation(1);//(a)
        dupRemOper = new DuplicateRemovalOperator(caf, input);
        resultFormulas = dupRemOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('B',1), "IF(ISNA(A1),0,1)");
        expectedResult.put(new Cell('C',1), "MATCH(ROW(),$B:$B,0)");
        expectedResult.put(new Cell('D',1), "INDEX(A:A,$C1)");
        expectedResult.put(new Cell('B',2), "IF(OR(ISNA($A2),COUNTIFS($A$1:$A2,$A2)>1),B1,1+B1)");
        expectedResult.put(new Cell('C',2), "MATCH(ROW(),$B:$B,0)");
        expectedResult.put(new Cell('D',2), "INDEX(A:A,$C2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = dupRemOper.getResultRelation();
        assertEquals(new Column('D'), resRelation.getFirstCol());
        assertEquals(1, resRelation.getCardinality());


        caf = new CellAddressFactory(1);
        input = caf.getSpaceForNewRelation(2);//(a,b)
        dupRemOper = new DuplicateRemovalOperator(caf, input);
        resultFormulas = dupRemOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "IF(ISNA(A1),0,1)");
        expectedResult.put(new Cell('D',1), "MATCH(ROW(),$C:$C,0)");
        expectedResult.put(new Cell('E',1), "INDEX(A:A,$D1)");
        expectedResult.put(new Cell('F',1), "INDEX(B:B,$D1)");
        expectedResult.put(new Cell('C',2), "IF(OR(ISNA($A2),COUNTIFS($A$1:$A2,$A2,$B$1:$B2,$B2)>1),C1,1+C1)");
        expectedResult.put(new Cell('D',2), "MATCH(ROW(),$C:$C,0)");
        expectedResult.put(new Cell('E',2), "INDEX(A:A,$D2)");
        expectedResult.put(new Cell('F',2), "INDEX(B:B,$D2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = dupRemOper.getResultRelation();
        assertEquals(new Column('E'), resRelation.getFirstCol());
        assertEquals(2, resRelation.getCardinality());

        caf = new CellAddressFactory(2);//zaczynamy od B i wypełniamy wiersze 3,4,5
        input = caf.getSpaceForNewRelation(3);//(b,c,d)
        dupRemOper = new DuplicateRemovalOperator(caf, input);
        resultFormulas = dupRemOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('E',1), "IF(ISNA(B1),0,1)");
        expectedResult.put(new Cell('F',1), "MATCH(ROW(),$E:$E,0)");
        expectedResult.put(new Cell('G',1), "INDEX(B:B,$F1)");
        expectedResult.put(new Cell('H',1), "INDEX(C:C,$F1)");
        expectedResult.put(new Cell('I',1), "INDEX(D:D,$F1)");
View Full Code Here

//H1  =IF(ISNA($G1),NA(),B1)
        CellAddressFactory caf;
        Relation in1;
        Relation in2;
        DifferenceBagOperator diffOper;
        Formulas expectedResult;
        Formulas resultFormulas;
        Relation resRelation;

        caf = new CellAddressFactory(1);
        in1 = caf.getSpaceForNewRelation(1);//(a)
        in2 = caf.getSpaceForNewRelation(1);//(b)
        diffOper = new DifferenceBagOperator(caf, in1, in2);
        resultFormulas = diffOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('C',1), "IF(COUNTIFS($B:$B,$A1)<COUNTIFS($A$1:$A1,$A1),A1,NA())");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = diffOper.getResultRelation();
        assertEquals(new Column('C'), resRelation.getFirstCol());
        assertEquals(1, resRelation.getCardinality());

        caf = new CellAddressFactory(1);
        in1 = caf.getSpaceForNewRelation(2);//(a,b)
        in2 = caf.getSpaceForNewRelation(2);//(c,d)
        diffOper = new DifferenceBagOperator(caf, in1, in2);
        resultFormulas = diffOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('E',1), "IF(COUNTIFS($C:$C,$A1,$D:$D,$B1)<COUNTIFS($A$1:$A1,$A1,$B$1:$B1,$B1),A1,NA())");
        expectedResult.put(new Cell('F',1), "IF(ISNA($E1),NA(),B1)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = diffOper.getResultRelation();
        assertEquals(new Column('E'), resRelation.getFirstCol());
        assertEquals(2, resRelation.getCardinality());

        caf = new CellAddressFactory(1);
        in1 = caf.getSpaceForNewRelation(3);//(a,b,c)
        in2 = caf.getSpaceForNewRelation(3);//(d,e,f)
        diffOper = new DifferenceBagOperator(caf, in1, in2);
        resultFormulas = diffOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('G',1), "IF(COUNTIFS($D:$D,$A1,$E:$E,$B1,$F:$F,$C1)<COUNTIFS($A$1:$A1,$A1,$B$1:$B1,$B1,$C$1:$C1,$C1),A1,NA())");
        expectedResult.put(new Cell('H',1), "IF(ISNA($G1),NA(),B1)");
        expectedResult.put(new Cell('I',1), "IF(ISNA($G1),NA(),C1)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
        resRelation = diffOper.getResultRelation();
        assertEquals(new Column('G'), resRelation.getFirstCol());
        assertEquals(3, resRelation.getCardinality());

        caf = new CellAddressFactory(2);//kolumny A jest poza naszym zakresem
        caf.getSpaceForNewRelation(1);//i jeszcze mamy na początku jedną kolumne z innymi danymi
        in1 = caf.getSpaceForNewRelation(2);//(c,d)
        caf.getSpaceForNewRelation(1);//oraz dane pomiędzy wejściami
        in2 = caf.getSpaceForNewRelation(2);//(f,g)
        caf.getSpaceForNewRelation(1);//i dane po wejściach
        diffOper = new DifferenceBagOperator(caf, in1, in2);
        resultFormulas = diffOper.getFormulas();
        expectedResult = new Formulas();
        expectedResult.put(new Cell('I',1), "IF(COUNTIFS($F:$F,$C1,$G:$G,$D1)<COUNTIFS($C$1:$C1,$C1,$D$1:$D1,$D1),C1,NA())");
        expectedResult.put(new Cell('J',1), "IF(ISNA($I1),NA(),D1)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
View Full Code Here

            copy.add(new Relation(r));
        return copy;
    }

    public Result1(Formulas formulas, ArrayList<Relation> dummyRelations, ArrayList<Relation> resultRelations) {
        this.formulas = new Formulas(formulas);
        formulas.sortColumns();
        this.dummyRelations = copyArrayListOfRelations(dummyRelations);
        this.resultRelations = copyArrayListOfRelations(resultRelations);
    }
View Full Code Here

    private Relation dummyRelation;
    private Relation resultRelation;
    private ColumnLabels labels;

    public Result() {
        formulas = new Formulas();
        labels = new ColumnLabels();
        dummyRelation = Utils.getCaf().getEmptyRelation();
        resultRelation = Utils.getCaf().getEmptyRelation();
    }
View Full Code Here

TOP

Related Classes of core.Formulas$ColumnsComparator

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.