Skip to content

Commit c46e0ee

Browse files
committed
fix Bullet javadoc
1 parent 74447ef commit c46e0ee

File tree

3 files changed

+44
-319
lines changed

3 files changed

+44
-319
lines changed

src/main/java/bwapi/Bullet.java

Lines changed: 41 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
* For example, ordering medics to restore units that are about to receive a lockdown
1616
* to compensate for latency and minimize its effects. You can't know entirely which unit
1717
* will be receiving a lockdown unless you can detect the lockdown missile using the
18-
* Bullet class.
18+
* {@link Bullet} class.
1919
*
20-
* Bullet objects are re-used after they are destroyed, however their ID is updated when it
20+
* {@link Bullet} objects are re-used after they are destroyed, however their ID is updated when it
2121
* represents a new Bullet.
2222
*
23-
* If Flag#CompleteMapInformation is disabled, then a Bullet is accessible if and only if
24-
* it is visible. Otherwise if Flag#CompleteMapInformation is enabled, then all Bullets
23+
* If {@link Flag#CompleteMapInformation} is disabled, then a {@link Bullet} is accessible if and only if
24+
* it is visible. Otherwise if {@link Flag#CompleteMapInformation} is enabled, then all Bullets
2525
* in the game are accessible.
26-
* @see Game#getBullets, Bullet#exists
26+
* @see {@link Game#getBullets}, {@link Bullet#exists}
2727
*/
2828
public class Bullet implements Comparable<Bullet> {
2929
private final BulletData bulletData;
@@ -37,7 +37,7 @@ public class Bullet implements Comparable<Bullet> {
3737
}
3838

3939
/**
40-
* Retrieves a unique identifier for the current Bullet.
40+
* Retrieves a unique identifier for the current {@link Bullet}.
4141
*
4242
* @return An integer value containing the identifier.
4343
*/
@@ -46,52 +46,45 @@ public int getID() {
4646
}
4747

4848
/**
49-
* Checks if the Bullet exists in the view of the BWAPI player.
49+
* Checks if the {@link Bullet} exists in the view of the BWAPI player.
5050
*
51-
* @retval true If the bullet exists or is visible.
52-
* @retval false If the bullet was destroyed or has gone out of scope.
53-
*
54-
* If Flag#CompleteMapInformation is disabled, and a Bullet is not visible, then the
51+
* If {@link Flag#CompleteMapInformation} is disabled, and a {@link Bullet} is not visible, then the
5552
* return value will be false regardless of the Bullet's true existence. This is because
5653
* absolutely no state information on invisible enemy bullets is made available to the AI.
5754
*
58-
* If Flag#CompleteMapInformation is enabled, then this function is accurate for all
59-
* Bullet information.
60-
* @see isVisible, Unit#exists
55+
* If {@link Flag#CompleteMapInformation} is enabled, then this function is accurate for all
56+
* {@link Bullet} information.
57+
*
58+
* @return true if the bullet exists or is visible. false if the bullet was destroyed or has gone out of scope.
59+
* @see {@link #isVisible}, {@link Unit#exists}
6160
*/
6261
public boolean exists() {
6362
return bulletData.getExists();
6463
}
6564

6665
/**
67-
* Retrieves the Player interface that owns the Bullet.
68-
*
69-
* @retval null If the Player object for this Bullet is inaccessible.
66+
* Retrieves the {@link Player} interface that owns the Bullet.
7067
*
71-
* @return The owning Player object.
68+
* @return The owning {@link Player} object. Returns null if the {@link Player} object for this {@link Bullet} is inaccessible.
7269
*/
7370
public Player getPlayer() {
7471
return game.getPlayer(bulletData.getPlayer());
7572
}
7673

7774
/**
78-
* Retrieves the type of this Bullet.
79-
*
80-
* @retval BulletType.Unknown if the Bullet is inaccessible.
75+
* Retrieves the type of this {@link Bullet}.
8176
*
82-
* @return A BulletType representing the Bullet's type.
77+
* @return A {@link BulletType} representing the Bullet's type. Returns {@link BulletType#Unknown} if the {@link Bullet} is inaccessible.
8378
*/
8479
public BulletType getType() {
8580
return BulletType.idToEnum[bulletData.getType()];
8681
}
8782

8883
/**
89-
* Retrieves the Unit interface that the Bullet spawned from.
84+
* Retrieves the {@link Unit} that the {@link Bullet} spawned from.
9085
*
91-
* @retval null If the source can not be identified or is inaccessible.
92-
*
93-
* @return The owning Unit object.
94-
* @see getTarget
86+
* @return The owning {@link Unit} object. Returns null if the source can not be identified or is inaccessible.
87+
* @see {@link #getTarget}
9588
*/
9689
public Unit getSource() {
9790
return game.getUnit(bulletData.getSource());
@@ -100,22 +93,18 @@ public Unit getSource() {
10093
/**
10194
* Retrieves the Bullet's current position.
10295
*
103-
* @retval Position.Unknown If the Bullet is inaccessible.
104-
*
105-
* @return A Position containing the Bullet's current coordinates.
106-
* @see getTargetPosition
96+
* @return A {@link Position} containing the Bullet's current coordinates. Returns {@link Position#Unknown} if the {@link Bullet} is inaccessible.
97+
* @see {@link #getTargetPosition}
10798
*/
10899
public Position getPosition() {
109100
return new Position(bulletData.getPositionX(), bulletData.getPositionY());
110101
}
111102

112103
/**
113-
* Retrieve's the direction the Bullet is facing. If the angle is 0, then
114-
* the Bullet is facing right.
115-
*
116-
* @retval 0.0 If the bullet is inaccessible.
104+
* Retrieve's the direction the {@link Bullet} is facing. If the angle is 0, then
105+
* the {@link Bullet} is facing right.
117106
*
118-
* @return A double representing the direction the Bullet is facing.
107+
* @return A double representing the direction the {@link Bullet} is facing. Returns 0.0 if the bullet is inaccessible.
119108
*/
120109
public double getAngle() {
121110
return bulletData.getAngle();
@@ -124,11 +113,9 @@ public double getAngle() {
124113
/**
125114
* Retrieves the X component of the Bullet's velocity, measured in pixels per frame.
126115
*
127-
* @retval 0.0 if the Bullet is inaccessible.
116+
* @return A double representing the number of pixels moved on the X axis per frame. Returns 0.0 if the {@link Bullet} is inaccessible.
128117
*
129-
* @return A double representing the number of pixels moved on the X axis per frame.
130-
*
131-
* @see getVelocityY, getAngle
118+
* @see {@link #getVelocityY}, {@link #getAngle}
132119
*/
133120
public double getVelocityX() {
134121
return bulletData.getVelocityX();
@@ -137,36 +124,29 @@ public double getVelocityX() {
137124
/**
138125
* Retrieves the Y component of the Bullet's velocity, measured in pixels per frame.
139126
*
140-
* @retval 0.0 if the Bullet is inaccessible.
141-
*
142-
* @return A double representing the number of pixels moved on the Y axis per frame.
127+
* @return A double representing the number of pixels moved on the Y axis per frame. Returns 0.0 if the {@link Bullet} is inaccessible.
143128
*
144-
* @see getVelocityX, getAngle
129+
* @see {@link #getVelocityX}, {@link #getAngle}
145130
*/
146131
public double getVelocityY() {
147132
return bulletData.getVelocityY();
148133
}
149134

150135
/**
151-
* Retrieves the Unit interface that the Bullet is heading to.
152-
*
153-
* @retval null If the Bullet's target Unit is inaccessible, the Bullet is targetting the
154-
* ground, or if the Bullet itself is inaccessible.
136+
* Retrieves the Unit interface that the {@link Bullet} is heading to.
155137
*
156-
* @return The target Unit object, if one exists.
157-
* @see getTargetPosition, getSource
138+
* @return The target Unit object, if one exists. Returns null if the Bullet's target {@link Unit} is inaccessible, the {@link Bullet} is targetting the ground, or if the {@link Bullet} itself is inaccessible.
139+
* @see {@link #getTargetPosition}, {@link #getSource}
158140
*/
159141
public Unit getTarget() {
160142
return game.getUnit(bulletData.getTarget());
161143
}
162144

163145
/**
164-
* Retrieves the target position that the Bullet is heading to.
146+
* Retrieves the target position that the {@link Bullet} is heading to.
165147
*
166-
* @retval Position.Unknown If the bullet is inaccessible.
167-
*
168-
* @return A Position indicating where the Bullet is headed.
169-
* @see getTarget, getPosition
148+
* @return A {@link Position} indicating where the {@link Bullet} is headed. Returns {@link Position#Unknown} if the bullet is inaccessible.
149+
* @see {@link #getTarget}, {@link #getPosition}
170150
*/
171151
public Position getTargetPosition() {
172152
return new Position(bulletData.getTargetPositionX(), bulletData.getTargetPositionY());
@@ -179,9 +159,7 @@ public Position getTargetPosition() {
179159
* This life span is measured in frames. Normally a Bullet will reach its target
180160
* before being removed.
181161
*
182-
* @retval 0 If the Bullet is inaccessible.
183-
*
184-
* @return An integer representing the remaining number of frames until the Bullet self-destructs.
162+
* @return An integer representing the remaining number of frames until the {@link Bullet} self-destructs. Returns 0 if the {@link Bullet} is inaccessible.
185163
*/
186164
public int getRemoveTimer() {
187165
return bulletData.getRemoveTimer();
@@ -194,16 +172,14 @@ public boolean isVisible() {
194172
/**
195173
* Retrieves the visibility state of the Bullet.
196174
*
197-
* @param player If this parameter is specified, then the Bullet's visibility to the given player is checked. If this parameter is omitted, then a default value of null is used, which will check if the BWAPI player has vision of the Bullet.
198-
*
199-
* @note If \c player is null and game.self() is also null, then the visibility of
200-
* the Bullet is determined by checking if at least one other player has vision of the
201-
* Bullet.
175+
* @param player If this parameter is specified, then the Bullet's visibility to the given player is checked. If this parameter is omitted, then a default value of null is used, which will check if the BWAPI player has vision of the {@link Bullet}.
202176
*
203-
* @retval true If the Bullet is visible to the specified player.
204-
* @retval false If the Bullet is not visible to the specified player.
177+
* @return true if the {@link Bullet} is visible to the specified player. false if the {@link Bullet} is not visible to the specified player.
205178
*/
206179
public boolean isVisible(final Player player) {
180+
if (player == null) {
181+
return isVisible();
182+
}
207183
return bulletData.isVisible(player.getID());
208184
}
209185

src/main/java/bwapi/Game.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ public int getReplayFrameCount() {
550550
*
551551
* Example:
552552
* @return Logical frames per second that the game is currently running at as an integer.
553-
* @see getAverageFPS
553+
* @see Game#getAverageFPS
554554
*/
555555
public int getFPS() {
556556
return gameData.getFps();
@@ -561,7 +561,7 @@ public int getFPS() {
561561
*
562562
* @return Average logical frames per second that the game is currently running at as a
563563
* double.
564-
* @see getFPS
564+
* @see {@link #getFPS}
565565
*/
566566
public double getAverageFPS() {
567567
return gameData.getAverageFPS();
@@ -571,7 +571,7 @@ public double getAverageFPS() {
571571
* Retrieves the position of the user's mouse on the screen, in Position coordinates.
572572
*
573573
* @return Position indicating the location of the mouse.
574-
* @retval Position.Unknown if Flag#UserInput is disabled.
574+
* @retval Position.Unknown if {@link Flag#UserInput} is disabled.
575575
*/
576576
public Position getMousePosition() {
577577
return new Position(gameData.getMouseX(), gameData.getMouseY());

0 commit comments

Comments
 (0)