001 package org.nakedobjects.applib.value;
002
003 import java.io.Serializable;
004
005 import org.nakedobjects.applib.annotation.Value;
006
007
008 /**
009 * Represents an image.
010 */
011 @Value(semanticsProviderName = "org.nakedobjects.metamodel.value.ImageValueSemanticsProvider")
012 public class Image implements Serializable {
013 private static final long serialVersionUID = 1L;
014 private final int[][] image;
015
016 public Image(final int[][] image) {
017 this.image = image;
018 }
019
020 public Object getValue() {
021 return image;
022 }
023
024 @Override
025 public String toString() {
026 final int height = getHeight();
027 return "Image [size=" + height + "x" + (height == 0 || image[0] == null ? 0 : image[0].length) + "]";
028 }
029
030 public int[][] getImage() {
031 return image;
032 }
033
034 public int getHeight() {
035 return image == null ? 0 : image.length;
036 }
037
038 public int getWidth() {
039 return image == null ? 0 : image[0].length;
040 }
041 }
042 // Copyright (c) Naked Objects Group Ltd.