Menu

Home

Concurrent


Collections

  • Event based collections - register events like OnBeforeAddEvent or OnAfterRemoveEvent (java.util.Collection, -List, -Set, -Map)
    • EventCollection
    • EventSet
    • EventSortedSet
    • EventList
    • EventMap
    • EventSortedMap
  • Partly Unmodifiable - decorate the collection, list, set, map by allowing for example only add new elements but nor removing any existing (java.util.Collection, -List, -Set, -Map)
    • UnmodifiableCollection
    • UnmodifiableSet
    • UnmodifiableSortedSet
    • UnmodifiableList
    • UnmodifiableMap
    • UnmodifiableSortedMap
  • Cache collections - decorates java.util.Collection, -List, -Set, -Map which caches often used elements and improves the performance during searching of elements in many cases.
    • CacheCollection
    • CacheSet
    • CacheSortedSet
    • CacheList
    • CacheMap
  • Synchronized collections - Happy synchronization-collections differs from standard java.util.Collections.synchronizedList(), -Map(), -Set() decorators by managing of synchronization lock inside public API. In that way hierarchical synchronization mechanisms which allows to synchronize the collections around foreign lock from outside.
    • SynchronizedCollection
    • SynchronizedSet
    • SynchronizedSortedSet
    • SynchronizedList
    • SynchronizedMap
    • SynchronizedSortedMap
  • Buffered Collections - You can revert any changes made to your collection since last commit. If you commit changes made to buffered collection decorator, the decorated collection will be modified.
    • BufferedCollection
    • BufferedSet
    • BufferedSortedSet
    • BufferedMap
  • Transient Collections - if stored elements in a transient collection will be not used for long period of time, they will be removed. This reduces the memory and processor requirements.
    • TransientMap
  • Data Collections - This map can adapt the data from data-sources like data-base or webservice and provide abstract management of elements in bounded data-source.
    • DataMap
  • Lists
    • SortedList - the decorator which decorates java.util.List to be sorted. There are two strategies implemented: (1) Linked and (2) Divide and Conquer. The Sorted List can increase the performance of the List dramatically (more than 20 times), see examples section!
    • SetList - decorates java.utli.List to be java.util.Set. Sometimes can be useful if you want use List methods like List.listIterator(int index) but don’t want allow duplicates in your List.

Controllers

control your processes, for example a download, upload or solving process.

  • ForkJoinController - pools started controllers in a pool
  • SynchronizedController - decorates a controller to be multi-thread safe
  • TaskLimiterController - If many controllers will be started, only defined number of controllers will be really started, all other controllers will block on start() method and wait until other controllers have finished. This is useful to avoid resource starvation.
  • TimeLimiterController - The decorator waits after the controller was started predefined time, after that decorated controller will be canceled.
  • ExecuteableController - adopts Executable as Controller.
  • FloatProgressController - adopts any Controllers to fire progress events between 0.0 and 1.0 thus decorated controller can be simply observed in a progress bar.
  • ProxyController - creates controller only if the start() method is executed. Avoids resource-starvation.
  • RetryController - implements Many-Retries method, which retries to a failed process many times in predefined period of time.
  • StreamCopyController - copy an InputStream to an OutputStream. Can be used for downloading of a file.
  • MockController - can be used for testing purpose. This controller can be custom initialized and controlled by user.

Deleagetes

Observer Design Pattern implementation - similar to .NET Delegates.

  • EventDelegate - register ActionListener on Delegates, thus if anybody wants to add an ActionListener an event about this action will be fired.
  • SynchronizedDelegate - deecorate delegate to be multi-thread safe, thus ActionListeners can be managed from diffrent threads.
  • UnfireableDelegate - protect your delegate, thus no body from public api can fire any events. In such case only internal events can be fired.

Generators

Often you need to generate random data. For example random integer value between 35 and 60. Or a String of the length between 5 and 10 letters. The generator package is designed to simply generate such random values..

  • RandomCharGenerator - generates random Chars in defined range
  • RandomDoubleGenerator - generates random Doubles in defined range
  • RandomFloatGenerator - generates random Floats in defined range
  • RandomIntegerGenerator - generates random Integers in defined range
  • RandomLongGenerator - generates random Long objects in defined range
  • RandomNameGenerator - generates Strings which contains only characters which is usually used in names
  • RandomObjectFromArrayGenerator_1x0 - generates randomly objects from input collection or array.
  • RandomStringGenerator - generates random Strings of defined length
  • CompositeGenerator - you can combine many generators which generates the same type to generate randomly objects with defined probability

Streams

Input- & OutputStream decorators for observing,controling and waiting for decorated streams.
Event based Input-& OutputStreams - register events like getOnWriteEvent or getOnReadEvent to observe decorated input & output streams. Events will be fired after defined timeDelay or after specified number of readed or written bytes.
Cancelable Input-& OutputStreams - Decorated your streams to be cancleable, thus after cancel an IOException will be fired if anybody tries to use decoated streams.
Blocking Input-& OutputStreams - Blocking Input & OutputStreams adds new block() method which allows to wait until the write or read operations on the streasm are completed.
Stopable InputStreams - this stream allows to cancel the decorated stream. You can stop this stream at any time. The decorator waits for decorated Stream in extra thread and if you stop this stream returns immediately.


Patterns


Examples - Code Snippets