@Override public boolean equals(Object o) { return o == this || o instanceof PreparedEvent && equalTo((PreparedEvent) o); } }
@Override public boolean equals(Object o) { return o == this || o instanceof FinishedEvent && equalTo((FinishedEvent) o); }
@Override public boolean equals(Object o) { return o == this || o instanceof StartedEvent && equalTo((StartedEvent) o); } }
if (!name.equals(event.getName())) { throw new IllegalStateException(format( "Unexpected %s event with script name '%s' while awaiting completion", event.getKind(), event.getName())); switch (event.getKind()) { case PREPARED: case ERROR: ErrorEvent error = (ErrorEvent) event; throw new RoboticException(format("%s:%s", error.getSummary(), error.getDescription())); case FINISHED: FinishedEvent finished = (FinishedEvent) event; return new ScriptPair(finished.getExpectedScript(), finished.getObservedScript()); default: throw new IllegalArgumentException("Unrecognized event kind: " + event.getKind());
private ErrorEvent readErrorEvent() throws IOException { ErrorEvent error = new ErrorEvent(); String line; int length = 0; case 'n': if ("name".equals(headerName)) { error.setName(headerValue); error.setSummary(headerValue); error.setDescription(readContent(length));
private FinishedEvent readFinishedEvent() throws IOException { FinishedEvent finished = new FinishedEvent(); String line; int length = -1; case 'n': if ("name".equals(headerName)) { finished.setName(headerValue); finished.setExpectedScript(readContent(length)); finished.setObservedScript(readContent(length));
private StartedEvent readStartedEvent() throws IOException { StartedEvent started = new StartedEvent(); String line; do { line = textIn.readLine(); Matcher matcher = HEADER_PATTERN.matcher(line); if (matcher.matches()) { String headerName = matcher.group(1); String headerValue = matcher.group(2); switch (headerName.charAt(0)) { case 'n': if ("name".equals(headerName)) { started.setName(headerValue); } break; default: throw new IllegalStateException("Unrecognized event header: " + headerName); } } } while (!line.isEmpty()); return started; }
private PreparedEvent readPreparedEvent() throws IOException { PreparedEvent prepared = new PreparedEvent(); String line; do { line = textIn.readLine(); Matcher matcher = HEADER_PATTERN.matcher(line); if (matcher.matches()) { String headerName = matcher.group(1); String headerValue = matcher.group(2); switch (headerName.charAt(0)) { case 'n': if ("name".equals(headerName)) { prepared.setName(headerValue); } break; default: throw new IllegalStateException("Unrecognized event header: " + headerName); } } } while (!line.isEmpty()); return prepared; }
protected boolean equalTo(ErrorEvent that) { return super.equalTo(that) && (this.summary == that.summary || this.summary != null && this.summary.equals(that.summary)) && (this.description == that.description || this.description != null && this.description.equals(that.description)); } }
@Override public int hashCode() { return hashTo(); }
@Override public boolean equals(Object o) { return o == this || o instanceof ErrorEvent && equalTo((ErrorEvent) o); }
@Override public int hashCode() { return hashTo(); }
@Override public int hashCode() { int hashCode = hashTo(); if (summary != null) { hashCode ^= summary.hashCode(); } return hashCode; }
@Override public int hashCode() { int hashCode = hashTo(); if (expectedScript != null && observedScript != null) { hashCode ^= (expectedScript + observedScript).hashCode(); } return hashCode; }
protected boolean equalTo(FinishedEvent that) { return super.equalTo(that) && this.expectedScript == that.expectedScript || this.expectedScript != null && this.expectedScript.equals(that.expectedScript) && this.observedScript == that.observedScript || this.observedScript != null && this.observedScript.equals(that.observedScript); } }