public final class IrCoreUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
ALL |
static double |
DEFAULT_ABSOLUTE_TOLERANCE
Default absolute tolerance in micro seconds.
|
static Charset |
DEFAULT_CHARSET
"Dumb" Charset
|
static String |
DEFAULT_CHARSET_NAME
"Dumb" Charset name
|
static double |
DEFAULT_DUTYCYCLE_TOLERANCE
Default absolute tolerance for duty cycles.
|
static double |
DEFAULT_FREQUENCY_TOLERANCE
Default absolute tolerance for frequency comparison.
|
static double |
DEFAULT_MIN_REPEAT_LAST_GAP
Default value for least value in a repeat in microseconds.
|
static double |
DEFAULT_MINIMUM_LEADOUT
Default threshold value for lead-out in microseconds.
|
static double |
DEFAULT_RELATIVE_TOLERANCE
Default relative tolerance as a number between 0 and 1.
|
static long |
INVALID |
static String |
LINE_SEPARATOR |
static long |
SOME |
| Modifier and Type | Method and Description |
|---|---|
static String |
addExtensionIfNotPresent(String filename,
String extension) |
static int |
approximateGreatestCommonDivider(int first,
int second,
double relTolerance) |
static int |
approximateGreatestCommonDivider(List<Integer> args,
double relTolerance) |
static boolean |
approximatelyEquals(Double x,
Double y) |
static boolean |
approximatelyEquals(Double x,
Double y,
double absoluteTolerance,
double relativeTolerance)
Tests for approximate equality.
|
static boolean |
approximatelyEquals(int x,
int y,
int absoluteTolerance,
double relativeTolerance)
Tests for approximate equality.
|
static String |
basename(String filename) |
static String |
capitalize(String s) |
static String |
chars(int length,
byte value) |
static String |
chars(int length,
char ch) |
static File[] |
filesInDirMatchingRegExp(File dir,
String regexp) |
static String |
formatIntegerWithLeadingZeros(long x,
int radix,
int length) |
static double |
getAbsoluteTolerance(Double userValue) |
static double |
getFrequencyTolerance(Double userValue) |
static InputStream |
getInputSteam(String filename)
Either opens an input file or returns stdin.
|
static double |
getMinimumLeadout(Double userValue) |
static double |
getMinRepeatLastGap(Double userValue) |
static PrintStream |
getPrintSteam(String filename)
Either opens a file (optionally for appending (if beginning with +)) or returns stdout.
|
static double |
getRelativeTolerance(Double userValue) |
static boolean |
hasDuplicatedElements(List<?> list) |
static int |
hashForDouble(Double d) |
static double |
hz2khz(double frequency) |
static String |
javaifyString(String s) |
static double |
khz2Hz(double khz) |
static double |
l1Norm(double[] sequence) |
static double |
l1Norm(Double[] sequence) |
static double |
l1Norm(double[] sequence,
int beg,
int length) |
static int |
l1Norm(int[] sequence) |
static int |
l1Norm(int[] sequence,
int beg,
int length) |
static double |
l1Norm(Iterable<Double> sequence) |
static double |
l1Norm(List<Double> list,
int beg) |
static int |
lexicalCompare(int... compare)
Support function for lexicographic compareTos
|
static long |
log2(long x)
Computes ceil(log2(x))
|
static void |
main(String[] args) |
static long |
maskTo(long data,
int width) |
static int |
maxLength(Iterable<String> strings) |
static int |
maxLength(String[] strings) |
static double |
microseconds2milliseconds(double us) |
static double |
microseconds2seconds(double us) |
static double |
milliseconds2microseconds(double ms) |
static double |
minDiff(TreeSet<Double> numbers) |
static int |
numberTrue(Boolean... args) |
static long |
ones(Number numOnes) |
static String |
padString(String s,
int length) |
static long |
parseLong(String str)
Parses integers of base 2 (prefix "0b" or "%", 8 (leading 0), 10, or 16 (prefix "0x).
|
static long |
parseLong(String str,
boolean special)
Parses integers of base 2 (prefix "0b" or "%", 8 (leading 0), 10, or 16 (prefix "0x).
|
static long |
parseUpper(String str) |
static double |
percent2real(double percent) |
static long |
power(long x,
long y)
The power function for long arguments.
|
static String |
radixPrefix(int radix) |
static double |
real2percent(double x) |
static BigInteger |
reverse(BigInteger x,
int width) |
static int |
reverse(int x,
int width)
Reverses the bits, living in a width-bit wide world.
|
static long |
reverse(long x,
int width)
Reverses the bits, living in a width-bit wide world.
|
static double |
seconds2microseconds(double secs)
Convert its argument from seconds to microseconds.
|
static String |
spaces(int length)
Returns a string consisting of length spaces.
|
static String |
tabs(int length)
Returns a string consisting of length number of tabs.
|
static String |
toCName(String name) |
static void |
trivialFormatter(PrintStream out,
String string,
int lineLength)
Prints the String in the second argument nicely on the PrintStream in the first argument,
nicely chopping after lineLength positions.
|
static double |
us2Periods(double us,
double frequency) |
public static final long INVALID
public static final long ALL
public static final long SOME
public static final String LINE_SEPARATOR
public static final double DEFAULT_ABSOLUTE_TOLERANCE
public static final double DEFAULT_RELATIVE_TOLERANCE
public static final double DEFAULT_FREQUENCY_TOLERANCE
public static final double DEFAULT_DUTYCYCLE_TOLERANCE
public static final double DEFAULT_MINIMUM_LEADOUT
public static final double DEFAULT_MIN_REPEAT_LAST_GAP
public static final String DEFAULT_CHARSET_NAME
public static final Charset DEFAULT_CHARSET
public static double getRelativeTolerance(Double userValue)
public static double getAbsoluteTolerance(Double userValue)
public static double getFrequencyTolerance(Double userValue)
public static double getMinimumLeadout(Double userValue)
public static double getMinRepeatLastGap(Double userValue)
public static double seconds2microseconds(double secs)
secs - secondspublic static double milliseconds2microseconds(double ms)
public static double microseconds2milliseconds(double us)
public static double microseconds2seconds(double us)
public static double khz2Hz(double khz)
public static double hz2khz(double frequency)
public static double us2Periods(double us,
double frequency)
public static double percent2real(double percent)
public static double real2percent(double x)
public static double l1Norm(Double[] sequence)
public static double l1Norm(double[] sequence)
public static double l1Norm(double[] sequence,
int beg,
int length)
public static int l1Norm(int[] sequence,
int beg,
int length)
public static int l1Norm(int[] sequence)
public static String chars(int length, char ch)
public static String chars(int length, byte value)
public static String spaces(int length)
length - public static String tabs(int length)
length - public static long ones(Number numOnes)
public static int numberTrue(Boolean... args)
public static PrintStream getPrintSteam(String filename) throws FileNotFoundException
filename - Either - for stdout, or a file name, or null. If starting with +, the file is opened in append mode, after removing the +-character.FileNotFoundException - if FileOutputStream doespublic static InputStream getInputSteam(String filename) throws FileNotFoundException
filename - FileNotFoundExceptionpublic static void trivialFormatter(PrintStream out, String string, int lineLength)
out - PrintStream to print on.string - String to printlineLength - Break after this position.public static String formatIntegerWithLeadingZeros(long x, int radix, int length)
public static long power(long x,
long y)
x - longy - long, non-negativeArithmeticExceptionpublic static long log2(long x)
x - public static String radixPrefix(int radix)
public static long parseLong(String str, boolean special)
str - String to be parsedspecial - If the special stuff should be interpreted ('*', '+', intervals).public static long parseLong(String str)
str - String to be parsedpublic static long parseUpper(String str)
public static long reverse(long x,
int width)
x - datawidth - width in bitspublic static int reverse(int x,
int width)
x - datawidth - width in bitspublic static BigInteger reverse(BigInteger x, int width)
public static boolean approximatelyEquals(Double x, Double y, double absoluteTolerance, double relativeTolerance)
x - first argumenty - second argumentabsoluteTolerance - relativeTolerance - public static boolean approximatelyEquals(int x,
int y,
int absoluteTolerance,
double relativeTolerance)
x - first argumenty - second argumentabsoluteTolerance - relativeTolerance - public static long maskTo(long data,
int width)
public static boolean hasDuplicatedElements(List<?> list)
public static int approximateGreatestCommonDivider(List<Integer> args, double relTolerance)
public static int approximateGreatestCommonDivider(int first,
int second,
double relTolerance)
public static int maxLength(String[] strings)
public static void main(String[] args)
public static String addExtensionIfNotPresent(String filename, String extension)
public static int hashForDouble(Double d)
public static int lexicalCompare(int... compare)
compare - Copyright © 2019. All rights reserved.