00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 package gov.lanl.isr.sensix;
00036
00037 import java.util.*;
00038
00039
00040 public class TaskImpl extends _TaskStub
00041 {
00042 private Functor funct;
00043 private Functor parent;
00044 private Response passup;
00045 private ArrayList<Request> subs;
00046
00047 private int num_peers;
00048 private boolean cancel;
00049
00050
00051 public TaskImpl(Functor p, Functor f, Response cb) {
00052 funct = f;
00053 parent = p;
00054 passup = cb;
00055 subs = new ArrayList<Request>();
00056 num_peers = 0;
00057 cancel = false;
00058 }
00059
00060 public Functor f() {
00061 return funct;
00062 }
00063
00064 public Functor superf() {
00065 return parent;
00066 }
00067
00068 public Response callback() {
00069 return passup;
00070 }
00071
00072 public Request[] subtasks() {
00073 Request[] fs = new Request[subs.size()];
00074 fs = subs.toArray(fs);
00075 return fs;
00076 }
00077
00078 public void addSubtask(Request r, Functor f) {
00079 subs.add(r);
00080 }
00081
00082
00083 public int numPeers() {
00084 return num_peers;
00085 }
00086
00087 public void numPeers(int p) {
00088 num_peers = p;
00089 }
00090
00091 public boolean cancelled() {
00092 return cancel;
00093 }
00094
00095 public void cancelled(boolean c) {
00096 cancel = c;
00097 }
00098
00099 public String toString() {
00100 String s = new String();
00101 if (funct == null)
00102 s += "NULL";
00103 else
00104 s += funct.asString();
00105 s += " subtask of ";
00106 if (parent == null)
00107 s += "NULL";
00108 else
00109 s += parent.asString();
00110 return s;
00111 }
00112 }