Examples of CellSet


Examples of org.olap4j.CellSet

     */
    public <T> T runQuery(String queryString, Util.Functor1<T, CellSet> f) {
        long start = System.currentTimeMillis();
        OlapConnection connection = null;
        OlapStatement statement = null;
        CellSet cellSet = null;
        try {
            connection = getOlapConnection();
            statement = connection.createStatement();
            debug("CmdRunner.runQuery: AFTER createStatement");
            start = System.currentTimeMillis();
View Full Code Here

Examples of org.olap4j.CellSet

        for (String castedType : castedTypes) {
            String mdx = "with member measures.type as '"
            + castedType + "' "
            + "select measures.type on 0 from sales";
            CellSet olap4jXmlaCellset = context.executeOlap4jXmlaQuery(mdx);
            CellSet olap4jCellset = context.executeOlap4jQuery(mdx);
            Result nativeMondrianResult = context.executeQuery(mdx);
            assertEquals(
                "Checking olap4jXmla datatype against native Mondrian. \n"
                + "Unexpected datatype when running mdx " + mdx + "\n",
                nativeMondrianResult.getCell(new int[]{0})
                    .getValue().getClass(),
                olap4jXmlaCellset.getCell(0).getValue().getClass());
            assertEquals(
                "Checking olap4jXmla datatype against native Mondrian. \n"
                + "Unexpected datatype when running mdx " + mdx + "\n",
                olap4jXmlaCellset.getCell(0).getValue().getClass(),
                olap4jCellset.getCell(0).getValue().getClass());
        }

        RolapCube cube =
            (RolapCube)context.executeQuery("select from sales")
                .getQuery().getCube();
        Dialect dialect = cube.getStar().getSqlQueryDialect();

        if (!dialect.getDatabaseProduct()
            .equals(Dialect.DatabaseProduct.MYSQL)
            && !dialect.getDatabaseProduct()
                .equals(Dialect.DatabaseProduct.ORACLE))
        {
            return;
        }

        // map of sql expressions to the corresponding (optional) datatype
        // attribute (RolapBaseCubeMeasure.Datatype)
        Map<String, String> expressionTypeMap = new HashMap<String, String>();
        expressionTypeMap.put("'StringValue'", "String");
        expressionTypeMap.put("cast(1.0001 as decimal)", null);
        expressionTypeMap.put("cast(1.0001 as decimal)", "Numeric");
        expressionTypeMap.put("cast(10.101 as decimal(10,8))", null);
        expressionTypeMap.put("cast(10.101 as decimal(10,8))", "Numeric");


        for (String expression : expressionTypeMap.keySet()) {
            String query = "Select measures.typeMeasure on 0 from Sales";
            context = getContextWithMeasureExpression(
                expression, expressionTypeMap.get(expression));
            CellSet olap4jXmlaCellset = context.executeOlap4jXmlaQuery(query);
            CellSet olap4jCellset = context.executeOlap4jQuery(query);
            Result nativeMondrianResult = context.executeQuery(query);

            assertEquals(
                "Checking olap4jXmla datatype against native Mondrian. \n"
                + "Unexpected datatype for measure expression " + expression
                + " with datatype attribute "
                + expressionTypeMap.get(expression) + "\n",
                nativeMondrianResult.getCell(new int[]{0})
                    .getValue().getClass(),
                olap4jXmlaCellset.getCell(0).getValue().getClass());
            assertEquals(
                "Checking olap4jXmla datatype against olap4j in process. \n"
                + "Unexpected datatype for expression " + expression
                + " with datatype attribute "
                + expressionTypeMap.get(expression) + "\n",
                olap4jXmlaCellset.getCell(0).getValue().getClass(),
                olap4jCellset.getCell(0).getValue().getClass());
        }
    }
View Full Code Here

Examples of org.olap4j.CellSet

            + "from [Sales]\n"
            + "where [Time].[1997].[Q3].[9]";

        final OlapStatement statement1 =
            getTestContext().getOlap4jConnection().createStatement();
        CellSet cellSet = statement1.executeOlapQuery(queryString);
        StringWriter stringWriter = new StringWriter();
        new RectangularCellSetFormatter(true).format(
            cellSet,
            new PrintWriter(stringWriter));
        statement1.close();
View Full Code Here

Examples of org.stathissideris.ascii2image.text.CellSet

   
    if(DEBUG){
      System.out.println("******* Distinct shapes found using AbstractionGrid *******");
      Iterator<CellSet> dit = boundarySetsStep1.iterator();
      while (dit.hasNext()) {
        CellSet set = dit.next();
        set.printAsGrid();
      }
      System.out.println("******* Same set of shapes after processing them by filling *******");
    }
   
   
    //Find all the boundaries by using the special version of the filling method
    //(fills in a different buffer than the buffer it reads from)
    ArrayList<CellSet> boundarySetsStep2 = new ArrayList<CellSet>();
    for(CellSet set : boundarySetsStep1) {     
      //the fill buffer keeps track of which cells have been
      //filled already
      TextGrid fillBuffer = new TextGrid(width * 3, height * 3);
     
      for(int yi = 0; yi < height * 3; yi++){
        for(int xi = 0; xi < width * 3; xi++){
          if(fillBuffer.isBlank(xi, yi)){
           
            TextGrid copyGrid = new AbstractionGrid(workGrid, set).getCopyOfInternalBuffer();

            CellSet boundaries =
              copyGrid
              .findBoundariesExpandingFrom(copyGrid.new Cell(xi, yi));
            if(boundaries.size() == 0) continue; //i'm not sure why these occur
            boundarySetsStep2.add(boundaries.makeScaledOneThirdEquivalent());
         
            copyGrid = new AbstractionGrid(workGrid, set).getCopyOfInternalBuffer();
            CellSet filled =
              copyGrid
              .fillContinuousArea(copyGrid.new Cell(xi, yi), '*');
            fillBuffer.fillCellsWith(filled, '*');
            fillBuffer.fillCellsWith(boundaries, '-');
           
            if(DEBUG){
              //System.out.println("Fill buffer:");
              //fillBuffer.printDebug();
              boundaries.makeScaledOneThirdEquivalent().printAsGrid();
              System.out.println("-----------------------------------");
            }
           
          }
        }
      }
    }

    if (DEBUG)
      System.out.println("******* Removed duplicates *******");

    boundarySetsStep2 = CellSet.removeDuplicateSets(boundarySetsStep2);

    if(DEBUG){
      Iterator<CellSet> dit = boundarySetsStep2.iterator();
      while (dit.hasNext()) {
        CellSet set = dit.next();
        set.printAsGrid();
      }
    }

    int originalSize = boundarySetsStep2.size();
    boundarySetsStep2 = CellSet.removeDuplicateSets(boundarySetsStep2);
    if(DEBUG) {
      System.out.println(
        "******* Removed duplicates: there were "
        +originalSize
        +" shapes and now there are "
        +boundarySetsStep2.size());
    }
   

    //split boundaries to open, closed and mixed
   
    if (DEBUG)
      System.out.println("******* First evaluation of openess *******");
   
    ArrayList<CellSet> open = new ArrayList<CellSet>();
    ArrayList<CellSet> closed = new ArrayList<CellSet>();
    ArrayList<CellSet> mixed = new ArrayList<CellSet>();
   
    Iterator<CellSet> sets = boundarySetsStep2.iterator();
    while(sets.hasNext()){
      CellSet set = (CellSet) sets.next();
      int type = set.getType(workGrid);
      if(type == CellSet.TYPE_CLOSED) closed.add(set);
      else if(type == CellSet.TYPE_OPEN) open.add(set);
      else if(type == CellSet.TYPE_MIXED) mixed.add(set);
      if(DEBUG){
        if(type == CellSet.TYPE_CLOSED) System.out.println("Closed boundaries:");
        else if(type == CellSet.TYPE_OPEN) System.out.println("Open boundaries:");
        else if(type == CellSet.TYPE_MIXED) System.out.println("Mixed boundaries:");
        set.printAsGrid();
      }
    }
   
    boolean hadToEliminateMixed = false;
   
    if(mixed.size() > 0 && closed.size() > 0) {
              // mixed shapes can be eliminated by
              // subtracting all the closed shapes from them
      if (DEBUG)
        System.out.println("******* Eliminating mixed shapes (basic algorithm) *******");
   
      hadToEliminateMixed = true;
     
      //subtract from each of the mixed sets all the closed sets
      sets = mixed.iterator();
      while(sets.hasNext()){
        CellSet set = (CellSet) sets.next();
        Iterator<CellSet> closedSets = closed.iterator();
        while(closedSets.hasNext()){
          CellSet closedSet = closedSets.next();
          set.subtractSet(closedSet);
        }
        // this is necessary because some mixed sets produce
        // several distinct open sets after you subtract the
        // closed sets from them
        if(set.getType(workGrid) == CellSet.TYPE_OPEN) {
          boundarySetsStep2.remove(set);
          boundarySetsStep2.addAll(set.breakIntoDistinctBoundaries(workGrid));
        }
      }

    } else if(mixed.size() > 0 && closed.size() == 0) {
              // no closed shape exists, will have to
              // handle mixed shape on its own
      // an example of this case is the following:
      // +-----+
      // |  A  |C                 B
      // +  ---+-------------------
      // |     |
      // +-----+

      hadToEliminateMixed = true;

      if (DEBUG)
        System.out.println("******* Eliminating mixed shapes (advanced algorithm for truly mixed shapes) *******");
       
      sets = mixed.iterator();
      while(sets.hasNext()){
        CellSet set = (CellSet) sets.next();
        boundarySetsStep2.remove(set);
        boundarySetsStep2.addAll(set.breakTrulyMixedBoundaries(workGrid));
      }

    } else {
      if (DEBUG)
        System.out.println("No mixed shapes found. Skipped mixed shape elimination step");
    }
   
   
    if(hadToEliminateMixed){
      if (DEBUG)
        System.out.println("******* Second evaluation of openess *******");
   
      //split boundaries again to open, closed and mixed
      open = new ArrayList<CellSet>();
      closed = new ArrayList<CellSet>();
      mixed = new ArrayList<CellSet>();
   
      sets = boundarySetsStep2.iterator();
      while(sets.hasNext()){
        CellSet set = (CellSet) sets.next();
        int type = set.getType(workGrid);
        if(type == CellSet.TYPE_CLOSED) closed.add(set);
        else if(type == CellSet.TYPE_OPEN) open.add(set);
        else if(type == CellSet.TYPE_MIXED) mixed.add(set);
        if(DEBUG){
          if(type == CellSet.TYPE_CLOSED) System.out.println("Closed boundaries:");
          else if(type == CellSet.TYPE_OPEN) System.out.println("Open boundaries:");
          else if(type == CellSet.TYPE_MIXED) System.out.println("Mixed boundaries:");
          set.printAsGrid();
        }
      }
    }

    boolean removedAnyObsolete = removeObsoleteShapes(workGrid, closed);
   
    boolean allCornersRound = false;
    if(options.processingOptions.areAllCornersRound()) allCornersRound = true;
   
    //make shapes from the boundary sets
    //make closed shapes
    if(DEBUG_MAKE_SHAPES) {
      System.out.println("***** MAKING SHAPES FROM BOUNDARY SETS *****");
      System.out.println("***** CLOSED: *****");
    }
   
    ArrayList<DiagramComponent> closedShapes = new ArrayList<DiagramComponent>();
    sets = closed.iterator();
    while(sets.hasNext()){
      CellSet set = (CellSet) sets.next();
     
      if(DEBUG_MAKE_SHAPES) {
        set.printAsGrid();
      }
     
      DiagramComponent shape = DiagramComponent.createClosedFromBoundaryCells(workGrid, set, cellWidth, cellHeight, allCornersRound);
      if(shape != null){
        if(shape instanceof DiagramShape){
          addToShapes((DiagramShape) shape);
          closedShapes.add(shape);
        } else if(shape instanceof CompositeDiagramShape)
          addToCompositeShapes((CompositeDiagramShape) shape);
      }
    }

    if(options.processingOptions.performSeparationOfCommonEdges())
      separateCommonEdges(closedShapes);

    //make open shapes
    sets = open.iterator();
    while(sets.hasNext()){
      CellSet set = (CellSet) sets.next();
      if(set.size() == 1){ //single cell "shape"
        TextGrid.Cell cell = (TextGrid.Cell) set.getFirst();
        if(!grid.cellContainsDashedLineChar(cell)) {
          DiagramShape shape = DiagramShape.createSmallLine(workGrid, cell, cellWidth, cellHeight);
          if(shape != null) {
            addToShapes(shape);
            shape.connectEndsToAnchors(workGrid, this);
          }
        }
      } else { //normal shape
                if (DEBUG)
                    System.out.println(set.getCellsAsString());       
       
        DiagramComponent shape =
          CompositeDiagramShape
            .createOpenFromBoundaryCells(
                workGrid, set, cellWidth, cellHeight, allCornersRound);

        if(shape != null){
          if(shape instanceof CompositeDiagramShape){
            addToCompositeShapes((CompositeDiagramShape) shape);
            ((CompositeDiagramShape) shape).connectEndsToAnchors(workGrid, this);
          } else if(shape instanceof DiagramShape) {
            addToShapes((DiagramShape) shape);
            ((DiagramShape) shape).connectEndsToAnchors(workGrid, this);
            ((DiagramShape) shape).moveEndsToCellEdges(grid, this);
          }
        }
         
      }
    }

    //assign color codes to shapes
    //TODO: text on line should not change its color
   
    Iterator<CellColorPair> cellColorPairs = grid.findColorCodes().iterator();
    while(cellColorPairs.hasNext()){
      TextGrid.CellColorPair pair =
        (TextGrid.CellColorPair) cellColorPairs.next();
     
      ShapePoint point =
        new ShapePoint(getCellMidX(pair.cell), getCellMidY(pair.cell));
      DiagramShape containingShape = findSmallestShapeContaining(point);
     
      if(containingShape != null)
        containingShape.setFillColor(pair.color);
    }

    //assign markup to shapes
    Iterator<CellTagPair> cellTagPairs = grid.findMarkupTags().iterator();
    while(cellTagPairs.hasNext()){
      TextGrid.CellTagPair pair =
        (TextGrid.CellTagPair) cellTagPairs.next();
     
      ShapePoint point =
        new ShapePoint(getCellMidX(pair.cell), getCellMidY(pair.cell));
     
      DiagramShape containingShape = findSmallestShapeContaining(point);
     
      //this tag is not within a shape, skip
      if(containingShape == null) continue;
     
      //TODO: the code below could be a lot more concise
      if(pair.tag.equals("d")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("d");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_DOCUMENT);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("s")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("s");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_STORAGE);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("io")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("io");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_IO);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("c")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("c");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_DECISION);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("mo")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("mo");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_MANUAL_OPERATION);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("tr")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("tr");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_TRAPEZOID);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("o")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("o");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_ELLIPSE);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else {
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes(pair.tag);
        containingShape.setType(DiagramShape.TYPE_CUSTOM);
        containingShape.setDefinition(def);           
      }
    }
   
    //make arrowheads
    Iterator<Cell> arrowheadCells = workGrid.findArrowheads().iterator();
    while(arrowheadCells.hasNext()){
      TextGrid.Cell cell = arrowheadCells.next();
      DiagramShape arrowhead = DiagramShape.createArrowhead(workGrid, cell, cellWidth, cellHeight);
      if(arrowhead != null) addToShapes(arrowhead);
      else System.err.println("Could not create arrowhead shape. Unexpected error.");
    }
   
    //make point markers
    Iterator<TextGrid.Cell> markersIt = grid.getPointMarkersOnLine().iterator();
    while (markersIt.hasNext()) {
      TextGrid.Cell cell = markersIt.next();

      DiagramShape mark = new DiagramShape();
      mark.addToPoints(new ShapePoint(
          getCellMidX(cell),
          getCellMidY(cell)
        ));
      mark.setType(DiagramShape.TYPE_POINT_MARKER);
      mark.setFillColor(Color.white);
      shapes.add(mark);
    }

    removeDuplicateShapes();
   
    if(DEBUG) System.out.println("Shape count: "+shapes.size());
    if(DEBUG) System.out.println("Composite shape count: "+compositeShapes.size());
   
    //copy again
    workGrid = new TextGrid(grid);
    workGrid.removeNonText();
   
   
    // ****** handle text *******
    //break up text into groups
    TextGrid textGroupGrid = new TextGrid(workGrid);
    CellSet gaps = textGroupGrid.getAllBlanksBetweenCharacters();
    //kludge
    textGroupGrid.fillCellsWith(gaps, '|');
    CellSet nonBlank = textGroupGrid.getAllNonBlank();
    ArrayList<CellSet> textGroups = nonBlank.breakIntoDistinctBoundaries();
    if(DEBUG) System.out.println(textGroups.size()+" text groups found");
   
    Font font = FontMeasurer.instance().getFontFor(cellHeight);
   
    Iterator<CellSet> textGroupIt = textGroups.iterator();
    while(textGroupIt.hasNext()){
      CellSet textGroupCellSet = (CellSet) textGroupIt.next();
     
      TextGrid isolationGrid = new TextGrid(width, height);
      workGrid.copyCellsTo(textGroupCellSet, isolationGrid);
      
      ArrayList<CellStringPair> strings = isolationGrid.findStrings();
View Full Code Here

Examples of org.stathissideris.ascii2image.text.CellSet

    if(DEBUG_VERBOSE) {
      System.out.println("******* Sets before *******");
      it = sets.iterator();
      while(it.hasNext()){
        CellSet set = (CellSet) it.next();
        set.printAsGrid();
      }
    }

    //make filled versions of all the boundary sets
    it = sets.iterator();
    while(it.hasNext()){
      CellSet set = (CellSet) it.next();
      set = set.getFilledEquivalent(grid);
      if(set == null){
        return false;
      } else filledSets.add(set);
    }
   
    ArrayList<Integer> toBeRemovedIndices = new ArrayList<Integer>();
    it = filledSets.iterator();
    while(it.hasNext()){
      CellSet set = (CellSet) it.next();
     
      if(DEBUG_VERBOSE){
        System.out.println("*** Deciding if the following should be removed:");
        set.printAsGrid();
      }
     
      //find the other sets that have common cells with set
      ArrayList<CellSet> common = new ArrayList<CellSet>();
      common.add(set);
      Iterator it2 = filledSets.iterator();
      while(it2.hasNext()){
        CellSet set2 = (CellSet) it2.next();
        if(set != set2 && set.hasCommonCells(set2)){
          common.add(set2);
        }
      }
      //it only makes sense for more than 2 sets
      if(common.size() == 2) continue;
     
      //find largest set
      CellSet largest = set;
      it2 = common.iterator();
      while(it2.hasNext()){
        CellSet set2 = (CellSet) it2.next();
        if(set2.size() > largest.size()){
          largest = set2;
        }
      }
     
      if(DEBUG_VERBOSE){
        System.out.println("Largest:");
        largest.printAsGrid();
      }

      //see if largest is sum of others
      common.remove(largest);

      //make the sum set of the small sets on a grid
      TextGrid gridOfSmalls = new TextGrid(largest.getMaxX() + 2, largest.getMaxY() + 2);
      CellSet sumOfSmall = new CellSet();
      it2 = common.iterator();
      while(it2.hasNext()){
        CellSet set2 = (CellSet) it2.next();
        if(DEBUG_VERBOSE){
          System.out.println("One of smalls:");
          set2.printAsGrid();
        }
        gridOfSmalls.fillCellsWith(set2, '*');
      }
      if(DEBUG_VERBOSE){
        System.out.println("Sum of smalls:");
        gridOfSmalls.printDebug();
      }
      TextGrid gridLargest = new TextGrid(largest.getMaxX() + 2, largest.getMaxY() + 2);
      gridLargest.fillCellsWith(largest, '*');

      int index = filledSets.indexOf(largest);
      if(gridLargest.equals(gridOfSmalls)
          && !toBeRemovedIndices.contains(new Integer(index))) {
        toBeRemovedIndices.add(new Integer(index));
        if (DEBUG){
          System.out.println("Decided to remove set:");
          largest.printAsGrid();
        }
      } /*else if (DEBUG){
        System.out.println("This set WILL NOT be removed:");
        largest.printAsGrid();
      }*/
      //if(gridLargest.equals(gridOfSmalls)) toBeRemovedIndices.add(new Integer(index));
    }
   
    ArrayList<CellSet> setsToBeRemoved = new ArrayList<CellSet>();
    it = toBeRemovedIndices.iterator();
    while(it.hasNext()){
      int i = ((Integer) it.next()).intValue();
      setsToBeRemoved.add(sets.get(i));
    }
 
    it = setsToBeRemoved.iterator();
    while(it.hasNext()){
      CellSet set = (CellSet) it.next();
      removedAny = true;
      sets.remove(set);
    }
 
    if(DEBUG_VERBOSE) {
      System.out.println("******* Sets after *******");
      it = sets.iterator();
      while(it.hasNext()){
        CellSet set = (CellSet) it.next();
        set.printAsGrid();
      }
    }
   
    return removedAny;
  }
View Full Code Here

Examples of org.stathissideris.ascii2image.text.CellSet

   
    TextGrid.Cell start = (TextGrid.Cell) cells.getFirst();
    if(workGrid.isCorner(start)) shape.addToPoints(makePointForCell(start, workGrid, cellWidth, cellHeight, allRound));
    TextGrid.Cell previous = start;
    TextGrid.Cell cell = null;
    CellSet nextCells = workGrid.followCell(previous);
    if(nextCells.size() == 0) return null;
    cell = (TextGrid.Cell) nextCells.getFirst();
    if(workGrid.isCorner(cell)) shape.addToPoints(makePointForCell(cell, workGrid, cellWidth, cellHeight, allRound));
   
    while(!cell.equals(start)){
      nextCells = workGrid.followCell(cell, previous);
      if(nextCells.size() == 1) {
        previous = cell;
        cell = (TextGrid.Cell) nextCells.getFirst();
        if(!cell.equals(start) && workGrid.isCorner(cell))
          shape.addToPoints(makePointForCell(cell, workGrid, cellWidth, cellHeight, allRound));
      } else if(nextCells.size() > 1) {
        return null;
      }
    }
   
    return shape;
View Full Code Here

Examples of org.stathissideris.ascii2image.text.CellSet

  @Test public void testFillContinuousAreaSquareOutside() throws FileNotFoundException, IOException {
    TextGrid squareGrid;
    squareGrid = new TextGrid();
    squareGrid.loadFrom("tests/text/simple_square01.txt");

    CellSet filledArea = squareGrid.fillContinuousArea(0, 0, '*');
    int size = filledArea.size();
    assertEquals(64, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(squareGrid, expectedFilledArea, 0,0, 11,2);
    addSquareToCellSet(squareGrid, expectedFilledArea, 0,7, 11,2);
    addSquareToCellSet(squareGrid, expectedFilledArea, 0,2, 2,5);
    addSquareToCellSet(squareGrid, expectedFilledArea, 9,2, 2,5);
    assertEquals(expectedFilledArea, filledArea);
View Full Code Here

Examples of org.stathissideris.ascii2image.text.CellSet

  @Test public void testFillContinuousAreaSquareInside() throws FileNotFoundException, IOException {
    TextGrid squareGrid;
    squareGrid = new TextGrid();
    squareGrid.loadFrom("tests/text/simple_square01.txt");
   
    CellSet filledArea = squareGrid.fillContinuousArea(3, 3, '*');
    int size = filledArea.size();
    assertEquals(15, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(squareGrid, expectedFilledArea, 3,3, 5,3);
    assertEquals(expectedFilledArea, filledArea);
  }
View Full Code Here

Examples of org.stathissideris.ascii2image.text.CellSet

  @Test public void testFillContinuousAreaUInside() throws FileNotFoundException, IOException {
    TextGrid uGrid;
    uGrid = new TextGrid();
    uGrid.loadFrom("tests/text/simple_U01.txt");
   
    CellSet filledArea = uGrid.fillContinuousArea(3, 3, '*');
    int size = filledArea.size();
   
    assertEquals(62, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(uGrid, expectedFilledArea,  3,3, 5,5);
    addSquareToCellSet(uGrid, expectedFilledArea, 14,3, 5,5);
    addSquareToCellSet(uGrid, expectedFilledArea,  8,6, 6,2);
    assertEquals(expectedFilledArea, filledArea);
  }
View Full Code Here

Examples of org.stathissideris.ascii2image.text.CellSet

  @Test public void testFillContinuousAreaUOutside() throws FileNotFoundException, IOException {
    TextGrid uGrid;
    uGrid = new TextGrid();
    uGrid.loadFrom("tests/text/simple_U01.txt");
   
    CellSet filledArea = uGrid.fillContinuousArea(0, 0, '*');
    int size = filledArea.size();
   
    assertEquals(128, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(uGrid, expectedFilledArea,  0,02,11);
    addSquareToCellSet(uGrid, expectedFilledArea, 20,02,11);
   
    addSquareToCellSet(uGrid, expectedFilledArea,  0,0, 22, 2);
    addSquareToCellSet(uGrid, expectedFilledArea,  0,9, 22, 2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.