public class FrostAPI extends Object
| Constructor and Description |
|---|
FrostAPI() |
| Modifier and Type | Method and Description |
|---|---|
Date |
addDays(Date date,
int amount)
Adds a number of days to a date returning a new object.
|
Date |
addDays(int amount)
Adds a number of days to a date returning a new object.
|
Date |
addHours(Date date,
int amount)
Adds a number of hours to a date returning a new object.
|
Date |
addHours(int amount)
Adds a number of hours to a date returning a new object.
|
Date |
addMilliseconds(Date date,
int amount)
Adds a number of milliseconds to a date returning a new object.
|
Date |
addMilliseconds(int amount)
Adds a number of milliseconds to a date returning a new object.
|
Date |
addMinutes(Date date,
int amount)
Adds a number of minutes to a date returning a new object.
|
Date |
addMinutes(int amount)
Adds a number of minutes to a date returning a new object.
|
Date |
addMonths(Date date,
int amount)
Adds a number of months to a date returning a new object.
|
Date |
addMonths(int amount)
Adds a number of months to a date returning a new object.
|
Date |
addSeconds(Date date,
int amount)
Adds a number of seconds to a date returning a new object.
|
Date |
addSeconds(int amount)
Adds a number of seconds to a date returning a new object.
|
Date |
addTime(@NotNull String input)
A method used to add a set amount of time to today's date, it will take a string and try to convert
it into a valid time format, for example, '12m' will be parsed as 12 minutes and add 12 minutes to
a specific date.
|
void |
addToList(List<Boolean> list,
Boolean value,
boolean condition)
A method used to add a boolean to a list if a condition is met
|
void |
addToList(List<Integer> list,
Integer value,
boolean condition)
A method used to add an integer to a list if a condition is met
|
void |
addToList(List<Object> list,
Object value,
boolean condition)
A method used to add an object to a list if a condition is met
|
void |
addToList(List<String> list,
String value,
boolean condition)
A method used to add a string to a list if a condition is met
|
Date |
addWeeks(Date date,
int amount)
Adds a number of weeks to a date returning a new object.
|
Date |
addWeeks(int amount)
Adds a number of weeks to a date returning a new object.
|
Date |
addYears(Date date,
int amount)
Adds a number of years to a date returning a new object.
|
Date |
addYears(int amount)
Adds a number of years to a date returning a new object.
|
void |
createParent(@NotNull File target)
A method used to create all parent directories for a targeted file.
|
String |
format(boolean stripColor,
ConsoleColor color,
String input,
Object... param)
A method used to format our console colors into the specified input, this method includes
the ability to add parameters by default.
|
String |
format(boolean stripColor,
@NotNull Level level,
String input,
Object... param)
A method used to format our console colors into the specified input, this method includes
the ability to add parameters by default.
|
@NotNull String |
format(boolean stripColor,
String input,
Object... param)
A method used to format a string and translate Bukkit color codes
|
String |
format(ConsoleColor color,
String input,
Object... param)
A method used to format our console colors into the specified input, this method includes
the ability to add parameters by default.
|
String |
format(Date date)
A method used to format a date to a pre-defined pattern
|
String |
format(Level level,
String input,
Object... param)
A method used to format our console colors into the specified input, this method includes
the ability to add parameters by default.
|
String |
format(String pattern,
Date date)
A method used to format a date to a specific pattern
|
@NotNull String |
format(String input,
Object... param)
A method used to format a method to include an array of parameters in the message
using a number format variable (i.e {0}).
|
String |
getExtension(File target)
A method used to get the file extension from a file path
|
String |
getExtension(@NotNull File target,
boolean dotless)
A method used to get the file extension from a file path, Additionally define whether
the extension should contain its '.' character.
|
String |
getExtension(Path path)
A method used to get the file extension from a file path
|
String |
getExtension(@NotNull Path path,
boolean dotless)
A method used to get the file extension from a file path, Additionally define whether
the extension should contain its '.' character.
|
String |
getExtension(String path)
A method used to get the file extension from a string representation of a file path
|
String |
getExtension(@NotNull String path,
boolean dotless)
A method used to get the file extension from a string representation of a file path.
|
static @NotNull FrostAPI |
getInstance()
A method used to return an instance of this api class
|
int |
getLevenshteinDistance(@NotNull String input,
@NotNull String compared)
A method used to return the
LevenshteinDistance between two string, this method will
return and integer that tells you how much of a difference there is between two strings. |
Date |
getToday()
A method used to return the current time
|
String |
getTodayAsString()
A method used to return the current date and time as a string
|
String |
getTodayAsString(String pattern)
A method used to return the current date and time as a string
|
boolean |
isAfterDate(@NotNull Date target,
Date comparedTo)
A method used to test whether a date is after a different date.
|
boolean |
isAfterDate(String target,
String comparedTo)
A method used to test whether a date is after a different date.
|
boolean |
isBeforeDate(@NotNull Date target,
Date comparedTo)
A method used to test whether a date is before a different date.
|
boolean |
isBeforeDate(Date target,
String comparedTo)
A method used to test whether a date is before a different date.
|
boolean |
isBeforeDate(String target,
Date comparedTo)
A method used to test whether a date is before a different date.
|
boolean |
isBeforeDate(String target,
String comparedTo)
A method used to test whether a date is before a different date.
|
String |
matchString(List<String> values,
String input)
A method used to find the closest matching string from inside a list, This method uses
the
LevenshteinDistance class to return this outcome. |
String |
matchString(@NotNull List<String> values,
String input,
double threshold)
A method used to find the closest matching string from inside a list, This method uses
the
LevenshteinDistance class to return this outcome. |
String |
matchString(Object[] values,
String input)
A method used to find the closest matching string from inside an array, This method uses
the
LevenshteinDistance class to return this outcome. |
String |
matchString(Object[] values,
String input,
double threshold)
A method used to find the closest matching string from inside an array, This method uses
the
LevenshteinDistance class to return this outcome. |
String |
matchString(Object value,
String input)
A method used to find the closest matching string from a value, This method uses
the
LevenshteinDistance class to return this outcome. |
String |
matchString(Object value,
String input,
double threshold)
A method used to find the closest matching string from a value, This method uses
the
LevenshteinDistance class to return this outcome. |
Date |
parseDate(String input)
A method used to convert a string to a valid date.
|
int |
parseTime(@NotNull String input)
A method used to turn a string into a valid time, and calculate the amount required.
|
void |
relocateIndex(File target,
File location)
A method used to relocate an index to a new location
|
void |
renameIndex(File target,
String name)
A method used to rename an index
|
void |
renameParent(@NotNull File target,
String name)
A method used to rename the parent directory of an index.
|
@NotNull List<String> |
stripColor(@NotNull List<String> input)
A method used to remove color codes from any given string list this method
will iterate through the list and individually remove color codes.
|
String |
stripColor(String input)
A method used to strip color codes from an input, it will remove any color codes present.
|
@NotNull String[] |
stripColor(@NotNull String[] input)
A method used to remove color codes from any given string list this method
will iterate through the list and individually remove color codes.
|
boolean |
toBoolean(Object target)
A method used to return an object as a boolean
|
int |
toDay(Object amount)
A method used in a runnable.
|
double |
toDouble(Object target)
A method used to return an object as a double
|
File |
toFile(File parent,
@NotNull String path)
A method used to create a file object from a string path.
|
File |
toFile(Path path)
A method used to create a file object from a path.
|
File |
toFile(String path)
A method used to create a file object from a string path.
|
int |
toHour(Object amount)
A method used in a runnable.
|
int |
toInteger(Object target)
A method used to return an object as an integer
|
Locale |
toLocale(@NotNull String target)
A method used to convert a string into a usable locale, this method pairs with the
Apache Commons library to convert the string.
|
int |
toMinute(Object amount)
A method used in a runnable.
|
int |
toSecond(Object amount)
A method used in a runnable.
|
String |
toString(Object target)
A method used to return an object as a string
|
@NotNull public static @NotNull FrostAPI getInstance()
public void createParent(@NotNull
@NotNull File target)
target - The file pathpublic void renameParent(@NotNull
@NotNull File target,
String name)
target - Target filename - New parent namepublic void renameIndex(File target, String name)
target - Target filename - New namepublic void relocateIndex(File target, File location)
target - Target indexlocation - Desired Locationpublic File toFile(String path)
path - Target pathpublic File toFile(Path path)
path - Target pathpublic File toFile(File parent, @NotNull @NotNull String path)
parent - The starting point to the path.path - Target pathpublic String toString(Object target)
target - Target objectpublic boolean toBoolean(Object target)
target - Target objectpublic int toInteger(Object target)
target - Target objectpublic double toDouble(Object target)
target - Target objectpublic Locale toLocale(@NotNull @NotNull String target)
target - Targeted inputpublic Date getToday()
public String getTodayAsString()
public String getTodayAsString(String pattern)
pattern - Date patternpublic int toSecond(Object amount)
amount - Amount of seconds.public int toMinute(Object amount)
amount - Amount of minutes.public int toHour(Object amount)
amount - Amount of hours.public int toDay(Object amount)
amount - Amount of days.public int parseTime(@NotNull
@NotNull String input)
input - String inputpublic Date parseDate(String input)
input - String representation of a date.public Date addYears(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addYears(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addMonths(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addMonths(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addWeeks(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addWeeks(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addDays(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addDays(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addHours(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addHours(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addMinutes(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addMinutes(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addSeconds(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addSeconds(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addMilliseconds(int amount)
Date is unchanged.amount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addMilliseconds(Date date, int amount)
Date is unchanged.date - the date, not nullamount - the amount to add, may be negativeDate with the amount addedIllegalArgumentException - if the date is nullpublic Date addTime(@NotNull @NotNull String input)
input - Target timepublic boolean isBeforeDate(String target, String comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isBeforeDate(String target, Date comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isBeforeDate(Date target, String comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isBeforeDate(@NotNull
@NotNull Date target,
Date comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isAfterDate(String target, String comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isAfterDate(@NotNull
@NotNull Date target,
Date comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public String getExtension(@NotNull @NotNull String path, boolean dotless)
path - String representation of file pathdotless - Whether our return value should contain a '.' characterpublic String getExtension(String path)
path - String representation of file pathpublic String getExtension(@NotNull @NotNull File target, boolean dotless)
target - File pathdotless - Whether our return value should contain a '.' characterpublic String getExtension(File target)
target - File pathpublic String getExtension(@NotNull @NotNull Path path, boolean dotless)
path - File pathdotless - Whether our return value should contain a '.' characterpublic String getExtension(Path path)
path - File pathpublic String format(Date date)
date - Target datepublic String format(String pattern, Date date)
pattern - Desired patterndate - Target date@NotNull public @NotNull String format(String input, Object... param)
input - Target messageparam - Optional params@NotNull public @NotNull String format(boolean stripColor, String input, Object... param)
stripColor - Condition to strip color codesinput - Target messageparam - Optional paramspublic String format(ConsoleColor color, String input, Object... param)
color - Target colorinput - Target messageparam - Optional paramspublic String format(boolean stripColor, ConsoleColor color, String input, Object... param)
stripColor - Strip color codes within the inputcolor - Target colorinput - Target messageparam - Optional paramspublic String format(Level level, String input, Object... param)
level - Level of severityinput - Target messageparam - Optional paramspublic String format(boolean stripColor, @NotNull @NotNull Level level, String input, Object... param)
stripColor - Strip color codes within the inputlevel - Level of severityinput - Target messageparam - Optional paramspublic String stripColor(String input)
input - Target input@NotNull public @NotNull List<String> stripColor(@NotNull @NotNull List<String> input)
input - Target list@NotNull public @NotNull String[] stripColor(@NotNull @NotNull String[] input)
input - Target arraypublic void addToList(List<String> list, String value, boolean condition)
list - Target listvalue - Target valuecondition - Required conditionpublic void addToList(List<Object> list, Object value, boolean condition)
list - Target listvalue - Target valuecondition - Required conditionpublic void addToList(List<Boolean> list, Boolean value, boolean condition)
list - Target listvalue - Target valuecondition - Required conditionpublic void addToList(List<Integer> list, Integer value, boolean condition)
list - Target listvalue - Target valuecondition - Required conditionpublic String matchString(Object[] values, String input, double threshold)
LevenshteinDistance class to return this outcome. If a match cannot be
determined, this method will return null.values - Tested arrayinput - Input being comparedthreshold - Minimum percentage the input needs to matchpublic String matchString(@NotNull @NotNull List<String> values, String input, double threshold)
LevenshteinDistance class to return this outcome. If a match cannot be
determined, this method will return null.values - Tested listinput - Input being comparedthreshold - Minimum percentage the input needs to matchpublic String matchString(Object value, String input, double threshold)
LevenshteinDistance class to return this outcome. If a match cannot be
determined, this method will return null.value - Tested valueinput - Input being comparedthreshold - Minimum percentage the input needs to matchpublic String matchString(List<String> values, String input)
LevenshteinDistance class to return this outcome. If a match cannot be
determined, this method will return null.values - Tested listinput - Input being comparedpublic String matchString(Object[] values, String input)
LevenshteinDistance class to return this outcome. If a match cannot be
determined, this method will return null.values - Tested arrayinput - Input being comparedpublic String matchString(Object value, String input)
LevenshteinDistance class to return this outcome. If a match cannot be
determined, this method will return null.value - Tested valueinput - Input being comparedpublic int getLevenshteinDistance(@NotNull
@NotNull String input,
@NotNull
@NotNull String compared)
LevenshteinDistance between two string, this method will
return and integer that tells you how much of a difference there is between two strings.
"Hello" and you are testing the distance from "Hello World",
this method will return 6 because there are 6 characters between the closest matching string.input - The working inputcompared - The target comparisonCopyright © 2022. All rights reserved.