本文整理汇总了Java中api.util.Support类的典型用法代码示例。如果您正苦于以下问题:Java Support类的具体用法?Java Support怎么用?Java Support使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Support类属于api.util包,在下文中一共展示了Support类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: damage
import api.util.Support; //导入依赖的package包/类
@Override
public final void damage(final int amount)
{
this.getDiceRoller()
.getOutput()
.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.RED,
Color.WHITE,
"Damaging " + this.getStatBlock().getName() + " for " + amount + " HP.\n\n");
if ((this.getStatBlock().getCurHealth() - amount) <= this.getConstants().DEAD_HP())
{
this.getStatBlock().setCurHealth(this.getConstants().DEAD_HP());
}
else
{
this.getStatBlock().setCurHealth(this.getStatBlock().getCurHealth() - amount);
}
this.updateStatus();
}
示例2: heal
import api.util.Support; //导入依赖的package包/类
@Override
public final void heal(final int amount)
{
this.getDiceRoller()
.getOutput()
.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.GREEN,
Color.WHITE,
"Healing " + this.getStatBlock().getName() + " for " + amount + " HP.\n\n");
if ((this.getStatBlock().getCurHealth() + amount) > this.getStatBlock().getMaxHealth())
{
this.getStatBlock().setCurHealth(this.getStatBlock().getMaxHealth());
}
else
{
this.getStatBlock().setCurHealth(this.getStatBlock().getCurHealth() + amount);
}
this.updateStatus();
}
示例3: printPrimes
import api.util.Support; //导入依赖的package包/类
public final static void printPrimes(final long numberOfPrimes, final RichTextPane output)
{
Stopwatch stopwatch = new Stopwatch();
for (long i = 0, j = 1; j <= numberOfPrimes; i++)
{
if (Mathematics.isPrime(i))
{
output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLUE, Color.WHITE, "Prime #" + (j) +
": " +
i +
"\n");
j++;
}
}
output.append(Color.BLACK,
Color.WHITE,
"\n[" + Support.getDateTimeStamp() + "]: ",
Color.BLUE,
Color.WHITE,
"Execution time (in seconds): " + stopwatch.elapsedTime() + ".\n\n");
}
示例4: nextCombatant
import api.util.Support; //导入依赖的package包/类
public Creature nextCombatant()
{
int index = this.getCurCreatureIndex();
Creature creature = null;
do
{
index++;
if (index >= this.getCreatureList().size())
{
this.setNumRounds(this.getNumRounds() + 1);
index = 0;
this.getParent()
.getOutput()
.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.MAGENTA,
Color.WHITE,
"- Round " + this.getNumRounds() + " -\n\n");
}
creature = this.getCreatureList().get(index);
}
while (((Creature35E)creature).getStatBlock().getStatus() == Constants35E.Status.DEAD);
this.setCurCreatureIndex(index);
this.setCurrentCreature(this.getCreatureList().get(index));
this.getWindow().reDrawGUI();
return this.getCurrentCreature();
}
示例5: filterInputLevels
import api.util.Support; //导入依赖的package包/类
protected static double filterInputLevels(final String s)
{
if (s.equals("1/2"))
{
return (1.0 / 2.0);
}
if (s.equals("1/3"))
{
return (1.0 / 3.0);
}
if (s.equals("1/4"))
{
return (1.0 / 4.0);
}
if (s.equals("1/6"))
{
return (1.0 / 6.0);
}
if (s.equals("1/8"))
{
return (1.0 / 8.0);
}
if (s.equals("1/10"))
{
return (1.0 / 10.0);
}
if (Support.isStringParsedAsDouble(s))
{
return Double.parseDouble(s);
}
return 0.0;
}
示例6: processInput
import api.util.Support; //导入依赖的package包/类
public long processInput(final String inputString)
{
boolean isInputBad = true;
long retVal = -1;
if ((inputString != null) && (inputString.isEmpty() == false))
{
if (inputString.matches("[0-9]+d[0-9]+"))
{
if (this.getWindow().isDebugging())
{
Support.displayDebugMessage(this.getWindow(), "Input: " + inputString + "\n");
}
String[] paramArray = inputString.split("d");
int[] resultsArray = Games.throwDice(Integer.parseInt(paramArray[0]), Integer.parseInt(paramArray[1]));
int upperBound = (resultsArray.length - 1);
StringBuilder outputStringBuilder = new StringBuilder();
for (int i = 0; i < upperBound; i++)
{
outputStringBuilder.append(resultsArray[i] + " ");
}
this.getOutput().append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.RED,
Color.WHITE,
"Input\t\t",
Color.GRAY,
Color.WHITE,
inputString + "\n");
this.getOutput().append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.GREEN,
Color.WHITE,
"Sum\t\t",
Color.GRAY,
Color.WHITE,
resultsArray[upperBound] + "\n");
this.getOutput().append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.BLUE,
Color.WHITE,
"Results\t",
Color.GRAY,
Color.WHITE,
outputStringBuilder.toString() + "\n\n");
isInputBad = false;
retVal = resultsArray[upperBound];
this.getInput().addItem(inputString);
}
}
if (isInputBad)
{
Support.displayException(this.getWindow(), new IllegalArgumentException(DiceBag.INPUT_EXCEPTION_STRING), false);
}
this.getInput().setSelectedIndex(-1);
this.getInput().grabFocus();
return retVal;
}
示例7: getChoiceInput
import api.util.Support; //导入依赖的package包/类
public final boolean getChoiceInput(final String message, final String title)
{
return Support.getChoiceInput(this.getWindow(), message, title);
}
示例8: getInputString
import api.util.Support; //导入依赖的package包/类
public final String getInputString(final String message, final String title)
{
return Support.getInputString(this.getWindow(), message, title);
}
示例9: getIntegerInputString
import api.util.Support; //导入依赖的package包/类
public final int getIntegerInputString(final String message, final String title)
{
return Support.getIntegerInputString(this.getWindow(), message, title);
}
示例10: reset
import api.util.Support; //导入依赖的package包/类
public void reset(final int numMode)
{
this.setNumRounds(1);
switch (numMode)
{
case 1:
this.resetCharacters();
this.resetMonsters();
break;
case 2:
this.resetCharacters();
break;
case 3:
this.resetMonsters();
break;
default:
this.resetCharacters();
this.resetMonsters();
break;
}
this.setCreatureList(new LinkedList<Creature>());
this.getCreatureList().addAll(this.getCharacterList());
this.getCreatureList().addAll(this.getMonsterList());
Collections.sort(this.getCreatureList());
this.setCurrentCreature(this.getCreatureList().getFirst());
this.setCurCreatureIndex(this.getCreatureList().indexOf(this.getCurrentCreature()));
this.getParent()
.getOutput()
.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLACK, Color.WHITE, "Initial Combatants:\n");
for (int i = 0; i < this.getCreatureList().size(); i++)
{
this.getParent().getOutput().append(Color.GRAY, Color.WHITE, "\t\t\t " + this.getCreatureList().get(i).toString() + "\n");
}
this.getParent().getOutput().append(Color.BLACK, Color.WHITE, "\n");
this.getParent()
.getOutput()
.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.MAGENTA,
Color.WHITE,
"- Round " + this.getNumRounds() + " -\n\n");
this.getParent()
.getOutput()
.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.BLACK,
Color.WHITE,
"First Combatant:\n",
Color.GRAY,
Color.WHITE,
"\t\t\t " + this.getCurrentCreature().toString() + "\n\n");
}
示例11: updateStatus
import api.util.Support; //导入依赖的package包/类
@Override
public void updateStatus()
{
final RichTextPane output = this.getDiceRoller().getOutput();
if ((this.getStatBlock().getCurHealth() <= (this.getStatBlock().getMaxHealth() / 2)) && (this.getStatBlock().getCurHealth() > this.getConstants()
.DISABLED_HP()))
{
if (this.getStatBlock().getStatus() != Constants35E.Status.BLOODIED)
{
output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.RED, Color.WHITE, this.getStatBlock()
.getName() + " has been reduced to half or less of its HP and is bloodied!\n\n");
this.getStatBlock().setStatus(Constants35E.Status.BLOODIED);
}
}
else if (this.getStatBlock().getCurHealth() == this.getConstants().DISABLED_HP())
{
if (this.getStatBlock().getStatus() != Constants35E.Status.DISABLED)
{
output.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.RED,
Color.WHITE,
this.getStatBlock().getName() + " has been reduced to " + this.getConstants().DISABLED_HP() + " HP and is disabled!\n\n",
Color.GRAY,
Color.WHITE,
"Note: Disabled creatures can only take one move action or one standard action per turn, " + "and take 1 point of damage after completing that action.\n\n");
this.getStatBlock().setStatus(Constants35E.Status.DISABLED);
}
}
else if ((this.getStatBlock().getCurHealth() <= this.getConstants().DYING_HP()) && (this.getStatBlock().getCurHealth() > this.getConstants()
.DEAD_HP()))
{
if ((this.getStatBlock().getStatus() != Constants35E.Status.DYING) && (this.getStatBlock().getStatus() != Constants35E.Status.UNCONCIOUS))
{
output.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.RED,
Color.WHITE,
this.getStatBlock().getName() + " has been reduced to " + this.getConstants().DYING_HP() + " or less HP and is dying!\n\n",
Color.GRAY,
Color.WHITE,
"Note: Dying creatures are also unconcious. " + "Each round, a dying creature has a 10% chance to become "
+ "stable. If the creature fails, it loses 1 HP. If the creature succeeds, it is still unconcious."
+ "Every hour the creature has a 10% chance to regain conciousness. If it fails, it loses 1 HP.\n\n");
this.getStatBlock().setStatus(Constants35E.Status.DYING);
}
}
else if (this.getStatBlock().getCurHealth() <= this.getConstants().DEAD_HP())
{
output.append(Color.BLACK,
Color.WHITE,
"[" + Support.getDateTimeStamp() + "]: ",
Color.RED,
Color.WHITE,
this.getStatBlock().getName() + " has been reduced to " + this.getConstants().DEAD_HP() + " or less HP and is dead!\n\n");
this.getStatBlock().setStatus(Constants35E.Status.DEAD);
}
else
{
this.getStatBlock().setStatus(Constants35E.Status.HEALTHY);
}
}
示例12: getWordBank
import api.util.Support; //导入依赖的package包/类
protected final static Object[] getWordBank(final Component parent, final boolean isDebugging)
{
ArrayList<String> words = new ArrayList<String>();
String filePath = null;
do
{
filePath = Support.getFilePath(parent, true, isDebugging);
}
while ((filePath == null) || filePath.isEmpty());
Scanner inputStream = null; // Stream object for file input.
try
{
// Initialize file stream. If the given path is invalid, an exception is thrown.
inputStream = new Scanner(new File(filePath));
while (inputStream.hasNextLine())
{
String line = inputStream.nextLine().toLowerCase().trim();
if (!(line.isEmpty()))
{
words.add(line);
}
}
}
catch (final Exception exception)
{
// Handle the exception by alerting the user of the error.
Support.displayException(null, exception, true);
}
finally
{
if (inputStream != null)
{
// Close the input stream.
inputStream.close();
inputStream = null;
}
}
return words.toArray();
}
示例13: handleInput
import api.util.Support; //导入依赖的package包/类
public final void handleInput(final Object... arguments)
{
if (this.getInput() == null)
{
Support.displayException(this.window, new Exception("Can't get the input element!"), true);
return;
}
else if (this.getInput().getText() == null)
{
Support.displayException(this.window, new Exception("Can't get the input element's text!"), true);
return;
}
// Check the user's guess.
if (this.checkGuess(this.getInput().getText()))
{
JOptionPane.showMessageDialog(this.window, "Congratulations, your guess was correct!", "Correct!", JOptionPane.INFORMATION_MESSAGE);
if (this.getCurrentGuesses() == 3)
{
this.setCurrentScore(this.getCurrentScore() + 5);
}
else if (this.getCurrentGuesses() == 2)
{
this.setCurrentScore(this.getCurrentScore() + 3);
}
else if (this.getCurrentGuesses() == 1)
{
this.setCurrentScore(this.getCurrentScore() + 1);
}
this.reinitialize(this.window);
}
else
{
JOptionPane.showMessageDialog(this.window, "Sorry, your guess was incorrect!", "Incorrect!", JOptionPane.INFORMATION_MESSAGE);
this.setCurrentGuesses(this.getCurrentGuesses() - 1);
if (this.getCurrentGuesses() <= 0)
{
this.revealAnswer(this.window);
}
}
}