edu.mit.jmwe.harness.result
Class ErrorResult<T extends IToken>

java.lang.Object
  extended by edu.mit.jmwe.harness.result.ErrorResult<T>
Type Parameters:
T - the type of tokens that form the multi-word expressions stored in this result
All Implemented Interfaces:
IErrorResult<T>

public class ErrorResult<T extends IToken>
extends Object
implements IErrorResult<T>

Default implementation of IErrorResult interface.

Since:
jMWE 1.0.0
Version:
$Id: ErrorResult.java 613 2011-05-06 21:31:24Z markaf $
Author:
N. Kulkarni

Nested Class Summary
static class ErrorResult.ErrorResultBuilder<T extends IToken>
          An object that builds an error result.
 
Constructor Summary
ErrorResult(Map<String,List<IMWE<T>>> details)
          Constructs the error result from a map that stores MWEs under the ID of the error class that they belong to.
ErrorResult(Map<String,List<IMWE<T>>> details, boolean reallocate)
          Constructs the error result from a Map that stores multi-word expressions under the ID of the error class that they belong to.This constructor may or may not allocate a new internal map, depending on the value of the reallocation flag.
ErrorResult(String errorID, List<IMWE<T>> errors)
          Constructs the error result that stores the given multi-word expressions under the given ID of the error class that they belong to.
 
Method Summary
 Map<String,List<IMWE<T>>> getDetails()
          Returns a Map that stores multi-word expressions under the ID of the error class they belong to.
 int getNumErrors(String errorID)
          Gets the number of MWEs that fall under the given error class.
 int getTotalErrors()
          Returns the total number of errors for the result.
 String toString()
           
static
<T extends IToken>
String
toString(IErrorResult<T> result)
          Creates a table displaying the number of instances of each error class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ErrorResult

public ErrorResult(String errorID,
                   List<IMWE<T>> errors)
Constructs the error result that stores the given multi-word expressions under the given ID of the error class that they belong to. This constructor allocates a new internal map, and so subsequent changes to the source list will not affect this object.

Parameters:
errors - a non-null list of error multi-word expressions
errorID - the ID of the error class that the multi-word expressions belong to
Throws:
NullPointerException - if the multi-word expression list is null.
Since:
jMWE 1.0.0

ErrorResult

public ErrorResult(Map<String,List<IMWE<T>>> details)
Constructs the error result from a map that stores MWEs under the ID of the error class that they belong to. This constructor allocates a new internal map, and so subsequent changes to the source list will not affect this object.

Parameters:
details - a non-null map that stores multi-word expressions under the ID of the error class that they belong to.
Throws:
NullPointerException - if the map is null.
Since:
jMWE 1.0.0

ErrorResult

public ErrorResult(Map<String,List<IMWE<T>>> details,
                   boolean reallocate)
Constructs the error result from a Map that stores multi-word expressions under the ID of the error class that they belong to.This constructor may or may not allocate a new internal map, depending on the value of the reallocation flag. If no reallocation is requested, this constructor reuses the given map, and so subsequent changes to the source list will affect this object.

Parameters:
details - a non-null map that stores multi-word expressions under the ID of the error class that they belong to.
reallocate - If true, will allocate a new internal map for details
Throws:
NullPointerException - if the map is null.
Since:
jMWE 1.0.0
Method Detail

getDetails

public Map<String,List<IMWE<T>>> getDetails()
Description copied from interface: IErrorResult
Returns a Map that stores multi-word expressions under the ID of the error class they belong to. Should never be null.

Specified by:
getDetails in interface IErrorResult<T extends IToken>
Returns:
a non-null Map that stores multi-word expressions under the ID of the error class they belong to.

getTotalErrors

public int getTotalErrors()
Description copied from interface: IErrorResult
Returns the total number of errors for the result. Will always be zero or greater.

Specified by:
getTotalErrors in interface IErrorResult<T extends IToken>
Returns:
the total number of errors for the result, always non-negative.

getNumErrors

public int getNumErrors(String errorID)
Description copied from interface: IErrorResult
Gets the number of MWEs that fall under the given error class.

Specified by:
getNumErrors in interface IErrorResult<T extends IToken>
Parameters:
errorID - the ID of the error class.
Returns:
the number of multi-word expression that fall under the given error class and zero if this error class is not represented in the error result.

toString

public String toString()
Overrides:
toString in class Object

toString

public static <T extends IToken> String toString(IErrorResult<T> result)
Creates a table displaying the number of instances of each error class.

Parameters:
result - a non-null error result
Returns:
A String that displays the number of instances of each error class in a table.
Since:
jMWE 1.0.0


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.