edu.mit.jsemcor.element
Class Punc

java.lang.Object
  extended by edu.mit.jsemcor.element.Punc
All Implemented Interfaces:
IElement, IPunc, IToken

public class Punc
extends Object
implements IPunc

Default, concrete implementation of IPunc, with all punctuation listed in the Semcor documentation, plus a few extras not mentioned, e.g., HYPHEN, PERCENT, STAR, PLUS, and AMPERSAND. This class is not implemented as an Enum so that clients can instantiate their own instances of this class without re-implementing the interface.

Since:
JSemcor 1.0.0
Version:
1.60, 22 Sep 2008
Author:
M.A. Finlayson

Field Summary
static Punc AMPERSAND
           
static Punc APOSTROPHE
           
static Punc CLOSED_QUOTE
           
static Punc COLON
           
static Punc COMMA
           
static Punc DEGREES
           
static Punc DOLLAR_SIGN
           
static Punc EXCLAMATION_PT
           
static Punc HYPHEN
           
static Punc LEFT_BRACKET
           
static Punc LEFT_PAREN
           
static Punc OPEN_QUOTE
           
static Punc PERCENT
           
static Punc PERIOD
           
static Punc PLUS
           
static Punc QUESTION_MARK
           
static Punc RIGHT_BRACKET
           
static Punc RIGHT_PAREN
           
static Punc SEMICOLON
           
static Punc SLASH
           
static Punc STAR
           
 
Fields inherited from interface edu.mit.jsemcor.element.IPunc
TAG_PUNC_END, TAG_PUNC_START, TAG_PUNC_VALUE
 
Fields inherited from interface edu.mit.jsemcor.element.IElement
CLOSE_QUOTE, EQUALS, FORWARD_SLASH, LEFT_ANGLE_BRACKET, NEWLINE, RIGHT_ANGLE_BRACKET, SPACE, SPACE_STR, UNDERSCORE, UNDERSCORE_STR
 
Constructor Summary
Punc(String name, char displayChar, String symbol)
          Constructs a new Category with the specified name.
 
Method Summary
 String getData()
          Returns the String representation of this element, as it would be found in the concordance file.
 char getDisplayCharacter()
          Returns the character that is used to display this punctuation on screen.
static Punc getInstance(String symbol)
          Returns the Punc object for the specified value, or null if there no static final instance for this value exists.
 String getName()
          Returns a user-readable name that identifies this punctuation object.
 String getSymbol()
          Returns the symbol (one or possibly two characters) used to identify this punctuation in context files.
 String getText()
          The actual string contained between the SGML brackets in the Semcor data file.
static boolean isClosingDelimiter(IToken p)
          Returns whether the specified token is the same as one of the static final closing delimiter punctuation marks, i.e., the double-quote, right parenthesis, or right bracket.
static boolean isClosingDelimiter(String p)
          Returns whether the specified string is the same as one of the static final closing delimiter punctuation mark strings, i.e., the double-quote, right parenthesis, or right bracket.
static boolean isOpeningDelimiter(IToken p)
          Returns whether the specified token is the same as one of the static final opening delimiter punctuation marks, i.e., the double-quote, left parenthesis, or left bracket.
static boolean isOpeningDelimiter(String p)
          Returns whether the specified token is the same as one of the static final opening delimiter punctuation mark strings, i.e., the double-quote, left parenthesis, or left bracket.
static boolean isPhraseDelimiter(IToken p)
          Returns whether the specified token is the same as one of the static final phrase delimiter punctuation marks, i.e., the comma, colon, or semicolon.
static boolean isPhraseDelimiter(String p)
          Returns whether the specified string is the same as one of the static final phrase delimiter punctuation mark strings, i.e., the comma, colon, or semicolon.
static boolean isSentenceFinal(IToken p)
          Returns whether the specified token is the same as one of the static final sentence-final punctuation marks, i.e., the period, exclamation point, or question mark.
static boolean isSentenceFinal(String p)
          Returns whether the specified string is the same as one of the static final sentence-final punctuation mark strings, i.e., the period, exclamation point, or question mark.
 String toString()
           
static Collection<Punc> values()
          This functions emulates the function of the same name found on each Enum class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMA

public static final Punc COMMA

PERIOD

public static final Punc PERIOD

QUESTION_MARK

public static final Punc QUESTION_MARK

EXCLAMATION_PT

public static final Punc EXCLAMATION_PT

SEMICOLON

public static final Punc SEMICOLON

LEFT_PAREN

public static final Punc LEFT_PAREN

RIGHT_PAREN

public static final Punc RIGHT_PAREN

LEFT_BRACKET

public static final Punc LEFT_BRACKET

RIGHT_BRACKET

public static final Punc RIGHT_BRACKET

APOSTROPHE

public static final Punc APOSTROPHE

OPEN_QUOTE

public static final Punc OPEN_QUOTE

CLOSED_QUOTE

public static final Punc CLOSED_QUOTE

DOLLAR_SIGN

public static final Punc DOLLAR_SIGN

COLON

public static final Punc COLON

HYPHEN

public static final Punc HYPHEN

SLASH

public static final Punc SLASH

DEGREES

public static final Punc DEGREES

PERCENT

public static final Punc PERCENT

STAR

public static final Punc STAR

PLUS

public static final Punc PLUS

AMPERSAND

public static final Punc AMPERSAND
Constructor Detail

Punc

public Punc(String name,
            char displayChar,
            String symbol)
Constructs a new Category with the specified name.

Throws:
NullPointerException - if either string is null
IllegalArgumentException - if either string is empty or all whitespace
Since:
JSemcor 1.0.0
Method Detail

getText

public String getText()
Description copied from interface: IToken
The actual string contained between the SGML brackets in the Semcor data file. This may be a collocation, with separate tokens concatenated with underscores instead of spaces.

Specified by:
getText in interface IToken

getName

public String getName()
Description copied from interface: IPunc
Returns a user-readable name that identifies this punctuation object.

Specified by:
getName in interface IPunc

getDisplayCharacter

public char getDisplayCharacter()
Description copied from interface: IPunc
Returns the character that is used to display this punctuation on screen.

Specified by:
getDisplayCharacter in interface IPunc

getSymbol

public String getSymbol()
Description copied from interface: IPunc
Returns the symbol (one or possibly two characters) used to identify this punctuation in context files.

Specified by:
getSymbol in interface IPunc

getData

public String getData()
Description copied from interface: IElement
Returns the String representation of this element, as it would be found in the concordance file.

Specified by:
getData in interface IElement

toString

public String toString()
Overrides:
toString in class Object

values

public static final Collection<Punc> values()
This functions emulates the function of the same name found on each Enum class. This method returns a static, unmodifiable collection containing all the instances of this type that are declared in static fields in this concrete class.

Since:
JSemcor 1.0.0

getInstance

public static final Punc getInstance(String symbol)
Returns the Punc object for the specified value, or null if there no static final instance for this value exists.

Since:
JSemcor 1.0.0

isSentenceFinal

public static boolean isSentenceFinal(IToken p)
Returns whether the specified token is the same as one of the static final sentence-final punctuation marks, i.e., the period, exclamation point, or question mark.

Returns:
true if the specified token is equal to the PERIOD, EXCLAMATION_PT, or QUESTION_MARK punctuation objects; false otherwise.
Since:
JSemcor 1.0.0

isSentenceFinal

public static boolean isSentenceFinal(String p)
Returns whether the specified string is the same as one of the static final sentence-final punctuation mark strings, i.e., the period, exclamation point, or question mark.

Returns:
true if the specified string is equal to the value of the PERIOD, EXCLAMATION_PT, or QUESTION_MARK punctuation objects; false otherwise.
Since:
JSemcor 1.0.0

isOpeningDelimiter

public static boolean isOpeningDelimiter(IToken p)
Returns whether the specified token is the same as one of the static final opening delimiter punctuation marks, i.e., the double-quote, left parenthesis, or left bracket.

Returns:
true if the specified token is equal to the OPEN_QUOTE, LEFT_PAREN, or LEFT_BRACKET punctuation objects; false otherwise.
Since:
JSemcor 1.0.0

isOpeningDelimiter

public static boolean isOpeningDelimiter(String p)
Returns whether the specified token is the same as one of the static final opening delimiter punctuation mark strings, i.e., the double-quote, left parenthesis, or left bracket.

Returns:
true if the specified string is equal to the value of the OPEN_QUOTE, LEFT_PAREN, or LEFT_BRACKET punctuation objects; false otherwise.
Since:
JSemcor 1.0.0

isClosingDelimiter

public static boolean isClosingDelimiter(IToken p)
Returns whether the specified token is the same as one of the static final closing delimiter punctuation marks, i.e., the double-quote, right parenthesis, or right bracket.

Returns:
true if the specified token is equal to the OPEN_QUOTE, RIGHT_PAREN, or RIGHT_BRACKET punctuation objects; false otherwise.
Since:
JSemcor 1.0.0

isClosingDelimiter

public static boolean isClosingDelimiter(String p)
Returns whether the specified string is the same as one of the static final closing delimiter punctuation mark strings, i.e., the double-quote, right parenthesis, or right bracket.

Returns:
true if the specified string is equal to the value of the OPEN_QUOTE, RIGHT_PAREN, or RIGHT_BRACKET punctuation objects; false otherwise.
Since:
JSemcor 1.0.0

isPhraseDelimiter

public static boolean isPhraseDelimiter(IToken p)
Returns whether the specified token is the same as one of the static final phrase delimiter punctuation marks, i.e., the comma, colon, or semicolon.

Returns:
true if the specified token is equal to the COMMA, COLON, or SEMICOLON punctuation objects; false otherwise.
Since:
JSemcor 1.0.0

isPhraseDelimiter

public static boolean isPhraseDelimiter(String p)
Returns whether the specified string is the same as one of the static final phrase delimiter punctuation mark strings, i.e., the comma, colon, or semicolon.

Returns:
true if the specified string is equal to the value of the COMMA, COLON, or SEMICOLON punctuation objects; false otherwise.
Since:
JSemcor 1.0.0


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