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

@ -46,6 +46,7 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
{
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;
}
/**
@ -149,6 +148,7 @@ 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));
}

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

@ -28,6 +28,7 @@ public class ArgumentOutOfRangeException extends ArgumentException
{
_rangeMessage = "Specified argument was out of the range of valid values.";
}
return _rangeMessage;
}

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

@ -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);
}

View File

@ -7,7 +7,7 @@ import java.util.Locale;
*
* @author Halofreak1990
*/
public class TimeSpan implements IComparable<TimeSpan>, IEquatable<TimeSpan>
public class TimeSpan implements Comparable<TimeSpan>, IEquatable<TimeSpan>
{
/**
* Represents the number of ticks in 1 millisecond. This field is constant.
@ -366,7 +366,7 @@ public class TimeSpan implements IComparable<TimeSpan>, IEquatable<TimeSpan>
* @return
* A signed number indicating the relative values of this instance and value.Value Description A negative integer This instance is less than value. Zero This instance is equal to value. A positive integer This instance is greater than value.
*/
public int CompareTo(TimeSpan value)
public int compareTo(TimeSpan value)
{
if (this._ticks > value._ticks)
{