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);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ public final class Viewport extends ValueType implements IEquatable<Viewport>
|
|||||||
{
|
{
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,6 +148,7 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class ArgumentOutOfRangeException extends ArgumentException
|
|||||||
{
|
{
|
||||||
_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
|
||||||
}
|
|
@ -7,7 +7,7 @@ import java.util.Locale;
|
|||||||
*
|
*
|
||||||
* @author Halofreak1990
|
* @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.
|
* 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
|
* @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.
|
* 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)
|
if (this._ticks > value._ticks)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user