|
| JRunArray (const JSize blockSize=10) |
|
| JRunArray (const JRunArray< T > &source) |
|
| JRunArray (const JRunArray< T > &source, const JIndexRange &range) |
|
| ~JRunArray () override |
|
JRunArray< T > & | operator= (const JRunArray< T > &source) |
|
T | GetFirstItem () const override |
|
T | GetLastItem () const override |
|
void | PrependItem (const T &data) override |
|
void | AppendItem (const T &data) override |
|
void | PrependItems (const T &data, const JSize count) |
|
void | AppendItems (const T &data, const JSize count) |
|
void | PrependSlice (const JRunArray< T > &source, const JIndexRange &range) |
|
void | AppendSlice (const JRunArray< T > &source, const JIndexRange &range) |
|
void | RemoveAll () override |
|
bool | AllItemsEqual (T *data=nullptr) const |
|
JInteger | SumItems (const JIndex startIndex, const JIndex endIndex, JInteger(*value)(const T &data)) const |
|
bool | FindPositiveSum (const JInteger requestedSum, const JIndex startIndex, JIndex *endIndex, JInteger *trueSum, JInteger(*value)(const T &data)) const |
|
JListIterator< T > * | NewIterator (const JListT::Position start=JListT::kStartAtBeginning, const JIndex index=0) override |
|
JListIterator< T > * | NewIterator (const JListT::Position start=JListT::kStartAtBeginning, const JIndex index=0) const override |
|
JSize | GetRunCount () const |
|
JSize | GetBlockSize () const |
|
void | SetBlockSize (const JSize newBlockSize) |
|
| JList () |
|
| JList (const JList< T > &source) |
|
| ~JList () override |
|
void | SetCompareFunction (const std::function< std::weak_ordering(const T &, const T &)> compareFn) |
|
void | CopyCompareFunction (const JList< T > &source) |
|
void | ClearCompareFunction () |
|
JListT::SortOrder | GetSortOrder () const |
|
void | SetSortOrder (const JListT::SortOrder order) |
|
bool | IsSorted () const |
|
| JCollection () |
|
| JCollection (const JCollection &source) |
|
| ~JCollection () override |
|
JCollection & | operator= (const JCollection &source) |
|
JSize | GetItemCount () const |
|
bool | IsEmpty () const |
|
bool | IndexValid (const JIndex index) const |
|
JIndex | GetIndexFromEnd (const JIndex index) const |
|
JString | ToString () const override |
|
| JBroadcaster () |
|
virtual | ~JBroadcaster () |
|
JBroadcaster & | operator= (const JBroadcaster &source) |
|
bool | HasSenders () const |
|
JSize | GetSenderCount () const |
|
bool | HasRecipients () const |
|
JSize | GetRecipientCount () const |
|
template<class T > |
void | ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f) |
|
template<class T>
class JRunArray< T >
Interface for JRunArrayIterator class template
JRunArray is a dynamic array optimized to conserve space where consecutive entries have the same value. Such a sequence of identical entries is called a run. Rather than storing N consecutive, identical entries, JRunArray stores the value once, along with the length of the run.
When using a JRunArray, operator== must be defined for the data type.
gcc 2.7.2 does not implement static data for template classes, without which we cannot provide an efficient implementation of Sort().
Implementation details:
A JArray is used to store the run lengths + actual items. Thus, JRunArrays cannot store objects, only intrinisic types.
Returns the index of the item that causes the sum, starting from startIndex, to exceed requestedSum. *trueSum is the sum of the items up to, but not including, *endIndex. This gives the correct behavior for determining which interval was clicked by a cursor. To verify this, consider the case when all intervals have width one, and the left edge has coordinate zero.
Returns false if the sum through the end of the array does not exceeed requestedSum. In this case, *endIndex is the last item, and *trueSum is the sum up to, but not including, *endIndex.
This function requires that requestedSum be positive.