org.stathissideris.ascii2image.text
Class CellSet

java.lang.Object
  extended by org.stathissideris.ascii2image.text.CellSet
All Implemented Interfaces:
Iterable<TextGrid.Cell>

public class CellSet
extends Object
implements Iterable<TextGrid.Cell>

Author:
Efstathios Sideris

Field Summary
static int TYPE_CLOSED
           
static int TYPE_HAS_CLOSED_AREA
           
static int TYPE_MIXED
           
static int TYPE_OPEN
           
static int TYPE_UNDETERMINED
           
 
Constructor Summary
CellSet()
           
CellSet(CellSet other)
           
 
Method Summary
 Object add(TextGrid.Cell cell)
           
 void addAll(CellSet set)
           
 void addSet(CellSet set)
           
 void appendSet(CellSet set)
           
 ArrayList breakIntoDistinctBoundaries()
           
 ArrayList breakIntoDistinctBoundaries(TextGrid grid)
          Takes into account character info from the grid
 ArrayList breakTrulyMixedBoundaries(TextGrid grid)
          Breaks that: +-----+ | | + ---+------------------- | | +-----+ into the following 3: +-----+ | | + + | | +-----+ --- -------------------
 boolean contains(TextGrid.Cell cell)
           
static CellSet copyCellSet(CellSet set)
          Deep copy
 boolean equals(Object o)
           
 TextGrid.Cell find(int x, int y)
           
 TextGrid.Cell find(TextGrid.Cell cell)
           
 TextGrid.Cell findCellNextTo(TextGrid.Cell cell)
          Returns the first cell that is found to be next to cell.
 CellSet findCellsNextTo(TextGrid.Cell cell)
          Returns all the cells that are found to be next to cell.
 String getCellsAsString()
           
 CellSet getFilledEquivalent(TextGrid textGrid)
           
 TextGrid.Cell getFirst()
           
 int getHeight()
           
 int getMaxX()
           
 int getMaxY()
           
 int getMinX()
           
 int getMinY()
           
 int getType(TextGrid grid)
           
 int getWidth()
           
 boolean hasCommonCells(CellSet otherSet)
           
 Iterator<TextGrid.Cell> iterator()
           
 TextGrid makeIntoGrid()
           
 CellSet makeScaledOneThirdEquivalent()
           
 void printAsGrid()
           
 void printDebug()
           
 Object remove(TextGrid.Cell cell)
           
static ArrayList removeDuplicateSets(ArrayList list)
           
 int size()
           
 void subtractSet(CellSet set)
           
 String toString()
           
 void translate(int dx, int dy)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_CLOSED

public static final int TYPE_CLOSED
See Also:
Constant Field Values

TYPE_OPEN

public static final int TYPE_OPEN
See Also:
Constant Field Values

TYPE_MIXED

public static final int TYPE_MIXED
See Also:
Constant Field Values

TYPE_HAS_CLOSED_AREA

public static final int TYPE_HAS_CLOSED_AREA
See Also:
Constant Field Values

TYPE_UNDETERMINED

public static final int TYPE_UNDETERMINED
See Also:
Constant Field Values
Constructor Detail

CellSet

public CellSet()

CellSet

public CellSet(CellSet other)
Method Detail

iterator

public Iterator<TextGrid.Cell> iterator()
Specified by:
iterator in interface Iterable<TextGrid.Cell>

add

public Object add(TextGrid.Cell cell)

addAll

public void addAll(CellSet set)

size

public int size()

getFirst

public TextGrid.Cell getFirst()

printAsGrid

public void printAsGrid()

printDebug

public void printDebug()

getCellsAsString

public String getCellsAsString()

toString

public String toString()
Overrides:
toString in class Object

copyCellSet

public static CellSet copyCellSet(CellSet set)
Deep copy

Parameters:
set -
Returns:

getType

public int getType(TextGrid grid)

translate

public void translate(int dx,
                      int dy)

find

public TextGrid.Cell find(TextGrid.Cell cell)

contains

public boolean contains(TextGrid.Cell cell)

addSet

public void addSet(CellSet set)

hasCommonCells

public boolean hasCommonCells(CellSet otherSet)

find

public TextGrid.Cell find(int x,
                          int y)

getFilledEquivalent

public CellSet getFilledEquivalent(TextGrid textGrid)

findCellNextTo

public TextGrid.Cell findCellNextTo(TextGrid.Cell cell)
Returns the first cell that is found to be next to cell.

Parameters:
cell -
Returns:

findCellsNextTo

public CellSet findCellsNextTo(TextGrid.Cell cell)
Returns all the cells that are found to be next to cell.

Parameters:
cell -
Returns:

appendSet

public void appendSet(CellSet set)

subtractSet

public void subtractSet(CellSet set)

getWidth

public int getWidth()

getHeight

public int getHeight()

getMaxX

public int getMaxX()

getMinX

public int getMinX()

getMaxY

public int getMaxY()

getMinY

public int getMinY()

remove

public Object remove(TextGrid.Cell cell)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

removeDuplicateSets

public static ArrayList removeDuplicateSets(ArrayList list)

breakIntoDistinctBoundaries

public ArrayList breakIntoDistinctBoundaries(TextGrid grid)
Takes into account character info from the grid

Returns:
ArrayList of distinct BoundarySetS

breakIntoDistinctBoundaries

public ArrayList breakIntoDistinctBoundaries()
Returns:
ArrayList of distinct BoundarySetS

breakTrulyMixedBoundaries

public ArrayList breakTrulyMixedBoundaries(TextGrid grid)
Breaks that:
  +-----+
  |     |
  +  ---+-------------------
  |     |
  +-----+
 
into the following 3:
  +-----+
  |     |
  +     +
  |     |
  +-----+
 
     ---
         -------------------
 

Parameters:
grid -
Returns:
a list of boundaries that are either open or closed but not mixed and they are equivalent to the this

makeIntoGrid

public TextGrid makeIntoGrid()

makeScaledOneThirdEquivalent

public CellSet makeScaledOneThirdEquivalent()


Copyright © 2013. All Rights Reserved.