Moved @Null for method return values to the same line.

This commit is contained in:
Nathan Sweet 2020-04-22 21:17:40 +02:00
parent afab54aaa1
commit dea3e3594c
13 changed files with 48 additions and 96 deletions

View File

@ -792,8 +792,7 @@ public class AnimationState {
}
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
@Null
public TrackEntry getCurrent (int trackIndex) {
public @Null TrackEntry getCurrent (int trackIndex) {
if (trackIndex < 0) throw new IllegalArgumentException("trackIndex must be >= 0.");
if (trackIndex >= tracks.size) return null;
return tracks.get(trackIndex);
@ -1031,8 +1030,7 @@ public class AnimationState {
* <p>
* A track entry returned from {@link AnimationState#setAnimation(int, Animation, boolean)} is already the current animation
* for the track, so the track entry listener {@link AnimationStateListener#start(TrackEntry)} will not be called. */
@Null
public AnimationStateListener getListener () {
public @Null AnimationStateListener getListener () {
return listener;
}
@ -1087,8 +1085,7 @@ public class AnimationState {
}
/** The animation queued to start after this animation, or null. <code>next</code> makes up a linked list. */
@Null
public TrackEntry getNext () {
public @Null TrackEntry getNext () {
return next;
}
@ -1147,15 +1144,13 @@ public class AnimationState {
/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
* mixing is currently occuring. When mixing from multiple animations, <code>mixingFrom</code> makes up a linked list. */
@Null
public TrackEntry getMixingFrom () {
public @Null TrackEntry getMixingFrom () {
return mixingFrom;
}
/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
* currently occuring. When mixing to multiple animations, <code>mixingTo</code> makes up a linked list. */
@Null
public TrackEntry getMixingTo () {
public @Null TrackEntry getMixingTo () {
return mixingTo;
}

View File

@ -225,8 +225,7 @@ public class Bone implements Updatable {
}
/** The parent bone, or null if this is the root bone. */
@Null
public Bone getParent () {
public @Null Bone getParent () {
return parent;
}

View File

@ -79,8 +79,7 @@ public class BoneData {
return name;
}
@Null
public BoneData getParent () {
public @Null BoneData getParent () {
return parent;
}

View File

@ -484,8 +484,7 @@ public class Skeleton {
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
* repeatedly. */
@Null
public Bone findBone (String boneName) {
public @Null Bone findBone (String boneName) {
if (boneName == null) throw new IllegalArgumentException("boneName cannot be null.");
Object[] bones = this.bones.items;
for (int i = 0, n = this.bones.size; i < n; i++) {
@ -502,8 +501,7 @@ public class Skeleton {
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* repeatedly. */
@Null
public Slot findSlot (String slotName) {
public @Null Slot findSlot (String slotName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Object[] slots = this.slots.items;
for (int i = 0, n = this.slots.size; i < n; i++) {
@ -524,8 +522,7 @@ public class Skeleton {
}
/** The skeleton's current skin. */
@Null
public Skin getSkin () {
public @Null Skin getSkin () {
return skin;
}
@ -573,8 +570,7 @@ public class Skeleton {
* name.
* <p>
* See {@link #getAttachment(int, String)}. */
@Null
public Attachment getAttachment (String slotName, String attachmentName) {
public @Null Attachment getAttachment (String slotName, String attachmentName) {
SlotData slot = data.findSlot(slotName);
if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName);
return getAttachment(slot.getIndex(), attachmentName);
@ -584,8 +580,7 @@ public class Skeleton {
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
* <p>
* See <a href="http://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. */
@Null
public Attachment getAttachment (int slotIndex, String attachmentName) {
public @Null Attachment getAttachment (int slotIndex, String attachmentName) {
if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null.");
if (skin != null) {
Attachment attachment = skin.getAttachment(slotIndex, attachmentName);
@ -618,8 +613,7 @@ public class Skeleton {
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly. */
@Null
public IkConstraint findIkConstraint (String constraintName) {
public @Null IkConstraint findIkConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Object[] ikConstraints = this.ikConstraints.items;
for (int i = 0, n = this.ikConstraints.size; i < n; i++) {
@ -636,8 +630,7 @@ public class Skeleton {
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it repeatedly. */
@Null
public TransformConstraint findTransformConstraint (String constraintName) {
public @Null TransformConstraint findTransformConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Object[] transformConstraints = this.transformConstraints.items;
for (int i = 0, n = this.transformConstraints.size; i < n; i++) {
@ -654,8 +647,7 @@ public class Skeleton {
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly. */
@Null
public PathConstraint findPathConstraint (String constraintName) {
public @Null PathConstraint findPathConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Object[] pathConstraints = this.pathConstraints.items;
for (int i = 0, n = this.pathConstraints.size; i < n; i++) {

View File

@ -312,8 +312,7 @@ public class SkeletonBinary extends SkeletonLoader {
return skeletonData;
}
@Null
private Skin readSkin (SkeletonInput input, SkeletonData skeletonData, boolean defaultSkin, boolean nonessential)
private @Null Skin readSkin (SkeletonInput input, SkeletonData skeletonData, boolean defaultSkin, boolean nonessential)
throws IOException {
Skin skin;
@ -920,8 +919,7 @@ public class SkeletonBinary extends SkeletonLoader {
super(file.read(512));
}
@Null
public String readStringRef () throws IOException {
public @Null String readStringRef () throws IOException {
int index = readInt(true);
return index == 0 ? null : strings[index - 1];
}

View File

@ -143,8 +143,7 @@ public class SkeletonBounds {
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
@Null
public BoundingBoxAttachment containsPoint (float x, float y) {
public @Null BoundingBoxAttachment containsPoint (float x, float y) {
Object[] polygons = this.polygons.items;
for (int i = 0, n = this.polygons.size; i < n; i++)
if (containsPoint((FloatArray)polygons[i], x, y)) return boundingBoxes.get(i);
@ -174,8 +173,7 @@ public class SkeletonBounds {
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns
* true. */
@Null
public BoundingBoxAttachment intersectsSegment (float x1, float y1, float x2, float y2) {
public @Null BoundingBoxAttachment intersectsSegment (float x1, float y1, float x2, float y2) {
Object[] polygons = this.polygons.items;
for (int i = 0, n = this.polygons.size; i < n; i++)
if (intersectsSegment((FloatArray)polygons[i], x1, y1, x2, y2)) return boundingBoxes.get(i);
@ -248,8 +246,7 @@ public class SkeletonBounds {
}
/** Returns the polygon for the specified bounding box, or null. */
@Null
public FloatArray getPolygon (BoundingBoxAttachment boundingBox) {
public @Null FloatArray getPolygon (BoundingBoxAttachment boundingBox) {
if (boundingBox == null) throw new IllegalArgumentException("boundingBox cannot be null.");
int index = boundingBoxes.indexOf(boundingBox, true);
return index == -1 ? null : polygons.get(index);

View File

@ -67,8 +67,7 @@ public class SkeletonData {
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
* multiple times. */
@Null
public BoneData findBone (String boneName) {
public @Null BoneData findBone (String boneName) {
if (boneName == null) throw new IllegalArgumentException("boneName cannot be null.");
Object[] bones = this.bones.items;
for (int i = 0, n = this.bones.size; i < n; i++) {
@ -87,8 +86,7 @@ public class SkeletonData {
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* multiple times. */
@Null
public SlotData findSlot (String slotName) {
public @Null SlotData findSlot (String slotName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Object[] slots = this.slots.items;
for (int i = 0, n = this.slots.size; i < n; i++) {
@ -103,8 +101,7 @@ public class SkeletonData {
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
* <p>
* See {@link Skeleton#getAttachment(int, String)}. */
@Null
public Skin getDefaultSkin () {
public @Null Skin getDefaultSkin () {
return defaultSkin;
}
@ -114,8 +111,7 @@ public class SkeletonData {
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
* multiple times. */
@Null
public Skin findSkin (String skinName) {
public @Null Skin findSkin (String skinName) {
if (skinName == null) throw new IllegalArgumentException("skinName cannot be null.");
for (Skin skin : skins)
if (skin.name.equals(skinName)) return skin;
@ -131,8 +127,7 @@ public class SkeletonData {
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
* multiple times. */
@Null
public EventData findEvent (String eventDataName) {
public @Null EventData findEvent (String eventDataName) {
if (eventDataName == null) throw new IllegalArgumentException("eventDataName cannot be null.");
for (EventData eventData : events)
if (eventData.name.equals(eventDataName)) return eventData;
@ -153,8 +148,7 @@ public class SkeletonData {
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
* call it multiple times. */
@Null
public Animation findAnimation (String animationName) {
public @Null Animation findAnimation (String animationName) {
if (animationName == null) throw new IllegalArgumentException("animationName cannot be null.");
Object[] animations = this.animations.items;
for (int i = 0, n = this.animations.size; i < n; i++) {
@ -173,8 +167,7 @@ public class SkeletonData {
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times. */
@Null
public IkConstraintData findIkConstraint (String constraintName) {
public @Null IkConstraintData findIkConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Object[] ikConstraints = this.ikConstraints.items;
for (int i = 0, n = this.ikConstraints.size; i < n; i++) {
@ -193,8 +186,7 @@ public class SkeletonData {
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it multiple times. */
@Null
public TransformConstraintData findTransformConstraint (String constraintName) {
public @Null TransformConstraintData findTransformConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Object[] transformConstraints = this.transformConstraints.items;
for (int i = 0, n = this.transformConstraints.size; i < n; i++) {
@ -213,8 +205,7 @@ public class SkeletonData {
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times. */
@Null
public PathConstraintData findPathConstraint (String constraintName) {
public @Null PathConstraintData findPathConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Object[] pathConstraints = this.pathConstraints.items;
for (int i = 0, n = this.pathConstraints.size; i < n; i++) {
@ -227,8 +218,7 @@ public class SkeletonData {
// ---
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. */
@Null
public String getName () {
public @Null String getName () {
return name;
}
@ -273,8 +263,7 @@ public class SkeletonData {
}
/** The Spine version used to export the skeleton data, or null. */
@Null
public String getVersion () {
public @Null String getVersion () {
return version;
}
@ -283,8 +272,7 @@ public class SkeletonData {
}
/** The skeleton data hash. This value will change if any of the skeleton data has changed. */
@Null
public String getHash () {
public @Null String getHash () {
return hash;
}
@ -293,8 +281,7 @@ public class SkeletonData {
}
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. */
@Null
public String getImagesPath () {
public @Null String getImagesPath () {
return imagesPath;
}
@ -303,8 +290,7 @@ public class SkeletonData {
}
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. */
@Null
public String getAudioPath () {
public @Null String getAudioPath () {
return audioPath;
}

View File

@ -448,8 +448,7 @@ public class SkeletonRenderer {
this.premultipliedAlpha = premultipliedAlpha;
}
@Null
public VertexEffect getVertexEffect () {
public @Null VertexEffect getVertexEffect () {
return vertexEffect;
}

View File

@ -94,8 +94,7 @@ public class Skin {
}
/** Returns the attachment for the specified slot index and name, or null. */
@Null
public Attachment getAttachment (int slotIndex, String name) {
public @Null Attachment getAttachment (int slotIndex, String name) {
lookup.set(slotIndex, name);
SkinEntry entry = attachments.get(lookup);
return entry != null ? entry.attachment : null;

View File

@ -95,14 +95,12 @@ public class Slot {
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */
@Null
public Color getDarkColor () {
public @Null Color getDarkColor () {
return darkColor;
}
/** The current attachment for the slot, or null if the slot has no attachment. */
@Null
public Attachment getAttachment () {
public @Null Attachment getAttachment () {
return attachment;
}

View File

@ -74,8 +74,7 @@ public class SlotData {
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */
@Null
public Color getDarkColor () {
public @Null Color getDarkColor () {
return darkColor;
}
@ -88,8 +87,7 @@ public class SlotData {
}
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
@Null
public String getAttachmentName () {
public @Null String getAttachmentName () {
return attachmentName;
}

View File

@ -39,26 +39,20 @@ import com.esotericsoftware.spine.Skin;
* Runtimes Guide. */
public interface AttachmentLoader {
/** @return May be null to not load the attachment. */
@Null
public RegionAttachment newRegionAttachment (Skin skin, String name, String path);
public @Null RegionAttachment newRegionAttachment (Skin skin, String name, String path);
/** @return May be null to not load the attachment. */
@Null
public MeshAttachment newMeshAttachment (Skin skin, String name, String path);
public @Null MeshAttachment newMeshAttachment (Skin skin, String name, String path);
/** @return May be null to not load the attachment. */
@Null
public BoundingBoxAttachment newBoundingBoxAttachment (Skin skin, String name);
public @Null BoundingBoxAttachment newBoundingBoxAttachment (Skin skin, String name);
/** @return May be null to not load the attachment. */
@Null
public ClippingAttachment newClippingAttachment (Skin skin, String name);
public @Null ClippingAttachment newClippingAttachment (Skin skin, String name);
/** @return May be null to not load the attachment. */
@Null
public PathAttachment newPathAttachment (Skin skin, String name);
public @Null PathAttachment newPathAttachment (Skin skin, String name);
/** @return May be null to not load the attachment. */
@Null
public PointAttachment newPointAttachment (Skin skin, String name);
public @Null PointAttachment newPointAttachment (Skin skin, String name);
}

View File

@ -123,8 +123,7 @@ abstract public class VertexAttachment extends Attachment {
/** Deform keys for the deform attachment are also applied to this attachment.
* @return May be null if no deform keys should be applied. */
@Null
public VertexAttachment getDeformAttachment () {
public @Null VertexAttachment getDeformAttachment () {
return deformAttachment;
}
@ -136,8 +135,7 @@ abstract public class VertexAttachment extends Attachment {
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
* the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#getBones()}. Will be null
* if this attachment has no weights. */
@Null
public int[] getBones () {
public @Null int[] getBones () {
return bones;
}