本文整理汇总了Java中org.cytoscape.work.Task类的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Task类属于org.cytoscape.work包,在下文中一共展示了Task类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startTask
import org.cytoscape.work.Task; //导入依赖的package包/类
private void startTask(Task task)
{
Task updateTask = new AbstractTask() {
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
updateContents();
}
};
TaskManager<?,?> mgr = registrar.getService(TaskManager.class);
mgr.execute(new TaskIterator(task, updateTask));
}
示例2: actionPerformed
import org.cytoscape.work.Task; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
Optional<AnnotationSet> as = modelManager.getActiveNetworkViewSet().flatMap(NetworkViewSet::getActiveAnnotationSet);
if(as.isPresent()) {
List<FileChooserFilter> filter = Collections.singletonList(new FileChooserFilter("txt Files", "txt"));
File file = fileUtil.getFile(jframeProvider.get(), TITLE, FileUtil.SAVE, filter);
if(file != null) {
Task exportTask = new ExportTask(as.get(), file);
dialogTaskManager.execute(new TaskIterator(exportTask));
}
}
}
示例3: taskIterator
import org.cytoscape.work.Task; //导入依赖的package包/类
public static Collector<Task, ?, TaskIterator> taskIterator() {
return Collector.of(
TaskIterator::new,
TaskIterator::append,
(left, right) -> { left.append(right); return left; },
Collector.Characteristics.IDENTITY_FINISH);
}
示例4: taskMessage
import org.cytoscape.work.Task; //导入依赖的package包/类
public static Task taskMessage(String message) {
return new AbstractTask() {
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setTitle(BuildProperties.APP_NAME);
taskMonitor.setStatusMessage(message);
}
};
}
示例5: taskOf
import org.cytoscape.work.Task; //导入依赖的package包/类
public static Task taskOf(Runnable runnable) {
return new AbstractTask() {
@Override
public void run(TaskMonitor taskMonitor) {
runnable.run();
}
};
}
示例6: taskFactory
import org.cytoscape.work.Task; //导入依赖的package包/类
public static TaskFactory taskFactory(Provider<? extends Task> taskProvider) {
return new AbstractTaskFactory() {
@Override
public TaskIterator createTaskIterator() {
return new TaskIterator(taskProvider.get());
}
};
}
示例7: createTaskIterator
import org.cytoscape.work.Task; //导入依赖的package包/类
@Override
public TaskIterator createTaskIterator() {
final String tempColumn = UUID.randomUUID().toString();
CyNetwork network = annotationSet.getParent().getNetwork();
CyTable nodeTable = network.getDefaultNodeTable();
// Create a temp column of cluster identifiers
Task createTempColumnTask = TaskTools.taskOf(() -> {
nodeTable.createColumn(tempColumn, Integer.class, false);
int i = 0;
for(Cluster cluster: annotationSet.getClusters()) {
for(CyNode node : cluster.getNodes()) {
network.getRow(node).set(tempColumn, i);
}
i++;
}
});
// Layout the clusters
Collection<Collection<CyNode>> clusters = annotationSet.getClusters().stream().map(Cluster::getNodes).collect(Collectors.toSet());
LayoutClustersTaskFactory layoutTaskFactory = layoutTaskFactoryFactory.create(clusters, annotationSet.getParent().getNetworkView(), tempColumn);
TaskIterator layoutTasks = layoutTaskFactory.createTaskIterator();
// Delete the temp column
Task deleteTempColumnTask = TaskTools.taskOf(() -> {
nodeTable.deleteColumn(tempColumn);
});
TaskIterator tasks = new TaskIterator();
tasks.append(TaskTools.taskMessage("Layout '" + annotationSet.getName() + "'"));
tasks.append(createTempColumnTask);
tasks.append(layoutTasks);
tasks.append(deleteTempColumnTask);
return tasks;
}
示例8: execute
import org.cytoscape.work.Task; //导入依赖的package包/类
@Override
public void execute(TaskIterator iterator, TaskObserver observer) {
TaskMonitor monitor = mock(TaskMonitor.class);
FinishStatus finishStatus = null;
Task task = null;
try {
while(iterator.hasNext()) {
task = iterator.next();
if(tasksToIgnore.contains(task.getClass())) {
//System.out.println("Task Ignored: " + task.getClass());
continue;
}
task.run(monitor);
//System.out.println("Task Ran: " + task.getClass());
if(task instanceof ObservableTask && observer != null) {
observer.taskFinished((ObservableTask)task);
}
}
finishStatus = FinishStatus.getSucceeded();
} catch(Exception e) {
finishStatus = FinishStatus.newFailed(task, e);
e.printStackTrace();
throw new AssertionError("Task failed", e);
} finally {
if(observer != null) {
observer.allFinished(finishStatus);
}
}
}
示例9: SimpleTaskFactory
import org.cytoscape.work.Task; //导入依赖的package包/类
public SimpleTaskFactory(FactoryMethod<Task> factory) {
this.factory = factory;
}
示例10: registerCommand
import org.cytoscape.work.Task; //导入依赖的package包/类
private void registerCommand(BundleContext bc, String name, Class<? extends Task> type, String description) {
TaskFactory taskFactory = taskFactory(injector.getProvider(type));
registerCommand(bc, name, false, taskFactory, description);
}
示例11: createDrawTask
import org.cytoscape.work.Task; //导入依赖的package包/类
Task createDrawTask(Cluster cluster);