changeset 302:de6d7361b523

remove package alice.topology.manager.keeparive
author sugi
date Tue, 05 Nov 2013 03:55:24 +0900
parents f117b0108dde
children 6e0a909b4b12
files src/alice/topology/manager/keeparive/PingScheduler.java src/alice/topology/manager/keeparive/SchedulerViewer.java src/alice/topology/manager/keeparive/StartViewer.java src/alice/topology/manager/keeparive/TaskInfo.java
diffstat 4 files changed, 0 insertions(+), 280 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/topology/manager/keeparive/PingScheduler.java	Mon Nov 04 13:10:50 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-package alice.topology.manager.keeparive;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import alice.codesegment.CodeSegment;
-
-public class PingScheduler extends CodeSegment{
-	private LinkedList<TaskInfo> list = new LinkedList<TaskInfo>();
-	private ArrayList<TaskInfo> regist = new ArrayList<TaskInfo>();
-	public boolean updateFlag = false;
-	public long time = 0;
-	public int taskNum = 0;
-	public TaskInfo nowTask;
-	
-	public List<TaskInfo> nameList(){
-		return regist;
-	}
-	
-	public List<TaskInfo> getTaskList(){
-		return list;
-	}
-	
-	public synchronized void wake(){
-		long t = System.currentTimeMillis();
-		long addTime = nowTask.getTime() - (t - time);
-		TaskInfo ti = list.get(0);
-		ti.setTime(ti.getTime() + addTime);
-		this.notify();
-	}
-	
-	public synchronized void addTask(TaskInfo newInfo){
-		boolean newTaskFlag = true;
-		for (TaskInfo t : regist){
-			if(newInfo.getName().equals(t.getName())){
-				newInfo.setTaskNum(t.getTaskNum());
-				newTaskFlag = false;
-				break;
-			}
-		}
-		if (newTaskFlag){
-			taskNum +=10;
-			newInfo.setTaskNum(taskNum);
-		}
-		boolean addFlag = true;
-		for (int i = 0;i< list.size(); i++){
-			TaskInfo info = list.get(i);
-			Long t = info.getTime();
-			if (newInfo.getTime() > t ){
-				newInfo.setTime(newInfo.getTime() -t);
-			} else {
-				list.add(i, newInfo);
-				if (i != list.size() -1 ){
-					TaskInfo nextInfo = list.get(i+1);
-					newInfo.setTime(nextInfo.getTime() - newInfo.getTime());
-				}
-				addFlag = false;
-				break;
-			}
-		}
-		if (addFlag)
-			list.add(newInfo);
-		
-		this.updateFlag = true;
-	}
-
-	@Override
-	public synchronized void run() {
-		try {
-			while(true){
-				if(list.size()== 0)System.exit(0);
-				nowTask = list.poll();
-				time = System.currentTimeMillis();
-				this.wait(nowTask.getTime());
-			}
-		} catch (InterruptedException e) {
-		}
-	}
-}
--- a/src/alice/topology/manager/keeparive/SchedulerViewer.java	Mon Nov 04 13:10:50 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-package alice.topology.manager.keeparive;
-
-/**
- * Copyright (c) 2008, 2012 Oracle and/or its affiliates.
- * All rights reserved. Use is subject to license terms.
- */
-import javafx.application.Application;
-import javafx.scene.Group;
-import javafx.scene.Scene;
-import javafx.stage.Stage;
-import javafx.animation.Animation;
-import javafx.animation.KeyFrame;
-import javafx.animation.Timeline;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.scene.chart.LineChart;
-import javafx.scene.chart.NumberAxis;
-import javafx.scene.chart.XYChart;
-import javafx.util.Duration;
-
-/**
- * A simulated stock line chart.
- *
- * @see javafx.scene.chart.Chart
- * @see javafx.scene.chart.LineChart
- * @see javafx.scene.chart.NumberAxis
- * @see javafx.scene.chart.XYChart
- */
-public class SchedulerViewer extends Application {
-	private PingScheduler ps;
-	private XYChart.Series<Number,Number> hourDataSeries;
-	private NumberAxis xAxis;
-	private Timeline animation;
-
-	private double hours = 0;
-	private double minutes = 0;
-	private double timeInHours = 0;
-	
-
-	private void init(Stage primaryStage) {
-		Group root = new Group();
-		primaryStage.setScene(new Scene(root));
-		root.getChildren().add(createChart());
-		// create timeline to add new data every 60th of second
-		animation = new Timeline();
-		animation.getKeyFrames().add(new KeyFrame(Duration.millis(1000/60), new EventHandler<ActionEvent>() {
-			@Override public void handle(ActionEvent actionEvent) {
-				// 6 minutes data per frame
-				for(int count=0; count < 6; count++) {
-					nextTime();
-					plotTime();
-				}
-			}
-		}));
-		animation.setCycleCount(Animation.INDEFINITE);
-	}
-
-	protected LineChart<Number, Number> createChart() {
-		xAxis = new NumberAxis(0,100,10);
-		final NumberAxis yAxis = new NumberAxis(0,100,10);
-		final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
-		// setup chart
-		lc.setId("lineStockDemo");
-		lc.setCreateSymbols(false);
-		lc.setAnimated(false);
-		lc.setLegendVisible(false);
-		lc.setTitle("Task Viewer");
-		xAxis.setLabel("Time");
-		xAxis.setForceZeroInRange(false);
-		yAxis.setLabel("Task Name");
-		yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null));
-		// add starting data
-		hourDataSeries = new XYChart.Series<Number,Number>();
-		for (double m=0; m<(60); m++) {
-			nextTime();
-			plotTime();
-			plotGraph();
-		}
-		lc.getData().add(hourDataSeries);
-		return lc;
-	}
-
-	private void plotGraph() {
-		if (ps.updateFlag){
-			if(!hourDataSeries.getData().isEmpty())
-				hourDataSeries.getData().clear();
-			int count = 0;
-			hourDataSeries.getData().add(new XYChart.Data<Number, Number>(count, ps.nowTask.getTaskNum()));
-			count += ps.nowTask.getTime()/1000;
-			hourDataSeries.getData().add(new XYChart.Data<Number, Number>(count, ps.nowTask.getTaskNum()));
-			
-			for (TaskInfo info : ps.getTaskList()){
-				hourDataSeries.getData().add(new XYChart.Data<Number, Number>(count, info.getTaskNum()));
-				count += info.getTime()/1000;
-				hourDataSeries.getData().add(new XYChart.Data<Number, Number>(count, info.getTaskNum()));	
-			}
-			ps.updateFlag = false;
-		}
-		
-		
-	}
-
-	private void nextTime() {
-		if (minutes == 59) {
-			hours ++;
-			minutes = 0;
-		} else {
-			minutes ++;
-		}
-		timeInHours = hours + ((1d/60d)*minutes);
-	}
-
-	private void plotTime() {
-		if ((timeInHours % 1) == 0) {
-				xAxis.setLowerBound(xAxis.getLowerBound()+1);
-				xAxis.setUpperBound(xAxis.getUpperBound()+1);
-			
-		}
-	}
-	
-	public void StartScheduler(){
-		ps = new PingScheduler();
-		TaskInfo a = new TaskInfo("a", 10 * 1000);
-		
-		
-		TaskInfo d = new TaskInfo("d", 100 * 1000);
-		TaskInfo c = new TaskInfo("c", 40 * 1000);
-		TaskInfo b = new TaskInfo("b", 20 * 1000);
-		
-		
-		ps.addTask(a);
-		ps.addTask(b);
-		ps.addTask(c);
-		
-		ps.addTask(d);
-		
-		for (TaskInfo info :ps.getTaskList()){
-			System.out.println(info.getTime());
-		}
-		ps.execute();
-	}
-
-	public void play() {
-		animation.play();
-	}
-
-	@Override public void stop() {
-		animation.pause();
-	}    
-
-	@Override public void start(Stage primaryStage) throws Exception {
-		StartScheduler();
-		init(primaryStage);
-		primaryStage.show();
-		play();
-	}
-	
-}
--- a/src/alice/topology/manager/keeparive/StartViewer.java	Mon Nov 04 13:10:50 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-package alice.topology.manager.keeparive;
-
-import javafx.application.Application;
-
-public class StartViewer {
-	public static void main(String[] args) {
-		Application.launch(SchedulerViewer.class, args);
-		
-	}
-}
--- a/src/alice/topology/manager/keeparive/TaskInfo.java	Mon Nov 04 13:10:50 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-package alice.topology.manager.keeparive;
-
-public class TaskInfo {
-	private long nextPingTime;
-	private String taskName;
-	private int taskNum = 0;
-	
-	public TaskInfo(String n, long t){
-		nextPingTime = t;
-		taskName = n;
-	}
-	
-	public long getTime(){
-		return nextPingTime;
-	}
-	
-	public String getName(){
-		return taskName;
-	}
-
-	public void setTime(long time){
-		nextPingTime = time;
-	}
-	
-	public int getTaskNum(){
-		return taskNum;
-	}
-
-	public void setTaskNum(int num){
-		taskNum = num;
-	}
-}