1/* 2 * Copyright (C) 2013 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.google.caliper.bridge; 18 19import java.io.Serializable; 20 21/** 22 * A message sent from the runner to the worker to indicate whether or not measuring should 23 * continue. 24 */ 25public class ShouldContinueMessage implements Serializable { 26 private static final long serialVersionUID = 1L; 27 28 private final boolean shouldContinue; 29 private final boolean warmupComplete; 30 31 public ShouldContinueMessage(boolean shouldContinue, boolean warmupComplete) { 32 this.shouldContinue = shouldContinue; 33 this.warmupComplete = warmupComplete; 34 } 35 36 public boolean shouldContinue() { 37 return shouldContinue; 38 } 39 40 @Override public int hashCode() { 41 return Boolean.valueOf(shouldContinue).hashCode(); 42 } 43 44 @Override public boolean equals(Object obj) { 45 return obj instanceof ShouldContinueMessage 46 && shouldContinue == ((ShouldContinueMessage) obj).shouldContinue; 47 } 48 49 public boolean isWarmupComplete() { 50 return warmupComplete; 51 } 52} 53