Package com.jacobpatterson.csci446.program1.core

Examples of com.jacobpatterson.csci446.program1.core.Cell


        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)");
        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);
View Full Code Here


        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)");
        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);
View Full Code Here

        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)");
        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);
View Full Code Here

        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))");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
View Full Code Here

        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)");
        expectedResult.put(new Cell('E',2), "IF(OR(ISNA($B2),COUNTIFS($B$1:$B2,$B2,$C$1:$C2,$C2,$D$1:$D2,$D2)>1),E1,1+E1)");
        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)");
        expectedResult.put(new Cell('I',2), "INDEX(D:D,$F2)");
//        System.out.println("expected:");
//        System.out.println(expectedResult.toString(caf));
//        System.out.println("real");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
View Full Code Here

        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");
//        System.out.println(resultFormulas.toString(caf));
        assertEquals(expectedResult, resultFormulas);
View Full Code Here

        dummyRelation = caf.getSpaceForNewRelation(2);
        labelDummy(dummyRelation, "Standarization of "+inputRelation.toString(caf));
        resultRelation = caf.getSpaceForNewRelation(inputRelation.getCardinality());
        labelResult(resultRelation, "Standarization of "+inputRelation.toString(caf));

        Cell a1 = caf.getLeftTopCellInRelation(inputRelation);
        Cell c1 = caf.getLeftTopCellInRelation(dummyRelation);
        Cell d1 = c1.nextInRow();
        Column c = dummyRelation.getFirstCol();
        formulas.put(c1, fillFR_IF(a1));
        formulas.put(d1, fillMatch(c));

        Cell ef1 = caf.getLeftTopCellInRelation(resultRelation);
        for (Column ab : inputRelation) {
            formulas.put(ef1, fillIndex(ab, d1));
            ef1 = ef1.nextInRow();
        }

        Cell a2 = a1.nextInColumn();
        Cell c2 = c1.nextInColumn();
        Cell d2 = d1.nextInColumn();
        String strC1 = c1.toString(caf);
        formulas.put(c2, String.format(SR_IF, a2.toString(caf), strC1, strC1));
        formulas.put(d2, fillMatch(c));

        Cell ef2 = d1.nextInRow().nextInColumn();
        for (Column ab : inputRelation) {
            formulas.put(ef2, fillSR_IF(ab, d2));
            ef2 = ef2.nextInRow();
        }
    }
View Full Code Here

        //dummies (nierozciagalne)
        Column a = inputRelation1.getFirstCol();
        Column c = inputRelation2.getFirstCol();
        Column e = dummyRelation.getFirstCol();
        Column f = e.getNext();
        Cell e1 = e.getCell(1);
        Cell f1 = e1.nextInRow();
        formulas.put(e1, fillCount(c));
        formulas.put(f1, fillCount(a));

        for (int row = 1; row <= 2; row++) {
            Cell g1 = resultRelation.getFirstCol().getCell(row);
            Cell ghij1 = g1;
            for (Column ab : inputRelation1) {
                formulas.put(ghij1, fillIndex(ab, e, f));
                ghij1 = ghij1.nextInRow();
            }
            for (Column cd : inputRelation2) {
                formulas.put(ghij1, fillIf(g1, cd, e));
                ghij1 = ghij1.nextInRow();
            }
        }
    }
View Full Code Here

        resultRelation = caf.getSpaceForNewRelation(inRelation1.getCardinality());
        labelResult(resultRelation, "Union of "+inRelation1.toString(caf)+" and "+inRelation2.toString(caf));
        Column b = inRelation2.getFirstCol();
        formulas.put(g.getCell(1), fillCount(b));

        Cell hij1 = caf.getLeftTopCellInRelation(resultRelation);
        Cell def1 = caf.getLeftTopCellInRelation(inRelation2);
        for (Column abc : inRelation1) {
            formulas.put(hij1, fillIf(g, def1, abc));
            def1 = def1.nextInRow();
            hij1 = hij1.nextInRow();
        }

        Cell hij2 = caf.getLeftTopCellInRelation(resultRelation).nextInColumn();
        Cell def2 = caf.getLeftTopCellInRelation(inRelation2).nextInColumn();
        for (Column abc : inRelation1) {
            formulas.put(hij2, fillIf(g, def2, abc));
            def2 = def2.nextInRow();
            hij2 = hij2.nextInRow();
        }
    }
View Full Code Here

        labelResult(resultRelation, "Sorting of "+inputRelation.toString(caf));

        Column a = inputRelation.getCol(sortingColIndexInInput);
        Column c = dummyRelation.getFirstCol();
        Column d = c.getNext();
        Cell a1 = a.getCell(1);
        Cell c1 = caf.getLeftTopCellInRelation(dummyRelation);
        Cell d1 = c1.nextInRow();
        Cell e1 = d1.nextInRow();
        Cell fg1 = e1.nextInRow();

        formulas.put(c1, fillCount(a));
        formulas.put(d1, fillIf(a1, c, a, getSortingOper()));
        formulas.put(e1, fillMatch(d));
        for (Column ab : inputRelation) {
            formulas.put(fg1, fillIndex(ab, e1));
            fg1 = fg1.nextInRow();
        }

        Cell a2 = a1.nextInColumn();
        Cell d2 = d1.nextInColumn();
        Cell e2 = e1.nextInColumn();
        Cell fg2 = e2.nextInRow();

        formulas.put(d2, fillIf(a2, c, a, getSortingOper()));
        formulas.put(e2, fillMatch(d));
        for (Column ab : inputRelation) {
            formulas.put(fg2, fillIndex(ab, e2));
            fg2 = fg2.nextInRow();
        }
    }
View Full Code Here

TOP

Related Classes of com.jacobpatterson.csci446.program1.core.Cell

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.