|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectadams.core.ConsoleObject
adams.core.option.AbstractOptionHandler
adams.flow.core.AbstractActor
adams.flow.transformer.AbstractTransformer
adams.flow.transformer.TwitterConverter
public class TwitterConverter
Turns a Twitter tweet or status into different representation.
Please note that tweet and status objects differ in what fields are available:
- tweet-specific: LANGUAGE_CODE
- status-specific: PLACE, COUNTRY, COUNTRY_CODE
Also, GEO location data might not be available.
For more information on the date format, see:
Javadoc. java.text.SimpleDateFormat.
@misc{missing_id,
author = {Javadoc},
title = {java.text.SimpleDateFormat},
HTTP = {http://download.oracle.com/javase/1,5.0/docs/api/java/text/SimpleDateFormat.html}
}
Input/output:-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: TwitterConverter
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-stop-flow-on-error (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors.
-output-type <STRING|INSTANCE> (property: outputType) The type of output to generate. default: STRING
-field <ID|USER_ID|USER_NAME|SOURCE|TEXT|CREATED|GEO_LATITUDE|GEO_LONGITUDE|LANGUAGE_CODE|PLACE|COUNTRY|COUNTRY_CODE> [-field ...] (property: fields) The fields to use for generating the output. default: TEXT
-separator <java.lang.String> (property: separator) The separator to use when generating strings as output; tab, new line, carriage return and backslash need to be escaped, ie, ' ', ' ', ' ', '\'. default: \t
-quote (property: quote) If enabled all sub-strings are quoted if necessary when generating string output.
-date-format <java.lang.String> (property: dateFormat) The format for the dates. default: yyyy-MM-dd HH:mm:ss
| Nested Class Summary | |
|---|---|
static class |
TwitterConverter.OutputType
The output to generate. |
static class |
TwitterConverter.TwitterField
The available fields for generating the output. |
| Field Summary | |
|---|---|
static String |
BACKUP_HEADER
the key for storing the current header in the backup. |
protected String |
m_DateFormat
for format for dates. |
protected DateFormat |
m_DateFormatter
for formatting/parsing dates. |
protected TwitterConverter.TwitterField[] |
m_Fields
the fields to generate the output from. |
protected Instances |
m_Header
the dataset header when generating Instance objects. |
protected TwitterConverter.OutputType |
m_OutputType
the type of output to generate. |
protected boolean |
m_Quote
whether to quote strings. |
protected String |
m_Separator
the separator, when generating a string. |
| Fields inherited from class adams.flow.transformer.AbstractTransformer |
|---|
BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken |
| Fields inherited from class adams.flow.core.AbstractActor |
|---|
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_FullName, m_Headless, m_Name, m_Parent, m_Root, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated |
| Fields inherited from class adams.core.option.AbstractOptionHandler |
|---|
m_DebugLevel, m_OptionManager |
| Fields inherited from interface adams.flow.core.Actor |
|---|
FILE_EXTENSION, FILE_EXTENSION_GZ |
| Constructor Summary | |
|---|---|
TwitterConverter()
|
|
| Method Summary | |
|---|---|
Class[] |
accepts()
Returns the class that the consumer accepts. |
protected Hashtable<String,Object> |
backupState()
Backs up the current state of the actor before update the variables. |
String |
dateFormatTipText()
Returns the tip text for this property. |
void |
defineOptions()
Adds options to the internal list of options. |
protected String |
doExecute()
Executes the flow item. |
String |
fieldsTipText()
Returns the tip text for this property. |
protected void |
generateHeader()
Generates the dataset header, if necessary. |
Class[] |
generates()
Returns the class of objects that it generates. |
String |
getDateFormat()
Returns the current date format. |
protected DateFormat |
getDateFormatter()
Returns the date formatter to use. |
TwitterConverter.TwitterField[] |
getFields()
Returns the fields to generate the output from. |
TwitterConverter.OutputType |
getOutputType()
Returns the type of output to generate. |
String |
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI. |
boolean |
getQuote()
Returns whether to quote the sub-strings when generating string output. |
String |
getSeparator()
Returns the separator in use. |
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on. |
String |
globalInfo()
Returns a string describing the object. |
protected void |
initialize()
Initializes the members. |
String |
outputTypeTipText()
Returns the tip text for this property. |
protected Token |
processFields(Hashtable<TwitterConverter.TwitterField,Object> fields)
Creates an output token from the given fields. |
protected Hashtable<TwitterConverter.TwitterField,Object> |
processStatus(twitter4j.Status status)
Processes the specified status. |
protected Hashtable<TwitterConverter.TwitterField,Object> |
processTweet(twitter4j.Tweet tweet)
Processes the specified tweet. |
protected void |
pruneBackup()
Removes entries from the backup. |
String |
quoteTipText()
Returns the tip text for this property. |
protected void |
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated. |
String |
separatorTipText()
Returns the tip text for this property. |
void |
setDateFormat(String value)
Sets the date format. |
void |
setFields(TwitterConverter.TwitterField[] value)
Sets fields to generate the output from. |
void |
setOutputType(TwitterConverter.OutputType value)
Sets the type of output to generate. |
void |
setQuote(boolean value)
Sets whether to quote the sub-strings when generating string output. |
void |
setSeparator(String value)
Sets the separator to use. |
| Methods inherited from class adams.flow.transformer.AbstractTransformer |
|---|
execute, hasPendingOutput, input, output, postExecute, reset, wrapUp |
| Methods inherited from class adams.core.option.AbstractOptionHandler |
|---|
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString |
| Methods inherited from class adams.core.ConsoleObject |
|---|
getDebugging, getSystemErr, getSystemOut |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface adams.flow.core.Actor |
|---|
cleanUp, compareTo, debug, destroy, equals, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFullName, getName, getNextSibling, getParent, getPreviousSibling, getRoot, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setUp, setVariables, sizeOf, stopExecution, stopExecution, variableChanged |
| Methods inherited from interface adams.core.AdditionalInformationHandler |
|---|
getAdditionalInformation |
| Methods inherited from interface adams.core.option.OptionHandler |
|---|
cleanUpOptions, getOptionManager |
| Field Detail |
|---|
public static final String BACKUP_HEADER
protected TwitterConverter.OutputType m_OutputType
protected TwitterConverter.TwitterField[] m_Fields
protected String m_Separator
protected boolean m_Quote
protected Instances m_Header
protected String m_DateFormat
protected transient DateFormat m_DateFormatter
| Constructor Detail |
|---|
public TwitterConverter()
| Method Detail |
|---|
public String globalInfo()
globalInfo in class AbstractOptionHandlerpublic TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic void defineOptions()
defineOptions in interface OptionHandlerdefineOptions in class AbstractActorprotected void initialize()
initialize in class AbstractActorpublic void setOutputType(TwitterConverter.OutputType value)
value - the typepublic TwitterConverter.OutputType getOutputType()
public String outputTypeTipText()
public void setFields(TwitterConverter.TwitterField[] value)
value - the fieldspublic TwitterConverter.TwitterField[] getFields()
public String fieldsTipText()
public void setSeparator(String value)
value - the separatorpublic String getSeparator()
public String separatorTipText()
public void setQuote(boolean value)
value - if true then the sub-strings get quotedpublic boolean getQuote()
public String quoteTipText()
public void setDateFormat(String value)
value - the separatorpublic String getDateFormat()
public String dateFormatTipText()
public String getQuickInfo()
getQuickInfo in interface QuickInfoSupportergetQuickInfo in interface ActorgetQuickInfo in class AbstractActorpublic Class[] accepts()
accepts in interface InputConsumerpublic Class[] generates()
generates in interface OutputProducerprotected void pruneBackup()
pruneBackup in class AbstractActorprotected Hashtable<String,Object> backupState()
backupState in class AbstractTransformerprotected void restoreState(Hashtable<String,Object> state)
restoreState in class AbstractTransformerstate - the backup of the state to restore fromprotected DateFormat getDateFormatter()
protected void generateHeader()
protected Hashtable<TwitterConverter.TwitterField,Object> processTweet(twitter4j.Tweet tweet)
tweet - the tweet to process
protected Hashtable<TwitterConverter.TwitterField,Object> processStatus(twitter4j.Status status)
status - the status to process
protected Token processFields(Hashtable<TwitterConverter.TwitterField,Object> fields)
fields - the data to use
protected String doExecute()
doExecute in class AbstractActor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||