From 9335b2e748e1a4d54f459cdac094d2bbf85fffb6 Mon Sep 17 00:00:00 2001 From: Tom Lint Date: Mon, 3 Feb 2014 21:13:29 +0100 Subject: [PATCH] Added preliminary Uri class Added method stubs for Media classes --- .../Microsoft/Xna/Framework/Media/Album.java | 6 +- .../Xna/Framework/Media/AlbumCollection.java | 12 ++-- .../Microsoft/Xna/Framework/Media/Genre.java | 53 ++++++++++++-- .../Xna/Framework/Media/MediaQueue.java | 12 ++-- .../Microsoft/Xna/Framework/Media/Song.java | 20 ++++-- .../Xna/Framework/Media/SongCollection.java | 13 ++-- Microsoft.Xna.Framework/src/System/Uri.java | 71 +++++++++++++++++++ .../src/System/UriKind.java | 23 ++++++ 8 files changed, 182 insertions(+), 28 deletions(-) create mode 100644 Microsoft.Xna.Framework/src/System/Uri.java create mode 100644 Microsoft.Xna.Framework/src/System/UriKind.java diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Album.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Album.java index 37daea2..6ac4035 100644 --- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Album.java +++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Album.java @@ -95,7 +95,7 @@ public final class Album implements IEquatable, IDisposable { return (obj instanceof Album) ? (this == (Album)obj) : false; } - + /** * Determines whether the specified Album is equal to this Album. * @@ -133,7 +133,9 @@ public final class Album implements IEquatable, IDisposable private void ThrowIfDisposed() { if (this.isDisposed) - throw new ObjectDisposedException(super.toString(), "This object has already been disposed."); + { + throw new ObjectDisposedException(this.getClass().toString(), "This object has already been disposed."); + } } /** diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/AlbumCollection.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/AlbumCollection.java index b8b5313..07aeff4 100644 --- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/AlbumCollection.java +++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/AlbumCollection.java @@ -2,6 +2,8 @@ package Microsoft.Xna.Framework.Media; import java.util.Iterator; +import System.*; + /** * * @@ -15,27 +17,25 @@ public final class AlbumCollection implements Iterable @Override public Iterator iterator() { - // TODO Auto-generated method stub - return null; + throw new NotImplementedException(); } protected void finalize() { - } public int Count() { - + throw new NotImplementedException(); } public boolean IsDisposed() { - + throw new NotImplementedException(); } public Album get(int index) { - + throw new NotImplementedException(); } } diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Genre.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Genre.java index e16a1a6..cdf75e4 100644 --- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Genre.java +++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Genre.java @@ -3,23 +3,63 @@ package Microsoft.Xna.Framework.Media; import System.*; /** + * Provides access to genre information in the media library. * * @author Halofreak1990 */ public final class Genre implements IEquatable, IDisposable { /** - * + * Gets the AlbumCollection for the Genre. + */ + public AlbumCollection getAlbums() + { + throw new NotImplementedException(); + } + + /** + * Gets a value indicating whether the object is disposed. + */ + public boolean IsDisposed() + { + throw new NotImplementedException(); + } + + /** + * Gets the name of the Genre. + */ + public String getName() + { + throw new NotImplementedException(); + } + + /** + * Gets the SongCollection for the Genre. + */ + public SongCollection getSongs() + { + throw new NotImplementedException(); + } + + protected void finalize() + { + // TODO: implement + } + + /** + * Immediately releases the unmanaged resources used by this object. */ @Override public void Dispose() { // TODO Auto-generated method stub - } /** + * Determines whether the specified Genre is equal to this Genre. * + * @param other + * The Genre to compare with this instance. */ @Override public boolean Equals(Genre other) @@ -27,9 +67,12 @@ public final class Genre implements IEquatable, IDisposable // TODO Auto-generated method stub return false; } - + /** + * Determines whether the specified Object is equal to this Genre. * + * @param obj + * The Object to compare with this instance. */ public boolean equals(Object obj) { @@ -37,10 +80,10 @@ public final class Genre implements IEquatable, IDisposable } /** - * + * Returns a String representation of the Genre. */ public String toString() { - + throw new NotImplementedException(); } } diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaQueue.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaQueue.java index 83062ec..604a861 100644 --- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaQueue.java +++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaQueue.java @@ -1,5 +1,7 @@ package Microsoft.Xna.Framework.Media; +import System.*; + /** * Provides methods and properties to access and control the queue of playing songs. * @@ -9,17 +11,17 @@ public final class MediaQueue { public Song getActiveSong() { - + throw new NotImplementedException(); } public int getActiveSongIndex() { - + throw new NotImplementedException(); } - public int Count() + public int getCount() { - + throw new NotImplementedException(); } MediaQueue() @@ -28,6 +30,6 @@ public final class MediaQueue public Song get(int index) { - + throw new NotImplementedException(); } } diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Song.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Song.java index 5049e97..ac29249 100644 --- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Song.java +++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Song.java @@ -35,6 +35,9 @@ public final class Song implements IEquatable, IDisposable } /** + * + * + * @param obj * */ @Override @@ -43,6 +46,12 @@ public final class Song implements IEquatable, IDisposable return (obj instanceof Song) ? Equals((Song)obj) : false; } + /** + * + * + * @param other + * + */ @Override public boolean Equals(Song other) { @@ -66,7 +75,7 @@ public final class Song implements IEquatable, IDisposable */ public static Song FromUri(String name, Uri uri) { - + throw new NotImplementedException(); } /** @@ -76,20 +85,23 @@ public final class Song implements IEquatable, IDisposable @Override public int hashCode() { - + throw new NotImplementedException(); } private void ThrowIfDisposed() { if (this.isDisposed) { - throw new ObjectDisposedException(this.toString(), "This object has already been disposed."); + throw new ObjectDisposedException(this.getClass().toString(), "This object has already been disposed."); } } + /** + * + */ @Override public String toString() { - + throw new NotImplementedException(); } } diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/SongCollection.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/SongCollection.java index 0fb3056..95c85c1 100644 --- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/SongCollection.java +++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/SongCollection.java @@ -2,6 +2,8 @@ package Microsoft.Xna.Framework.Media; import java.util.Iterator; +import System.*; + /** * * @@ -16,17 +18,16 @@ public final class SongCollection implements Iterable @Override public Iterator iterator() { - // TODO Auto-generated method stub - return null; + throw new NotImplementedException(); } /** * * @return */ - public int Count() + public int getCount() { - + throw new NotImplementedException(); } /** @@ -35,7 +36,7 @@ public final class SongCollection implements Iterable */ public boolean IsDisposed() { - + throw new NotImplementedException(); } /** @@ -53,6 +54,6 @@ public final class SongCollection implements Iterable */ public Song get(int index) { - + throw new NotImplementedException(); } } diff --git a/Microsoft.Xna.Framework/src/System/Uri.java b/Microsoft.Xna.Framework/src/System/Uri.java new file mode 100644 index 0000000..1143238 --- /dev/null +++ b/Microsoft.Xna.Framework/src/System/Uri.java @@ -0,0 +1,71 @@ +package System; + +/** + * Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI. + * + * @author Halofreak1990 + */ +public class Uri +{ + private String uriString; + + /** + * Gets a value that indicates whether the System.Uri instance is absolute. + * + * @return + * A boolean value that is true if the System.Uri instance is absolute; otherwise, false. + */ + public boolean IsAbsoluteUri() + { + throw new NotImplementedException(); + } + + /** + * Gets the original URI string that was passed to the System.Uri constructor. + * + * @return + * A String containing the exact URI specified when this instance was constructed; otherwise, String.Empty. + * + * @exception System.InvalidOperationException + * This instance represents a relative URI, and this property is valid only for absolute URIs. + */ + public String getOriginalString() + { + if (!this.IsAbsoluteUri()) + { + throw new InvalidOperationException(""); + } + + return uriString; + } + + public Uri(String uriString) + { + this.uriString = uriString; + } + + 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) + { + + } +} diff --git a/Microsoft.Xna.Framework/src/System/UriKind.java b/Microsoft.Xna.Framework/src/System/UriKind.java new file mode 100644 index 0000000..58c9805 --- /dev/null +++ b/Microsoft.Xna.Framework/src/System/UriKind.java @@ -0,0 +1,23 @@ +package System; + +/** + * Defines the kinds of System.Uris for the System.Uri.IsWellFormedUriString(String,System.UriKind) and several Overload:System.Uri.#ctor methods. + * + * @author Halofreak1990 + * + */ +public enum UriKind +{ + /** + * The kind of the Uri is indeterminate. + */ + RelativeOrAbsolute, + /** + * The Uri is an absolute Uri. + */ + Absolute, + /** + * The Uri is a relative Uri. + */ + Relative +}