Updated whitespace and formatting
Replaced remaining usages of IComparable with Comparable Remove useless IComparable interface
This commit is contained in:
parent
9cfedf1e78
commit
d4c31e72c2
@ -378,7 +378,7 @@ public class Game implements IDisposable
|
|||||||
|
|
||||||
if (isFixedTimeStep)
|
if (isFixedTimeStep)
|
||||||
{
|
{
|
||||||
while (elapsedUpdateTime.CompareTo(TargetElapsedTime) == -1)
|
while (elapsedUpdateTime.compareTo(TargetElapsedTime) == -1)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -401,7 +401,7 @@ public class Game implements IDisposable
|
|||||||
|
|
||||||
elapsedUpdateTime = TimeSpan.FromMilliseconds(getTicks() - gameTime.getTotalGameTime().getTotalMilliseconds());
|
elapsedUpdateTime = TimeSpan.FromMilliseconds(getTicks() - gameTime.getTotalGameTime().getTotalMilliseconds());
|
||||||
|
|
||||||
if (isFixedTimeStep && elapsedUpdateTime.CompareTo(TargetElapsedTime) == 1)
|
if (isFixedTimeStep && elapsedUpdateTime.compareTo(TargetElapsedTime) == 1)
|
||||||
{
|
{
|
||||||
gameTime.setIsRunningSlowly(true);
|
gameTime.setIsRunningSlowly(true);
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,11 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
|
|||||||
public float getAspectRatio()
|
public float getAspectRatio()
|
||||||
{
|
{
|
||||||
if ((this.Height != 0) && (this.Width != 0))
|
if ((this.Height != 0) && (this.Width != 0))
|
||||||
{
|
{
|
||||||
return (((float) this.Width) / ((float) this.Height));
|
return (((float) this.Width) / ((float) this.Height));
|
||||||
}
|
}
|
||||||
return 0f;
|
|
||||||
|
return 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,9 +124,7 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (obj instanceof Viewport)
|
return (obj instanceof Viewport) ? this.Equals((Viewport)obj) : false;
|
||||||
return this.Equals((Viewport)obj);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,10 +146,11 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean WithinEpsilon(float a, float b)
|
private static boolean WithinEpsilon(float a, float b)
|
||||||
{
|
{
|
||||||
float num = a - b;
|
float num = a - b;
|
||||||
return ((-1.401298E-45f <= num) && (num <= 1.401298E-45f));
|
|
||||||
}
|
return ((-1.401298E-45f <= num) && (num <= 1.401298E-45f));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Projects a 3D vector from object space into screen space.
|
* Projects a 3D vector from object space into screen space.
|
||||||
@ -168,19 +168,19 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
|
|||||||
* The world matrix.
|
* The world matrix.
|
||||||
*/
|
*/
|
||||||
public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
|
public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
|
||||||
{
|
{
|
||||||
Matrix matrix = Matrix.Multiply(Matrix.Multiply(world, view), projection);
|
Matrix matrix = Matrix.Multiply(Matrix.Multiply(world, view), projection);
|
||||||
Vector3 vector = Vector3.Transform(source, matrix);
|
Vector3 vector = Vector3.Transform(source, matrix);
|
||||||
float a = (((source.X * matrix.M14) + (source.Y * matrix.M24)) + (source.Z * matrix.M34)) + matrix.M44;
|
float a = (((source.X * matrix.M14) + (source.Y * matrix.M24)) + (source.Z * matrix.M34)) + matrix.M44;
|
||||||
if (!WithinEpsilon(a, 1f))
|
if (!WithinEpsilon(a, 1f))
|
||||||
{
|
{
|
||||||
vector.Divide(a);
|
vector.Divide(a);
|
||||||
}
|
}
|
||||||
vector.X = (((vector.X + 1f) * 0.5f) * this.Width) + this.X;
|
vector.X = (((vector.X + 1f) * 0.5f) * this.Width) + this.X;
|
||||||
vector.Y = (((-vector.Y + 1f) * 0.5f) * this.Height) + this.Y;
|
vector.Y = (((-vector.Y + 1f) * 0.5f) * this.Height) + this.Y;
|
||||||
vector.Z = (vector.Z * (this.MaxDepth - this.MinDepth)) + this.MinDepth;
|
vector.Z = (vector.Z * (this.MaxDepth - this.MinDepth)) + this.MinDepth;
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a screen space point into a corresponding point in world space.
|
* Converts a screen space point into a corresponding point in world space.
|
||||||
@ -198,7 +198,7 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
|
|||||||
* The world matrix.
|
* The world matrix.
|
||||||
*/
|
*/
|
||||||
public Vector3 Unproject(Vector3 source, Matrix projection, Matrix view, Matrix world)
|
public Vector3 Unproject(Vector3 source, Matrix projection, Matrix view, Matrix world)
|
||||||
{
|
{
|
||||||
Matrix matrix = Matrix.Invert(Matrix.Multiply(Matrix.Multiply(world, view), projection));
|
Matrix matrix = Matrix.Invert(Matrix.Multiply(Matrix.Multiply(world, view), projection));
|
||||||
source.X = (((source.X - this.X) / ((float) this.Width)) * 2f) - 1f;
|
source.X = (((source.X - this.X) / ((float) this.Width)) * 2f) - 1f;
|
||||||
source.Y = -((((source.Y - this.Y) / ((float) this.Height)) * 2f) - 1f);
|
source.Y = -((((source.Y - this.Y) / ((float) this.Height)) * 2f) - 1f);
|
||||||
@ -210,5 +210,5 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
|
|||||||
vector.Divide(a);
|
vector.Divide(a);
|
||||||
}
|
}
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ public final class Artist implements IEquatable<Artist>, IDisposable
|
|||||||
|
|
||||||
private Artist()
|
private Artist()
|
||||||
{
|
{
|
||||||
//this.handle = uint.MaxValue;
|
//this.handle = uint.MaxValue;
|
||||||
this.hashcode = -1;
|
this.hashcode = -1;
|
||||||
this.name = "";
|
this.name = "";
|
||||||
this.songs = SongCollection.Empty;
|
this.songs = SongCollection.Empty;
|
||||||
this.albums = AlbumCollection.Empty;
|
this.albums = AlbumCollection.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Artist(uint handle)
|
/*Artist(uint handle)
|
||||||
|
@ -108,7 +108,9 @@ public final class StorageDevice
|
|||||||
public static IAsyncResult BeginShowSelector(PlayerIndex player, int sizeInBytes, int directoryCount, AsyncCallback callback, Object state)
|
public static IAsyncResult BeginShowSelector(PlayerIndex player, int sizeInBytes, int directoryCount, AsyncCallback callback, Object state)
|
||||||
{
|
{
|
||||||
if (player.ordinal() > PlayerIndex.One.ordinal())
|
if (player.ordinal() > PlayerIndex.One.ordinal())
|
||||||
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -128,7 +130,9 @@ public final class StorageDevice
|
|||||||
public static IAsyncResult BeginShowSelector(PlayerIndex player, AsyncCallback callback, Object state)
|
public static IAsyncResult BeginShowSelector(PlayerIndex player, AsyncCallback callback, Object state)
|
||||||
{
|
{
|
||||||
if (player.ordinal() > PlayerIndex.One.ordinal())
|
if (player.ordinal() > PlayerIndex.One.ordinal())
|
||||||
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -152,7 +156,9 @@ public final class StorageDevice
|
|||||||
public StorageContainer EndOpenContainer(IAsyncResult result)
|
public StorageContainer EndOpenContainer(IAsyncResult result)
|
||||||
{
|
{
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException("result");
|
throw new ArgumentNullException("result");
|
||||||
|
}
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -166,7 +172,9 @@ public final class StorageDevice
|
|||||||
public static StorageDevice EndShowSelector(IAsyncResult result)
|
public static StorageDevice EndShowSelector(IAsyncResult result)
|
||||||
{
|
{
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException("result");
|
throw new ArgumentNullException("result");
|
||||||
|
}
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,12 @@ public class ArgumentOutOfRangeException extends ArgumentException
|
|||||||
|
|
||||||
private static String getRangeMessage()
|
private static String getRangeMessage()
|
||||||
{
|
{
|
||||||
if (_rangeMessage == null)
|
if (_rangeMessage == null)
|
||||||
{
|
{
|
||||||
_rangeMessage = "Specified argument was out of the range of valid values.";
|
_rangeMessage = "Specified argument was out of the range of valid values.";
|
||||||
}
|
}
|
||||||
return _rangeMessage;
|
|
||||||
|
return _rangeMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,6 +94,6 @@ public class ArgumentOutOfRangeException extends ArgumentException
|
|||||||
public ArgumentOutOfRangeException(String paramName, Object actualValue, String message)
|
public ArgumentOutOfRangeException(String paramName, Object actualValue, String message)
|
||||||
{
|
{
|
||||||
super(message, paramName);
|
super(message, paramName);
|
||||||
this.m_actualValue = actualValue;
|
this.m_actualValue = actualValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,9 @@ public class Event<T extends EventArgs>
|
|||||||
public synchronized void removeHandler(EventHandler<T> handler)
|
public synchronized void removeHandler(EventHandler<T> handler)
|
||||||
{
|
{
|
||||||
if (this.handlers.isEmpty())
|
if (this.handlers.isEmpty())
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Cannot remove event handler because none have been assigned.");
|
throw new InvalidOperationException("Cannot remove event handler because none have been assigned.");
|
||||||
|
}
|
||||||
|
|
||||||
this.handlers.remove(handler);
|
this.handlers.remove(handler);
|
||||||
}
|
}
|
||||||
@ -64,7 +66,7 @@ public class Event<T extends EventArgs>
|
|||||||
* The Object that raised the event.
|
* The Object that raised the event.
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* An instance of System.EventArgs that provides information about the event.
|
* An instance of {@link System.EventArgs} that provides information about the event.
|
||||||
*
|
*
|
||||||
* @throws InvalidOperationException
|
* @throws InvalidOperationException
|
||||||
* Thrown when the event is raised with no event handlers assigned.
|
* Thrown when the event is raised with no event handlers assigned.
|
||||||
@ -72,7 +74,9 @@ public class Event<T extends EventArgs>
|
|||||||
public synchronized void raise(Object sender, T e)
|
public synchronized void raise(Object sender, T e)
|
||||||
{
|
{
|
||||||
if (this.handlers.isEmpty())
|
if (this.handlers.isEmpty())
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Trying to raise an event without Event Handlers.");
|
throw new InvalidOperationException("Trying to raise an event without Event Handlers.");
|
||||||
|
}
|
||||||
|
|
||||||
for (EventHandler<T> handler : handlers)
|
for (EventHandler<T> handler : handlers)
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,22 @@
|
|||||||
package System;
|
package System;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Represents the method that will handle an event.
|
||||||
*
|
*
|
||||||
* @author Halofreak1990
|
* @author Halofreak1990
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* The type of EventArgs to use in this EventHandler.
|
* The type of the event data generated by the event.
|
||||||
*/
|
*/
|
||||||
public interface EventHandler<T>
|
public interface EventHandler<T>
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param sender
|
||||||
|
* The source of the event.
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
* An {@link System.EventArgs} that contains the event data.
|
||||||
|
*/
|
||||||
void Invoke(Object sender, T e);
|
void Invoke(Object sender, T e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ public class FormatException extends SystemException
|
|||||||
* Initializes a new instance of the FormatException class.
|
* Initializes a new instance of the FormatException class.
|
||||||
*/
|
*/
|
||||||
public FormatException()
|
public FormatException()
|
||||||
{
|
{
|
||||||
super("One of the identified items was in an invalid format.");
|
super("One of the identified items was in an invalid format.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the FormatException class with a specified error message.
|
* Initializes a new instance of the FormatException class with a specified error message.
|
||||||
@ -23,22 +23,22 @@ public class FormatException extends SystemException
|
|||||||
* @param message
|
* @param message
|
||||||
* The message that describes the error.
|
* The message that describes the error.
|
||||||
*/
|
*/
|
||||||
public FormatException(String message)
|
public FormatException(String message)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the FormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.
|
* Initializes a new instance of the FormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* The error message that explains the reason for the exception.
|
* The error message that explains the reason for the exception.
|
||||||
*
|
*
|
||||||
* @param innerException
|
* @param innerException
|
||||||
* The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception.
|
* The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception.
|
||||||
*/
|
*/
|
||||||
public FormatException(String message, RuntimeException innerException)
|
public FormatException(String message, RuntimeException innerException)
|
||||||
{
|
{
|
||||||
super(message, innerException);
|
super(message, innerException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package System;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines a generalized comparison method that a value type or class implements to create a type-specific comparison method for ordering instances.
|
|
||||||
*
|
|
||||||
* @author Halofreak1990
|
|
||||||
* @param <T>
|
|
||||||
*/
|
|
||||||
public interface IComparable<T>
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Compares the current object with an object of the same type.
|
|
||||||
*
|
|
||||||
* @param other
|
|
||||||
* An object to compare with this object.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter. Zero This object is equal to other. Greater than zero This object is greater than other.
|
|
||||||
*/
|
|
||||||
public int CompareTo(T other);
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user