Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/main/java/net/sf/javaanpr/intelligence/RecognizedPlate.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,46 @@

import java.util.Vector;

/**
* This class represents a number plate being recognized. As each character (represented by {@link RecognizedChar})
* is recognized it gets added to the {@code RecognizedPlate}.
*/
public class RecognizedPlate {

private Vector<RecognizedChar> chars;

/**
* Constructs a new {@code RecognizedPlate} with no {@code RecognizedChar}s.
*/
public RecognizedPlate() {
this.chars = new Vector<RecognizedChar>();
}

/**
* Adds one instance of {@link RecognizedChar} to the list of {@code RecognizedChar}s which have been
* recognized for this plate.
* @param chr The new {@link RecognizedChar} to be added
*/
public void addChar(RecognizedChar chr) {
this.chars.add(chr);
}

/**
* This method is for getting a specific {@link RecognizedChar} which has been added to this plate.
* @param i The index of the {@link RecognizedChar} to be returned
* @return The {@link RecognizedChar} which was the {@code i}th one to be added to this plate (starting from 0)
* @throws ArrayIndexOutOfBoundsException if {@code i} is larger than the number of {@code RecognizedChar}s added
* - 1 or {@code i} is less than 0.
*/
public RecognizedChar getChar(int i) {
return this.chars.elementAt(i);
}

/**
* This method is for getting a string representation of all the {@code RecognizedChar}s added to this plate.
* @return A string is made up of the character stored in the first pattern of each {@link RecognizedChar} with
* a space in between each one.
*/
public String getString() {
String ret = new String("");
for (int i = 0; i < this.chars.size(); i++) {
Expand All @@ -44,6 +68,9 @@ public String getString() {
return ret;
}

/**
* @return All the {@code RecognizedChar}s added to this plate
*/
public Vector<RecognizedChar> getChars() {
return chars;
}
Expand Down