Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
oskopek committed Dec 31, 2014
1 parent 3285fc6 commit df3af34
Show file tree
Hide file tree
Showing 87 changed files with 2,708 additions and 2,047 deletions.
344 changes: 178 additions & 166 deletions .openshift/config/standalone.xml

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions carcv-core/src/main/java/org/carcv/core/detect/CarSorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,26 @@

package org.carcv.core.detect;

import java.io.IOException;
import java.util.List;

import org.carcv.core.model.file.FileCarImage;
import org.carcv.core.model.file.FileEntry;

import java.io.IOException;
import java.util.List;

/**
* Provides methods for arranging a sequence of images (video frames) into groups of individual real cars depicted in them.
*
*/
public abstract class CarSorter {

/**
* Turns the FileEntry directly loaded from input directory (containing all images from a given video) into several
* FileEntry-s, corresponding to the individual real cars on the video.
*
* <p>
* <p/>
* Be careful to clone the CarData when assigning it from <code>batchEntry</code> to all new FileEntries.
*
* @param batchEntry <code>FileEntry</code> containing all images from the new batch
*
* @return individual real cars as a list of <code>FileEntry</code>-s, or an empty List if the list of FileCarImages is
* empty
* empty
*/
public abstract List<FileEntry> sortIntoCars(FileEntry batchEntry) throws IOException;

Expand All @@ -54,7 +51,7 @@ public abstract class CarSorter {
/**
* Wrapper method for {@link CarSorter#carsEquals(String, String)}.
*
* @param one <code>A FileCarImage</code>, has to have a valid filePath set, not null
* @param one <code>A FileCarImage</code>, has to have a valid filePath set, not null
* @param twoPlate Text of the number plate of the second Car to compare
*/
public abstract boolean carsEquals(FileCarImage one, String twoPlate);
Expand Down
4 changes: 2 additions & 2 deletions carcv-core/src/main/java/org/carcv/core/detect/Detector.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

package org.carcv.core.detect;

import java.util.List;

import org.carcv.core.model.AbstractCarImage;

import java.util.List;

/**
* Abstraction of a detector, given a list of <code>CarImage</code>s, detects what it should and returns a String
* representation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

package org.carcv.core.detect;

import java.util.List;

import org.carcv.core.model.AbstractCarImage;

import java.util.List;

/**
* Abstraction of a Number Plate detector. Detects the text of the plate, and the country of origin.
*
* <p>
* <p/>
* The list of input images should try to be of the same (in real life) car.
*/
public abstract class NumberPlateDetector implements Detector {
Expand All @@ -32,7 +31,6 @@ public abstract class NumberPlateDetector implements Detector {
* Detects the text (usually an alpha-numerical String) of the Number Plate. The text is a unique identification number
* (plate number) registered in a specific country.
*
*
* @param images Must be non-null, loaded externally!
* @return A String containing the text of the plate, or null if an error occurred
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@

package org.carcv.core.detect;

import java.util.List;

import org.carcv.core.model.AbstractCarImage;
import org.carcv.core.model.SpeedUnit;

import java.util.List;

/**
* Abstraction of a speed detector. Detects (calculates) the speed of a given car on the list of input images.
*
* <p>
* <p/>
* The list of input images should try to be of the same (in real life) car.
*
* <p>
* <p/>
* The default speed measuring unit is {@link SpeedUnit#KPH} (kilometers per hour, km/h, kmh^-1, ...)
*/
public abstract class SpeedDetector implements Detector {
Expand Down
16 changes: 8 additions & 8 deletions carcv-core/src/main/java/org/carcv/core/detect/package.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<html>
<body>
Provides an abstraction of basic detection objects. All Detectors implement the {@link org.carcv.core.detect.Detector}
interface.
<p>These are three types of objects used for the three stages of detection:
<ol>
<li>Sorting of video frames into real cars -- {@link org.carcv.core.detect.CarSorter}
<li>Detection of {@link org.carcv.core.model.NumberPlate}s -- {@link org.carcv.core.detect.NumberPlateDetector}
<li>Detection of car {@link org.carcv.core.model.Speed} -- {@link org.carcv.core.detect.SpeedDetector}
</ol>
Provides an abstraction of basic detection objects. All Detectors implement the {@link org.carcv.core.detect.Detector}
interface.
<p>These are three types of objects used for the three stages of detection:
<ol>
<li>Sorting of video frames into real cars -- {@link org.carcv.core.detect.CarSorter}
<li>Detection of {@link org.carcv.core.model.NumberPlate}s -- {@link org.carcv.core.detect.NumberPlateDetector}
<li>Detection of car {@link org.carcv.core.model.Speed} -- {@link org.carcv.core.detect.SpeedDetector}
</ol>
</body>
</html>
14 changes: 7 additions & 7 deletions carcv-core/src/main/java/org/carcv/core/io/DirectoryLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

package org.carcv.core.io;

import org.carcv.core.model.Address;
import org.carcv.core.model.CarData;
import org.carcv.core.model.file.FileCarImage;
import org.carcv.core.model.file.FileEntry;

import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.DirectoryStream;
Expand All @@ -27,11 +32,6 @@
import java.util.List;
import java.util.Properties;

import org.carcv.core.model.Address;
import org.carcv.core.model.CarData;
import org.carcv.core.model.file.FileCarImage;
import org.carcv.core.model.file.FileEntry;

/**
* Provides methods for loading CarData from a directory containing a {@link #infoFileName info file}.
*/
Expand All @@ -40,7 +40,7 @@ public class DirectoryLoader {
/**
* An array of lower case String representations of image file suffixes. Without leading dots.
*/
final public static String[] knownImageFileSuffixes = { "png", "jpg", "jpeg", "bmp" };
final public static String[] knownImageFileSuffixes = {"png", "jpg", "jpeg", "bmp"};

/**
* The default name of the info file.
Expand Down Expand Up @@ -104,7 +104,7 @@ private static CarData loadCarData(Path directory) throws IOException {
String time = p.getProperty("timestamp");

Address address = new Address(Double.parseDouble(latitude), Double.parseDouble(longitude), city, postalcode, street,
country, Integer.parseInt(streetNumber), Integer.parseInt(referenceNumber));
country, Integer.parseInt(streetNumber), Integer.parseInt(referenceNumber));

Date timestamp = new Date(Long.parseLong(time));

Expand Down
22 changes: 11 additions & 11 deletions carcv-core/src/main/java/org/carcv/core/io/DirectoryWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

package org.carcv.core.io;

import org.carcv.core.model.AbstractEntry;
import org.carcv.core.model.file.FileEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.FileVisitResult;
Expand All @@ -28,11 +33,6 @@
import java.util.ArrayList;
import java.util.List;

import org.carcv.core.model.AbstractEntry;
import org.carcv.core.model.file.FileEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Provides methods for discovery of new files recursively under a root directory.
*/
Expand Down Expand Up @@ -68,7 +68,7 @@ public DirectoryWatcher(Path rootDir) {
* on every newly discovered file.
*
* @throws IOException If an error creating a DirectoryStream from rootDir occurs. Doesn't throw if an invalid directory
* happens to be in rootDir, just ignores it (adds it to knownDirs) and continues
* happens to be in rootDir, just ignores it (adds it to knownDirs) and continues
*/
public void discover() throws IOException {
DirectoryStream<Path> stream;
Expand All @@ -83,8 +83,8 @@ public void discover() throws IOException {
completed = Paths.get(p.toString(), completedMarkerFilename);

if (!Files.isDirectory(p)
|| knownDirs.contains(p)
|| Files.exists(completed)) {
|| knownDirs.contains(p)
|| Files.exists(completed)) {
continue;
}

Expand All @@ -96,7 +96,7 @@ public void discover() throws IOException {
entries.add(e);
} catch (IOException ioe) {
LOGGER.error("Loading FileEntry batch directory failed, discarding it: {} with message: {}", p,
ioe.getMessage());
ioe.getMessage());
}
}
}
Expand Down Expand Up @@ -134,9 +134,9 @@ public List<FileEntry> getEntries() {

/**
* Deletes given path (directory) and everything under it recursively.
* <p>
* <p/>
* Similar to <code>rm -rf path</code>
* <p>
* <p/>
* <strong>USE WITH CAUTION!</strong>
*
* @param path the path to delete
Expand Down
10 changes: 5 additions & 5 deletions carcv-core/src/main/java/org/carcv/core/io/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

package org.carcv.core.io;

import org.carcv.core.model.AbstractEntry;

import java.io.IOException;
import java.util.List;

import org.carcv.core.model.AbstractEntry;

/**
* An interface for any object that wants to load a batch (java.util.List) of {@link AbstractEntry}-s. The input data source and
* method are responsibilities of the implementation.
* <p>
* <p/>
* If you implement this interface, it is considered good conduct to implement a complementing {@link Saver} interface and link
* here) too. The saving/loading shouldn't in any way lose data contained in the <code>AbstractEntry</code> -s. You are also
* encouraged to add other, more specific saving methods.
Expand All @@ -34,16 +34,16 @@ public interface Loader {
/**
* Loads all batches according to the implementation details.
*
* @throws IOException if an error during the save occurs
* @return a list of AbstractEntry-s that were loaded from the data source
* @throws IOException if an error during the save occurs
*/
public List<? extends AbstractEntry> loadAll() throws IOException;

/**
* Loads all batches since last load of new batches according to the implementation details.
*
* @throws IOException if an error during the save occurs
* @return a list of AbstractEntry-s that were loaded from the data source
* @throws IOException if an error during the save occurs
*/
public List<? extends AbstractEntry> loadNew() throws IOException;
}
6 changes: 3 additions & 3 deletions carcv-core/src/main/java/org/carcv/core/io/Saver.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

package org.carcv.core.io;

import org.carcv.core.model.AbstractEntry;

import java.io.IOException;
import java.util.List;

import org.carcv.core.model.AbstractEntry;

/**
* An interface for any object that wants to save a batch (java.util.List) of {@link AbstractEntry}-s. The output form and
* method are responsibilities of the implementation.
* <p>
* <p/>
* If you implement this interface, it is considered good conduct to implement a complementing {@link Loader} interface and link
* here) too. The saving/loading shouldn't in any way lose data contained in the <code>AbstractEntry</code> -s. You are also
* encouraged to add other, more specific saving methods.
Expand Down
14 changes: 7 additions & 7 deletions carcv-core/src/main/java/org/carcv/core/io/VideoHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public abstract class VideoHandler {
/**
* Splits video into frames with a frame rate.
*
* @param video Path of the input video file
* @param video Path of the input video file
* @param frameRate number of frames per second
* @return true if the splitting finished successfully
* @throws IOException if an error during loading video or saving images occurs
Expand All @@ -38,9 +38,9 @@ public abstract class VideoHandler {
/**
* Splits video into frames with a frame rate.
*
* @param video Path of the input video file
* @param video Path of the input video file
* @param frameRate number of frames per second
* @param imageDir directory where output files will be saved
* @param imageDir directory where output files will be saved
* @return true if the splitting finished successfully
* @throws IOException if an error during loading video or saving images occurs
*/
Expand All @@ -49,8 +49,8 @@ public abstract class VideoHandler {
/**
* Creates a video from all images in a directory.
*
* @param imageDir directory from which to load images
* @param video Path of the output video file
* @param imageDir directory from which to load images
* @param video Path of the output video file
* @param frameRate number of frames per second
* @throws IOException if an error during loading images or saving of the video occurs
*/
Expand All @@ -59,7 +59,7 @@ public abstract class VideoHandler {
/**
* Creates a video from all images in a directory.
*
* @param imageDir directory from which to load images
* @param imageDir directory from which to load images
* @param frameRate number of frames per second
* @throws IOException if an error during loading images or saving of the video occurs
*/
Expand All @@ -68,7 +68,7 @@ public abstract class VideoHandler {
/**
* Creates a video from all images in a directory.
*
* @param imageDir directory from which to load images
* @param imageDir directory from which to load images
* @param frameRate number of frames per second
* @throws IOException if an error during loading images or creating the video occurs
*/
Expand Down
2 changes: 1 addition & 1 deletion carcv-core/src/main/java/org/carcv/core/io/package.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<html>
<body>Provides basic functionality for loading input and saving output videos/images. They can be used further with the
Entities and Embeddables from {@link org.carcv.core.detect.Detector}s, etc.
Entities and Embeddables from {@link org.carcv.core.detect.Detector}s, etc.
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

package org.carcv.core.model;

import java.io.Serializable;

import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
* The base class for all Embeddables. It is recommended for subclasses to implement Comparable with the given type.
Expand Down
Loading

0 comments on commit df3af34

Please sign in to comment.