org.jquantlib.util
Class Std
- java.lang.Object
-
- org.jquantlib.util.Std
-
public class Std extends java.lang.ObjectThis class contains utility methods similar to C++ std functions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classStd.BinaryOperator<T extends java.lang.Number>classStd.Bind2nd<T extends java.lang.Number>classStd.Operator<T extends java.lang.Number>static classStd.OpTypeclassStd.Plus<T extends java.lang.Number>classStd.UninaryOperator<T extends java.lang.Number>
-
Constructor Summary
Constructors Constructor and Description Std()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static <T> intcopy(java.util.List<T> from, int first, int last, java.util.List<T> to)std:copy: Copy range of elements Copies the elements in the range [first,last) into a range beginning at result.static <T> intcopy(java.util.List<T> from, int first, int last, java.util.List<T> to, int toFrom)static <T> intdistance(java.util.List<T> values, int first, int last)This method is equivalent to C++ std:distance function Return distance between indices (or iterators) Calculates the number of elements between first and last.static <T> booleanequal(java.util.List<T> first, int from, int last, java.util.List<T> second, int secondFrom)Test whether the elements in two ranges are equal Compares the elements in the range [first1,last1) with those in the range beginning at first2, and returns true if the elements in both ranges are considered equal.static <T> booleanequal(java.util.List<T> first, java.util.List<T> second)static <T> voidfill(java.util.List<T> array, int from, int last, T value)static <T> intlowerBound(java.util.List<T> valueList, java.lang.Comparable<T> value)static <T> intlowerBound(java.util.List<T> valueList, int fromIdx, int toIdx, java.lang.Comparable<T> value)This method is equivalent to std:lower_bound function Returns an index pointing to the first element in the ordered collection is equal or greater than passed valuestatic <T extends java.lang.Number>
inttransform(java.util.List<T> list1, int first1, int last1, java.util.List<T> list2, int first2, java.util.List<T> result, Std.BinaryOperator<T> binaryOp)static <T> intupperBound(java.util.List<T> valueList, java.lang.Comparable<T> value)static <T> intupperBound(java.util.List<T> valueList, int fromIdx, int toIdx, java.lang.Comparable<T> value)This method is equivalent to C++ std:upper_bound function Returns an index pointing to the first element in the ordered collection which is greater than passed value
-
-
-
Method Detail
-
lowerBound
public static <T> int lowerBound(java.util.List<T> valueList, int fromIdx, int toIdx, java.lang.Comparable<T> value)This method is equivalent to std:lower_bound function Returns an index pointing to the first element in the ordered collection is equal or greater than passed value- Parameters:
valueList- order collection in ascending ordervalue- Date to be compared- Returns:
- index to element which is >= passed value
-
lowerBound
public static <T> int lowerBound(java.util.List<T> valueList, java.lang.Comparable<T> value)
-
upperBound
public static <T> int upperBound(java.util.List<T> valueList, int fromIdx, int toIdx, java.lang.Comparable<T> value)This method is equivalent to C++ std:upper_bound function Returns an index pointing to the first element in the ordered collection which is greater than passed value- Type Parameters:
T-- Parameters:
valueList- order collection in ascending ordervalue- Date to be compared- Returns:
- index to element which is > passed value
-
upperBound
public static <T> int upperBound(java.util.List<T> valueList, java.lang.Comparable<T> value)
-
distance
public static <T> int distance(java.util.List<T> values, int first, int last)This method is equivalent to C++ std:distance function Return distance between indices (or iterators) Calculates the number of elements between first and last. If i is a Random Access Iterator, the function uses operator- to calculate this. Otherwise, the function uses repeatedly the increase or decrease operator (operator++ or operator--) until this distance is calculated.
-
copy
public static <T> int copy(java.util.List<T> from, int first, int last, java.util.List<T> to)std:copy: Copy range of elements Copies the elements in the range [first,last) into a range beginning at result. Returns an iterator to the last element in the destination range Parameters first, last Input iterators to the initial and final positions in a sequence to be copied. The range used is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last. result Output iterator to the initial position in the destination sequence. This shall not point to any element in the range [first,last).- Returns:
-
copy
public static <T> int copy(java.util.List<T> from, int first, int last, java.util.List<T> to, int toFrom)
-
fill
public static <T> void fill(java.util.List<T> array, int from, int last, T value)
-
equal
public static <T> boolean equal(java.util.List<T> first, int from, int last, java.util.List<T> second, int secondFrom)Test whether the elements in two ranges are equal Compares the elements in the range [first1,last1) with those in the range beginning at first2, and returns true if the elements in both ranges are considered equal. The elements are compared by either applying the == comparison operator to each pair of corresponding elements, or the template parameter pred (for the second version)\ The behavior of this function template is equivalent to templatebool equal ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2 ) { while ( first1!=last1 ) { if (*first1 != *first2) // or: if (!pred(*first1,*first2)), for pred version return false; ++first1; ++first2; } return true; } - Parameters:
array-size-to-i-- Returns:
-
equal
public static <T> boolean equal(java.util.List<T> first, java.util.List<T> second)
-
transform
public static <T extends java.lang.Number> int transform(java.util.List<T> list1, int first1, int last1, java.util.List<T> list2, int first2, java.util.List<T> result, Std.BinaryOperator<T> binaryOp)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG