Added missing project files

Updated whitespace
This commit is contained in:
Tom Lint 2014-01-10 13:58:21 +01:00
parent 309f7d2a3a
commit a1dc59f2ba
10 changed files with 236 additions and 153 deletions

17
JavaXNA Test/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JavaXNA Test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Microsoft.Xna.Framework.Game</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Microsoft.Xna.Framework</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -10,44 +10,45 @@ import System.*;
public final class Album implements IEquatable<Album>, IDisposable public final class Album implements IEquatable<Album>, IDisposable
{ {
private Artist artist; private Artist artist;
private TimeSpan duration; private TimeSpan duration;
static Album Empty; static Album Empty;
private Genre genre; private Genre genre;
//private uint handle; //private uint handle;
private boolean hasArt; private boolean hasArt;
private int hashcode; private int hashcode;
private boolean isDisposed; private boolean isDisposed;
private String name; private String name;
private SongCollection songs; 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) Album(uint handle)
{ {
@ -57,30 +58,32 @@ public final class Album implements IEquatable<Album>, IDisposable
this.songs = SongCollection.Empty; this.songs = SongCollection.Empty;
this.duration = TimeSpan.Zero; this.duration = TimeSpan.Zero;
}*/ }*/
/** /**
* Immediately releases the unmanaged resources used by this object. * Immediately releases the unmanaged resources used by this object.
*/ */
@Override @Override
public void Dispose() public void Dispose()
{ {
this.Dispose(true); this.Dispose(true);
} }
private void Dispose(boolean disposing) private void Dispose(boolean disposing)
{ {
if (!isDisposed) if (!isDisposed)
{ {
this.isDisposed = true; this.isDisposed = true;
// TODO: implement // TODO: implement
if (false) if (false)
{ {
} }
songs = SongCollection.Empty; songs = SongCollection.Empty;
} }
} }
/** /**
* Determines whether the specified Object is equal to this Album. * Determines whether the specified Object is equal to this Album.
* *
@ -105,12 +108,12 @@ public final class Album implements IEquatable<Album>, IDisposable
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
protected void finalize() protected void finalize()
{ {
this.Dispose(false); this.Dispose(false);
} }
/** /**
* Gets the hash code for this instance. * Gets the hash code for this instance.
*/ */
@ -118,19 +121,21 @@ public final class Album implements IEquatable<Album>, IDisposable
public int hashCode() public int hashCode()
{ {
ThrowIfDisposed(); ThrowIfDisposed();
if (this.hashcode == -1) if (this.hashcode == -1)
{ {
this.hashcode = this.name.hashCode(); this.hashcode = this.name.hashCode();
} }
return this.hashcode; return this.hashcode;
} }
private void ThrowIfDisposed() private void ThrowIfDisposed()
{ {
if (this.isDisposed) 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. * Returns a String representation of this Album.
*/ */

View File

@ -10,57 +10,57 @@ import System.*;
public final class Artist implements IEquatable<Artist>, IDisposable public final class Artist implements IEquatable<Artist>, IDisposable
{ {
private AlbumCollection albums; private AlbumCollection albums;
static Artist Empty; static Artist Empty;
//private uint handle; //private uint handle;
private int hashcode; private int hashcode;
private boolean isDisposed; private boolean isDisposed;
private String name; private String name;
private SongCollection songs; 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 @Override
public void Dispose() public void Dispose()
{ {
@ -112,13 +112,15 @@ public final class Artist implements IEquatable<Artist>, IDisposable
} }
return this.hashcode; return this.hashcode;
} }
private void ThrowIfDisposed() private void ThrowIfDisposed()
{ {
if (this.isDisposed) 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. * Returns a String representation of the Artist.
*/ */
@ -128,7 +130,7 @@ public final class Artist implements IEquatable<Artist>, IDisposable
ThrowIfDisposed(); ThrowIfDisposed();
return this.name; return this.name;
} }
static static
{ {
Empty = new Artist(); Empty = new Artist();

View File

@ -12,44 +12,50 @@ public class MediaPlayer
private static boolean repeat; private static boolean repeat;
private static boolean shuffle; private static boolean shuffle;
private static MediaQueue queue; 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. * 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<EventArgs> ActiveSongChanged = new Event<EventArgs>(); public static final Event<EventArgs> ActiveSongChanged = new Event<EventArgs>();
/** /**
* Raised when the media player play state changes. * Raised when the media player play state changes.
*/ */
public static final Event<EventArgs> MediaStateChanged = new Event<EventArgs>(); public static final Event<EventArgs> MediaStateChanged = new Event<EventArgs>();
/** /**
* *
*/ */
public static void MoveNext() public static void MoveNext()
{ {
if (!ActiveSongChanged.getHandlers().isEmpty()) if (!ActiveSongChanged.hasHandlers())
{
ActiveSongChanged.raise(null, EventArgs.Empty); ActiveSongChanged.raise(null, EventArgs.Empty);
}
} }
/** /**
* *
*/ */
public static void MovePrevious() public static void MovePrevious()
{ {
if (!ActiveSongChanged.getHandlers().isEmpty()) if (!ActiveSongChanged.hasHandlers())
{
ActiveSongChanged.raise(null, EventArgs.Empty); ActiveSongChanged.raise(null, EventArgs.Empty);
}
} }
/** /**
* *
*/ */
public static void Pause() public static void Pause()
{ {
if (!MediaStateChanged.getHandlers().isEmpty()) if (!MediaStateChanged.hasHandlers())
{
MediaStateChanged.raise(null, EventArgs.Empty); MediaStateChanged.raise(null, EventArgs.Empty);
}
} }
/** /**
* *
* @param song * @param song
@ -58,7 +64,7 @@ public class MediaPlayer
{ {
} }
/** /**
* *
* @param songs * @param songs
@ -67,7 +73,7 @@ public class MediaPlayer
{ {
} }
/** /**
* *
* @param songs * @param songs
@ -77,25 +83,29 @@ public class MediaPlayer
{ {
} }
/** /**
* *
*/ */
public static void Resume() public static void Resume()
{ {
if (!MediaStateChanged.getHandlers().isEmpty()) if (!MediaStateChanged.hasHandlers())
{
MediaStateChanged.raise(null, EventArgs.Empty); MediaStateChanged.raise(null, EventArgs.Empty);
}
} }
/** /**
* *
*/ */
public static void Stop() public static void Stop()
{ {
if (!MediaStateChanged.getHandlers().isEmpty()) if (!MediaStateChanged.hasHandlers())
{
MediaStateChanged.raise(null, EventArgs.Empty); MediaStateChanged.raise(null, EventArgs.Empty);
}
} }
static static
{ {
repeat = false; repeat = false;

View File

@ -11,21 +11,21 @@ public final class MediaQueue
{ {
} }
public int getActiveSongIndex() public int getActiveSongIndex()
{ {
} }
public int Count() public int Count()
{ {
} }
MediaQueue() MediaQueue()
{ {
} }
public Song get(int index) public Song get(int index)
{ {

View File

@ -10,13 +10,13 @@ public enum MediaState
/** /**
* Media playback is stopped. * Media playback is stopped.
*/ */
Stopped, Stopped,
/** /**
* Media is currently playing. * Media is currently playing.
*/ */
Playing, Playing,
/** /**
* Media playback is paused. * Media playback is paused.
*/ */
Paused Paused
} }

View File

@ -17,23 +17,23 @@ public final class Song implements IEquatable<Song>, IDisposable
{ {
} }
Song(String name, String fileName, int duration) Song(String name, String fileName, int duration)
{ {
} }
private void Dispose(boolean disposing)
{
}
@Override @Override
public void Dispose() public void Dispose()
{ {
this.Dispose(true); this.Dispose(true);
} }
private void Dispose(boolean disposing)
{
}
/** /**
* *
*/ */
@ -42,14 +42,14 @@ public final class Song implements IEquatable<Song>, IDisposable
{ {
return (obj instanceof Song) ? Equals((Song)obj) : false; return (obj instanceof Song) ? Equals((Song)obj) : false;
} }
@Override @Override
public boolean Equals(Song other) public boolean Equals(Song other)
{ {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
/** /**
* *
*/ */
@ -57,7 +57,7 @@ public final class Song implements IEquatable<Song>, IDisposable
{ {
this.Dispose(false); this.Dispose(false);
} }
/** /**
* *
* @param name * @param name
@ -68,7 +68,7 @@ public final class Song implements IEquatable<Song>, IDisposable
{ {
} }
/** /**
* *
* @return * @return
@ -78,13 +78,15 @@ public final class Song implements IEquatable<Song>, IDisposable
{ {
} }
private void ThrowIfDisposed() private void ThrowIfDisposed()
{ {
if (this.isDisposed) if (this.isDisposed)
{
throw new ObjectDisposedException(this.toString(), "This object has already been disposed."); throw new ObjectDisposedException(this.toString(), "This object has already been disposed.");
}
} }
@Override @Override
public String toString() public String toString()
{ {

View File

@ -191,48 +191,55 @@ public abstract class KeyedCollection<TKey, TItem> extends Collection<TItem>
} }
} }
} }
return false; return false;
} }
private boolean ContainsItem(TItem item) private boolean ContainsItem(TItem item)
{ {
TKey local; TKey local;
TItem local2; TItem local2;
if ((this.dict != null) || ((local = this.GetKeyForItem(item)) != null)) if ((this.dict != null) || ((local = this.GetKeyForItem(item)) != null))
{ {
return super.getItems().contains(item); return super.getItems().contains(item);
} }
throw new NotImplementedException(); throw new NotImplementedException();
} }
private void CreateDictionary() private void CreateDictionary()
{ {
this.dict = new HashMap<TKey, TItem>(); this.dict = new HashMap<TKey, TItem>();
} }
protected abstract TKey GetKeyForItem(TItem item); protected abstract TKey GetKeyForItem(TItem item);
@Override @Override
protected void InsertItem(int index, TItem item) protected void InsertItem(int index, TItem item)
{ {
TKey keyForItem = this.GetKeyForItem(item); TKey keyForItem = this.GetKeyForItem(item);
if (keyForItem != null) if (keyForItem != null)
{ {
this.AddKey(keyForItem, item); this.AddKey(keyForItem, item);
} }
super.InsertItem(index, item); super.InsertItem(index, item);
} }
public boolean Remove(TKey key) public boolean Remove(TKey key)
{ {
if (key == null) if (key == null)
{ {
throw new ArgumentNullException("key"); throw new ArgumentNullException("key");
} }
if (this.dict != null) if (this.dict != null)
{ {
return (this.dict.containsKey(key) && super.Remove(this.dict.get(key))); return (this.dict.containsKey(key) && super.Remove(this.dict.get(key)));
} }
if (key != null) if (key != null)
{ {
for (int i = 0; i < super.getItems().size(); i++) for (int i = 0; i < super.getItems().size(); i++)
@ -244,20 +251,23 @@ public abstract class KeyedCollection<TKey, TItem> extends Collection<TItem>
} }
} }
} }
return false; return false;
} }
@Override @Override
protected void RemoveItem(int index) protected void RemoveItem(int index)
{ {
TKey keyForItem = this.GetKeyForItem(super.getItems().get(index)); TKey keyForItem = this.GetKeyForItem(super.getItems().get(index));
if (keyForItem != null) if (keyForItem != null)
{ {
this.RemoveKey(keyForItem); this.RemoveKey(keyForItem);
} }
super.RemoveItem(index); super.RemoveItem(index);
} }
private void RemoveKey(TKey key) private void RemoveKey(TKey key)
{ {
if (this.dict != null) if (this.dict != null)
@ -269,12 +279,13 @@ public abstract class KeyedCollection<TKey, TItem> extends Collection<TItem>
this.keyCount--; this.keyCount--;
} }
} }
@Override @Override
protected void SetItem(int index, TItem item) protected void SetItem(int index, TItem item)
{ {
TKey keyForItem = this.GetKeyForItem(item); TKey keyForItem = this.GetKeyForItem(item);
TKey x = this.GetKeyForItem(super.getItems().get(index)); TKey x = this.GetKeyForItem(super.getItems().get(index));
if (this.comparer.equals(x, keyForItem)) if (this.comparer.equals(x, keyForItem))
{ {
if ((keyForItem != null) && (this.dict != null)) if ((keyForItem != null) && (this.dict != null))
@ -288,11 +299,13 @@ public abstract class KeyedCollection<TKey, TItem> extends Collection<TItem>
{ {
this.AddKey(keyForItem, item); this.AddKey(keyForItem, item);
} }
if (x != null) if (x != null)
{ {
this.RemoveKey(x); this.RemoveKey(x);
} }
} }
super.SetItem(index, item); super.SetItem(index, item);
} }
} }