edu.mit.jverbnet.data
Class VerbnetTypes

java.lang.Object
  extended by edu.mit.jverbnet.data.VerbnetTypes

public class VerbnetTypes
extends java.lang.Object

Utility class for verbnet types

Since:
JVerbnet 1.0.0
Version:
1.2.0
Author:
Mark A. Finlayson

Field Summary
static java.lang.String minus
           
static java.lang.String plus
           
 
Constructor Summary
VerbnetTypes()
           
 
Method Summary
static
<T extends IVerbnetType>
T
getById(java.lang.Class<T> cls, java.lang.String id)
          Invokes the static getById method on a given verbnet type.
static INounPhraseType getNounPhraseTypeById(java.lang.String id)
          Returns the noun phrase type for the specified id.
static boolean getSelectionRestriction(java.lang.String value)
          Returns the selection restriction for a particular string value.
static
<T extends IVerbnetType>
T
getTypeByIdNoWarnings(java.lang.Class<T> cls, java.lang.String id)
          Invokes the static getById method on a given verbnet type.
static java.lang.String getXSDSimpleTypeName(java.lang.Class<? extends IVerbnetType> c)
          Retrieves the value of the static field containing the XSD type name for a verbnet type.
static boolean isPrintingIdWarnings()
          Returns the value of the isPringingIdWarnings flag.
static void printIdNormalizationWarning(java.lang.Class<? extends IHasID> type, java.lang.String id)
          Prints a warning to standard err if the type's id does not match the specified id exactly (e.g., it differs in case).
static void printIdUnknownWarning(java.lang.Class<? extends IHasID> cls, java.lang.String id)
          Prints a warning to standard err that the specified id is unknown for the specified type
static void printIdWarnings(java.lang.Class<? extends IHasID> cls, IHasID type, java.lang.String id)
          Prints a warning to standard err if the type is null or the type's id does not match the specified id exactly (e.g., it differs in case).
static void setPrintIdWarnings(boolean value)
          Sets the isPrintingIdWarnings flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

plus

public static final java.lang.String plus
See Also:
Constant Field Values

minus

public static final java.lang.String minus
See Also:
Constant Field Values
Constructor Detail

VerbnetTypes

public VerbnetTypes()
Method Detail

getById

public static <T extends IVerbnetType> T getById(java.lang.Class<T> cls,
                                                 java.lang.String id)
Invokes the static getById method on a given verbnet type. If the specified id is not found, prints a warning to standard err.

Parameters:
cls - the verbnet type from which to retrieve the value
id - the id of the type to retrieve
Returns:
the retrieved object, or null if none found
Throws:
java.lang.NullPointerException - if the class is null
Since:
JVerbnet 1.0.0

getTypeByIdNoWarnings

public static <T extends IVerbnetType> T getTypeByIdNoWarnings(java.lang.Class<T> cls,
                                                               java.lang.String id)
Invokes the static getById method on a given verbnet type.

Parameters:
cls - the verbnet type from which to retrieve the value
id - the id of the type to retrieve
Returns:
the retrieved object, or null if none found
Throws:
java.lang.NullPointerException - if the class is null
java.lang.IllegalStateException - if the class does not have an accessible getById method
Since:
JVerbnet 1.0.0

getXSDSimpleTypeName

public static java.lang.String getXSDSimpleTypeName(java.lang.Class<? extends IVerbnetType> c)
Retrieves the value of the static field containing the XSD type name for a verbnet type.

Parameters:
c - the type for which the name should be retrieved
Returns:
the value of the field
Throws:
java.lang.IllegalStateException - if the class does not have an accessible xsd type name field
Since:
JVerbnet 1.0.0

getSelectionRestriction

public static boolean getSelectionRestriction(java.lang.String value)
Returns the selection restriction for a particular string value. When passed "+", returns true; when passed "-", returns false. Otherwise, throws an exception

Parameters:
value - either "+" or "-"
Returns:
true when the value is "+"; false when the value is "-"
Throws:
java.lang.IllegalArgumentException - if the specified string is not "+" or "-"
Since:
JVerbnet 1.0.0

getNounPhraseTypeById

public static INounPhraseType getNounPhraseTypeById(java.lang.String id)
Returns the noun phrase type for the specified id.

Parameters:
id - the id of the noun phrase type to find.
Returns:
the noun phrase type found
Since:
JVerbnet 1.0.0

isPrintingIdWarnings

public static boolean isPrintingIdWarnings()
Returns the value of the isPringingIdWarnings flag.

Returns:
true if warnings are being printed to standard err; false if not.
Since:
JVerbnet 1.0.0

setPrintIdWarnings

public static void setPrintIdWarnings(boolean value)
Sets the isPrintingIdWarnings flag.

Since:
JVerbnet 1.0.0

printIdWarnings

public static void printIdWarnings(java.lang.Class<? extends IHasID> cls,
                                   IHasID type,
                                   java.lang.String id)
Prints a warning to standard err if the type is null or the type's id does not match the specified id exactly (e.g., it differs in case).

Parameters:
cls - the class of the type
type - the object with the id
id - the id to check
Since:
JVerbnet 1.0.0

printIdUnknownWarning

public static void printIdUnknownWarning(java.lang.Class<? extends IHasID> cls,
                                         java.lang.String id)
Prints a warning to standard err that the specified id is unknown for the specified type

Parameters:
cls - the class of the type
id - the id to check
Since:
JVerbnet 1.0.0

printIdNormalizationWarning

public static void printIdNormalizationWarning(java.lang.Class<? extends IHasID> type,
                                               java.lang.String id)
Prints a warning to standard err if the type's id does not match the specified id exactly (e.g., it differs in case).

Parameters:
type - the object with the id
id - the id to check
Since:
JVerbnet 1.0.0


Copyright © 2012 ${project.organization.name}. All Rights Reserved.