Skip to content

Commit

Permalink
Fixed issue #123: sort device profiles alphabetically.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Willem Janssen committed Jan 26, 2013
1 parent 4ba27d0 commit 723ed58
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -32,7 +32,7 @@
/**
* Provides a device profile.
*/
public final class DeviceProfile implements Cloneable
public final class DeviceProfile implements Cloneable, Comparable<DeviceProfile>
{
// INNER TYPES

Expand Down Expand Up @@ -205,6 +205,21 @@ public DeviceProfile clone()
}
}

/**
* {@inheritDoc}
*/
@Override
public int compareTo( DeviceProfile aProfile )
{
// Issue #123: allow device profiles to be sorted alphabetically...
int result = getDescription().compareTo( aProfile.getDescription() );
if ( result == 0 )
{
result = getType().compareTo( aProfile.getType() );
}
return result;
}

/**
* {@inheritDoc}
*/
Expand Down
Expand Up @@ -157,6 +157,8 @@ public List<DeviceProfile> getProfiles()
{
List<DeviceProfile> result = new ArrayList<DeviceProfile>();
result.addAll( this.profiles.values() );
// Issue #123: sort device profiles alphabetically...
Collections.sort( result );
return result;
}

Expand Down

0 comments on commit 723ed58

Please sign in to comment.