mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Removed Braids progress monitor (unused)
This commit is contained in:
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -12670,7 +12670,6 @@ src/main/java/forge/gui/GuiUtils.java svneol=native#text/plain
|
||||
src/main/java/forge/gui/ListChooser.java svneol=native#text/plain
|
||||
src/main/java/forge/gui/MultiLineLabel.java svneol=native#text/plain
|
||||
src/main/java/forge/gui/MultiLineLabelUI.java svneol=native#text/plain
|
||||
src/main/java/forge/gui/MultiPhaseProgressMonitorWithETA.java svneol=native#text/plain
|
||||
src/main/java/forge/gui/SOverlayUtils.java -text
|
||||
src/main/java/forge/gui/UnsortedListModel.java -text
|
||||
src/main/java/forge/gui/WrapLayout.java -text
|
||||
@@ -12945,10 +12944,6 @@ src/main/java/forge/view/arcane/util/ImageUtil.java svneol=native#text/plain
|
||||
src/main/java/forge/view/arcane/util/UI.java svneol=native#text/plain
|
||||
src/main/java/forge/view/arcane/util/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/view/package-info.java svneol=native#text/plain
|
||||
src/main/java/net/slightlymagic/braids/BaseProgressMonitor.java svneol=native#text/plain
|
||||
src/main/java/net/slightlymagic/braids/BraidsProgressMonitor.java svneol=native#text/plain
|
||||
src/main/java/net/slightlymagic/braids/LICENSE.txt svneol=native#text/plain
|
||||
src/main/java/net/slightlymagic/braids/package-info.java svneol=native#text/plain
|
||||
src/main/java/tree/properties/PropertyElement.java svneol=native#text/plain
|
||||
src/main/java/tree/properties/PropertyType.java svneol=native#text/plain
|
||||
src/main/java/tree/properties/TreeProperties.java svneol=native#text/plain
|
||||
|
||||
@@ -1,322 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.gui;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import forge.util.ThreadUtil;
|
||||
|
||||
import net.slightlymagic.braids.BaseProgressMonitor;
|
||||
|
||||
/**
|
||||
* GUI Progress Monitor that displays the ETA (Estimated Time of Arrival or
|
||||
* completion) on some platforms and supports one or multiple phases of
|
||||
* progress.
|
||||
*
|
||||
* In this implementation, each phase opens a new dialog.
|
||||
*/
|
||||
public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
|
||||
|
||||
private transient GuiProgressBarWindow dialog;
|
||||
private transient String title;
|
||||
|
||||
/**
|
||||
* Convenience for MultiPhaseProgressMonitorWithETA(title, numPhases,
|
||||
* totalUnitsFirstPhase, minUIUpdateIntervalSec, null).
|
||||
*
|
||||
* @param neoTitle
|
||||
* the title to give the dialog box(es)
|
||||
* @param numPhases
|
||||
* the total number of phases to expect
|
||||
* @param totalUnitsFirstPhase
|
||||
* the total number of units that will be processed in the first
|
||||
* phase
|
||||
* @param minUIUpdateIntervalSec
|
||||
* the approximate interval at which to update the dialog box in
|
||||
* seconds
|
||||
* @see #MultiPhaseProgressMonitorWithETA(String,int,long,float,float[])
|
||||
*/
|
||||
public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases,
|
||||
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec) {
|
||||
this(neoTitle, numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a GUI progress monitor and open its first dialog.
|
||||
*
|
||||
* Like all swing components, this constructor must be invoked from the
|
||||
* swing Event Dispatching Thread. The rest of the methods of this class are
|
||||
* exempt from this requirement.
|
||||
*
|
||||
* @param neoTitle
|
||||
* the title to give the dialog box(es)
|
||||
*
|
||||
* @param numPhases
|
||||
* the total number of phases to expect
|
||||
*
|
||||
* @param totalUnitsFirstPhase
|
||||
* the total number of units that will be processed in the first
|
||||
* phase
|
||||
*
|
||||
* @param minUIUpdateIntervalSec
|
||||
* the approximate interval at which to update the dialog box in
|
||||
* seconds
|
||||
*
|
||||
* @param phaseWeights
|
||||
* see BaseProgressMonitor
|
||||
*
|
||||
* @see BaseProgressMonitor#BaseProgressMonitor(int,long,float,float[])
|
||||
*/
|
||||
public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases,
|
||||
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec, final float[] phaseWeights) {
|
||||
super(numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, phaseWeights);
|
||||
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
throw new IllegalStateException("must be called from within an event dispatch thread");
|
||||
}
|
||||
|
||||
this.title = neoTitle;
|
||||
|
||||
if ((totalUnitsFirstPhase > 0) && (this.dialog == null)) {
|
||||
throw new IllegalStateException("dialog is null");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For developer testing.
|
||||
*
|
||||
* @param args
|
||||
* ignored
|
||||
*/
|
||||
public static void main(final String[] args) {
|
||||
|
||||
System.out.println("Initializing...");
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
final int totalUnitsFirstPhase = 5000;
|
||||
final MultiPhaseProgressMonitorWithETA monitor = new MultiPhaseProgressMonitorWithETA(
|
||||
"Testing 2 phases", 2, totalUnitsFirstPhase, 1.0f, new float[] { 2, 1 });
|
||||
|
||||
final SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
|
||||
@Override
|
||||
public Object doInBackground() {
|
||||
|
||||
System.out.println("Running...");
|
||||
|
||||
for (int i = 0; i <= totalUnitsFirstPhase; i++) {
|
||||
monitor.incrementUnitsCompletedThisPhase(1);
|
||||
|
||||
System.out.print("\ri = " + i);
|
||||
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (final InterruptedException ignored) {
|
||||
// blank
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
|
||||
final int totalUnitsSecondPhase = 2000;
|
||||
monitor.markCurrentPhaseAsComplete(totalUnitsSecondPhase);
|
||||
|
||||
for (int i = 0; i <= totalUnitsSecondPhase; i++) {
|
||||
monitor.incrementUnitsCompletedThisPhase(1);
|
||||
|
||||
System.out.print("\ri = " + i);
|
||||
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (final InterruptedException ignored) {
|
||||
// blank
|
||||
}
|
||||
}
|
||||
|
||||
monitor.markCurrentPhaseAsComplete(0);
|
||||
|
||||
System.out.println();
|
||||
System.out.println("Done!");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
worker.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the total units this phase.
|
||||
*
|
||||
* @param numUnits
|
||||
* cannot be higher than Integer.MAX_VALUE
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#setTotalUnitsThisPhase(long)
|
||||
*/
|
||||
@Override
|
||||
public final void setTotalUnitsThisPhase(final long numUnits) {
|
||||
super.setTotalUnitsThisPhase(numUnits);
|
||||
|
||||
if (numUnits > Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("numUnits must be <= " + Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
if (numUnits > 0) {
|
||||
// dialog must exist before we exit this method.
|
||||
ThreadUtil.invokeInEventDispatchThreadAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// (Re)create the progress bar.
|
||||
if (MultiPhaseProgressMonitorWithETA.this.dialog != null) {
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.dispose();
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog = null;
|
||||
}
|
||||
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog = new GuiProgressBarWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.setTitle(MultiPhaseProgressMonitorWithETA.this.title);
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.setVisible(true);
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.setResizable(true);
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar().setIndeterminate(false);
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.setProgressRange(0, (int) numUnits);
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.reset();
|
||||
|
||||
final JProgressBar bar = MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar();
|
||||
bar.setString("");
|
||||
bar.setStringPainted(true);
|
||||
bar.setValue(0);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment units completed this phase.
|
||||
*
|
||||
* @param numUnits
|
||||
* the num units
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#incrementUnitsCompletedThisPhase(long)
|
||||
*/
|
||||
@Override
|
||||
public final void incrementUnitsCompletedThisPhase(final long numUnits) {
|
||||
super.incrementUnitsCompletedThisPhase(numUnits);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < numUnits; i++) {
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.increment();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (this.shouldUpdateUI()) {
|
||||
|
||||
if ((this.getNumPhases() > 1)) {
|
||||
this.displayUpdate("Phase " + this.getCurrentPhase() + ". "
|
||||
// + getUnitsCompletedSoFarThisPhase() + " units processed. "
|
||||
// + "Overall: " + getTotalPercentCompleteAsString() +
|
||||
// "% complete, "
|
||||
+ "Overall ETA in " + this.getRelativeETAAsString() + ".");
|
||||
} else {
|
||||
this.displayUpdate(
|
||||
// "Overall: " +
|
||||
this.getUnitsCompletedSoFarThisPhase() + " units processed; "
|
||||
// + "(" + getTotalPercentCompleteAsString() + "%); "
|
||||
+ "ETA in " + this.getRelativeETAAsString() + ".");
|
||||
}
|
||||
}
|
||||
|
||||
if ((this.getCurrentPhase() == this.getNumPhases())
|
||||
&& (this.getUnitsCompletedSoFarThisPhase() >= this.getTotalUnitsThisPhase())) {
|
||||
this.displayUpdate("Done!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the message inside the progress dialog; does not always work on all
|
||||
* platforms.
|
||||
*
|
||||
* @param message
|
||||
* the message to display
|
||||
*/
|
||||
public final void displayUpdate(final String message) {
|
||||
|
||||
final Runnable proc = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// i've been having trouble getting the dialog to display its
|
||||
// title.
|
||||
MultiPhaseProgressMonitorWithETA.this.dialog.setTitle(MultiPhaseProgressMonitorWithETA.this.title);
|
||||
|
||||
final JProgressBar bar = MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar();
|
||||
bar.setString(message);
|
||||
|
||||
MultiPhaseProgressMonitorWithETA.this.justUpdatedUI();
|
||||
}
|
||||
};
|
||||
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
proc.run();
|
||||
} else {
|
||||
SwingUtilities.invokeLater(proc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* net.slightlymagic.braids.util.progress_monitor.BaseProgressMonitor#dispose
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public final void dispose() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MultiPhaseProgressMonitorWithETA.this.getDialog().dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dialog.
|
||||
*
|
||||
* @return the JDialog for the current phase; use this judiciously to
|
||||
* manipulate the dialog directly.
|
||||
*/
|
||||
public final JDialog getDialog() {
|
||||
return this.dialog;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public enum FModel {
|
||||
testNetworkConnection();
|
||||
|
||||
this.setBuildInfo(new BuildInfo());
|
||||
FModel.loadDynamicGamedata();
|
||||
this.loadDynamicGamedata();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ public enum FModel {
|
||||
/**
|
||||
* Load dynamic gamedata.
|
||||
*/
|
||||
public static void loadDynamicGamedata() {
|
||||
public void loadDynamicGamedata() {
|
||||
if (!Constant.CardTypes.LOADED[0]) {
|
||||
final List<String> typeListFile = FileUtil.readFile("res/gamedata/TypeLists.txt");
|
||||
|
||||
|
||||
@@ -1,664 +0,0 @@
|
||||
/*
|
||||
* The files in the directory "net/slightlymagic/braids" and in all subdirectories of it (the "Files") are
|
||||
* Copyright 2011 Braids Cabal-Conjurer. They are available under either Forge's
|
||||
* main license (the GNU Public License; see LICENSE.txt in Forge's top directory)
|
||||
* or under the Apache License, as explained below.
|
||||
*
|
||||
* The Files are additionally licensed under the Apache License, Version 2.0 (the
|
||||
* "Apache License"); you may not use the files in this directory except in
|
||||
* compliance with one of its two licenses. You may obtain a copy of the Apache
|
||||
* License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the Apache License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the Apache License for the specific language governing permissions and
|
||||
* limitations under the Apache License.
|
||||
*
|
||||
*/
|
||||
package net.slightlymagic.braids;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
/**
|
||||
* This base class also acts as a "null" progress monitor; it doesn't display
|
||||
* anything when updated.
|
||||
*
|
||||
* Absolute times are measured in seconds, in congruence with ProgressMonitor.
|
||||
*
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor
|
||||
*/
|
||||
public class BaseProgressMonitor implements BraidsProgressMonitor {
|
||||
private int numPhases;
|
||||
private int currentPhase;
|
||||
private long totalUnitsThisPhase;
|
||||
private long unitsCompletedSoFarThisPhase;
|
||||
private float minUIUpdateIntervalSec;
|
||||
private long lastUIUpdateTime;
|
||||
private long phaseOneStartTime;
|
||||
private long currentPhaseStartTime;
|
||||
private float currentPhaseExponent;
|
||||
private long[] phaseDurationHistorySecList;
|
||||
private float[] phaseWeights;
|
||||
|
||||
/** The SECOND s_ pe r_ minute. */
|
||||
private final int secondsPerMinute = 60;
|
||||
|
||||
/** The SECOND s_ pe r_ hour. */
|
||||
private final int secondsPerHour = 60 * secondsPerMinute;
|
||||
|
||||
/** The SECOND s_ pe r_ day. */
|
||||
private final int secondsPerDay = 24 * secondsPerHour;
|
||||
|
||||
/**
|
||||
* Convenience for BaseProgressMonitor(1, 1, 2.0f, null).
|
||||
*
|
||||
* @see #BaseProgressMonitor(int,long,float,float[])
|
||||
*/
|
||||
public BaseProgressMonitor() {
|
||||
this(1, 1L, 2.0f, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience for BaseProgressMonitor(numPhases, 1, 2.0f, null).
|
||||
*
|
||||
* @param numPhases
|
||||
* the num phases
|
||||
* @see #BaseProgressMonitor(int,long,float,float[])
|
||||
*/
|
||||
public BaseProgressMonitor(final int numPhases) {
|
||||
this(numPhases, 1L, 2.0f, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience for BaseProgressMonitor(numPhases, totalUnitsFirstPhase,
|
||||
* 2.0f, null).
|
||||
*
|
||||
* @param numPhases
|
||||
* the num phases
|
||||
* @param totalUnitsFirstPhase
|
||||
* the total units first phase
|
||||
* @see #BaseProgressMonitor(int,long,float,float[])
|
||||
*/
|
||||
public BaseProgressMonitor(final int numPhases, final long totalUnitsFirstPhase) {
|
||||
this(numPhases, totalUnitsFirstPhase, 2.0f, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience for BaseProgressMonitor(numPhases, totalUnitsFirstPhase,
|
||||
* minUIUpdateIntervalSec, null).
|
||||
*
|
||||
* @param numPhases
|
||||
* the num phases
|
||||
* @param totalUnitsFirstPhase
|
||||
* the total units first phase
|
||||
* @param minUIUpdateIntervalSec
|
||||
* the min ui update interval sec
|
||||
* @see #BaseProgressMonitor(int,long,float,float[])
|
||||
*/
|
||||
public BaseProgressMonitor(final int numPhases,
|
||||
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec) {
|
||||
this(numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes fields and starts the timers.
|
||||
*
|
||||
* @param numPhases
|
||||
* the total number of phases we will monitor
|
||||
*
|
||||
* @param totalUnitsFirstPhase
|
||||
* how many units to expect in phase 1
|
||||
*
|
||||
* @param minUIUpdateIntervalSec
|
||||
* the approximate interval at which we update the user
|
||||
* interface, in seconds
|
||||
*
|
||||
* @param phaseWeights
|
||||
* may be null; if not null, this indicates the relative weight
|
||||
* of each phase in terms of time to complete all phases. Index 0
|
||||
* of this array indicates phase 1's weight, index 1 indicates
|
||||
* the weight of phase 2, and so on. If null, all phases are
|
||||
* considered to take an equal amount of time to complete, which
|
||||
* is equivalent to setting all phase weights to 1.0f. For
|
||||
* example, if there are two phases, and the phase weights are
|
||||
* set to {2.0f, 1.0f}, then the methods that compute the final
|
||||
* ETA (Estimated Time of Arrival or completion) will assume that
|
||||
* phase 2 takes half as long as phase 1. In other words, the
|
||||
* operation will spend 67% of its time in phase 1, and 33% of
|
||||
* its time in phase 2.
|
||||
*/
|
||||
public BaseProgressMonitor(final int numPhases, final long totalUnitsFirstPhase,
|
||||
final float minUIUpdateIntervalSec, final float[] phaseWeights) {
|
||||
this.numPhases = numPhases;
|
||||
this.currentPhase = 1;
|
||||
this.unitsCompletedSoFarThisPhase = 0L;
|
||||
this.minUIUpdateIntervalSec = minUIUpdateIntervalSec;
|
||||
this.lastUIUpdateTime = 0L;
|
||||
this.phaseOneStartTime = new Date().getTime() / 1000;
|
||||
this.currentPhaseStartTime = this.phaseOneStartTime;
|
||||
this.currentPhaseExponent = 1;
|
||||
this.phaseDurationHistorySecList = new long[numPhases];
|
||||
|
||||
if (phaseWeights == null) {
|
||||
this.phaseWeights = new float[numPhases];
|
||||
for (int ix = 0; ix < numPhases; ix++) {
|
||||
this.phaseWeights[ix] = 1.0f;
|
||||
}
|
||||
} else {
|
||||
this.phaseWeights = phaseWeights;
|
||||
}
|
||||
|
||||
setTotalUnitsThisPhase(totalUnitsFirstPhase);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Does nothing.
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the num phases.
|
||||
*
|
||||
* @return the num phases
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getNumPhases()
|
||||
*/
|
||||
@Override
|
||||
public final int getNumPhases() {
|
||||
return this.numPhases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min update interval sec.
|
||||
*
|
||||
* @return the min update interval sec
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getMinUpdateIntervalSec()
|
||||
*/
|
||||
@Override
|
||||
public final float getMinUpdateIntervalSec() {
|
||||
return this.minUIUpdateIntervalSec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current phase.
|
||||
*
|
||||
* @return the current phase
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getCurrentPhase()
|
||||
*/
|
||||
@Override
|
||||
public final int getCurrentPhase() {
|
||||
return this.currentPhase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the units completed so far this phase.
|
||||
*
|
||||
* @return the units completed so far this phase
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getUnitsCompletedSoFarThisPhase()
|
||||
*/
|
||||
@Override
|
||||
public final long getUnitsCompletedSoFarThisPhase() {
|
||||
return this.unitsCompletedSoFarThisPhase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total units this phase.
|
||||
*
|
||||
* @return the total units this phase
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getTotalUnitsThisPhase()
|
||||
*/
|
||||
@Override
|
||||
public final long getTotalUnitsThisPhase() {
|
||||
return this.totalUnitsThisPhase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last ui update time.
|
||||
*
|
||||
* @return the last ui update time
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getLastUIUpdateTime()
|
||||
*/
|
||||
@Override
|
||||
public final long getLastUIUpdateTime() {
|
||||
return this.lastUIUpdateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the phase one start time.
|
||||
*
|
||||
* @return the phase one start time
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getPhaseOneStartTime()
|
||||
*/
|
||||
@Override
|
||||
public final long getPhaseOneStartTime() {
|
||||
return this.phaseOneStartTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current phase start time.
|
||||
*
|
||||
* @return the current phase start time
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getCurrentPhaseStartTime()
|
||||
*/
|
||||
@Override
|
||||
public final long getCurrentPhaseStartTime() {
|
||||
return this.currentPhaseStartTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the min update interval sec.
|
||||
*
|
||||
* @param value
|
||||
* the new min update interval sec
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#setMinUpdateIntervalSec(float)
|
||||
*/
|
||||
@Override
|
||||
public final void setMinUpdateIntervalSec(final float value) {
|
||||
this.minUIUpdateIntervalSec = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the total units this phase.
|
||||
*
|
||||
* @param value
|
||||
* the new total units this phase
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#setTotalUnitsThisPhase(long)
|
||||
*/
|
||||
@Override
|
||||
public void setTotalUnitsThisPhase(final long value) {
|
||||
this.totalUnitsThisPhase = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the percent complete of this phase as string.
|
||||
*
|
||||
* @return the percent complete of this phase as string
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getPercentCompleteOfThisPhaseAsString()
|
||||
*/
|
||||
@Override
|
||||
public final String getPercentCompleteOfThisPhaseAsString() {
|
||||
|
||||
Float percent = getPercentCompleteOfThisPhaseAsFloat();
|
||||
|
||||
if (percent != null) {
|
||||
return Integer.toString((int) (float) percent);
|
||||
} else {
|
||||
return "??";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total percent complete as string.
|
||||
*
|
||||
* @return the total percent complete as string
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getTotalPercentCompleteAsString()
|
||||
*/
|
||||
@Override
|
||||
public final String getTotalPercentCompleteAsString() {
|
||||
Float percent = getTotalPercentCompleteAsFloat();
|
||||
|
||||
if (percent == null) {
|
||||
return "??";
|
||||
} else {
|
||||
return Integer.toString((int) (float) percent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience for getRelativeETAAsString(false), meaning to compute the
|
||||
* value for the end of the last phase.
|
||||
*
|
||||
* @return the relative eta as string
|
||||
* @see #getRelativeETAAsString(boolean)
|
||||
*/
|
||||
public final String getRelativeETAAsString() {
|
||||
return getRelativeETAAsString(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relative eta as string.
|
||||
*
|
||||
* @param thisPhaseOnly
|
||||
* the this phase only
|
||||
* @return the relative eta as string
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getRelativeETAAsString(boolean)
|
||||
*/
|
||||
@Override
|
||||
public final String getRelativeETAAsString(final boolean thisPhaseOnly) {
|
||||
|
||||
Integer etaSec = getRelativeETASec(thisPhaseOnly);
|
||||
|
||||
if (etaSec == null) {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
String result = "";
|
||||
if (etaSec > secondsPerDay) {
|
||||
result += Integer.toString(etaSec / secondsPerDay);
|
||||
result += " da, ";
|
||||
etaSec %= secondsPerDay; // Shave off the portion recorded.
|
||||
}
|
||||
if (result.length() > 0 || etaSec > secondsPerHour) {
|
||||
result += Integer.toString(etaSec / secondsPerHour);
|
||||
result += " hr, ";
|
||||
etaSec %= secondsPerHour; // Shave off the portion recorded.
|
||||
}
|
||||
if (result.length() > 0 || etaSec > secondsPerMinute) {
|
||||
result += Integer.toString(etaSec / secondsPerMinute);
|
||||
result += " min, ";
|
||||
etaSec %= secondsPerMinute; // Shave off the portion recorded.
|
||||
}
|
||||
|
||||
result += Integer.toString(etaSec);
|
||||
result += " sec";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience for getAbsoluteETAAsLocalTimeString(false), meaning to
|
||||
* compute the value for the end of the last phase.
|
||||
*
|
||||
* @return the absolute eta as local time string
|
||||
* @see #getAbsoluteETAAsLocalTimeString(boolean)
|
||||
*/
|
||||
public final String getAbsoluteETAAsLocalTimeString() {
|
||||
return getAbsoluteETAAsLocalTimeString(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the absolute eta as local time string.
|
||||
*
|
||||
* @param thisPhaseOnly
|
||||
* the this phase only
|
||||
* @return the absolute eta as local time string
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getAbsoluteETAAsLocalTimeString(boolean)
|
||||
*/
|
||||
@Override
|
||||
public final String getAbsoluteETAAsLocalTimeString(final boolean thisPhaseOnly) {
|
||||
Long etaTime = getAbsoluteETATime(thisPhaseOnly);
|
||||
|
||||
if (etaTime == null) {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
return (new Date(etaTime * 1000).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment units completed this phase.
|
||||
*
|
||||
* @param numUnits
|
||||
* the num units
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#incrementUnitsCompletedThisPhase(long)
|
||||
*/
|
||||
@Override
|
||||
public void incrementUnitsCompletedThisPhase(final long numUnits) {
|
||||
this.unitsCompletedSoFarThisPhase += numUnits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses must call this immediately after updating the UI, to preserve
|
||||
* the integrity of the shouldUpdateUI method.
|
||||
*/
|
||||
@Override
|
||||
public final void justUpdatedUI() {
|
||||
this.lastUIUpdateTime = new Date().getTime() / 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should update ui.
|
||||
*
|
||||
* @return true, if successful
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#shouldUpdateUI()
|
||||
*/
|
||||
@Override
|
||||
public final boolean shouldUpdateUI() {
|
||||
|
||||
doctorStartTimes();
|
||||
long nowTime = (new Date().getTime() / 1000);
|
||||
|
||||
return (nowTime - this.lastUIUpdateTime >= this.minUIUpdateIntervalSec
|
||||
|| (this.getUnitsCompletedSoFarThisPhase() == this.getTotalUnitsThisPhase()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark current phase as complete.
|
||||
*
|
||||
* @param totalUnitsNextPhase
|
||||
* the total units next phase
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#markCurrentPhaseAsComplete(long)
|
||||
*/
|
||||
@Override
|
||||
public final void markCurrentPhaseAsComplete(final long totalUnitsNextPhase) {
|
||||
|
||||
if ((this.currentPhase > this.numPhases)) {
|
||||
String message = "The phase just completed (";
|
||||
message += this.currentPhase;
|
||||
message += ") is greater than the total number ";
|
||||
message += "of anticipated phases (";
|
||||
message += this.numPhases;
|
||||
message += "); the latter is probably incorrect.";
|
||||
|
||||
Log.warn(message);
|
||||
}
|
||||
|
||||
this.currentPhase += 1;
|
||||
this.unitsCompletedSoFarThisPhase = 0;
|
||||
setTotalUnitsThisPhase(totalUnitsNextPhase);
|
||||
this.currentPhaseExponent = 1;
|
||||
|
||||
long nowTime = (new Date().getTime() / 1000);
|
||||
long durationOfThisPhaseSec = nowTime - this.currentPhaseStartTime;
|
||||
if (durationOfThisPhaseSec < 0) {
|
||||
durationOfThisPhaseSec = 0;
|
||||
}
|
||||
|
||||
if (0 <= currentPhase - 2 && currentPhase - 2 < phaseDurationHistorySecList.length) {
|
||||
this.phaseDurationHistorySecList[currentPhase - 2] = durationOfThisPhaseSec;
|
||||
}
|
||||
this.currentPhaseStartTime = nowTime;
|
||||
|
||||
if (this.currentPhase >= this.numPhases) {
|
||||
String message = "Actual individual phase durations: [";
|
||||
for (int ix = 0; ix < phaseDurationHistorySecList.length; ix++) {
|
||||
message += phaseDurationHistorySecList[ix] + ", ";
|
||||
}
|
||||
|
||||
Log.info(message + ']');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send message.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#sendMessage(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public final void sendMessage(final String message) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current phase as exponential.
|
||||
*
|
||||
* @param value
|
||||
* the new current phase as exponential
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#setCurrentPhaseAsExponential(float)
|
||||
*/
|
||||
@Override
|
||||
public final void setCurrentPhaseAsExponential(final float value) {
|
||||
this.currentPhaseExponent = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current phase exponent.
|
||||
*
|
||||
* @return the current phase exponent
|
||||
* @see net.slightlymagic.braids.BraidsProgressMonitor#getCurrentPhaseExponent()
|
||||
*/
|
||||
@Override
|
||||
public final float getCurrentPhaseExponent() {
|
||||
return this.currentPhaseExponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the percent complete of this phase as float.
|
||||
*
|
||||
* @return number in range [0.0, 100.0] or null.
|
||||
*/
|
||||
protected final Float getPercentCompleteOfThisPhaseAsFloat() {
|
||||
if (this.totalUnitsThisPhase < 1 || this.unitsCompletedSoFarThisPhase > this.totalUnitsThisPhase) {
|
||||
return null;
|
||||
} else {
|
||||
float ratio = ((float) (this.unitsCompletedSoFarThisPhase)) / ((float) this.totalUnitsThisPhase);
|
||||
|
||||
ratio = (float) Math.pow(ratio, this.getCurrentPhaseExponent());
|
||||
|
||||
return (ratio * 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number in range [0.0, 100.0] or null.
|
||||
*
|
||||
* @return the total percent complete as float
|
||||
*/
|
||||
protected final Float getTotalPercentCompleteAsFloat() {
|
||||
long totalPoints = 0;
|
||||
for (float weight : this.phaseWeights) {
|
||||
totalPoints += weight * 100;
|
||||
}
|
||||
|
||||
Float percentThisPhase = getPercentCompleteOfThisPhaseAsFloat();
|
||||
|
||||
if (percentThisPhase == null) {
|
||||
// If we can't know the percentage for this phase, use a
|
||||
// conservative estimate.
|
||||
percentThisPhase = 0.0f;
|
||||
}
|
||||
|
||||
long pointsSoFar = 0;
|
||||
for (int ix = 0; ix < this.currentPhase - 1; ix++) {
|
||||
// We get full points for (all the phases completed prior to this
|
||||
// one.
|
||||
pointsSoFar += phaseWeights[ix] * 100;
|
||||
}
|
||||
|
||||
pointsSoFar += percentThisPhase * this.phaseWeights[this.currentPhase - 1];
|
||||
|
||||
if (totalPoints <= 0.0 || pointsSoFar > totalPoints) {
|
||||
return null;
|
||||
} else {
|
||||
return (100.0f * pointsSoFar) / totalPoints;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience for getRelativeETASec(false), meaning to compute the value
|
||||
* for the end of the last phase.
|
||||
*
|
||||
* @return the relative eta sec
|
||||
* @see #getRelativeETASec(boolean)
|
||||
*/
|
||||
protected final Integer getRelativeETASec() {
|
||||
return getRelativeETASec(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relative eta sec.
|
||||
*
|
||||
* @param thisPhaseOnly
|
||||
* the this phase only
|
||||
* @return estimated seconds until completion for either thisPhaseOnly or
|
||||
* for the entire operation. May return null if unknown.
|
||||
*/
|
||||
protected final Integer getRelativeETASec(final boolean thisPhaseOnly) {
|
||||
|
||||
Long absoluteETATime = getAbsoluteETATime(thisPhaseOnly);
|
||||
if (absoluteETATime == null) {
|
||||
return null;
|
||||
}
|
||||
return (int) (absoluteETATime - (new Date().getTime() / 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience for getAbsoluteETATime(false), meaning to compute the value
|
||||
* for the end of all phases.
|
||||
*
|
||||
* @return the absolute eta time
|
||||
* @see #getAbsoluteETATime(boolean)
|
||||
*/
|
||||
protected final Long getAbsoluteETATime() {
|
||||
return getAbsoluteETATime(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the absolute eta time.
|
||||
*
|
||||
* @param thisPhaseOnly
|
||||
* the this phase only
|
||||
* @return the estimated time (in absolute seconds) at which thisPhaseOnly
|
||||
* or the entire operation will be completed. May return null if
|
||||
* (unknown.
|
||||
*/
|
||||
protected final Long getAbsoluteETATime(boolean thisPhaseOnly) {
|
||||
doctorStartTimes();
|
||||
|
||||
// If we're in the last phase, the overall ETA is the same as the ETA
|
||||
// for (this particular phase.
|
||||
if (this.getCurrentPhase() >= this.getNumPhases()) {
|
||||
thisPhaseOnly = true;
|
||||
}
|
||||
|
||||
Float percentDone = null;
|
||||
long startTime = 0L;
|
||||
|
||||
if (thisPhaseOnly) {
|
||||
percentDone = getPercentCompleteOfThisPhaseAsFloat();
|
||||
startTime = this.currentPhaseStartTime;
|
||||
} else {
|
||||
percentDone = getTotalPercentCompleteAsFloat();
|
||||
startTime = this.phaseOneStartTime;
|
||||
}
|
||||
|
||||
if (percentDone == null || percentDone <= 0.001) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Elapsed time is to percent done as total time is to total done =>
|
||||
// elapsed/percentDone == totalTime/100.0 =>
|
||||
long totalTime = (long) (100.0f * ((new Date().getTime() / 1000) - startTime) / percentDone);
|
||||
|
||||
return totalTime + startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Repair the start times in case the system clock has been moved backwards.
|
||||
*/
|
||||
protected final void doctorStartTimes() {
|
||||
|
||||
long nowTime = (new Date().getTime() / 1000);
|
||||
|
||||
if (this.lastUIUpdateTime > nowTime) {
|
||||
this.lastUIUpdateTime = 0;
|
||||
}
|
||||
|
||||
if (this.phaseOneStartTime > nowTime) {
|
||||
this.phaseOneStartTime = nowTime;
|
||||
}
|
||||
|
||||
if (this.currentPhaseStartTime > nowTime) {
|
||||
this.currentPhaseStartTime = nowTime;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* The files in the directory "net/slightlymagic/braids" and in all subdirectories of it (the "Files") are
|
||||
* Copyright 2011 Braids Cabal-Conjurer. They are available under either Forge's
|
||||
* main license (the GNU Public License; see LICENSE.txt in Forge's top directory)
|
||||
* or under the Apache License, as explained below.
|
||||
*
|
||||
* The Files are additionally licensed under the Apache License, Version 2.0 (the
|
||||
* "Apache License"); you may not use the files in this directory except in
|
||||
* compliance with one of its two licenses. You may obtain a copy of the Apache
|
||||
* License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the Apache License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the Apache License for the specific language governing permissions and
|
||||
* limitations under the Apache License.
|
||||
*
|
||||
*/
|
||||
package net.slightlymagic.braids;
|
||||
|
||||
/**
|
||||
* Interface for a progress monitor that can have multiple phases and
|
||||
* periodically update its UI.
|
||||
*
|
||||
* All times must be in seconds; absolute times are measured in seconds since 01
|
||||
* Jan 1970 00:00:00 UTC (GMT) a la (new Date().getTime()/1000).
|
||||
*/
|
||||
public interface BraidsProgressMonitor {
|
||||
|
||||
/**
|
||||
* Destroy this progress monitor, making it no longer usable and/or visible.
|
||||
*/
|
||||
void dispose();
|
||||
|
||||
/**
|
||||
* Gets the num phases.
|
||||
*
|
||||
* @return the total number of phases monitored by this object.
|
||||
*/
|
||||
int getNumPhases();
|
||||
|
||||
/**
|
||||
* Gets the min update interval sec.
|
||||
*
|
||||
* @return the approximate minimum interval in seconds at which the UI
|
||||
* should be updated.
|
||||
*/
|
||||
float getMinUpdateIntervalSec();
|
||||
|
||||
/**
|
||||
* Gets the current phase.
|
||||
*
|
||||
* @return the current phase number; this is never less than 1 (one).
|
||||
*/
|
||||
int getCurrentPhase();
|
||||
|
||||
/**
|
||||
* Gets the units completed so far this phase.
|
||||
*
|
||||
* @return the number of units (an intentionally vague amount) completed so
|
||||
* far in the current phase.
|
||||
*/
|
||||
long getUnitsCompletedSoFarThisPhase();
|
||||
|
||||
/**
|
||||
* Gets the total units this phase.
|
||||
*
|
||||
* @return the total units we expect to process in this phase
|
||||
*/
|
||||
long getTotalUnitsThisPhase();
|
||||
|
||||
/**
|
||||
* Gets the last ui update time.
|
||||
*
|
||||
* @return the time in absolute seconds since the UI was last updated
|
||||
*/
|
||||
long getLastUIUpdateTime();
|
||||
|
||||
/**
|
||||
* Gets the phase one start time.
|
||||
*
|
||||
* @return the time in absolute seconds at which the first phase started
|
||||
*/
|
||||
long getPhaseOneStartTime();
|
||||
|
||||
/**
|
||||
* Gets the current phase start time.
|
||||
*
|
||||
* @return the time in absolute seconds at which the current phase started
|
||||
*/
|
||||
long getCurrentPhaseStartTime();
|
||||
|
||||
/**
|
||||
* Sets the min update interval sec.
|
||||
*
|
||||
* @param value
|
||||
* the approximate time in relative seconds at which the UI
|
||||
* should be updated periodically
|
||||
*/
|
||||
void setMinUpdateIntervalSec(float value);
|
||||
|
||||
/**
|
||||
* Sets the total units this phase.
|
||||
*
|
||||
* @param value
|
||||
* the total number of units expected to processed in this phase
|
||||
*/
|
||||
void setTotalUnitsThisPhase(long value);
|
||||
|
||||
/**
|
||||
* Resulting string does not contain a percent sign.
|
||||
*
|
||||
* @return the percentage completion of this phase as a String with no
|
||||
* percent sign.
|
||||
*/
|
||||
String getPercentCompleteOfThisPhaseAsString();
|
||||
|
||||
/**
|
||||
* Resulting string does not contain a percent sign.
|
||||
*
|
||||
* @return the percentage completion at this point, taking into account all
|
||||
* phases and phase-weights, as a String with no percent sign.
|
||||
*/
|
||||
String getTotalPercentCompleteAsString();
|
||||
|
||||
/**
|
||||
* May return "unknown".
|
||||
*
|
||||
* @param thisPhaseOnly
|
||||
* the this phase only
|
||||
* @return the relative eta as string
|
||||
*/
|
||||
String getRelativeETAAsString(boolean thisPhaseOnly);
|
||||
|
||||
/**
|
||||
* May return "unknown".
|
||||
*
|
||||
* @param thisPhaseOnly
|
||||
* the this phase only
|
||||
* @return the absolute eta as local time string
|
||||
*/
|
||||
String getAbsoluteETAAsLocalTimeString(boolean thisPhaseOnly);
|
||||
|
||||
/**
|
||||
* Note this will NOT advance the phase. To do that, use
|
||||
* markCurrentPhaseAsComplete().
|
||||
*
|
||||
* @param numUnits
|
||||
* the num units
|
||||
*/
|
||||
void incrementUnitsCompletedThisPhase(long numUnits);
|
||||
|
||||
/**
|
||||
* Returns a boolean, whether or not to display the updated information.
|
||||
* This throttles the update so it doesn't refresh so fast that it is
|
||||
* unreadable. Implementers should call this method from their own
|
||||
* incrementUnitsCompletedThisPhase method.
|
||||
*
|
||||
* If we have just reached 100% for (the current phase, we return true, even
|
||||
* if it would otherwise be too soon to update the UI.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
boolean shouldUpdateUI();
|
||||
|
||||
/**
|
||||
* Subclasses must call this immediately after updating the UI, to preserve
|
||||
* the integrity of the shouldUpdateUI method.
|
||||
*/
|
||||
void justUpdatedUI();
|
||||
|
||||
/**
|
||||
* This is the only way to advance the phase number. It automatically
|
||||
* "starts the clock" for the next phase.
|
||||
*
|
||||
* @param totalUnitsNextPhase
|
||||
* if unknown, use zero (0), and be sure to call
|
||||
* setTotalUnitsThisPhase() soon after.
|
||||
*/
|
||||
void markCurrentPhaseAsComplete(long totalUnitsNextPhase);
|
||||
|
||||
/**
|
||||
* Attempt to display a message to the user; not all implementations support
|
||||
* this.
|
||||
*
|
||||
* If they do not, they may silently ignore this call.
|
||||
*
|
||||
* @param message
|
||||
* the message to display
|
||||
*/
|
||||
void sendMessage(String message);
|
||||
|
||||
/**
|
||||
* Mark the current phase as having an exponential rate; such phases reach
|
||||
* their totalUnits slower and slower as they process more units.
|
||||
*
|
||||
* By default, a phase is considered to be linear, meaning this value is
|
||||
* 1.0f.
|
||||
*
|
||||
* @param value
|
||||
* usually less than 1.0f; often determined empirically.
|
||||
*/
|
||||
void setCurrentPhaseAsExponential(float value);
|
||||
|
||||
/**
|
||||
* Gets the current phase exponent.
|
||||
*
|
||||
* @return the exponent for this phase
|
||||
*/
|
||||
float getCurrentPhaseExponent();
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
The files in this directory and in all subdirectories of it (the "Files") are
|
||||
Copyright 2011 Braids Cabal-Conjurer. They are available under either Forge's
|
||||
main license (the GNU Public License; see LICENSE.txt in Forge's top directory)
|
||||
or under the Apache License, as explained below.
|
||||
|
||||
The Files are additionally licensed under the Apache License, Version 2.0 (the
|
||||
"Apache License"); you may not use the files in this directory except in
|
||||
compliance with one of its two licenses. You may obtain a copy of the Apache
|
||||
License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the Apache License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the Apache License for the specific language governing permissions and
|
||||
limitations under the Apache License.
|
||||
@@ -1,3 +0,0 @@
|
||||
/** Forge Card Game. */
|
||||
package net.slightlymagic.braids;
|
||||
|
||||
Reference in New Issue
Block a user