edu.mit.jwi.data.parse
Class SenseKeyParser

java.lang.Object
  extended by edu.mit.jwi.data.parse.SenseKeyParser
All Implemented Interfaces:
ILineParser<ISenseKey>

public class SenseKeyParser
extends java.lang.Object
implements ILineParser<ISenseKey>

A parser that takes a sense key string and produces an ISenseKey object.

This class follows a singleton design pattern, and is not intended to be instantiated directly; rather, call the getInstance() method to get the singleton instance.

Since:
JWI 2.1.4
Version:
2.4.0
Author:
Mark A. Finlayson

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.mit.jwi.data.parse.ILineParser
ILineParser.MisformattedLineException
 
Constructor Summary
protected SenseKeyParser()
          This constructor is marked protected so that the class may be sub-classed, but not directly instantiated.
 
Method Summary
static SenseKeyParser getInstance()
          Returns the singleton instance of this class, instantiating it if necessary.
 ISenseKey parseLine(java.lang.String key)
          Given the line of data, this method produces an object of class T.
protected  ILexFile resolveLexicalFile(int lexFileNum)
           Retrieves the lexical file objects for the parseLine(String) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SenseKeyParser

protected SenseKeyParser()
This constructor is marked protected so that the class may be sub-classed, but not directly instantiated. Obtain instances of this class via the static getInstance() method.

Since:
JWI 2.1.4
Method Detail

getInstance

public static SenseKeyParser getInstance()
Returns the singleton instance of this class, instantiating it if necessary. The singleton instance will not be null.

Returns:
the non-null singleton instance of this class, instantiating it if necessary.
Since:
JWI 2.1.4

parseLine

public ISenseKey parseLine(java.lang.String key)
Description copied from interface: ILineParser
Given the line of data, this method produces an object of class T.

Specified by:
parseLine in interface ILineParser<ISenseKey>
Parameters:
key - the line to be parsed
Returns:
the object resulting from the parse

resolveLexicalFile

protected ILexFile resolveLexicalFile(int lexFileNum)

Retrieves the lexical file objects for the parseLine(String) method. If the lexical file number does correspond to a known lexical file, the method returns a singleton placeholder 'unknown' lexical file object.

This is implemented in its own method for ease of subclassing.

Parameters:
lexFileNum - the number of the lexical file to return
Returns:
the lexical file corresponding to the specified frame number
Since:
JWI 2.1.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.