Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Added isNormal() method to Device interface and updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
royclarkson committed Apr 20, 2012
1 parent 429bf79 commit 7cff3ca
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 95 deletions.
Expand Up @@ -23,6 +23,11 @@
* @author Scott Rossillo
*/
public interface Device {

/**
* True if this device is not a mobile or tablet device.
*/
boolean isNormal();

/**
* True if this device is a mobile device such as an Apple iPhone or an Nexus One Android.
Expand Down
Expand Up @@ -27,12 +27,12 @@ public enum DeviceType {
NORMAL,

/**
* Represents a mobile sized device, such as an iPhone
* Represents a mobile device, such as an iPhone
*/
MOBILE,

/**
* Represents a tablet sized device, such as an iPad
* Represents a tablet device, such as an iPad
*/
TABLET
}
Expand Up @@ -29,15 +29,23 @@ class LiteDevice implements Device {
public static final LiteDevice TABLET_INSTANCE = new LiteDevice(DeviceType.TABLET);

public static final LiteDevice NORMAL_INSTANCE = new LiteDevice(DeviceType.NORMAL);

public boolean isNormal() {
return this.deviceType == DeviceType.NORMAL;
}

public boolean isMobile() {
return deviceType == DeviceType.MOBILE;
return this.deviceType == DeviceType.MOBILE;
}

public boolean isTablet() {
return deviceType == DeviceType.TABLET;
return this.deviceType == DeviceType.TABLET;
}

public DeviceType getDeviceType() {
return this.deviceType;
}

public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[LiteDevice ");
Expand Down

0 comments on commit 7cff3ca

Please sign in to comment.