I need to implement the concept of task in my application. In my project, the task is an operation that must be performed and is identified by a name: each task also has input parameters (types and values) and produces one or more outputs.
Having to implement the Task class, how can I express the concept of "operation that has some kind of result"? I could store the name of the operation in a string attribute, but how do I express the type returned by this operation? Similarly, how can I implement a list of input parameters of the operation, when these parameters may also be of different types?
目标是将工作队的目标编成序号,并将其发送至另一节点。 接收人分析所收到的任务对象,读写行动的名称并履行相应的职能。
例如,假设A和Node B“拥有”以下方法......
a. 拨号A:
- double getAreaOfRectangle(double length, double width);
- double getAreaOfTriangle(double base, double height);
- double getAreaOfParallelogram(double base, double height).
B号:
- double getAreaOfCircle(double radius);
- double getAreaOfTrapezoid(double base1, double base2, double height).
If the node C needs to calculate the area of a rectangle, it knows it must contact the node A and send a message to node A by specifying the operation (double areaOfRectangle) and the inputs (double width and double height). Similarly, if the node C needs to calculate the area of a circle, it must send a message to node B, specifying the operation and the length of the radius. In order to send the inputs, since they could be different types (or even new user-defined types), I could use an array of object...
有些任务可能取决于其他任务,即投入参数可能至少具有另一项任务的一项产出,因此,我还需要执行任务产出与另一项任务的投入之间的联系。
我应如何界定这一类别?