RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.util.MutableNumber Class Reference

The container class that contains functions to simplify the modification of a number. More...

Inheritance diagram for com.runehive.util.MutableNumber:
Collaboration diagram for com.runehive.util.MutableNumber:

Public Member Functions

int compareTo (MutableNumber o)
int decrementAndGet ()
 Decrements the value within this counter by 1 and then returns it.
int decrementAndGet (int amount)
 Decrements the value within this counter by amount and then returns it.
int decrementAndGet (int amount, int minimum)
 Decrements the value within this counter by amount to a minimum of minimum and then returns it.
double doubleValue ()
boolean equals (Object obj)
float floatValue ()
int get ()
 Gets the value present within this counter.
int getAndDecrement ()
 Returns the value within this counter and then decrements it by an amount of 1.
int getAndDecrement (int amount)
 Returns the value within this counter and then decrements it by amount.
int getAndDecrement (int amount, int minimum)
 Returns the value within this counter and then decrements it by amount to a minimum of minimum.
int getAndIncrement ()
 Returns the value within this counter and then increments it by an amount of 1.
int getAndIncrement (int amount)
 Returns the value within this counter and then increments it by amount.
int getAndIncrement (int amount, int maximum)
 Returns the value within this counter and then increments it by amount to a maximum of maximum.
int hashCode ()
MutableNumber increment ()
 Increments the value within this counter by 1 and then returns it.
int incrementAndGet ()
 Increments the value within this counter by 1 and then returns it.
int incrementAndGet (int amount)
 Increments the value within this counter by amount and then returns it.
int incrementAndGet (int amount, int maximum)
 Increments the value within this counter by amount to a maximum of maximum and then returns it.
int intValue ()
long longValue ()
 MutableNumber ()
 Creates a new MutableNumber with a value of 0.
 MutableNumber (int value)
 Creates a new MutableNumber with value.
void set (int value)
 Sets the value within this container to rarity.
String toString ()

Private Attributes

int value
 The value present within this counter.

Static Private Attributes

static final long serialVersionUID = -7475363158492415879L
 The constant serial version UID for serialization.

Detailed Description

The container class that contains functions to simplify the modification of a number.

This class is similar in functionality to AtomicInteger but does not support atomic operations, and therefore should not be used across multiple threads.

Author
lare96 http://github.com/lare96

Definition at line 16 of file MutableNumber.java.

Constructor & Destructor Documentation

◆ MutableNumber() [1/2]

com.runehive.util.MutableNumber.MutableNumber ( int value)

Creates a new MutableNumber with value.

Parameters
valuethe value present within this counter.

Definition at line 34 of file MutableNumber.java.

34 {
35 this.value = value;
36 }

References value.

Referenced by compareTo(), equals(), and increment().

Here is the caller graph for this function:

◆ MutableNumber() [2/2]

com.runehive.util.MutableNumber.MutableNumber ( )

Creates a new MutableNumber with a value of 0.

Definition at line 41 of file MutableNumber.java.

41 {
42 this(0);
43 }

Member Function Documentation

◆ compareTo()

int com.runehive.util.MutableNumber.compareTo ( MutableNumber o)

Definition at line 68 of file MutableNumber.java.

68 {
69 return Integer.compare(value, o.value);
70 }

References MutableNumber(), and value.

Here is the call graph for this function:

◆ decrementAndGet() [1/3]

int com.runehive.util.MutableNumber.decrementAndGet ( )

Decrements the value within this counter by 1 and then returns it.

Returns
the value after it is decremented.

Definition at line 262 of file MutableNumber.java.

262 {
263 return decrementAndGet(1);
264 }

References decrementAndGet().

Referenced by decrementAndGet(), and decrementAndGet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decrementAndGet() [2/3]

int com.runehive.util.MutableNumber.decrementAndGet ( int amount)

Decrements the value within this counter by amount and then returns it.

Parameters
amountthe amount to decrement it by.
Returns
the value after it is decremented.

Definition at line 252 of file MutableNumber.java.

252 {
253 return decrementAndGet(amount, Integer.MIN_VALUE);
254 }

References decrementAndGet().

Here is the call graph for this function:

◆ decrementAndGet() [3/3]

int com.runehive.util.MutableNumber.decrementAndGet ( int amount,
int minimum )

Decrements the value within this counter by amount to a minimum of minimum and then returns it.

Parameters
amountthe amount to decrement it by.
minimumthe minimum amount it will be decremented to.
Returns
the value after it is decremented.

Definition at line 237 of file MutableNumber.java.

237 {
238 value -= amount;
239 if (value < minimum)
240 value = minimum;
241 return value;
242 }

References value.

Referenced by com.runehive.game.task.impl.AntiVenomTask.execute(), com.runehive.game.task.impl.SuperAntipoisonTask.execute(), and com.runehive.game.world.entity.combat.effect.impl.CombatAntifireEffect.process().

Here is the caller graph for this function:

◆ doubleValue()

double com.runehive.util.MutableNumber.doubleValue ( )

Definition at line 93 of file MutableNumber.java.

93 {
94 return (double) value;
95 }

References value.

◆ equals()

boolean com.runehive.util.MutableNumber.equals ( Object obj)

Definition at line 56 of file MutableNumber.java.

56 {
57 if (this == obj)
58 return true;
59 if (obj == null)
60 return false;
61 if (!(obj instanceof MutableNumber))
62 return false;
63 MutableNumber other = (MutableNumber) obj;
64 return value == other.value;
65 }

References MutableNumber(), and value.

Here is the call graph for this function:

◆ floatValue()

float com.runehive.util.MutableNumber.floatValue ( )

Definition at line 88 of file MutableNumber.java.

88 {
89 return (float) value;
90 }

References value.

◆ get()

int com.runehive.util.MutableNumber.get ( )

Gets the value present within this counter.

This function equates to the inherited MutableNumber#intValue() function.

Returns
the value present.

Definition at line 272 of file MutableNumber.java.

272 {
273 return value;
274 }

References value.

Referenced by com.runehive.game.world.entity.combat.effect.impl.CombatPoisonEffect.apply(), com.runehive.game.world.entity.combat.effect.impl.CombatVenomEffect.apply(), com.runehive.net.packet.out.SendSpecialAmount.encode(), com.runehive.content.consume.PotionData.onAntiPoisonEffect(), and com.runehive.game.world.entity.combat.strategy.npc.boss.Hydra.poisonTask().

Here is the caller graph for this function:

◆ getAndDecrement() [1/3]

int com.runehive.util.MutableNumber.getAndDecrement ( )

Returns the value within this counter and then decrements it by an amount of 1.

Returns
the value before it is decremented.

Definition at line 223 of file MutableNumber.java.

223 {
224 return getAndDecrement(1);
225 }

References getAndDecrement().

Referenced by getAndDecrement(), and getAndDecrement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAndDecrement() [2/3]

int com.runehive.util.MutableNumber.getAndDecrement ( int amount)

Returns the value within this counter and then decrements it by amount.

Parameters
amountthe amount to decrement it by.
Returns
the value before it is decremented.

Definition at line 213 of file MutableNumber.java.

213 {
214 return getAndDecrement(amount, Integer.MIN_VALUE);
215 }

References getAndDecrement().

Here is the call graph for this function:

◆ getAndDecrement() [3/3]

int com.runehive.util.MutableNumber.getAndDecrement ( int amount,
int minimum )

Returns the value within this counter and then decrements it by amount to a minimum of minimum.

Parameters
amountthe amount to decrement it by.
minimumthe minimum amount it will be decremented to.
Returns
the value before it is decremented.

Definition at line 197 of file MutableNumber.java.

197 {
198 int val = value;
199 value -= amount;
200 if (value < minimum)
201 value = minimum;
202 return val;
203 }

References value.

◆ getAndIncrement() [1/3]

int com.runehive.util.MutableNumber.getAndIncrement ( )

Returns the value within this counter and then increments it by an amount of 1.

Returns
the value before it is incremented.

Definition at line 133 of file MutableNumber.java.

133 {
134 return getAndIncrement(1);
135 }

References getAndIncrement().

Referenced by getAndIncrement(), and getAndIncrement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAndIncrement() [2/3]

int com.runehive.util.MutableNumber.getAndIncrement ( int amount)

Returns the value within this counter and then increments it by amount.

Parameters
amountthe amount to append it by.
Returns
the value before it is incremented.

Definition at line 123 of file MutableNumber.java.

123 {
124 return getAndIncrement(amount, Integer.MAX_VALUE);
125 }

References getAndIncrement().

Here is the call graph for this function:

◆ getAndIncrement() [3/3]

int com.runehive.util.MutableNumber.getAndIncrement ( int amount,
int maximum )

Returns the value within this counter and then increments it by amount to a maximum of maximum.

Parameters
amountthe amount to append it by.
maximumthe maximum amount it will be incremented to.
Returns
the value before it is incremented.

Definition at line 107 of file MutableNumber.java.

107 {
108 int val = value;
109 value += amount;
110 if (value > maximum)
111 value = maximum;
112 return val;
113 }

References value.

◆ hashCode()

int com.runehive.util.MutableNumber.hashCode ( )

Definition at line 51 of file MutableNumber.java.

51 {
52 return Integer.hashCode(value);
53 }

References value.

◆ increment()

MutableNumber com.runehive.util.MutableNumber.increment ( )

Increments the value within this counter by 1 and then returns it.

Returns
the value after it is incremented.

Definition at line 182 of file MutableNumber.java.

182 {
183 incrementAndGet(1);
184 return this;
185 }

References incrementAndGet(), and MutableNumber().

Here is the call graph for this function:

◆ incrementAndGet() [1/3]

int com.runehive.util.MutableNumber.incrementAndGet ( )

Increments the value within this counter by 1 and then returns it.

Returns
the value after it is incremented.

Definition at line 172 of file MutableNumber.java.

172 {
173 return incrementAndGet(1);
174 }

References incrementAndGet().

Referenced by increment(), incrementAndGet(), and incrementAndGet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incrementAndGet() [2/3]

int com.runehive.util.MutableNumber.incrementAndGet ( int amount)

Increments the value within this counter by amount and then returns it.

Parameters
amountthe amount to append it by.
Returns
the value after it is incremented.

Definition at line 162 of file MutableNumber.java.

162 {
163 return incrementAndGet(amount, Integer.MAX_VALUE);
164 }

References incrementAndGet().

Here is the call graph for this function:

◆ incrementAndGet() [3/3]

int com.runehive.util.MutableNumber.incrementAndGet ( int amount,
int maximum )

Increments the value within this counter by amount to a maximum of maximum and then returns it.

Parameters
amountthe amount to append it by.
maximumthe maximum amount it will be incremented to.
Returns
the value after it is incremented.

Definition at line 147 of file MutableNumber.java.

147 {
148 value += amount;
149 if (value > maximum)
150 value = maximum;
151 return value;
152 }

References value.

Referenced by com.runehive.content.bot.BotUtility.logLoot(), and com.runehive.content.consume.PotionData.onAntiPoisonEffect().

Here is the caller graph for this function:

◆ intValue()

int com.runehive.util.MutableNumber.intValue ( )

This function equates to the MutableNumber#get() function.

Definition at line 78 of file MutableNumber.java.

78 {
79 return value;
80 }

References value.

Referenced by com.runehive.content.bot.botclass.impl.AGSRuneMelee.hit(), com.runehive.content.bot.botclass.impl.PureMelee.hit(), com.runehive.content.bot.botclass.impl.PureRangeMelee.hit(), com.runehive.content.bot.botclass.impl.WelfareRuneMelee.hit(), and com.runehive.content.bot.botclass.impl.ZerkerMelee.hit().

Here is the caller graph for this function:

◆ longValue()

long com.runehive.util.MutableNumber.longValue ( )

Definition at line 83 of file MutableNumber.java.

83 {
84 return (long) value;
85 }

References value.

◆ set()

void com.runehive.util.MutableNumber.set ( int value)

Sets the value within this container to rarity.

Parameters
valuethe new value to set.

Definition at line 282 of file MutableNumber.java.

282 {
283 this.value = value;
284 }

References value.

Referenced by com.runehive.content.consume.PotionData.onAntiPoisonEffect().

Here is the caller graph for this function:

◆ toString()

String com.runehive.util.MutableNumber.toString ( )

Definition at line 46 of file MutableNumber.java.

46 {
47 return Integer.toString(value);
48 }

References value.

Member Data Documentation

◆ serialVersionUID

final long com.runehive.util.MutableNumber.serialVersionUID = -7475363158492415879L
staticprivate

The constant serial version UID for serialization.

Definition at line 21 of file MutableNumber.java.

◆ value

int com.runehive.util.MutableNumber.value
private

The documentation for this class was generated from the following file: