diff --git a/JavaXNA Test/.project b/JavaXNA Test/.project
new file mode 100644
index 0000000..837159b
--- /dev/null
+++ b/JavaXNA Test/.project
@@ -0,0 +1,17 @@
+
+
+ JavaXNA Test
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Microsoft.Xna.Framework.Game/.project b/Microsoft.Xna.Framework.Game/.project
new file mode 100644
index 0000000..fb89a0b
--- /dev/null
+++ b/Microsoft.Xna.Framework.Game/.project
@@ -0,0 +1,17 @@
+
+
+ Microsoft.Xna.Framework.Game
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Microsoft.Xna.Framework/.project b/Microsoft.Xna.Framework/.project
new file mode 100644
index 0000000..a6c676a
--- /dev/null
+++ b/Microsoft.Xna.Framework/.project
@@ -0,0 +1,17 @@
+
+
+ Microsoft.Xna.Framework
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
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 de22223..37daea2 100644
--- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Album.java
+++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Album.java
@@ -10,44 +10,45 @@ import System.*;
public final class Album implements IEquatable, IDisposable
{
private Artist artist;
- private TimeSpan duration;
- static Album Empty;
- private Genre genre;
- //private uint handle;
- private boolean hasArt;
- private int hashcode;
- private boolean isDisposed;
- private String name;
- private SongCollection songs;
+ private TimeSpan duration;
+ static Album Empty;
+ private Genre genre;
+ //private uint handle;
+ private boolean hasArt;
+ private int hashcode;
+ private boolean isDisposed;
+ private String name;
+ private SongCollection songs;
+
+ /**
+ *
+ * @return
+ */
+ public Artist getArtist()
+ {
+ if (this.artist == Artist.Empty)
+ {
+
+ }
+
+ return this.artist;
+ }
+
+ public boolean HasArt()
+ {
+ ThrowIfDisposed();
+ return this.hasArt;
+ }
+
+ private Album()
+ {
+ this.name = "";
+ this.artist = Artist.Empty;
+ this.genre = Genre.Empty;
+ this.songs = SongCollection.Empty;
+ this.duration = TimeSpan.Zero;
+ }
- /**
- *
- * @return
- */
- public Artist getArtist()
- {
- if (this.artist == Artist.Empty)
- {
-
- }
- return this.artist;
- }
-
- public boolean HasArt()
- {
- ThrowIfDisposed();
- return this.hasArt;
- }
-
- private Album()
- {
- this.name = "";
- this.artist = Artist.Empty;
- this.genre = Genre.Empty;
- this.songs = SongCollection.Empty;
- this.duration = TimeSpan.Zero;
- }
-
/*
Album(uint handle)
{
@@ -57,30 +58,32 @@ public final class Album implements IEquatable, IDisposable
this.songs = SongCollection.Empty;
this.duration = TimeSpan.Zero;
}*/
-
- /**
- * Immediately releases the unmanaged resources used by this object.
- */
+
+ /**
+ * Immediately releases the unmanaged resources used by this object.
+ */
@Override
public void Dispose()
{
this.Dispose(true);
}
-
+
private void Dispose(boolean disposing)
{
if (!isDisposed)
{
this.isDisposed = true;
// TODO: implement
+
if (false)
{
}
+
songs = SongCollection.Empty;
}
}
-
+
/**
* Determines whether the specified Object is equal to this Album.
*
@@ -105,12 +108,12 @@ public final class Album implements IEquatable, IDisposable
// TODO Auto-generated method stub
return false;
}
-
+
protected void finalize()
{
this.Dispose(false);
}
-
+
/**
* Gets the hash code for this instance.
*/
@@ -118,19 +121,21 @@ public final class Album implements IEquatable, IDisposable
public int hashCode()
{
ThrowIfDisposed();
+
if (this.hashcode == -1)
{
this.hashcode = this.name.hashCode();
}
+
return this.hashcode;
}
-
+
private void ThrowIfDisposed()
{
if (this.isDisposed)
- throw new ObjectDisposedException(super.toString(), "This object has already been disposed.");
+ throw new ObjectDisposedException(super.toString(), "This object has already been disposed.");
}
-
+
/**
* Returns a String representation of this Album.
*/
diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Artist.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Artist.java
index 2c7e65b..5b6a97a 100644
--- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Artist.java
+++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Artist.java
@@ -10,57 +10,57 @@ import System.*;
public final class Artist implements IEquatable, IDisposable
{
private AlbumCollection albums;
- static Artist Empty;
- //private uint handle;
- private int hashcode;
- private boolean isDisposed;
- private String name;
- private SongCollection songs;
+ static Artist Empty;
+ //private uint handle;
+ private int hashcode;
+ private boolean isDisposed;
+ private String name;
+ private SongCollection songs;
+
+ /**
+ * Gets a value indicating whether the object is disposed.
+ */
+ public boolean IsDisposed()
+ {
+ return this.isDisposed;
+ }
+
+ /**
+ * Gets the name of the Artist.
+ */
+ public String getName()
+ {
+ ThrowIfDisposed();
+ return this.name;
+ }
+
+ private Artist()
+ {
+ //this.handle = uint.MaxValue;
+ this.hashcode = -1;
+ this.name = "";
+ this.songs = SongCollection.Empty;
+ this.albums = AlbumCollection.Empty;
+ }
+
+ /*Artist(uint handle)
+ {
+ this.handle = uint.MaxValue;
+ this.hashcode = -1;
+ this.name = "";
+ this.songs = SongCollection.Empty;
+ this.albums = AlbumCollection.Empty;
+ this.handle = handle;
+ if (this.IsValidHandle)
+ {
+ StringBuilder sbName = new StringBuilder(260);
+ if (Helpers.Succeeded(UnsafeNativeMethods.MediaItem_GetName(handle, sbName, 260)))
+ {
+ this.name = sbName.ToString();
+ }
+ }
+ }*/
- /**
- * Gets a value indicating whether the object is disposed.
- */
- public boolean IsDisposed()
- {
- return this.isDisposed;
- }
-
- /**
- * Gets the name of the Artist.
- */
- public String getName()
- {
- ThrowIfDisposed();
- return this.name;
- }
-
- private Artist()
- {
- //this.handle = uint.MaxValue;
- this.hashcode = -1;
- this.name = "";
- this.songs = SongCollection.Empty;
- this.albums = AlbumCollection.Empty;
- }
-
- /*Artist(uint handle)
- {
- this.handle = uint.MaxValue;
- this.hashcode = -1;
- this.name = "";
- this.songs = SongCollection.Empty;
- this.albums = AlbumCollection.Empty;
- this.handle = handle;
- if (this.IsValidHandle)
- {
- StringBuilder sbName = new StringBuilder(260);
- if (Helpers.Succeeded(UnsafeNativeMethods.MediaItem_GetName(handle, sbName, 260)))
- {
- this.name = sbName.ToString();
- }
- }
- }*/
-
@Override
public void Dispose()
{
@@ -112,13 +112,15 @@ public final class Artist implements IEquatable, IDisposable
}
return this.hashcode;
}
-
+
private void ThrowIfDisposed()
{
if (this.isDisposed)
- throw new ObjectDisposedException(super.toString(), "This object has already been disposed.");
+ {
+ throw new ObjectDisposedException(super.toString(), "This object has already been disposed.");
+ }
}
-
+
/**
* Returns a String representation of the Artist.
*/
@@ -128,7 +130,7 @@ public final class Artist implements IEquatable, IDisposable
ThrowIfDisposed();
return this.name;
}
-
+
static
{
Empty = new Artist();
diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaPlayer.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaPlayer.java
index 4a8c89e..b5027f8 100644
--- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaPlayer.java
+++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaPlayer.java
@@ -12,44 +12,50 @@ public class MediaPlayer
private static boolean repeat;
private static boolean shuffle;
private static MediaQueue queue;
-
+
/**
* Raised when the active song changes due to active playback or due to explicit calls to the MoveNext or MovePrevious methods.
*/
public static final Event ActiveSongChanged = new Event();
-
+
/**
* Raised when the media player play state changes.
*/
public static final Event MediaStateChanged = new Event();
-
+
/**
*
*/
public static void MoveNext()
{
- if (!ActiveSongChanged.getHandlers().isEmpty())
+ if (!ActiveSongChanged.hasHandlers())
+ {
ActiveSongChanged.raise(null, EventArgs.Empty);
+ }
}
-
+
/**
*
*/
public static void MovePrevious()
{
- if (!ActiveSongChanged.getHandlers().isEmpty())
+ if (!ActiveSongChanged.hasHandlers())
+ {
ActiveSongChanged.raise(null, EventArgs.Empty);
+ }
}
-
+
/**
*
*/
public static void Pause()
{
- if (!MediaStateChanged.getHandlers().isEmpty())
+ if (!MediaStateChanged.hasHandlers())
+ {
MediaStateChanged.raise(null, EventArgs.Empty);
+ }
}
-
+
/**
*
* @param song
@@ -58,7 +64,7 @@ public class MediaPlayer
{
}
-
+
/**
*
* @param songs
@@ -67,7 +73,7 @@ public class MediaPlayer
{
}
-
+
/**
*
* @param songs
@@ -77,25 +83,29 @@ public class MediaPlayer
{
}
-
+
/**
*
*/
public static void Resume()
{
- if (!MediaStateChanged.getHandlers().isEmpty())
+ if (!MediaStateChanged.hasHandlers())
+ {
MediaStateChanged.raise(null, EventArgs.Empty);
+ }
}
-
+
/**
*
*/
public static void Stop()
{
- if (!MediaStateChanged.getHandlers().isEmpty())
+ if (!MediaStateChanged.hasHandlers())
+ {
MediaStateChanged.raise(null, EventArgs.Empty);
+ }
}
-
+
static
{
repeat = false;
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 fcb62de..83062ec 100644
--- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaQueue.java
+++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaQueue.java
@@ -11,21 +11,21 @@ public final class MediaQueue
{
}
-
+
public int getActiveSongIndex()
{
}
-
+
public int Count()
{
}
-
+
MediaQueue()
{
}
-
+
public Song get(int index)
{
diff --git a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaState.java b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaState.java
index b0b6654..4a2d7f0 100644
--- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaState.java
+++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/MediaState.java
@@ -10,13 +10,13 @@ public enum MediaState
/**
* Media playback is stopped.
*/
- Stopped,
- /**
- * Media is currently playing.
- */
- Playing,
- /**
- * Media playback is paused.
- */
- Paused
+ Stopped,
+ /**
+ * Media is currently playing.
+ */
+ Playing,
+ /**
+ * Media playback is paused.
+ */
+ Paused
}
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 8279d27..5049e97 100644
--- a/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Song.java
+++ b/Microsoft.Xna.Framework/src/Microsoft/Xna/Framework/Media/Song.java
@@ -17,23 +17,23 @@ public final class Song implements IEquatable, IDisposable
{
}
-
+
Song(String name, String fileName, int duration)
{
}
-
+
+ private void Dispose(boolean disposing)
+ {
+
+ }
+
@Override
public void Dispose()
{
this.Dispose(true);
}
-
- private void Dispose(boolean disposing)
- {
-
- }
-
+
/**
*
*/
@@ -42,14 +42,14 @@ public final class Song implements IEquatable, IDisposable
{
return (obj instanceof Song) ? Equals((Song)obj) : false;
}
-
+
@Override
public boolean Equals(Song other)
{
// TODO Auto-generated method stub
return false;
}
-
+
/**
*
*/
@@ -57,7 +57,7 @@ public final class Song implements IEquatable, IDisposable
{
this.Dispose(false);
}
-
+
/**
*
* @param name
@@ -68,7 +68,7 @@ public final class Song implements IEquatable, IDisposable
{
}
-
+
/**
*
* @return
@@ -78,13 +78,15 @@ public final class Song implements IEquatable, IDisposable
{
}
-
+
private void ThrowIfDisposed()
{
if (this.isDisposed)
+ {
throw new ObjectDisposedException(this.toString(), "This object has already been disposed.");
+ }
}
-
+
@Override
public String toString()
{
diff --git a/Microsoft.Xna.Framework/src/System/Collections/ObjectModel/KeyedCollection.java b/Microsoft.Xna.Framework/src/System/Collections/ObjectModel/KeyedCollection.java
index fdcf95c..eae6d3b 100644
--- a/Microsoft.Xna.Framework/src/System/Collections/ObjectModel/KeyedCollection.java
+++ b/Microsoft.Xna.Framework/src/System/Collections/ObjectModel/KeyedCollection.java
@@ -191,48 +191,55 @@ public abstract class KeyedCollection extends Collection
}
}
}
+
return false;
}
-
+
private boolean ContainsItem(TItem item)
{
TKey local;
TItem local2;
+
if ((this.dict != null) || ((local = this.GetKeyForItem(item)) != null))
{
return super.getItems().contains(item);
}
+
throw new NotImplementedException();
}
-
+
private void CreateDictionary()
{
this.dict = new HashMap();
}
-
+
protected abstract TKey GetKeyForItem(TItem item);
-
+
@Override
protected void InsertItem(int index, TItem item)
{
TKey keyForItem = this.GetKeyForItem(item);
+
if (keyForItem != null)
{
this.AddKey(keyForItem, item);
}
+
super.InsertItem(index, item);
}
-
+
public boolean Remove(TKey key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
+
if (this.dict != null)
{
return (this.dict.containsKey(key) && super.Remove(this.dict.get(key)));
}
+
if (key != null)
{
for (int i = 0; i < super.getItems().size(); i++)
@@ -244,20 +251,23 @@ public abstract class KeyedCollection extends Collection
}
}
}
+
return false;
}
-
+
@Override
protected void RemoveItem(int index)
{
TKey keyForItem = this.GetKeyForItem(super.getItems().get(index));
+
if (keyForItem != null)
{
this.RemoveKey(keyForItem);
}
+
super.RemoveItem(index);
}
-
+
private void RemoveKey(TKey key)
{
if (this.dict != null)
@@ -269,12 +279,13 @@ public abstract class KeyedCollection extends Collection
this.keyCount--;
}
}
-
+
@Override
protected void SetItem(int index, TItem item)
{
TKey keyForItem = this.GetKeyForItem(item);
TKey x = this.GetKeyForItem(super.getItems().get(index));
+
if (this.comparer.equals(x, keyForItem))
{
if ((keyForItem != null) && (this.dict != null))
@@ -288,11 +299,13 @@ public abstract class KeyedCollection extends Collection
{
this.AddKey(keyForItem, item);
}
+
if (x != null)
{
this.RemoveKey(x);
}
}
+
super.SetItem(index, item);
}
}