StickyPromotion.vala 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. namespace Invercargill {
  2. public abstract class StickyPromotion<T, TPromotion> : EnumerableProxy<T>, Promotion<T> {
  3. public abstract Enumerable<T> wrap(Enumerable<T> enumerable);
  4. protected abstract Enumerable<T> new_wrap(Enumerable<T> enumerable);
  5. public abstract bool can_wrap(GLib.Type element_type);
  6. public new TPromotion where(owned PredicateDelegate<T> predicate) {
  7. return (TPromotion)new_wrap(inner.where((owned)predicate));
  8. }
  9. public new TPromotion sort(owned CompareDelegate<T> compare) {
  10. return (TPromotion)new_wrap(inner.sort((owned)compare));
  11. }
  12. public new TPromotion concat(Enumerable<T> other) {
  13. return (TPromotion)new_wrap(inner.concat(other));
  14. }
  15. public new TPromotion take(int count) {
  16. return (TPromotion)new_wrap(inner.take(count));
  17. }
  18. public new TPromotion skip(int count) {
  19. return (TPromotion)new_wrap(inner.skip(count));
  20. }
  21. public new TPromotion with(T item, uint times = 1) {
  22. return (TPromotion)new_wrap(inner.with(item, times));
  23. }
  24. public new TPromotion seal() {
  25. return (TPromotion)new_wrap(inner.seal());
  26. }
  27. public new TPromotion cache() {
  28. return (TPromotion)new_wrap(inner.cache());
  29. }
  30. public new TPromotion act(ItemDelegate<T> handler) {
  31. return (TPromotion)new_wrap(inner.act(handler));
  32. }
  33. public new TPromotion debug_trace(owned TransformDelegate<T, string> stringifier, string additional_message = "", owned DebugOutputDelegate? output_func = null, bool formatting = true) {
  34. return (TPromotion)new_wrap(new TraceEnumerable<T>(this, get_info(), (owned)stringifier, additional_message, (owned)output_func, formatting));
  35. }
  36. public new TPromotion debug_type(string additional_message = "", DebugOutputDelegate? output_func = null, bool formatting = true) {
  37. DebugPrinter.print_enumerable_information(get_info(), additional_message, output_func, formatting);
  38. return (TPromotion)wrap(inner);
  39. }
  40. }
  41. }