00001 package edu.rice.cs.hpc.traceviewer.services; 00002 00003 import java.util.HashMap; 00004 import java.util.Map; 00005 00006 import org.eclipse.ui.AbstractSourceProvider; 00007 00008 import edu.rice.cs.hpc.traceviewer.data.timeline.ProcessTimeline; 00009 00010 public class ProcessTimelineService extends AbstractSourceProvider { 00011 00012 final static public String PROCESS_TIMELINE_PROVIDER = "edu.rice.cs.hpc.traceviewer.services.ProcessTimelineService.data"; 00013 private ProcessTimeline []traces; 00014 00015 00016 @Override 00017 public void dispose() { } 00018 00019 @Override 00020 public Map getCurrentState() { 00021 Map<String, Object> map = new HashMap<String, Object>(1); 00022 map.put(PROCESS_TIMELINE_PROVIDER, traces); 00023 00024 return map; 00025 } 00026 00027 @Override 00028 public String[] getProvidedSourceNames() { 00029 return new String[] {PROCESS_TIMELINE_PROVIDER}; 00030 } 00031 00032 public void setProcessTimeline(ProcessTimeline[] traces) { 00033 this.traces = traces; 00034 } 00035 00036 00037 public void setProcessTimeline(int index, ProcessTimeline trace) { 00038 traces[index] = trace; 00039 } 00040 00041 00042 public ProcessTimeline getProcessTimeline(int proc) { 00043 if (traces == null) 00044 return null; 00045 00046 return traces[proc]; 00047 } 00048 00049 public int getNumProcessTimeline() { 00050 if (traces == null) 00051 return 0; 00052 return traces.length; 00053 } 00054 }