|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.mytrendtimer.trendtimer.Checker
public class Checker
Generic implementation of some checks for : config file content (datatypes, mandatory etc...), current situation (result of last calculation), arguments given to the main method. This class also increase the number of (WARN) warnings found and raise (ERROR) exception.
| Field Summary | |
|---|---|
static int |
MAX_DAILY_PERC_QUOTE_CHANGE_ERR
Raise Fatal Error daily quote percent change if above that. |
static int |
NBR_DAY_OBSOLETE_QUOTE_WARN
Number of days before the current date before last quote in file is considered obsolete (and a warning is raised) |
static float |
SIGNAL_STRENGTH_HIGHER_LIMIT_WARN
Higher signal strength. |
static float |
SIGNAL_STRENGTH_LOWER_LIMIT_WARN
Lower signal strength. |
| Constructor Summary | |
|---|---|
Checker(java.util.Date referenceDateArg,
java.util.Date currentQuoteDateArg,
float currentStrengthArg,
float currentOsc2Arg,
float currentQuoteArg,
QuoteSourceFile quoteSourceFileArg)
Main constructor used to store data about current situation (result of last calculation). |
|
| Method Summary | |
|---|---|
static void |
checkArgRelationship(int osc1DaysArg,
int osc2DaysArg)
ERROR : Check arg1 and arg2 relationship |
static int[] |
checkArgs(java.lang.String[] argsToCheck)
ERROR : Check that we have the correct number of arguments and that integers passed arguments to the main method are correct. |
static void |
checkBigPercChange(float percChangeArg,
int maxDailyPercQuoteChangeWarnNameArg,
java.lang.String quoteDateArg,
int lineNumberArg,
MyTrendTimer myTTArg)
WARN : Check for big percent change in quote file |
static void |
checkDateGap(int dateDiffInDaysArg,
int maxDayGapWarnNameArg,
java.lang.String quoteDateArg,
int lineNumberArg,
MyTrendTimer myTTArg)
WARN : Check for date gap in quote file |
static void |
checkDuplicateQuote(float quoteArg,
float prevQuoteArg,
java.lang.String quoteDateArg,
int fileLineNumberArg,
MyTrendTimer myTTArg)
WARN : Check duplicate quotes (same quote for 2 consecutive days) |
static void |
checkHoleSplit(float percChangeArg,
java.lang.String quoteDateArg,
int lineNumberArg,
QuoteSourceFile quoteSrcArg)
ERROR : Check for hole (split) in quote file |
static boolean |
checkIsBoolean(java.lang.String boolToCheckArg)
Check value is a real boolean and return it. |
static float |
checkIsFloat(java.lang.String floatToCheckArg,
java.lang.String errorMsgArg)
ERROR : Check value is a float and return it |
static int |
checkIsInteger(java.lang.String intToCheckArg,
java.lang.String errorMsgArg)
ERROR : Check value is an integer and return it |
static void |
checkIsWritableDir(java.lang.String dirToCheckArg,
java.lang.String errorMsgArg)
ERROR : Check that we have a writable directory |
static void |
checkNbrOfDigits(int nbrOfDigitsNameArg)
ERROR : Check number of digits provided in xml config file |
static void |
checkNegativeQuote(float quoteArg,
int fileLineNumberArg,
QuoteSourceFile quoteSrcArg)
ERROR : Check negative quote |
static void |
checkNotNull(java.lang.String strToCheckArg,
java.lang.String errorMsgArg)
ERROR : Check value is not null. |
boolean |
checkObsolete(MyTrendTimer myTTArg)
WARN : Check that last price is not obsolete |
boolean |
checkQuoteBelowOcs2(MyTrendTimer myTTArg)
WARN : Check that last price is above long term trend (osc2) |
boolean |
checkSignalStrength(MyTrendTimer myTTArg)
WARN : Check that signal strength is in boundary |
static void |
checkSortOrder(int dateDiffInDaysArg,
java.lang.String quoteDateArg,
int lineNumberArg,
QuoteSourceFile quoteSrcArg)
ERROR : Check sort order of quote file |
static void |
checkYScaleRelationship(int minYaxisArg,
int maxYaxisArg)
ERROR : Check minYaxis and maxYaxis relationship |
static void |
checkZeroQuote(float quoteArg,
int fileLineNumberArg,
QuoteSourceFile quoteSrcArg)
ERROR : Check zero quote |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_DAILY_PERC_QUOTE_CHANGE_ERR
public static final int NBR_DAY_OBSOLETE_QUOTE_WARN
public static final float SIGNAL_STRENGTH_HIGHER_LIMIT_WARN
public static final float SIGNAL_STRENGTH_LOWER_LIMIT_WARN
| Constructor Detail |
|---|
public Checker(java.util.Date referenceDateArg,
java.util.Date currentQuoteDateArg,
float currentStrengthArg,
float currentOsc2Arg,
float currentQuoteArg,
QuoteSourceFile quoteSourceFileArg)
throws java.lang.Exception
referenceDateArg - Date used as a reference (usually today) to see if quote is obsolete.currentQuoteDateArg - Last date in filecurrentStrengthArg - Last strength calculatedcurrentOsc2Arg - Last Osc2 calculatedcurrentQuoteArg - Last quote in file
java.lang.Exception| Method Detail |
|---|
public static void checkArgRelationship(int osc1DaysArg,
int osc2DaysArg)
throws java.lang.Exception
osc1DaysArg - The arg1osc2DaysArg - The arg2
java.lang.Exception
public static int[] checkArgs(java.lang.String[] argsToCheck)
throws java.lang.Exception
argsToCheck - Same than args array in the main method
java.lang.Exception
public static void checkBigPercChange(float percChangeArg,
int maxDailyPercQuoteChangeWarnNameArg,
java.lang.String quoteDateArg,
int lineNumberArg,
MyTrendTimer myTTArg)
percChangeArg - The daily percent change between 2 quotesmaxDailyPercQuoteChangeWarnNameArg - The maximum before warningquoteDateArg - The date of the quotelineNumberArg - The lineNumber of the file where error was found
public static void checkDateGap(int dateDiffInDaysArg,
int maxDayGapWarnNameArg,
java.lang.String quoteDateArg,
int lineNumberArg,
MyTrendTimer myTTArg)
dateDiffInDaysArg - The difference in days, negative or zero when wrong dates are found in quote file.maxDayGapWarnNameArg - The maximum before warningquoteDateArg - The date of the quotelineNumberArg - The lineNumber of the file where error was found
public static void checkDuplicateQuote(float quoteArg,
float prevQuoteArg,
java.lang.String quoteDateArg,
int fileLineNumberArg,
MyTrendTimer myTTArg)
quoteArg - The quoteprevQuoteArg - The previous quotequoteDateArg - The date of the quotefileLineNumberArg - The line number where error was found in file.
public static void checkHoleSplit(float percChangeArg,
java.lang.String quoteDateArg,
int lineNumberArg,
QuoteSourceFile quoteSrcArg)
throws java.lang.Exception
percChangeArg - The daily percent change between 2 quotesquoteDateArg - The date of the quotelineNumberArg - The lineNumber of the file where error was found
java.lang.Exceptionpublic static boolean checkIsBoolean(java.lang.String boolToCheckArg)
boolToCheckArg - The supposed boolean to be checked
public static float checkIsFloat(java.lang.String floatToCheckArg,
java.lang.String errorMsgArg)
throws java.lang.Exception
floatToCheckArg - The supposed integer to be checkederrorMsgArg - The dynamic error message to raise
java.lang.Exception
public static int checkIsInteger(java.lang.String intToCheckArg,
java.lang.String errorMsgArg)
throws java.lang.Exception
intToCheckArg - The supposed integer to be checkederrorMsgArg - The dynamic error message to raise
java.lang.Exception
public static void checkIsWritableDir(java.lang.String dirToCheckArg,
java.lang.String errorMsgArg)
throws java.lang.Exception
dirToCheckArg - The directory to be checkederrorMsgArg - The dynamic error message to raise
java.lang.Exception
public static void checkNbrOfDigits(int nbrOfDigitsNameArg)
throws java.lang.Exception
nbrOfDigitsNameArg - The number of digits retreived from xml config file
java.lang.Exception
public static void checkNegativeQuote(float quoteArg,
int fileLineNumberArg,
QuoteSourceFile quoteSrcArg)
throws java.lang.Exception
quoteArg - The quotefileLineNumberArg - The line number where error was found in file.
java.lang.Exception
public static void checkNotNull(java.lang.String strToCheckArg,
java.lang.String errorMsgArg)
throws java.lang.Exception
strToCheckArg - The mandatory String to be checkederrorMsgArg - The dynamic error message to raise
java.lang.Exception
public boolean checkObsolete(MyTrendTimer myTTArg)
throws java.lang.Exception
java.lang.Exceptionpublic boolean checkQuoteBelowOcs2(MyTrendTimer myTTArg)
public boolean checkSignalStrength(MyTrendTimer myTTArg)
public static void checkSortOrder(int dateDiffInDaysArg,
java.lang.String quoteDateArg,
int lineNumberArg,
QuoteSourceFile quoteSrcArg)
throws java.lang.Exception
dateDiffInDaysArg - The difference in days, negative or zero when wrong dates are found in quote file.quoteDateArg - The date of the quotelineNumberArg - The lineNumber of the file where error was found
java.lang.Exception
public static void checkYScaleRelationship(int minYaxisArg,
int maxYaxisArg)
throws java.lang.Exception
minYaxisArg - The minYaxis (lowest value on Y scale)maxYaxisArg - The maxYaxis (highest value on Y scale)
java.lang.Exception
public static void checkZeroQuote(float quoteArg,
int fileLineNumberArg,
QuoteSourceFile quoteSrcArg)
throws java.lang.Exception
quoteArg - The quotefileLineNumberArg - The line number where error was found in file.
java.lang.Exception
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||