pl.edu.agh.cast.importer.base.parser.analyzer
Class AbstractDateAnalyzer

java.lang.Object
  extended by pl.edu.agh.cast.importer.base.parser.analyzer.AbstractDateAnalyzer
All Implemented Interfaces:
IAnalyzer
Direct Known Subclasses:
DateAnalyzer, DateAndTimeAnalyzer, TimeAnalyzer

public abstract class AbstractDateAnalyzer
extends Object
implements IAnalyzer

Analyzer for the objects in Date format. The actual format should be specified in analyzer's constructor or set with use of the date format setter method, before the analyze() method is used.

Author:
AGH CAST Team

Field Summary
protected  SimpleDateFormat dateFormat
          The date format.
 
Constructor Summary
AbstractDateAnalyzer()
          The default constructor.
 
Method Summary
 List<Object> analyze(String tokenToAnalyze)
          Analyzes a given token and returns an appropriate object.
 boolean equals(Object obj)
          
 String getDatePattern()
           
 int hashCode()
          
 boolean isComplete()
          Checks whether current analyzer is fully configured - all necessary parameters are present and the the analysis process can be performed.
protected  Date parseDate(String text)
           
 void setDateFormat(String format)
          Setter for the date format attribute.
 void setDefaultValue(String defaultValue)
          Sets the default value for the analyzer.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.importer.base.parser.analyzer.IAnalyzer
createCopy, getReturnTypes
 

Field Detail

dateFormat

protected SimpleDateFormat dateFormat
The date format.

Constructor Detail

AbstractDateAnalyzer

public AbstractDateAnalyzer()
The default constructor. The date format must be set with use of the setDateFormat(String) method.

Method Detail

analyze

public List<Object> analyze(String tokenToAnalyze)
                     throws UnsupportedTokenException
Analyzes a given token and returns an appropriate object.

Specified by:
analyze in interface IAnalyzer
Parameters:
tokenToAnalyze - the token to analyze
Returns:
the list of analyzed objects
Throws:
UnsupportedTokenException
See Also:
IAnalyzer.analyze(java.lang.String)

setDefaultValue

public void setDefaultValue(String defaultValue)
Sets the default value for the analyzer.

Specified by:
setDefaultValue in interface IAnalyzer
Parameters:
defaultValue - the analyzer's default value
See Also:
IAnalyzer.setDefaultValue(java.lang.String)

isComplete

public boolean isComplete()
Checks whether current analyzer is fully configured - all necessary parameters are present and the the analysis process can be performed.

Specified by:
isComplete in interface IAnalyzer
Returns:
flag indicating the analyzer's completion state
See Also:
IAnalyzer.isComplete()

parseDate

protected Date parseDate(String text)
                  throws ParseException
Throws:
ParseException

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

equals

public boolean equals(Object obj)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getDatePattern

public String getDatePattern()

setDateFormat

public void setDateFormat(String format)
                   throws IllegalArgumentException
Setter for the date format attribute.

Parameters:
format - the date format to parse
Throws:
IllegalArgumentException - when specified format is not correct


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.