1 package io.github.robertograham.rleparser.domain; 2 3 import java.util.Objects; 4 5 public class MetaData { 6 7 private final int width; 8 private final int height; 9 private final String rule; 10 11 public MetaData(int width, int height, String rule) { 12 this.width = width; 13 this.height = height; 14 this.rule = rule; 15 } 16 17 public int getWidth() { 18 return width; 19 } 20 21 public int getHeight() { 22 return height; 23 } 24 25 public String getRule() { 26 return rule; 27 } 28 29 @Override 30 public String toString() { 31 return "MetaData{" + 32 "x=" + width + 33 ", y=" + height + 34 ", rule='" + rule + '\'' + 35 '}'; 36 } 37 38 @Override 39 public boolean equals(Object object) { 40 if (this == object) 41 return true; 42 43 if (!(object instanceof MetaData)) 44 return false; 45 46 MetaData metaData = (MetaData) object; 47 48 return width == metaData.width && 49 height == metaData.height && 50 Objects.equals(rule, metaData.rule); 51 } 52 53 @Override 54 public int hashCode() { 55 return Objects.hash(width, height, rule); 56 } 57 }