@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MachineImpl)) { return false; } MachineImpl machine = (MachineImpl) o; return Objects.equals(getAttributes(), machine.getAttributes()) && Objects.equals(getServers(), machine.getServers()) && getStatus() == machine.getStatus(); }
public RuntimeImpl(Runtime runtime) { this.activeEnv = runtime.getActiveEnv(); this.machines = runtime .getMachines() .entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> new MachineImpl(e.getValue()))); this.owner = runtime.getOwner(); this.warnings = runtime.getWarnings().stream().map(WarningImpl::new).collect(Collectors.toList()); this.commands = runtime.getCommands().stream().map(CommandImpl::new).collect(Collectors.toList()); }
/** * Returns map of machine name to machine instance entries. * * @throws InfrastructureException when any error occurs */ public Map<String, ? extends Machine> getMachines() throws InfrastructureException { return getInternalMachines() .entrySet() .stream() .collect( toMap( Map.Entry::getKey, e -> new MachineImpl( e.getValue().getAttributes(), rewriteExternalServers(e.getKey(), e.getValue().getServers()), e.getValue().getStatus()))); }
@Override public int hashCode() { return Objects.hash(getAttributes(), getServers(), getStatus()); }