📄 incrementcontrol.java
字号:
package edu.odu.cs.zeil.AlgAE.Client;/** * Control information regarding incremental movement of graphics * (when nodes change position, they can be drawn in a series of * intermediate positions over time, giving an illusion of movement and * aiding in visual tracking of changes to the picture). * * @author Steven J. Zeil */public class IncrementControl{ /** * If one or more nodes have changed position, how many steps * should be used in visibly moving the node from its former * position to its new one? * @see edu.odu.cs.zeil.AlgAE.Client.DataViewer.DataGraph.Graph.initiateMovement */ private int incrementTotal; /** * Get the value of incrementTotal. * @return Value of incrementTotal. */ public synchronized int getIncrementTotal() {return incrementTotal;} /** * In portraying incremental movement, on which step out of * the <code>incrementTotal</code> are we currently at? * * @see edu.odu.cs.zeil.AlgAE.Client.DataViewer.DataGraph.Graph.initiateMovement */ private int incrementStep; /** * Get the value of incrementStep. * @return Value of incrementStep. */ public synchronized int getIncrementStep() {return incrementStep;} /** * Time interval (in seconds) between steps. */ private double incrementTime; /** * Get the value of incrementTime. * @return Value of incrementTime. */ public synchronized double getIncrementTime() {return incrementTime;} /** * Create an IncrementControl object. */ public IncrementControl() { incrementTime = 0.25; incrementTotal = 5; incrementStep = incrementTotal; } /** * Have we drawn the full set of incremental pictures? **/ public synchronized boolean completed() { return incrementStep >= incrementTotal; } /** * Set/reset the increment state. * * @param step current step number * @param nSteps total number of steps to draw * @param interval number of seconds between drawings * */ public synchronized void set (int step, int nSteps, double interval) { incrementStep = step; incrementTotal = nSteps; incrementTime = interval; } /** * Advance the increment counter */ public synchronized void advance () { if (incrementStep < incrementTotal) ++incrementStep; } /** * Cancel any remaining incremental drawings. */ public synchronized void cancel () { incrementStep = incrementTotal; } /** * Set the value of incrementStep. * @param v Value to assign to incrementStep. */ public synchronized void setIncrementStep(int v) {this.incrementStep = v;} }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -