- java.lang.Object
-
- com.uddernetworks.newocr.character.Character
-
- com.uddernetworks.newocr.character.CoordinateCharacter
-
- All Implemented Interfaces:
java.lang.Comparable<Character>
- Direct Known Subclasses:
ImageLetter,SearchCharacter
public abstract class CoordinateCharacter extends Character
The superclass for characters containing data from the input image.- Since:
- April 25, 2019
-
-
Constructor Summary
Constructors Constructor Description CoordinateCharacter()
-
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object obj)intgetAmountOfMerges()Gets how many times the currentImageLetterhas been merged viamerge(CoordinateCharacter)with anotherImageLetter.java.util.List<IntPair>getCoordinates()Gets the coordinates of the character.java.util.Optional<java.util.Map<Letter,CoordinateCharacter>>getMergedPieces()Gets the individual pieces before merging.boolean[][]getValues()Gets the black (true) and white (false) pixels of the scanned character.inthashCode()voidmerge(CoordinateCharacter character)Merges the givenCoordinateCharacterwith the current one, possibly changing width, height, X and Y values, along with combining the current and givenCoordinateCharacter's coordinates and values (Accessible viagetCoordinates()andgetValues()respectively).voidsetValues(boolean[][] values)Sets the black (true) and white (false) pixels of the scanned character.-
Methods inherited from class com.uddernetworks.newocr.character.Character
compareTo, getHeight, getLetter, getModifier, getWidth, getX, getY, isInBounds, isInXBounds, isInYBounds, isOverlappingX, isOverlappingY, setHeight, setLetter, setModifier, setWidth, setX, setY, toString
-
-
-
-
Method Detail
-
merge
public void merge(CoordinateCharacter character)
Merges the givenCoordinateCharacterwith the current one, possibly changing width, height, X and Y values, along with combining the current and givenCoordinateCharacter's coordinates and values (Accessible viagetCoordinates()andgetValues()respectively).- Parameters:
character- TheCoordinateCharacterto merge into the current one
-
getCoordinates
public java.util.List<IntPair> getCoordinates()
Gets the coordinates of the character.- Returns:
- The coordinates
-
getValues
public boolean[][] getValues()
Gets the black (true) and white (false) pixels of the scanned character.- Returns:
- The grid of black or white values
-
setValues
public void setValues(boolean[][] values)
Sets the black (true) and white (false) pixels of the scanned character.- Parameters:
values- The grid of black or white values. Will return `null` for spaces
-
getAmountOfMerges
public int getAmountOfMerges()
Gets how many times the currentImageLetterhas been merged viamerge(CoordinateCharacter)with anotherImageLetter. This value is added every timemerge(CoordinateCharacter)is invoked, and adds the amount of merges the argument of that method to the current merge value, as well as incrementing normally.- Returns:
- The amount of merge operations affecting the current
ImageLetter
-
getMergedPieces
public java.util.Optional<java.util.Map<Letter,CoordinateCharacter>> getMergedPieces()
Gets the individual pieces before merging.- Returns:
- The
CoordinateCharacters that have been merged, or null if there have been no merges
-
-