00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.calcium.skeletons;
00032
00033 import java.util.Vector;
00034
00035 import org.objectweb.proactive.calcium.Task;
00036 import org.objectweb.proactive.calcium.exceptions.EnvironmentException;
00037 import org.objectweb.proactive.calcium.interfaces.Execute;
00038 import org.objectweb.proactive.calcium.interfaces.Instruction;
00039 import org.objectweb.proactive.calcium.interfaces.Skeleton;
00040 import org.objectweb.proactive.calcium.statistics.Timer;
00041
00042
00052 public class Seq<T> implements Skeleton<T>, Instruction<T> {
00053
00054 Execute<T> secCode;
00055 int muscleId;
00056
00057 public Seq(Execute<T> secCode){
00058 this.secCode=secCode;
00059 muscleId=0;
00060 }
00061
00062 public Vector<Instruction<T>> getInstructionStack() {
00063
00064 Vector<Instruction<T>> v=new Vector<Instruction<T>>();
00065 v.add(this);
00066 return v;
00067 }
00068
00069 public Task<T> compute(Task<T> t) throws RuntimeException, EnvironmentException {
00070
00071 Timer timer = new Timer();
00072 T resultObject=secCode.execute(t.getObject());
00073 timer.stop();
00074
00075
00076
00077
00078
00079 t.setObject(resultObject);
00080 t.getStats().getWorkout().track(secCode,timer);
00081 return t;
00082 }
00083
00084 public String toString(){
00085 return "Seq("+this.secCode.getClass()+")";
00086 }
00087 }