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