5 #include <libutl/Predicate.h> 6 #include <libutl/RandIt.h> 7 #include <libutl/Stream.h> 8 #include <libutl/String.h> 63 const FwdIt& rhsBegin,
83 const FwdIt& rhsBegin,
103 bool cloning =
false,
105 bool predVal =
true);
123 bool cloning =
false,
125 bool predVal =
true);
141 bool cloning =
false,
143 bool predVal =
true);
178 const FwdIt& rhsBegin,
182 bool cloning =
false,
183 bool outIsLHS =
false);
206 bool printClassName =
false,
208 const char* separator =
nullptr);
290 const FwdIt& rhsBegin,
294 bool cloning =
false,
295 bool multiSet =
false,
296 bool outIsLHS =
false);
315 const FwdIt& rhsBegin,
318 bool multiSet =
false);
335 const FwdIt& rhsBegin,
337 const Ordering* ordering =
nullptr);
367 const FwdIt& rhsBegin,
369 const Ordering* ordering =
nullptr);
386 const FwdIt& rhsBegin,
388 const Ordering* ordering =
nullptr);
447 const FwdIt& rhsBegin,
451 bool cloning =
false);
543 void remove(
FwdIt& begin,
547 bool predVal =
false);
664 it.
set(lhsIdx, it.
get(rhsIdx));
685 const FwdIt& rhsBegin,
689 bool cloning =
false);
710 const FwdIt& rhsBegin,
715 bool lhsCloning =
false,
716 bool rhsCloning =
false);
749 bool cloning =
false,
750 bool outIsSrc =
false);
758 #include <libutl/algorithms_inl.h> String toString(const FwdIt &begin, const FwdIt &end, const String &sep, bool key=false)
Obtain a string representation of a sequence (via Object::toString()).
void intersect(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, FwdIt &out, const Ordering *ordering=nullptr, bool cloning=false, bool multiSet=false, bool outIsLHS=false)
Determine the intersection of two sorted sequences.
void merge(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, FwdIt &out, const Ordering *ordering=nullptr, bool cloning=false)
Merge two sorted sequences into a single sorted sequence.
Object comparison abstraction.
bool intersects(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, const Ordering *ordering=nullptr)
Determine whether the intersection of two sorted sequences is non-empty.
void linearSearch(const FwdIt &begin, const FwdIt &end, const Object &key, FwdIt &out, const Ordering *ordering=nullptr, uint_t findType=find_first)
Linear search a sequence for a key.
void symmetricDifference(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, FwdIt &lhsOut, FwdIt &rhsOut, const Ordering *ordering=nullptr, bool lhsCloning=false, bool rhsCloning=false)
Determine the symmetric difference of two sorted sequences.
void difference(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, FwdIt &out, const Ordering *ordering=nullptr, bool cloning=false, bool outIsLHS=false)
Determine the difference between two sorted sequences.
default representation (via getSerializeMode())
Store information about a class.
void multiKeyQuickSort(const FwdIt &begin, const FwdIt &end, bool key=true, bool reverse=false, size_t size=size_t_max)
Multi-key quick-sort a sequence.
void serializeIn(FwdIt &out, size_t numItems, Stream &is, uint_t mode=ser_default, const RunTimeClass *rtc=nullptr)
Serialize objects from an input stream.
sort_t
Specifies a sort algorithm.
virtual void set(const Object *object)=0
Set the current object.
void reverse(const BidIt &begin, const BidIt &end)
Reverse a sequence.
Random-access iterator abstraction.
void heapSort(Object **array, size_t begin, size_t end, const Ordering *ordering=nullptr)
Heap-sort a sequence.
const size_t size_t_max
Maximum size_t value.
void sort(Object **array, size_t begin, size_t end, const Ordering *ordering=nullptr, uint_t algorithm=sort_quickSort)
Sort a sequence using a given algorithm.
void swap(RandIt &it, size_t lhsIdx, size_t rhsIdx)
Swap two objects in a random-access sequence.
virtual void set(const Object *object)=0
Set the current object.
bool isSorted(const FwdIt &begin, const FwdIt &end, const Ordering *ordering=nullptr)
Determine whether the given sequence is sorted.
size_t intersectCard(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, const Ordering *ordering=nullptr, bool multiSet=false)
Determine the cardinality of the intersection of two sorted sequences.
Logical predicate abstraction.
void quickSort(Object **array, size_t begin, size_t end, const Ordering *ordering=nullptr)
Quick-sort (part of) a sequence.
Forward iterator abstraction.
void linearSearchSorted(const FwdIt &begin, const FwdIt &end, const Object &key, FwdIt &out, const Ordering *ordering=nullptr, uint_t findType=find_first)
Linear search a sorted sequence for a key.
void insertionSort(Object **array, size_t begin, size_t end, const Ordering *ordering=nullptr)
Insertion-sort (part of) an array.
int compare(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, const Ordering *ordering=nullptr)
Compare two sorted sequences.
bool isSuperSet(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, const Ordering *ordering=nullptr)
Determine whether the lhs sorted sequence is a superset of the rhs sorted sequence.
unsigned int uint_t
Unsigned integer.
const uint_t uint_t_max
Maximum uint_t value.
Bi-directional iterator abstraction.
find first matching object
A sequence of same-type objects.
void clobber(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, const Ordering *ordering=nullptr)
Where lhs and rhs intersect, make the lhs version of the object equal to the rhs version ("clobber" i...
bool isSubSet(const FwdIt &lhsBegin, const FwdIt &lhsEnd, const FwdIt &rhsBegin, const FwdIt &rhsEnd, const Ordering *ordering=nullptr)
Determine whether the lhs sorted sequence is a subset of the rhs sorted sequence. ...
void serializeOut(const FwdIt &begin, const FwdIt &end, Stream &os, uint_t mode=ser_default, bool boxed=true)
Serialize objects to an output stream.
Root of UTL++ class hierarchy.
void dump(const FwdIt &begin, const FwdIt &end, Stream &os, uint_t level=uint_t_max, bool key=false, bool printClassName=false, uint_t indent=0, const char *separator=nullptr)
Dump objects to the given stream (with Object::dump()).
void unique(const FwdIt &begin, const FwdIt &end, FwdIt &out, const Ordering *ordering=nullptr, bool cloning=false, bool outIsSrc=false)
Remove duplicate objects from a sorted sequence.
virtual Object * get() const =0
Get the current object.
void mergeSort(Object **array, size_t begin, size_t end, const Ordering *ordering=nullptr)
Merge-sort (part of) an array.
size_t binarySearch(const RandIt &begin, const RandIt &end, const Object &key, const Ordering *ordering=nullptr, uint_t findType=find_first)
Binary search an ordered sequence for a key.
void copy(FwdIt &out, const Vector< Object *> &in, bool cloning=false, const Predicate *pred=nullptr, bool predVal=true)
Copy objects from a Vector to a sequence.
size_t count(const FwdIt &begin, const FwdIt &end, const Predicate *pred=nullptr, bool predVal=true)
Count objects that satisfy a Predicate.