3using System.Threading.Tasks;
18 private readonly
bool isAsynchronous;
19 private readonly Dictionary<Type, ObjectProperties> propertiesX =
new Dictionary<Type, ObjectProperties>();
20 private readonly Dictionary<Type, ObjectProperties> propertiesY =
new Dictionary<Type, ObjectProperties>();
21 private readonly KeyValuePair<ScriptNode, bool>[] order;
22 private readonly List<object> items =
new List<object>();
34 this.processor = Processor;
39 foreach (KeyValuePair<ScriptNode, bool> P
in Order)
41 if (P.Key.IsAsynchronous)
43 this.isAsynchronous =
true;
61 this.items.Add(Object);
72 this.items.Add(Object);
73 return Task.FromResult(
true);
84 foreach (
object Item
in this.items)
86 if (!this.processor.Process(Item))
90 return this.processor.Flush();
95 this.items.Sort((x, y) =>
107 Type Tx = x.GetType();
108 Type Ty = y.GetType();
114 Vx = new ObjectProperties(x, this.variables);
115 this.propertiesX[Tx] = Vx;
122 Vy = new ObjectProperties(y, this.variables);
123 this.propertiesY[Ty] = Vy;
126 int i, j, c =
this.order.Length;
130 for (i = 0; i < c; i++)
132 Node = this.order[i].Key;
133 Ex = Node.Evaluate(Vx);
134 Ey = Node.Evaluate(Vy);
139 j = S.Compare(Ex, Ey);
142 if (this.order[i].Value)
161 foreach (
object Item
in this.items)
163 if (!await this.processor.ProcessAsync(Item))
167 return await this.processor.FlushAsync();
Script runtime exception.
Base class for all nodes in a parsed script tree.
Processor that reorders a sequence of items.
async Task< bool > FlushAsync()
Called at the end of processing, to allow for flushing of buffers, etc.
bool Process(object Object)
Processes an object synchronously.
Task< bool > ProcessAsync(object Object)
Processes an object asynchronously.
bool IsAsynchronous
If the processor operates asynchronously.
CustomOrderProcessor(IProcessor< object > Processor, Variables Variables, KeyValuePair< ScriptNode, bool >[] Order)
Processor that reorders a sequence of items.
bool Flush()
Called at the end of processing, to allow for flushing of buffers, etc.
Interface for processors of objects.
bool IsAsynchronous
If the processor operates asynchronously.
Basic interface for all types of elements.
ISet AssociatedSet
Associated Set.
Basic interface for ordered sets.