Class Tools
- java.lang.Object
-
- online.ronikier.essw.library.utils.Tools
-
public class Tools extends java.lang.Object
Tools
TODO Implement- Version:
- 1.0
- Author:
- Lukasz Ronikier
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SESSION_DATE_FORMAT
static java.lang.String
TRANSACTION_TIME_FORMAT
-
Constructor Summary
Constructors Constructor Description Tools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
appendZero(int i)
Metoda dodajaca 0 do Stringa z liczb jednocyfrowychstatic java.lang.String
appendZero(java.lang.Double wiggle, int i)
static void
backupFile(java.lang.String path, java.io.File file)
static java.math.BigDecimal
calculateChangeDecimal(java.math.BigDecimal valuePrevious, java.math.BigDecimal valueCurrent)
static java.math.BigDecimal
calculateChangeLong(java.lang.Long valuePrevious, java.lang.Long valueCurrent)
static java.lang.Integer
calculateChangePercent(java.lang.Long valuePrevious, java.lang.Long valueCurrent)
static java.math.BigDecimal
calculateChangeRatioBigDecimal2BigDecimal(java.math.BigDecimal valuePrevious, java.math.BigDecimal valueCurrent)
static java.lang.Long
calculateChangeRatioLong2Long(java.lang.Long valuePrevious, java.lang.Long valueCurrent)
static void
copyFile(java.lang.String path, java.io.File file)
static java.time.LocalDateTime
currentDate()
static java.lang.String
currentDateStringDD_MM_YYYY()
static java.lang.String
currentDateStringYYYYMMDD()
static java.lang.String
currentTimeStringhhMMss()
static long
dateEpochMilli(java.time.LocalDateTime localDateTime)
static java.lang.String
datehhdwukropekmmdwukropekss(java.time.LocalDateTime dateTime, boolean showSeconds)
static java.lang.String
dateStringDDdashMMdashYYYY(java.time.LocalDate dateTime)
static java.lang.String
dateStringDDslashMMstashYYYY(java.time.LocalDate dateTime)
static java.lang.String
dateStringFull(java.time.LocalDateTime date)
static java.lang.String
dateStringhhdashmmdashss(java.util.Date date)
static java.lang.String
dateStringYYYY_MM_DD()
static java.lang.String
dateStringYYYYdashMMdashDD(java.time.LocalDateTime dateTime)
static java.lang.String
formatChartLabel(java.time.LocalDateTime localDateTime)
static java.lang.String
formatFullDateHour(java.time.LocalDateTime localDateTime)
static java.lang.String
formatInvestmentTime(java.time.LocalDateTime localDateTime)
static java.lang.String
formatPrice(double price)
static java.lang.String
getDuration(long start, long stop)
static Transaction
getLatestTransaction(Period period)
static java.lang.String
getLogTime(java.time.LocalDateTime date)
static java.lang.Long
getLongFromDoubleString(java.lang.String doubleString)
static java.lang.Double
getPercent(java.lang.Double doubleValue)
static java.lang.Double
getPercentTwoDigits(java.lang.Double doubleValue)
static java.lang.String
getPeriodTime(java.time.LocalDateTime date)
static java.lang.String
getSessionDate(java.time.LocalDate date)
static java.time.LocalDate
getTestDate()
static java.time.LocalDateTime
getTransactionDateTime(Transaction transaction)
static boolean
isDouble(java.lang.String doubleValue)
static boolean
isInteger(java.lang.String integerValue)
static java.lang.String
monthDay(java.time.LocalDateTime dateTime)
static java.util.List<java.io.File>
parseFilesDirectory(java.lang.String filesDirectory)
static java.time.LocalDateTime
parseTransactionTime(java.lang.String timeString)
static java.lang.String
prependCounter(java.lang.Integer counetValue)
static java.lang.String
prependSpace(int i)
static java.lang.String
prependZero(java.lang.Double doubleValue, int i)
static java.lang.String
prependZero(java.lang.String stringValue, int i)
static int
round(double doubleValue)
static double
roundDOWN(double doubleValue, int decimalPlace)
static double
roundUP(double doubleValue, int decimalPlace)
static java.lang.String
systemPath()
static Period[]
toPeriodArray(java.util.List periodList)
-
-
-
Method Detail
-
parseTransactionTime
public static java.time.LocalDateTime parseTransactionTime(java.lang.String timeString) throws java.text.ParseException
- Parameters:
timeString
-- Returns:
- Throws:
java.text.ParseException
-
dateStringYYYY_MM_DD
public static java.lang.String dateStringYYYY_MM_DD()
-
appendZero
public static java.lang.String appendZero(int i)
Metoda dodajaca 0 do Stringa z liczb jednocyfrowych- Parameters:
i
-- Returns:
-
prependSpace
public static java.lang.String prependSpace(int i)
- Parameters:
i
-- Returns:
-
appendZero
public static java.lang.String appendZero(java.lang.Double wiggle, int i)
- Parameters:
wiggle
-i
-- Returns:
-
prependZero
public static java.lang.String prependZero(java.lang.Double doubleValue, int i)
- Parameters:
wiggle
-i
-- Returns:
-
prependZero
public static java.lang.String prependZero(java.lang.String stringValue, int i)
-
prependCounter
public static java.lang.String prependCounter(java.lang.Integer counetValue)
-
currentDateStringYYYYMMDD
public static java.lang.String currentDateStringYYYYMMDD()
- Returns:
-
currentDateStringDD_MM_YYYY
public static java.lang.String currentDateStringDD_MM_YYYY()
-
currentTimeStringhhMMss
public static java.lang.String currentTimeStringhhMMss()
- Returns:
-
dateStringYYYYdashMMdashDD
public static java.lang.String dateStringYYYYdashMMdashDD(java.time.LocalDateTime dateTime)
- Parameters:
dateTime
-- Returns:
-
dateStringDDdashMMdashYYYY
public static java.lang.String dateStringDDdashMMdashYYYY(java.time.LocalDate dateTime)
- Parameters:
dateTime
-- Returns:
-
dateStringDDslashMMstashYYYY
public static java.lang.String dateStringDDslashMMstashYYYY(java.time.LocalDate dateTime)
- Parameters:
dateTime
-- Returns:
-
monthDay
public static java.lang.String monthDay(java.time.LocalDateTime dateTime)
- Parameters:
dateTime
-- Returns:
-
roundUP
public static double roundUP(double doubleValue, int decimalPlace)
- Parameters:
doubleValue
-decimalPlace
-- Returns:
-
roundDOWN
public static double roundDOWN(double doubleValue, int decimalPlace)
- Parameters:
doubleValue
-decimalPlace
-- Returns:
-
round
public static int round(double doubleValue)
- Parameters:
doubleValue
-- Returns:
-
isDouble
public static boolean isDouble(java.lang.String doubleValue)
- Parameters:
doubleValue
-- Returns:
-
isInteger
public static boolean isInteger(java.lang.String integerValue)
- Parameters:
integerValue
-- Returns:
-
currentDate
public static java.time.LocalDateTime currentDate()
- Returns:
-
getTestDate
public static java.time.LocalDate getTestDate()
- Returns:
-
parseFilesDirectory
public static java.util.List<java.io.File> parseFilesDirectory(java.lang.String filesDirectory)
- Parameters:
stockDataFilesDirectory
-- Returns:
-
getLongFromDoubleString
public static java.lang.Long getLongFromDoubleString(java.lang.String doubleString)
- Parameters:
doubleString
-- Returns:
-
getLatestTransaction
public static Transaction getLatestTransaction(Period period)
- Parameters:
period
-- Returns:
-
toPeriodArray
public static Period[] toPeriodArray(java.util.List periodList)
- Parameters:
periodList
-- Returns:
-
getPercent
public static java.lang.Double getPercent(java.lang.Double doubleValue)
-
getPercentTwoDigits
public static java.lang.Double getPercentTwoDigits(java.lang.Double doubleValue)
-
getLogTime
public static java.lang.String getLogTime(java.time.LocalDateTime date)
-
getPeriodTime
public static java.lang.String getPeriodTime(java.time.LocalDateTime date)
-
getSessionDate
public static java.lang.String getSessionDate(java.time.LocalDate date)
-
formatFullDateHour
public static java.lang.String formatFullDateHour(java.time.LocalDateTime localDateTime)
-
formatChartLabel
public static java.lang.String formatChartLabel(java.time.LocalDateTime localDateTime)
-
formatInvestmentTime
public static java.lang.String formatInvestmentTime(java.time.LocalDateTime localDateTime)
-
datehhdwukropekmmdwukropekss
public static java.lang.String datehhdwukropekmmdwukropekss(java.time.LocalDateTime dateTime, boolean showSeconds)
- Parameters:
dateTime
-showSeconds
-- Returns:
-
dateStringhhdashmmdashss
public static java.lang.String dateStringhhdashmmdashss(java.util.Date date)
- Parameters:
date
-- Returns:
-
dateStringFull
public static java.lang.String dateStringFull(java.time.LocalDateTime date)
- Parameters:
date
-- Returns:
-
getDuration
public static java.lang.String getDuration(long start, long stop)
- Parameters:
start
-stop
-- Returns:
-
formatPrice
public static java.lang.String formatPrice(double price)
- Parameters:
price
-- Returns:
-
getTransactionDateTime
public static java.time.LocalDateTime getTransactionDateTime(Transaction transaction)
- Parameters:
transaction
-- Returns:
-
copyFile
public static void copyFile(java.lang.String path, java.io.File file) throws java.io.IOException
- Parameters:
path
-file
-- Throws:
java.io.IOException
-
backupFile
public static void backupFile(java.lang.String path, java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
dateEpochMilli
public static long dateEpochMilli(java.time.LocalDateTime localDateTime)
-
systemPath
public static java.lang.String systemPath()
-
calculateChangeDecimal
public static java.math.BigDecimal calculateChangeDecimal(java.math.BigDecimal valuePrevious, java.math.BigDecimal valueCurrent)
-
calculateChangeLong
public static java.math.BigDecimal calculateChangeLong(java.lang.Long valuePrevious, java.lang.Long valueCurrent)
-
calculateChangeRatioBigDecimal2BigDecimal
public static java.math.BigDecimal calculateChangeRatioBigDecimal2BigDecimal(java.math.BigDecimal valuePrevious, java.math.BigDecimal valueCurrent)
-
calculateChangeRatioLong2Long
public static java.lang.Long calculateChangeRatioLong2Long(java.lang.Long valuePrevious, java.lang.Long valueCurrent)
-
calculateChangePercent
public static java.lang.Integer calculateChangePercent(java.lang.Long valuePrevious, java.lang.Long valueCurrent)
-
-