org.ath.converters
Class ScriptLineCounter

java.lang.Object
  extended by java.lang.Thread
      extended by org.ath.converters.ScriptLineCounter
All Implemented Interfaces:
java.lang.Runnable

public class ScriptLineCounter
extends java.lang.Thread


Nested Class Summary
static class ScriptLineCounter.FileFormats
          Enumeration of the file formats supported.
static class ScriptLineCounter.InputFileState
          Enumeration of the supported input file types that also returns the corresponding file extension.
static class ScriptLineCounter.OutputFileState
          Enumeration of the supported output file types that also returns the corresponding file extension.
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.lang.String APP_NAME
           
static java.lang.String APP_VERSION
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ScriptLineCounter()
          Default Constructor
ScriptLineCounter(ScriptLineCounter origin)
          Copy Constructor.
 
Method Summary
 void addCharacterMapping(java.lang.String character, java.lang.String mapping)
          Add a new character mapping set
 void addIgnoreCharacter(java.lang.String character)
          Add to ignore list, stored in lowercase.
 ScriptLineCounter.FileFormats getActiveFileFormat()
           
 java.lang.String getACTOR_TITLE()
           
 int getCHARACTER_MAX_PARTS()
           
 java.lang.String getCHARACTER_TITLE()
           
 java.util.List<java.lang.String> getCharacterIgnore()
           
 java.util.SortedMap<java.lang.String,java.lang.String> getCharacterMapping()
           
 java.util.Map<java.lang.String,java.lang.String> getCharacterNames()
           
 java.lang.String getCSV_COLUMN_NAME()
           
 java.lang.String getCSV_COLUMN_TEXT()
           
 int getCSV_SKIP_LINES()
           
 java.lang.String getDbgfile()
           
 int getDbglevel()
           
 int getDetectLines()
           
 java.lang.String getDirectory()
           
 java.lang.String getEncoding()
           
 java.lang.String getEPISODE_TITLE()
           
 java.util.SortedMap<java.lang.Integer,Episode> getEpisodes()
           
 java.lang.String getExcelfile()
           
static java.lang.String getExceptionMsg(java.lang.Exception exception)
          Convert an exception into a string
 java.lang.String getEXTRAINFO_TITLE()
           
 java.lang.String getEXTRANAMES_TITLE()
           
 java.lang.String getFileFilter()
           
 SLCGui getGui()
           
 java.lang.String getIGNOREDNAMES_TITLE()
           
 java.lang.String getMatch()
           
 java.lang.String getPassword()
           
 java.lang.String getTOTAL_TITLE()
           
 boolean isAlternateLines()
           
 boolean isConsoleMode()
           
 boolean isConsoleVerbose()
           
 boolean isCountSeparateLines()
           
 boolean isDbg()
           
 boolean isDisplayZero()
           
 boolean isEncodingIsSet()
           
 boolean isExcelExtra()
           
 boolean isGuiMode()
           
 boolean isIgnoreCharacter(java.lang.String character)
          Check to see if this is an ignored character.
 boolean isIgnoreMinimal()
           
 boolean isIncludeReacts()
           
 boolean isNoConsole()
           
 boolean isOutputContent()
           
 boolean isRunning()
           
 boolean isSortedByLines()
           
 boolean isSortedByName()
           
 void run()
          Main entry-point.
 void setActiveFileFormat(ScriptLineCounter.FileFormats fileFormats)
           
 void setActiveFileFormat(java.lang.String newFileFormat)
          Usable names: 0 .. 4 (and up to the matching name of the FileFormats enumeration)
 void setACTOR_TITLE(java.lang.String ACTOR_TITLE)
           
 void setAlternateLines(boolean alternateLines)
           
 void setCHARACTER_MAX_PARTS(int cHARACTER_MAX_PARTS)
           
 void setCHARACTER_TITLE(java.lang.String CHARACTER_TITLE)
           
 void setCharacterName(java.lang.String characterName, java.lang.String actorName)
           
 void setConsoleMode(boolean consoleMode)
           
 void setConsoleVerbose(boolean consoleVerbose)
           
 void setCountSeparateLines(boolean countSeparateLines)
           
 void setCSV_COLUMN_NAME(java.lang.String cSV_COLUMN_NAME)
           
 void setCSV_COLUMN_TEXT(java.lang.String cSV_COLUMN_TEXT)
           
 void setCSV_SKIP_LINES(int cSV_SKIP_LINES)
           
 void setDbg(boolean dbg)
           
 void setDbgfile(java.lang.String dbgfile)
           
 void setDbglevel(int dbglevel)
           
 void setDetectLines(int detectLines)
           
 void setDirectory(java.lang.String directory)
           
 void setDisplayZero(boolean displayZero)
           
 void setEncoding(java.lang.String encoding)
           
 void setEncodingIsSet(boolean encodingIsSet)
           
 void setEPISODE_TITLE(java.lang.String EPISODE_TITLE)
           
 void setExcelExtra(boolean excelExtra)
           
 void setExcelfile(java.lang.String excelfile)
           
 void setEXTRAINFO_TITLE(java.lang.String eXTRAINFO_TITLE)
           
 void setEXTRANAMES_TITLE(java.lang.String eXTRANAMES_TITLE)
           
 void setFileFilter(java.lang.String fileFilter)
           
 void setGui(SLCGui gui)
           
 void setGuiMode(boolean guiMode)
           
 void setIGNOREDNAMES_TITLE(java.lang.String iGNOREDNAMES_TITLE)
           
 void setIgnoreMinimal(boolean ignoreMinimal)
           
 void setIncludeReacts(boolean includeReacts)
           
 void setMatch(java.lang.String match)
           
 void setNoConsole(boolean noConsole)
           
 void setOutputContent(boolean outputContent)
           
 void setPassword(java.lang.String password)
           
 void setSortedByLines(boolean linesSorted)
           
 void setSortedByName(boolean nameSorted)
           
 void setTOTAL_TITLE(java.lang.String TOTAL_TITLE)
           
static java.lang.String StrRepeat(java.lang.String str, int repeats)
          Repeat a string a few times
 void writeErrorLog(java.lang.String msg)
          Write an error message to the console (if quiet isn't set) and also to the log, if enabled.
 void writeLogLine(int level, java.lang.String msg)
          Write a log line if the debug-level is at least level.
 void writeLogLine(java.lang.String msg)
          Write a time-stamped message to the log file, if the name is know and debugging is enabled.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

APP_NAME

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

APP_VERSION

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

ScriptLineCounter

public ScriptLineCounter()
Default Constructor


ScriptLineCounter

public ScriptLineCounter(ScriptLineCounter origin)
Copy Constructor.

Parameters:
origin -
Method Detail

run

public void run()
Main entry-point.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

StrRepeat

public static java.lang.String StrRepeat(java.lang.String str,
                                         int repeats)
Repeat a string a few times

Parameters:
str - the input
repeats - this number of times
Returns:
the new string

getExceptionMsg

public static java.lang.String getExceptionMsg(java.lang.Exception exception)
Convert an exception into a string

Parameters:
exception - an exception to convert into a message
Returns:
The errormessage and stacktrace as a \n separated string

writeErrorLog

public void writeErrorLog(java.lang.String msg)
Write an error message to the console (if quiet isn't set) and also to the log, if enabled.

Parameters:
msg - The message

writeLogLine

public void writeLogLine(java.lang.String msg)
Write a time-stamped message to the log file, if the name is know and debugging is enabled.

Parameters:
msg - The message

writeLogLine

public void writeLogLine(int level,
                         java.lang.String msg)
Write a log line if the debug-level is at least level.

Parameters:
level - the level to trigger at
msg - the message to log

isDbg

public boolean isDbg()
Returns:
the dbg

setDbg

public void setDbg(boolean dbg)
Parameters:
dbg - the dbg to set

getDbgfile

public java.lang.String getDbgfile()
Returns:
the dbgfile

setDbgfile

public void setDbgfile(java.lang.String dbgfile)
Parameters:
dbgfile - the dbgfile to set

getDbglevel

public int getDbglevel()
Returns:
the debug level

setDbglevel

public void setDbglevel(int dbglevel)
Parameters:
dbglevel - the debug level to set

getEpisodes

public java.util.SortedMap<java.lang.Integer,Episode> getEpisodes()
Returns:
the set of episodes, sorted.

isIncludeReacts

public boolean isIncludeReacts()
Returns:
the includeReacts

setIncludeReacts

public void setIncludeReacts(boolean includeReacts)
Parameters:
includeReacts - the includeReacts to set

isConsoleMode

public boolean isConsoleMode()
Returns:
the consoleMode

setConsoleMode

public void setConsoleMode(boolean consoleMode)
Parameters:
consoleMode - the consoleMode to set

isConsoleVerbose

public boolean isConsoleVerbose()
Returns:
the consoleVerbose

setConsoleVerbose

public void setConsoleVerbose(boolean consoleVerbose)
Parameters:
consoleVerbose - the consoleVerbose to set

isNoConsole

public boolean isNoConsole()
Returns:
the noConsole

setNoConsole

public void setNoConsole(boolean noConsole)
Parameters:
noConsole - the noConsole to set

getExcelfile

public java.lang.String getExcelfile()
Returns:
the excelfile

setExcelfile

public void setExcelfile(java.lang.String excelfile)
Parameters:
excelfile - the excelfile to set

isGuiMode

public boolean isGuiMode()
Returns:
the guiMode

setGuiMode

public void setGuiMode(boolean guiMode)
Parameters:
guiMode - the guiMode to set

getGui

public SLCGui getGui()
Returns:
the gui

setGui

public void setGui(SLCGui gui)
Parameters:
gui - the gui to set

getDirectory

public java.lang.String getDirectory()
Returns:
the directory

setDirectory

public void setDirectory(java.lang.String directory)
Parameters:
directory - the directory to set

getMatch

public java.lang.String getMatch()
Returns:
the match

setMatch

public void setMatch(java.lang.String match)
Parameters:
match - the match to set

isSortedByLines

public boolean isSortedByLines()
Returns:
the linesSorted

setSortedByLines

public void setSortedByLines(boolean linesSorted)
Parameters:
linesSorted - the linesSorted to set

isSortedByName

public boolean isSortedByName()
Returns:
the nameSorted

setSortedByName

public void setSortedByName(boolean nameSorted)
Parameters:
nameSorted - the nameSorted to set

getFileFilter

public java.lang.String getFileFilter()
Returns:
the fileFilter

setFileFilter

public void setFileFilter(java.lang.String fileFilter)
Parameters:
fileFilter - the fileFilter to set

isAlternateLines

public boolean isAlternateLines()
Returns:
the alternateLines

setAlternateLines

public void setAlternateLines(boolean alternateLines)
Parameters:
alternateLines - the alternateLines to set

isDisplayZero

public boolean isDisplayZero()
Returns:
the displayZero

setDisplayZero

public void setDisplayZero(boolean displayZero)
Parameters:
displayZero - the displayZero to set

getDetectLines

public int getDetectLines()
Returns:
the detectLines

setDetectLines

public void setDetectLines(int detectLines)
Parameters:
detectLines - the detectLines to set

isRunning

public boolean isRunning()
Returns:
the running

getCHARACTER_TITLE

public java.lang.String getCHARACTER_TITLE()
Returns:
the CHARACTER_TITLE

setCHARACTER_TITLE

public void setCHARACTER_TITLE(java.lang.String CHARACTER_TITLE)
Parameters:
CHARACTER_TITLE - the CHARACTER_TITLE to set

getACTOR_TITLE

public java.lang.String getACTOR_TITLE()
Returns:
the ACTOR_TITLE

setACTOR_TITLE

public void setACTOR_TITLE(java.lang.String ACTOR_TITLE)
Parameters:
ACTOR_TITLE - the ACTOR_TITLE to set

getEPISODE_TITLE

public java.lang.String getEPISODE_TITLE()
Returns:
the EPISODE_TITLE

setEPISODE_TITLE

public void setEPISODE_TITLE(java.lang.String EPISODE_TITLE)
Parameters:
EPISODE_TITLE - the EPISODE_TITLE to set

getTOTAL_TITLE

public java.lang.String getTOTAL_TITLE()
Returns:
the TOTAL_TITLE

setTOTAL_TITLE

public void setTOTAL_TITLE(java.lang.String TOTAL_TITLE)
Parameters:
TOTAL_TITLE - the tOTAL_TITLE to set

getEXTRAINFO_TITLE

public java.lang.String getEXTRAINFO_TITLE()
Returns:
the eXTRAINFO_TITLE

setEXTRAINFO_TITLE

public void setEXTRAINFO_TITLE(java.lang.String eXTRAINFO_TITLE)
Parameters:
eXTRAINFO_TITLE - the eXTRAINFO_TITLE to set

getEXTRANAMES_TITLE

public java.lang.String getEXTRANAMES_TITLE()
Returns:
the eXTRANAMES_TITLE

setEXTRANAMES_TITLE

public void setEXTRANAMES_TITLE(java.lang.String eXTRANAMES_TITLE)
Parameters:
eXTRANAMES_TITLE - the eXTRANAMES_TITLE to set

getIGNOREDNAMES_TITLE

public java.lang.String getIGNOREDNAMES_TITLE()
Returns:
the iGNOREDNAMES_TITLE

setIGNOREDNAMES_TITLE

public void setIGNOREDNAMES_TITLE(java.lang.String iGNOREDNAMES_TITLE)
Parameters:
iGNOREDNAMES_TITLE - the iGNOREDNAMES_TITLE to set

getCharacterIgnore

public java.util.List<java.lang.String> getCharacterIgnore()
Returns:
the ignoreCharacters

addIgnoreCharacter

public void addIgnoreCharacter(java.lang.String character)
Add to ignore list, stored in lowercase.

Parameters:
character -

isIgnoreCharacter

public boolean isIgnoreCharacter(java.lang.String character)
Check to see if this is an ignored character.

Parameters:
character -
Returns:
true if character is in the list of ignored characters

getCharacterNames

public java.util.Map<java.lang.String,java.lang.String> getCharacterNames()
Returns:
the characterNames

setCharacterName

public void setCharacterName(java.lang.String characterName,
                             java.lang.String actorName)
Parameters:
characterName - the characterName to set
actorName - the actor playing the character

getPassword

public java.lang.String getPassword()
Returns:
the password

setPassword

public void setPassword(java.lang.String password)
Parameters:
password - the password to set

getEncoding

public java.lang.String getEncoding()
Returns:
the encoding

isEncodingIsSet

public boolean isEncodingIsSet()
Returns:
the encodingIsSet

setEncodingIsSet

public void setEncodingIsSet(boolean encodingIsSet)
Parameters:
encodingIsSet - the encodingIsSet to set

setEncoding

public void setEncoding(java.lang.String encoding)
Parameters:
encoding - the encoding to set

isCountSeparateLines

public boolean isCountSeparateLines()
Returns:
the countSeparateLines

setCountSeparateLines

public void setCountSeparateLines(boolean countSeparateLines)
Parameters:
countSeparateLines - the countSeparateLines to set

isOutputContent

public boolean isOutputContent()
Returns:
the outputContent

setOutputContent

public void setOutputContent(boolean outputContent)
Parameters:
outputContent - the outputContent to set

isIgnoreMinimal

public boolean isIgnoreMinimal()
Returns:
the ignoreMinimal

setIgnoreMinimal

public void setIgnoreMinimal(boolean ignoreMinimal)
Parameters:
ignoreMinimal - the ignoreMinimal to set

isExcelExtra

public boolean isExcelExtra()
Returns:
the excelExtra

setExcelExtra

public void setExcelExtra(boolean excelExtra)
Parameters:
excelExtra - the excelExtra to set

addCharacterMapping

public void addCharacterMapping(java.lang.String character,
                                java.lang.String mapping)
Add a new character mapping set

Parameters:
character - the character to map to
mapping - a list of , or ; separated character names to convert to 'character'

getCharacterMapping

public java.util.SortedMap<java.lang.String,java.lang.String> getCharacterMapping()
Returns:
the characterMapping map

getActiveFileFormat

public ScriptLineCounter.FileFormats getActiveFileFormat()
Returns:
the activeFileFormat

setActiveFileFormat

public void setActiveFileFormat(java.lang.String newFileFormat)
Usable names: 0 .. 4 (and up to the matching name of the FileFormats enumeration)

Parameters:
newFileFormat - the activeFileFormat to set

setActiveFileFormat

public void setActiveFileFormat(ScriptLineCounter.FileFormats fileFormats)

getCSV_COLUMN_NAME

public java.lang.String getCSV_COLUMN_NAME()
Returns:
the cSV_COLUMN_NAME

setCSV_COLUMN_NAME

public void setCSV_COLUMN_NAME(java.lang.String cSV_COLUMN_NAME)
Parameters:
cSV_COLUMN_NAME - the cSV_COLUMN_NAME to set

getCSV_COLUMN_TEXT

public java.lang.String getCSV_COLUMN_TEXT()
Returns:
the cSV_COLUMN_TEXT

setCSV_COLUMN_TEXT

public void setCSV_COLUMN_TEXT(java.lang.String cSV_COLUMN_TEXT)
Parameters:
cSV_COLUMN_TEXT - the cSV_COLUMN_TEXT to set

getCSV_SKIP_LINES

public int getCSV_SKIP_LINES()
Returns:
the cSV_SKIP_LINES

setCSV_SKIP_LINES

public void setCSV_SKIP_LINES(int cSV_SKIP_LINES)
Parameters:
cSV_SKIP_LINES - the cSV_SKIP_LINES to set

getCHARACTER_MAX_PARTS

public int getCHARACTER_MAX_PARTS()
Returns:
the cHARACTER_MAX_PARTS

setCHARACTER_MAX_PARTS

public void setCHARACTER_MAX_PARTS(int cHARACTER_MAX_PARTS)
Parameters:
cHARACTER_MAX_PARTS - the cHARACTER_MAX_PARTS to set