Added missing fields

Added Uri-related enums
Added Microphone class and related enum
Updated whitespace
This commit is contained in:
Tom Lint 2014-02-03 22:35:46 +01:00
parent 9335b2e748
commit 9cfedf1e78
19 changed files with 667 additions and 232 deletions

View File

@ -12,9 +12,9 @@ import Microsoft.Xna.Framework.Net.*;
*/
public class Game1 extends Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D background;
private GraphicsDeviceManager graphics;
private SpriteBatch spriteBatch;
private Texture2D background;
public Game1()
{
@ -24,9 +24,9 @@ public class Game1 extends Game
/**
* Allows the game to perform any initialization it needs to before starting to run.
* This is where it can query for any required services and load any non-graphic
* related content. Calling base.Initialize will enumerate through any components
* and initialize them as well.
* This is where it can query for any required services and load any non-graphic
* related content. Calling base.Initialize will enumerate through any components
* and initialize them as well.
*/
@Override
public void Initialize()
@ -38,7 +38,7 @@ public class Game1 extends Game
/**
* LoadContent will be called once per game and is the place to load
* all of your content.
* all of your content.
*/
@Override
public void LoadContent()
@ -54,7 +54,7 @@ public class Game1 extends Game
/**
* UnloadContent will be called once per game and is the place to unload
* all content.
* all content.
*/
@Override
protected void UnloadContent()

View File

@ -10,12 +10,12 @@ import System.*;
public final class DynamicSoundEffectInstance extends SoundEffectInstance
{
private AudioFormat format;
/**
* Event that occurs when the number of audio capture buffers awaiting playback is less than or equal to two.
*/
public final Event<EventArgs> BufferNeeded = new Event<EventArgs>();
/**
* Initializes a new instance of this class, which creates a dynamic sound effect based on the specified sample rate and audio channel.
*
@ -38,10 +38,10 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
{
throw new ArgumentOutOfRangeException("channels");
}
// TODO: implement
// TODO: implement
}
/**
*
*/
@ -57,7 +57,7 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
super.Dispose(disposing);
}
}
/**
* Returns the sample duration based on the specified size of the audio buffer.
*
@ -74,19 +74,25 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
synchronized (super.VoiceHandleLock)
{
if (super.IsDisposed())
{
throw new ObjectDisposedException(super.getClass().getName(), "This object has already been disposed.");
}
if (sizeInBytes < 0)
{
throw new ArgumentException("Buffer size cannot be negative.");
}
if (sizeInBytes == 0)
{
return TimeSpan.Zero;
}
// TODO: get this from AudioFormat
throw new NotImplementedException();
}
}
/**
* Returns the size of the audio buffer required to contain audio samples based on the specified duration.
*
@ -107,26 +113,27 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
throw new ObjectDisposedException(super.getClass().getName(), "This object has already been disposed.");
if ((duration.getTotalMilliseconds() < 0.0) || (duration.getTotalMilliseconds() > 2147483647.0))
{
throw new ArgumentOutOfRangeException("duration");
}
if (duration == TimeSpan.Zero)
{
return 0;
}
{
throw new ArgumentOutOfRangeException("duration");
}
if (duration == TimeSpan.Zero)
{
return 0;
}
try
{
// TODO: implement
}
catch(OverflowException ex)
{
throw new ArgumentOutOfRangeException("duration");
}
try
{
// TODO: implement
}
catch(OverflowException ex)
{
throw new ArgumentOutOfRangeException("duration", ex);
}
}
return num;
}
/**
* Begins or resumes audio playback.
*
@ -138,13 +145,15 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
synchronized(super.VoiceHandleLock)
{
if (super.IsDisposed())
{
throw new ObjectDisposedException(super.getClass().getName(), "This object has already been disposed.");
}
// TODO: implement
throw new NotImplementedException();
}
}
/**
* Submits an audio buffer for playback. Playback starts at the beginning, and the buffer is played in its entirety.
*
@ -153,9 +162,9 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
*/
public void SubmitBuffer(byte[] buffer)
{
this.SubmitBuffer(buffer, 0, buffer.length);
this.SubmitBuffer(buffer, 0, buffer.length);
}
/**
* Submits an audio buffer for playback. Playback begins at the specified offset, and the byte count determines the size of the sample played.
*
@ -178,9 +187,12 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
synchronized(super.VoiceHandleLock)
{
int num = 0;
if (super.IsDisposed())
{
throw new ObjectDisposedException(super.getClass().getName(), "This object has already been disposed.");
}
if (((buffer == null) || (buffer.length == 0)) || !this.format.IsAligned(buffer.length))
{
throw new ArgumentException("Ensure that the buffer length is non-zero and meets the block alignment requirements for the audio format.");
@ -195,13 +207,13 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
}
catch(OverflowException ex)
{
throw new ArgumentException("Ensure that count is valid and meets the block alignment requirements for the audio format. Offset and count must define a valid region within the buffer boundaries.");
throw new ArgumentException("Ensure that count is valid and meets the block alignment requirements for the audio format. Offset and count must define a valid region within the buffer boundaries.", ex);
}
if (((count <= 0) || (num > buffer.length)) |!this.format.IsAligned(count))
{
throw new ArgumentException("Ensure that count is valid and meets the block alignment requirements for the audio format. Offset and count must define a valid region within the buffer boundaries.");
}
// TODO: implement
throw new NotImplementedException();
}

View File

@ -0,0 +1,150 @@
package Microsoft.Xna.Framework.Audio;
import System.*;
import System.Collections.ObjectModel.*;
/**
* Provides properties, methods, and fields and events for capturing audio data with microphones.
*
* @author Halofreak1990
*/
public final class Microphone
{
/**
* Returns the collection of all currently-available microphones.
*/
public static ReadOnlyCollection<Microphone> getAll()
{
throw new NotImplementedException();
}
/**
* Gets audio capture buffer duration of the microphone.
*/
public TimeSpan getBufferDuration()
{
throw new NotImplementedException();
}
/**
* Sets audio capture buffer duration of the microphone.
*
* @param value
*/
public void setBufferDuration(TimeSpan value)
{
throw new NotImplementedException();
}
/**
* Returns the default attached microphone.
*/
public static Microphone getDefault()
{
throw new NotImplementedException();
}
/**
* Determines if the microphone is a wired headset or a Bluetooth device.
*/
public boolean IsHeadset()
{
throw new NotImplementedException();
}
/**
* Returns the friendly name of the microphone.
*/
public final String Name = ""; // TODO: use constructor to get this at run-time.
/**
* Returns the sample rate at which the microphone is capturing audio data.
*/
public int getSampleRate()
{
throw new NotImplementedException();
}
/**
* Returns the recording state of the Microphone object.
*/
public MicrophoneState getState()
{
throw new NotImplementedException();
}
/**
* The event that occurs when the audio capture buffer is ready to processed.
*/
public final Event<EventArgs> BufferReady = new Event<EventArgs>();
protected void finalize()
{
}
/**
* Gets the latest recorded data from the microphone based on the audio capture buffer.
*
* @param buffer
* Buffer, in bytes, containing the captured audio data. The audio format must be PCM wave data.
*/
public int GetData(byte[] buffer)
{
return this.GetData(buffer, 0, buffer.length);
}
/**
* Gets the latest captured audio data from the microphone based on the specified offset and byte count.
*
* @param buffer
* Buffer, in bytes, containing the captured audio data. The audio format must be PCM wave data.
*
* @param offset
* Offset, in bytes, to the starting position of the data.
*
* @param count
* Amount, in bytes, of desired audio data.
*/
public int GetData(byte[ ] buffer, int offset, int count)
{
throw new NotImplementedException();
}
/**
* Returns the duration of audio playback based on the size of the buffer.
*
* @param sizeInBytes
* Size, in bytes, of the audio data.
*/
public TimeSpan GetSampleDuration(int sizeInBytes)
{
throw new NotImplementedException();
}
/**
* Returns the size of the byte array required to hold the specified duration of audio for this microphone object.
*
* @param duration
* TimeSpan object that contains the duration of the audio sample.
*/
public int GetSampleSizeInBytes(TimeSpan duration)
{
throw new NotImplementedException();
}
/**
* Starts microphone audio capture.
*/
public void Start()
{
throw new NotImplementedException();
}
/**
* Stops microphone audio capture.
*/
public void Stop()
{
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,18 @@
package Microsoft.Xna.Framework.Audio;
/**
* Current state of the Microphone audio capture (started or stopped).
*
* @author Halofreak1990
*/
public enum MicrophoneState
{
/**
* The Microphone audio capture has started.
*/
Started,
/**
* The Microphone audio capture has stopped.
*/
Stopped
}

View File

@ -10,18 +10,18 @@ import System.*;
public class SoundEffectInstance implements IDisposable
{
private float currentPan;
private float currentPitch;
private float currentVolume;
private float currentPitch;
private float currentVolume;
private boolean isDisposed;
private boolean isFireAndForget;
private SoundEffect parent;
Object VoiceHandleLock;
/**
* Gets a value that indicates whether looping is enabled for the SoundEffectInstance. Reference page contains links to related code samples.
*/
public boolean IsLooped;
/**
* Gets a value that indicates whether the object is disposed.
*/
@ -29,12 +29,12 @@ public class SoundEffectInstance implements IDisposable
{
return isDisposed;
}
boolean IsFireAndForget()
{
return this.isFireAndForget;
}
/**
* Gets the panning for the SoundEffectInstance.
*/
@ -42,7 +42,7 @@ public class SoundEffectInstance implements IDisposable
{
return this.currentPan;
}
/**
* Sets the panning for the SoundEffectInstance.
*/
@ -51,16 +51,20 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
if (value < -1f || value > 1f)
{
throw new ArgumentOutOfRangeException("value");
}
//Helpers.ThrowExceptionFromErrorCode(SoundEffectUnsafeNativeMethods.SetPan(this.voiceHandle, value));
this.currentPan = value;
this.currentPan = value;
}
}
/**
* Gets the pitch adjustment for the SoundEffectInstance. Reference page contains links to related code samples.
*/
@ -68,7 +72,7 @@ public class SoundEffectInstance implements IDisposable
{
return this.currentPitch;
}
/**
* Sets the pitch adjustment for the SoundEffectInstance. Reference page contains links to related code samples.
*/
@ -77,21 +81,25 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
if (value < -1f || value > 1f)
{
throw new ArgumentOutOfRangeException("value");
}
//Helpers.ThrowExceptionFromErrorCode(SoundEffectUnsafeNativeMethods.SetPitch(this.voiceHandle, value));
this.currentPitch = value;
}
}
SoundEffect getSoundEffect()
{
return this.parent;
}
/**
* Gets the current state (playing, paused, or stopped) of the SoundEffectInstance.
*/
@ -100,13 +108,15 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
}
}
/**
* Gets the volume of the SoundEffectInstance. Reference page contains links to related code samples.
*/
@ -114,7 +124,7 @@ public class SoundEffectInstance implements IDisposable
{
return this.currentVolume;
}
/**
* Sets the volume of the SoundEffectInstance. Reference page contains links to related code samples.
*/
@ -123,30 +133,36 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
if (value < -1f || value > 1f)
{
throw new ArgumentOutOfRangeException("value");
}
//Helpers.ThrowExceptionFromErrorCode(SoundEffectUnsafeNativeMethods.SetVolume(this.voiceHandle, value));
this.currentVolume = value;
}
}
SoundEffectInstance()
{
this.currentVolume = 1f;
// TODO: implement
this.VoiceHandleLock = new Object();
}
SoundEffectInstance(SoundEffect parentEffect, boolean fireAndForget)
{
this.currentVolume = 1f;
this.VoiceHandleLock = new Object();
if (parentEffect.IsDisposed())
{
throw new ObjectDisposedException(SoundEffect.class.getName(), "This object has already been disposed.");
}
this.parent = parentEffect;
this.setVolume(1f);
this.setPitch(0f);
@ -154,7 +170,7 @@ public class SoundEffectInstance implements IDisposable
this.IsLooped = false;
this.isFireAndForget = fireAndForget;
}
/**
* Applies 3D positioning to the sound using a single listener. Reference page contains links to related code samples.
*
@ -168,7 +184,7 @@ public class SoundEffectInstance implements IDisposable
{
this.Apply3D(new AudioListener[] { listener }, emitter);
}
/**
* Applies 3D position to the sound using multiple listeners. Reference page contains links to related code samples.
*
@ -183,13 +199,15 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
}
}
/**
* Releases unmanaged resources held by this SoundEffectInstance.
*/
@ -197,7 +215,7 @@ public class SoundEffectInstance implements IDisposable
{
this.Dispose(true);
}
/**
* Releases the unmanaged resources held by this SoundEffectInstance, and optionally releases the managed resources.
*
@ -218,7 +236,7 @@ public class SoundEffectInstance implements IDisposable
}
}
}
/**
* Releases unmanaged resources and performs other cleanup operations before the SoundEffectInstance is reclaimed by garbage collection.
*/
@ -226,7 +244,7 @@ public class SoundEffectInstance implements IDisposable
{
this.Dispose(false);
}
/**
* Pauses a SoundEffectInstance.
*/
@ -235,13 +253,15 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
}
}
/**
* Plays or resumes a SoundEffectInstance.
*/
@ -250,13 +270,15 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
}
}
/**
* Resumes playback for a SoundEffectInstance.
*/
@ -265,13 +287,15 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
}
}
/**
* Immediately stops playing a SoundEffectInstance.
*/
@ -279,7 +303,7 @@ public class SoundEffectInstance implements IDisposable
{
this.Stop(true);
}
/**
* Stops playing a SoundEffectInstance, either immediately or as authored.
*
@ -291,8 +315,10 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
}

View File

@ -1,5 +1,6 @@
package Microsoft.Xna.Framework.Content;
import java.io.InputStream;
import java.lang.reflect.*;
import java.util.*;
@ -20,19 +21,31 @@ public class ContentManager implements IDisposable
private IServiceProvider serviceProvider;
private Action<IDisposable> recordDisposableObject;
/**
* Gets the root directory associated with this ContentManager.
*/
public String getRootDirectory()
{
return this.rootDirectory;
}
/**
* Sets the root directory associated with this ContentManager.
*
* @param value
*/
public void setRootDirectory(String value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (this.assets.size() > 0)
{
throw new InvalidOperationException("");
}
this.rootDirectory = value;
/*this.fullRootDirectory = value;
this.isRootDirectoryAbsolute = TitleContainer.IsPathAbsolute(value);
@ -48,15 +61,22 @@ public class ContentManager implements IDisposable
}*/
}
/**
* Gets the service provider associated with the ContentManager.
*/
public IServiceProvider getServiceProvider()
{
return this.serviceProvider;
}
/**
* Initializes a new instance of ContentManager.
*
* @param serviceProvider
* The service provider that the ContentManager should use to locate services.
*
* @throws ArgumentNullException
* serviceProvider is null.
*/
public ContentManager(IServiceProvider serviceProvider)
{
@ -64,10 +84,16 @@ public class ContentManager implements IDisposable
}
/**
* Initializes a new instance of ContentManager.
*
* @param serviceProvider
* The service provider the ContentManager should use to locate services.
*
* @param rootDirectory
* The root directory to search for content.
*
* @throws ArgumentNullException
* serviceProvider or rootDirectory is null.
*/
public ContentManager(IServiceProvider serviceProvider, String rootDirectory)
{
@ -87,7 +113,7 @@ public class ContentManager implements IDisposable
}
/**
*
* Releases all resources used by the ContentManager class.
*/
@Override
public void Dispose()
@ -95,6 +121,12 @@ public class ContentManager implements IDisposable
Dispose(true);
}
/**
* Releases the unmanaged resources used by the ContentManager and optionally releases the managed resources.
*
* @param disposing
* true to release both managed and unmanaged resources; false to release only unmanaged resources.
*/
protected void Dispose(boolean disposing)
{
if (!this.disposed)
@ -153,11 +185,22 @@ public class ContentManager implements IDisposable
}
}
T asset = this.ReadAsset(assetName, null);
return asset;
}
/**
* Opens a stream for reading the specified asset. Derived classes can replace this to implement pack files or asset compression.
*
* @param assetName
* The name of the asset being read.
*/
protected InputStream OpenStream(String assetName)
{
throw new NotImplementedException();
}
/**
* Low-level worker method that reads asset data.
*

View File

@ -2,6 +2,8 @@ package Microsoft.Xna.Framework.GamerServices;
import java.util.EnumSet;
import System.*;
/**
* Provides the presence information of a friend of the local gamer.
*
@ -12,9 +14,31 @@ public final class FriendGamer extends Gamer
private EnumSet<FriendState> friendState;
private FriendCollection parent;
private String presence;
/**
* Gets whether the local gamer who requested the friends list has received a friend request from this gamer.
*/
public boolean FriendRequestReceivedFrom()
{
throw new NotImplementedException();
}
/**
* Gets whether the local gamer who requested the friends list has sent a friend request to this gamer.
*/
public boolean FriendRequestSentTo()
{
throw new NotImplementedException();
}
/**
* Gets a title-defined presence string describing what this friend is currently doing.
*/
public String getPresence()
{
return presence;
}
FriendGamer(FriendCollection parent, String gamertag, String presence, EnumSet<FriendState> friendState)
{
this.friendState = friendState;

View File

@ -73,12 +73,8 @@ public final class Album implements IEquatable<Album>, IDisposable
if (!isDisposed)
{
this.isDisposed = true;
// TODO: implement
if (false)
{
}
// TODO: implement
songs = SongCollection.Empty;
}

View File

@ -11,6 +11,8 @@ import System.*;
*/
public final class AlbumCollection implements Iterable<Album>
{
static final AlbumCollection Empty = null;
/**
* Returns an iterator that iterates through the AlbumCollection.
*/

View File

@ -51,6 +51,7 @@ public final class Artist implements IEquatable<Artist>, IDisposable
this.songs = SongCollection.Empty;
this.albums = AlbumCollection.Empty;
this.handle = handle;
if (this.IsValidHandle)
{
StringBuilder sbName = new StringBuilder(260);

View File

@ -9,6 +9,8 @@ import System.*;
*/
public final class Genre implements IEquatable<Genre>, IDisposable
{
static final Genre Empty = null;
/**
* Gets the AlbumCollection for the Genre.
*/

View File

@ -12,6 +12,8 @@ import System.*;
public final class SongCollection implements Iterable<Song>
{
static final SongCollection Empty = null;
/**
*
*/

View File

@ -47,7 +47,7 @@ public final class Point extends ValueType implements IEquatable<Point>
X = x;
Y = y;
}
/**
* Determines whether the specified Object is equal to this instance.
*
@ -59,7 +59,7 @@ public final class Point extends ValueType implements IEquatable<Point>
{
return (obj != null && obj instanceof Point) ? this.Equals((Point)obj) : false;
}
/**
* Determines whether two Point instances are equal.
*
@ -68,24 +68,24 @@ public final class Point extends ValueType implements IEquatable<Point>
*/
public boolean Equals(Point other)
{
return ((this.X == other.X) && (this.Y == other.Y));
return ((this.X == other.X) && (this.Y == other.Y));
}
/**
* Gets the hash code for this object.
*/
@Override
public int hashCode()
{
return (this.X ^ this.Y);
return (this.X ^ this.Y);
}
/**
* Returns a String that represents the current Point.
*/
@Override
public String toString()
{
return String.format(Locale.getDefault(), "{X:%i Y:%i}", this.X, this.Y);
return String.format(Locale.getDefault(), "{X:%i Y:%i}", this.X, this.Y);
}
}

View File

@ -18,7 +18,7 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return (this.Y + this.Height);
}
/**
* Gets the Point that specifies the center of the rectangle.
*/
@ -26,17 +26,17 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return new Point(this.X + (this.Width / 2), this.Y + (this.Height / 2));
}
/**
* Returns a Rectangle with all of its values set to zero.
*/
public static final Rectangle Empty = new Rectangle();
/**
* Specifies the height of the rectangle.
*/
public int Height;
/**
* Gets a value that indicates whether the Rectangle is empty.
*/
@ -44,7 +44,7 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return ((((this.Width == 0) && (this.Height == 0)) && (this.X == 0)) && (this.Y == 0));
}
/**
* Returns the x-coordinate of the left side of the rectangle.
*/
@ -52,7 +52,7 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return this.X;
}
/**
* Gets the upper-left value of the Rectangle.
*/
@ -60,7 +60,7 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return new Point(this.X, this.Y);
}
/**
* Sets the upper-left value of the Rectangle.
*
@ -70,9 +70,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
public void setLocation(Point newLocation)
{
this.X = newLocation.X;
this.Y = newLocation.Y;
this.Y = newLocation.Y;
}
/**
* Returns the x-coordinate of the right side of the rectangle.
*/
@ -80,7 +80,7 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return (this.X + this.Width);
}
/**
* Returns the y-coordinate of the top of the rectangle.
*/
@ -88,22 +88,22 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return this.Y;
}
/**
* Specifies the width of the rectangle.
*/
public int Width;
/**
* Specifies the x-coordinate of the rectangle.
*/
public int X;
/**
* Specifies the y-coordinate of the rectangle.
*/
public int Y;
/**
* Initializes a new instance of Rectangle.
*
@ -121,12 +121,12 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public Rectangle(int x, int y, int width, int height)
{
this.X = x;
this.Y = y;
this.Width = width;
this.Height = height;
this.X = x;
this.Y = y;
this.Width = width;
this.Height = height;
}
/**
* Initializes a new instance of Rectangle.
*/
@ -137,7 +137,7 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
this.Width = 0;
this.Height = 0;
}
/**
* Determines whether this Rectangle contains a specified Point.
*
@ -146,9 +146,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public boolean Contains(Point value)
{
return ((((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height)));
return ((((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height)));
}
/**
* Determines whether this Rectangle entirely contains a specified Rectangle.
*
@ -157,9 +157,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public boolean Contains(Rectangle value)
{
return ((((this.X <= value.X) && ((value.X + value.Width) <= (this.X + this.Width))) && (this.Y <= value.Y)) && ((value.Y + value.Height) <= (this.Y + this.Height)));
return ((((this.X <= value.X) && ((value.X + value.Width) <= (this.X + this.Width))) && (this.Y <= value.Y)) && ((value.Y + value.Height) <= (this.Y + this.Height)));
}
/**
* Determines whether this Rectangle entirely contains a specified Rectangle.
*
@ -171,9 +171,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public void Contains(Rectangle value, boolean result)
{
result = (((this.X <= value.X) && ((value.X + value.Width) <= (this.X + this.Width))) && (this.Y <= value.Y)) && ((value.Y + value.Height) <= (this.Y + this.Height));
result = (((this.X <= value.X) && ((value.X + value.Width) <= (this.X + this.Width))) && (this.Y <= value.Y)) && ((value.Y + value.Height) <= (this.Y + this.Height));
}
/**
* Determines whether this Rectangle contains a specified point represented by its x- and y-coordinates.
*
@ -185,9 +185,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public boolean Contains(int x, int y)
{
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
}
/**
* Determines whether this Rectangle contains a specified Point.
*
@ -199,9 +199,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public void Contains(Point value, boolean result)
{
result = (((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height));
result = (((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height));
}
/**
* Determines whether the specified Object is equal to the current instance.
*
@ -213,7 +213,7 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
{
return (obj != null && obj instanceof Rectangle) ? this.Equals((Rectangle)obj) : false;
}
/**
* Determines whether the specified Object is equal to the Rectangle.
*
@ -222,17 +222,17 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public boolean Equals(Rectangle other)
{
return ((((this.X == other.X) && (this.Y == other.Y)) && (this.Width == other.Width)) && (this.Height == other.Height));
return ((((this.X == other.X) && (this.Y == other.Y)) && (this.Width == other.Width)) && (this.Height == other.Height));
}
/**
* Gets the hash code for this object.
*/
public int GetHashCode()
{
return (this.X ^ this.Y ^ this.Width ^ this.Height);
return (this.X ^ this.Y ^ this.Width ^ this.Height);
}
/**
* Pushes the edges of the Rectangle out by the horizontal and vertical values specified.
*
@ -244,12 +244,12 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public void Inflate(int horizontalAmount, int verticalAmount)
{
this.X -= horizontalAmount;
this.Y -= verticalAmount;
this.Width += horizontalAmount * 2;
this.Height += verticalAmount * 2;
this.X -= horizontalAmount;
this.Y -= verticalAmount;
this.Width += horizontalAmount * 2;
this.Height += verticalAmount * 2;
}
/**
* Creates a Rectangle defining the area where one rectangle overlaps with another rectangle.
*
@ -264,30 +264,30 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public static Rectangle Intersect(Rectangle value1, Rectangle value2)
{
Rectangle rectangle = Rectangle.Empty;
int num8 = value1.X + value1.Width;
int num7 = value2.X + value2.Width;
int num6 = value1.Y + value1.Height;
int num5 = value2.Y + value2.Height;
int num2 = (value1.X > value2.X) ? value1.X : value2.X;
int num = (value1.Y > value2.Y) ? value1.Y : value2.Y;
int num4 = (num8 < num7) ? num8 : num7;
int num3 = (num6 < num5) ? num6 : num5;
if ((num4 > num2) && (num3 > num))
{
rectangle.X = num2;
rectangle.Y = num;
rectangle.Width = num4 - num2;
rectangle.Height = num3 - num;
return rectangle;
}
rectangle.X = 0;
rectangle.Y = 0;
rectangle.Width = 0;
rectangle.Height = 0;
return rectangle;
Rectangle rectangle = Rectangle.Empty;
int num8 = value1.X + value1.Width;
int num7 = value2.X + value2.Width;
int num6 = value1.Y + value1.Height;
int num5 = value2.Y + value2.Height;
int num2 = (value1.X > value2.X) ? value1.X : value2.X;
int num = (value1.Y > value2.Y) ? value1.Y : value2.Y;
int num4 = (num8 < num7) ? num8 : num7;
int num3 = (num6 < num5) ? num6 : num5;
if ((num4 > num2) && (num3 > num))
{
rectangle.X = num2;
rectangle.Y = num;
rectangle.Width = num4 - num2;
rectangle.Height = num3 - num;
return rectangle;
}
rectangle.X = 0;
rectangle.Y = 0;
rectangle.Width = 0;
rectangle.Height = 0;
return rectangle;
}
/**
* Creates a Rectangle defining the area where one rectangle overlaps with another rectangle.
*
@ -302,30 +302,30 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public static void Intersect(Rectangle value1, Rectangle value2, Rectangle result)
{
int num8 = value1.X + value1.Width;
int num7 = value2.X + value2.Width;
int num6 = value1.Y + value1.Height;
int num5 = value2.Y + value2.Height;
int num2 = (value1.X > value2.X) ? value1.X : value2.X;
int num = (value1.Y > value2.Y) ? value1.Y : value2.Y;
int num4 = (num8 < num7) ? num8 : num7;
int num3 = (num6 < num5) ? num6 : num5;
if ((num4 > num2) && (num3 > num))
{
result.X = num2;
result.Y = num;
result.Width = num4 - num2;
result.Height = num3 - num;
}
else
{
result.X = 0;
result.Y = 0;
result.Width = 0;
result.Height = 0;
}
int num8 = value1.X + value1.Width;
int num7 = value2.X + value2.Width;
int num6 = value1.Y + value1.Height;
int num5 = value2.Y + value2.Height;
int num2 = (value1.X > value2.X) ? value1.X : value2.X;
int num = (value1.Y > value2.Y) ? value1.Y : value2.Y;
int num4 = (num8 < num7) ? num8 : num7;
int num3 = (num6 < num5) ? num6 : num5;
if ((num4 > num2) && (num3 > num))
{
result.X = num2;
result.Y = num;
result.Width = num4 - num2;
result.Height = num3 - num;
}
else
{
result.X = 0;
result.Y = 0;
result.Width = 0;
result.Height = 0;
}
}
/**
* Determines whether a specified Rectangle intersects with this Rectangle.
*
@ -337,9 +337,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public boolean Intersects(Rectangle value)
{
return ((((value.X < (this.X + this.Width)) && (this.X < (value.X + value.Width))) && (value.Y < (this.Y + this.Height))) && (this.Y < (value.Y + value.Height)));
return ((((value.X < (this.X + this.Width)) && (this.X < (value.X + value.Width))) && (value.Y < (this.Y + this.Height))) && (this.Y < (value.Y + value.Height)));
}
/**
* Determines whether a specified Rectangle intersects with this Rectangle.
*
@ -351,9 +351,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public void Intersects(Rectangle value, boolean result)
{
result = (((value.X < (this.X + this.Width)) && (this.X < (value.X + value.Width))) && (value.Y < (this.Y + this.Height))) && (this.Y < (value.Y + value.Height));
result = (((value.X < (this.X + this.Width)) && (this.X < (value.X + value.Width))) && (value.Y < (this.Y + this.Height))) && (this.Y < (value.Y + value.Height));
}
/**
* Changes the position of the Rectangle.
*
@ -362,10 +362,10 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public void Offset(Point amount)
{
this.X += amount.X;
this.Y += amount.Y;
this.X += amount.X;
this.Y += amount.Y;
}
/**
* Changes the position of the Rectangle.
*
@ -377,10 +377,10 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public void Offset(int offsetX, int offsetY)
{
this.X += offsetX;
this.Y += offsetY;
this.X += offsetX;
this.Y += offsetY;
}
/**
* Retrieves a string representation of the current object.
*
@ -389,9 +389,9 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public String toString()
{
return String.format(Locale.getDefault(), "{{X:%i Y:%i Width:%i Height:%i}}", this.X, this.Y, this.Width, this.Height);
return String.format(Locale.getDefault(), "{{X:%i Y:%i Width:%i Height:%i}}", this.X, this.Y, this.Width, this.Height);
}
/**
* Creates a new Rectangle that exactly contains two other rectangles.
*
@ -403,22 +403,22 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public static Rectangle Union(Rectangle value1, Rectangle value2)
{
Rectangle rectangle = Rectangle.Empty;
int num6 = value1.X + value1.Width;
int num5 = value2.X + value2.Width;
int num4 = value1.Y + value1.Height;
int num3 = value2.Y + value2.Height;
int num2 = (value1.X < value2.X) ? value1.X : value2.X;
int num = (value1.Y < value2.Y) ? value1.Y : value2.Y;
int num8 = (num6 > num5) ? num6 : num5;
int num7 = (num4 > num3) ? num4 : num3;
rectangle.X = num2;
rectangle.Y = num;
rectangle.Width = num8 - num2;
rectangle.Height = num7 - num;
return rectangle;
Rectangle rectangle = Rectangle.Empty;
int num6 = value1.X + value1.Width;
int num5 = value2.X + value2.Width;
int num4 = value1.Y + value1.Height;
int num3 = value2.Y + value2.Height;
int num2 = (value1.X < value2.X) ? value1.X : value2.X;
int num = (value1.Y < value2.Y) ? value1.Y : value2.Y;
int num8 = (num6 > num5) ? num6 : num5;
int num7 = (num4 > num3) ? num4 : num3;
rectangle.X = num2;
rectangle.Y = num;
rectangle.Width = num8 - num2;
rectangle.Height = num7 - num;
return rectangle;
}
/**
* Creates a new Rectangle that exactly contains two other rectangles.
*
@ -433,17 +433,17 @@ public final class Rectangle extends ValueType implements IEquatable<Rectangle>
*/
public static void Union(Rectangle value1, Rectangle value2, Rectangle result)
{
int num6 = value1.X + value1.Width;
int num5 = value2.X + value2.Width;
int num4 = value1.Y + value1.Height;
int num3 = value2.Y + value2.Height;
int num2 = (value1.X < value2.X) ? value1.X : value2.X;
int num = (value1.Y < value2.Y) ? value1.Y : value2.Y;
int num8 = (num6 > num5) ? num6 : num5;
int num7 = (num4 > num3) ? num4 : num3;
result.X = num2;
result.Y = num;
result.Width = num8 - num2;
result.Height = num7 - num;
int num6 = value1.X + value1.Width;
int num5 = value2.X + value2.Width;
int num4 = value1.Y + value1.Height;
int num3 = value2.Y + value2.Height;
int num2 = (value1.X < value2.X) ? value1.X : value2.X;
int num = (value1.Y < value2.Y) ? value1.Y : value2.Y;
int num8 = (num6 > num5) ? num6 : num5;
int num7 = (num4 > num3) ? num4 : num3;
result.X = num2;
result.Y = num;
result.Width = num8 - num2;
result.Height = num7 - num;
}
}

View File

@ -148,7 +148,8 @@ public class TitleContainer
{
if (exception instanceof java.io.FileNotFoundException)
{
throw new FileNotFoundException("", "name", exception);
// TODO: error message
throw new FileNotFoundException("", name, exception);
}
}

View File

@ -19,6 +19,26 @@ public class Uri
{
throw new NotImplementedException();
}
/**
* This instance represents a relative URI, and this property is valid only for absolute URIs.
*
* @return
* A boolean value that is true if the System.Uri is a file URI; otherwise, false.
*
* @exception System.InvalidOperationException
* This instance represents a relative URI, and this property is valid only for absolute URIs.
*/
public boolean IsFile()
{
if (!this.IsAbsoluteUri())
{
// TODO: error message
throw new InvalidOperationException();
}
throw new NotImplementedException();
}
/**
* Gets the original URI string that was passed to the System.Uri constructor.
@ -35,37 +55,80 @@ public class Uri
{
throw new InvalidOperationException("");
}
return uriString;
}
/**
*
*
* @param uriString
*/
public Uri(String uriString)
{
this.uriString = uriString;
}
/**
*
*
* @param uriString
* @param dontEscape
*/
public Uri(String uriString, boolean dontEscape)
{
this.uriString = uriString;
}
public Uri(String uriString, UriKind uriKind)
{
}
public Uri(Uri baseUri, String relativeUri)
{
}
public Uri(Uri baseUri, String relativeUri, boolean dontEscape)
{
}
public Uri(Uri baseUri, Uri relativeUri)
{
}
protected void Canonicalize()
{
throw new NotImplementedException();
}
protected void CheckSecurity()
{
throw new NotImplementedException();
}
public static UriHostNameType CheckHostName(String name)
{
throw new NotImplementedException();
}
public static boolean CheckSchemeName(String schemeName)
{
throw new NotImplementedException();
}
/**
* Gets a canonical string representation for the specified System.Uri instance.
*
* @return
* A java.lang.String instance that contains the unescaped canonical representation of the System.Uri instance. All characters are unescaped except #, ?, and %.
*/
@Override
public String toString()
{
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,22 @@
package System;
/**
* Controls how URI information is escaped.
*
* @author Halofreak1990
*/
public enum UriFormat
{
/**
* Escaping is performed according to the rules in RFC 2396.
*/
UriEscaped,
/**
* No escaping is performed.
*/
Unescaped,
/**
* Characters that have a reserved meaning in the requested URI components remain escaped. All others are not escaped. See Remarks.
*/
SafeUnescaped
}

View File

@ -0,0 +1,43 @@
package System;
/**
* The exception that is thrown when an invalid Uniform Resource Identifier (URI) is detected.
*
* @author Halofreak1990
*/
public class UriFormatException extends FormatException
{
private static final long serialVersionUID = 3724278989095091838L;
/**
* Initializes a new instance of the System.UriFormatException class.
*/
public UriFormatException()
{
}
/**
* Initializes a new instance of the System.UriFormatException class with the specified message.
*
* @param textString
* The error message string.
*/
public UriFormatException(String textString)
{
super(textString);
}
/**
* Initializes a new instance of the System.UriFormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.
*
* @param textString
* The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
*
* @param e
* The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.
*/
public UriFormatException(String textString, RuntimeException e)
{
super(textString, e);
}
}

View File

@ -0,0 +1,30 @@
package System;
/**
* Defines host name types for the System.Uri.CheckHostName(System.String) method.
*
* @author Halofreak1990
*/
public enum UriHostNameType
{
/**
* The type of the host name is not supplied.
*/
Unknown,
/**
* The host is set, but the type cannot be determined.
*/
Basic,
/**
* The host name is a domain name system (DNS) style host name.
*/
Dns,
/**
* The host name is an Internet Protocol (IP) version 4 host address.
*/
IPv4,
/**
* The host name is an Internet Protocol (IP) version 6 host address.
*/
IPv6
}