コード例 #1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof InstanceStateChange == false) return false;
    InstanceStateChange other = (InstanceStateChange) obj;
    if (other.getInstanceId() == null ^ this.getInstanceId() == null) return false;
    if (other.getInstanceId() != null
        && other.getInstanceId().equals(this.getInstanceId()) == false) return false;
    if (other.getCurrentState() == null ^ this.getCurrentState() == null) return false;
    if (other.getCurrentState() != null
        && other.getCurrentState().equals(this.getCurrentState()) == false) return false;
    if (other.getPreviousState() == null ^ this.getPreviousState() == null) return false;
    if (other.getPreviousState() != null
        && other.getPreviousState().equals(this.getPreviousState()) == false) return false;
    return true;
  }
コード例 #2
0
 private void printStateChanges(TerminateInstancesResult tir) {
   List<InstanceStateChange> states = tir.getTerminatingInstances();
   out.println("Terminated " + states.size() + " instances:");
   for (InstanceStateChange state : states) {
     out.println(
         state.getInstanceId()
             + ": "
             + state.getPreviousState()
             + " -> "
             + state.getCurrentState());
   }
 }