Updated whitespace and formatting

Replaced remaining usages of IComparable with Comparable
Remove useless IComparable interface
This commit is contained in:
Tom Lint 2014-03-10 14:51:54 +01:00
parent 9cfedf1e78
commit d4c31e72c2
13 changed files with 1100 additions and 1100 deletions

View File

@ -378,7 +378,7 @@ public class Game implements IDisposable
if (isFixedTimeStep)
{
while (elapsedUpdateTime.CompareTo(TargetElapsedTime) == -1)
while (elapsedUpdateTime.compareTo(TargetElapsedTime) == -1)
{
try
{
@ -401,7 +401,7 @@ public class Game implements IDisposable
elapsedUpdateTime = TimeSpan.FromMilliseconds(getTicks() - gameTime.getTotalGameTime().getTotalMilliseconds());
if (isFixedTimeStep && elapsedUpdateTime.CompareTo(TargetElapsedTime) == 1)
if (isFixedTimeStep && elapsedUpdateTime.compareTo(TargetElapsedTime) == 1)
{
gameTime.setIsRunningSlowly(true);
}

View File

@ -43,10 +43,11 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
public float getAspectRatio()
{
if ((this.Height != 0) && (this.Width != 0))
{
return (((float) this.Width) / ((float) this.Height));
}
return 0f;
{
return (((float) this.Width) / ((float) this.Height));
}
return 0f;
}
/**
@ -123,9 +124,7 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
@Override
public boolean equals(Object obj)
{
if (obj instanceof Viewport)
return this.Equals((Viewport)obj);
return false;
return (obj instanceof Viewport) ? this.Equals((Viewport)obj) : false;
}
/**
@ -147,10 +146,11 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
}
private static boolean WithinEpsilon(float a, float b)
{
float num = a - b;
return ((-1.401298E-45f <= num) && (num <= 1.401298E-45f));
}
{
float num = a - b;
return ((-1.401298E-45f <= num) && (num <= 1.401298E-45f));
}
/**
* 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.
*/
public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
{
Matrix matrix = Matrix.Multiply(Matrix.Multiply(world, view), projection);
Vector3 vector = Vector3.Transform(source, matrix);
float a = (((source.X * matrix.M14) + (source.Y * matrix.M24)) + (source.Z * matrix.M34)) + matrix.M44;
if (!WithinEpsilon(a, 1f))
{
vector.Divide(a);
}
vector.X = (((vector.X + 1f) * 0.5f) * this.Width) + this.X;
vector.Y = (((-vector.Y + 1f) * 0.5f) * this.Height) + this.Y;
vector.Z = (vector.Z * (this.MaxDepth - this.MinDepth)) + this.MinDepth;
return vector;
}
{
Matrix matrix = Matrix.Multiply(Matrix.Multiply(world, view), projection);
Vector3 vector = Vector3.Transform(source, matrix);
float a = (((source.X * matrix.M14) + (source.Y * matrix.M24)) + (source.Z * matrix.M34)) + matrix.M44;
if (!WithinEpsilon(a, 1f))
{
vector.Divide(a);
}
vector.X = (((vector.X + 1f) * 0.5f) * this.Width) + this.X;
vector.Y = (((-vector.Y + 1f) * 0.5f) * this.Height) + this.Y;
vector.Z = (vector.Z * (this.MaxDepth - this.MinDepth)) + this.MinDepth;
return vector;
}
/**
* 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.
*/
public Vector3 Unproject(Vector3 source, Matrix projection, Matrix view, Matrix world)
{
{
Matrix matrix = Matrix.Invert(Matrix.Multiply(Matrix.Multiply(world, view), projection));
source.X = (((source.X - this.X) / ((float) this.Width)) * 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);
}
return vector;
}
}
}

View File

@ -36,11 +36,11 @@ public final class Artist implements IEquatable<Artist>, IDisposable
private Artist()
{
//this.handle = uint.MaxValue;
this.hashcode = -1;
this.name = "";
this.songs = SongCollection.Empty;
this.albums = AlbumCollection.Empty;
//this.handle = uint.MaxValue;
this.hashcode = -1;
this.name = "";
this.songs = SongCollection.Empty;
this.albums = AlbumCollection.Empty;
}
/*Artist(uint handle)

View File

@ -108,7 +108,9 @@ public final class StorageDevice
public static IAsyncResult BeginShowSelector(PlayerIndex player, int sizeInBytes, int directoryCount, AsyncCallback callback, Object state)
{
if (player.ordinal() > PlayerIndex.One.ordinal())
{
throw new InvalidOperationException();
}
throw new NotImplementedException();
}
@ -128,7 +130,9 @@ public final class StorageDevice
public static IAsyncResult BeginShowSelector(PlayerIndex player, AsyncCallback callback, Object state)
{
if (player.ordinal() > PlayerIndex.One.ordinal())
{
throw new InvalidOperationException();
}
throw new NotImplementedException();
}
@ -152,7 +156,9 @@ public final class StorageDevice
public StorageContainer EndOpenContainer(IAsyncResult result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
throw new NotImplementedException();
}
@ -166,7 +172,9 @@ public final class StorageDevice
public static StorageDevice EndShowSelector(IAsyncResult result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
throw new NotImplementedException();
}

View File

@ -24,11 +24,12 @@ public class ArgumentOutOfRangeException extends ArgumentException
private static String getRangeMessage()
{
if (_rangeMessage == null)
{
_rangeMessage = "Specified argument was out of the range of valid values.";
}
return _rangeMessage;
if (_rangeMessage == null)
{
_rangeMessage = "Specified argument was out of the range of valid values.";
}
return _rangeMessage;
}
/**
@ -93,6 +94,6 @@ public class ArgumentOutOfRangeException extends ArgumentException
public ArgumentOutOfRangeException(String paramName, Object actualValue, String message)
{
super(message, paramName);
this.m_actualValue = actualValue;
this.m_actualValue = actualValue;
}
}

View File

@ -52,7 +52,9 @@ public class Event<T extends EventArgs>
public synchronized void removeHandler(EventHandler<T> handler)
{
if (this.handlers.isEmpty())
{
throw new InvalidOperationException("Cannot remove event handler because none have been assigned.");
}
this.handlers.remove(handler);
}
@ -64,7 +66,7 @@ public class Event<T extends EventArgs>
* The Object that raised the event.
*
* @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
* 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)
{
if (this.handlers.isEmpty())
{
throw new InvalidOperationException("Trying to raise an event without Event Handlers.");
}
for (EventHandler<T> handler : handlers)
{

View File

@ -1,14 +1,22 @@
package System;
/**
*
* Represents the method that will handle an event.
*
* @author Halofreak1990
* @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>
{
/**
*
* @param sender
* The source of the event.
*
* @param e
* An {@link System.EventArgs} that contains the event data.
*/
void Invoke(Object sender, T e);
}

View File

@ -13,9 +13,9 @@ public class FormatException extends SystemException
* Initializes a new instance of the FormatException class.
*/
public FormatException()
{
{
super("One of the identified items was in an invalid format.");
}
}
/**
* Initializes a new instance of the FormatException class with a specified error message.
@ -23,22 +23,22 @@ public class FormatException extends SystemException
* @param message
* The message that describes the error.
*/
public FormatException(String message)
{
super(message);
}
public FormatException(String 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.
*
* @param message
* The error message that explains the reason for the exception.
*
* @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.
*/
public FormatException(String message, RuntimeException innerException)
{
super(message, innerException);
}
/**
* 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
* The error message that explains the reason for the exception.
*
* @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.
*/
public FormatException(String message, RuntimeException innerException)
{
super(message, innerException);
}
}

View File

@ -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