@Override public int hashCode() { return new HashCodeBuilder() .append(getDevice()) .append(getMedia()) .append(getPaper()) .append(getToner()) .append(getInk()) .append(getLamp()) .append(getRetractBins().orElse(null)) .append(getMediaOnStacker()) .append(getExtra()) .toHashCode(); }
private PtrStatus3 createPtrStatus(Pointer p, XfsVersion xfsVersion) { PtrStatus3 result; if (xfsVersion.compareTo(XfsVersion.V3_30) >= 0) { result = new PtrStatus330(new PtrStatus330(p)); } else if (xfsVersion.compareTo(XfsVersion.V3_20) >= 0) { result = new PtrStatus320(new PtrStatus320(p)); } else if (xfsVersion.compareTo(XfsVersion.V3_10) >= 0) { result = new PtrStatus310(new PtrStatus310(p)); } else { result = new PtrStatus3(new PtrStatus3(p)); } return result; }
private void addPTRService(final PTRService service) { try { PtrStatus3 status = new PTRStatusCallable(service).call(); table.addRowWithCommand(new ExecuteSubTaskCommand(taskManager, new PTRStatusTask(service)), service, status.getDevice()); } catch (XfsException e) { table.addRow(service, e.getError()); } }
@Test public final void test() { PtrStatus3 expected = new PtrStatus3(buildPtrStatus3().getPointer()); PtrStatus3 actual = new PtrStatus3(expected); System.out.println(actual); assertEquals(expected, actual); }
@Override public String toString() { return new ToStringBuilder(this) .append("device", getDevice()) .append("media", getMedia()) .append("paper", getPaper()) .append("toner", getToner()) .append("ink", getInk()) .append("lamp", getLamp()) .append("retractBins", getRetractBins()) .append("mediaOnStacker", getMediaOnStacker()) .append("extra", getExtra()) .toString(); } }
@Override public boolean equals(Object obj) { if (obj instanceof PtrStatus3) { PtrStatus3 ptrStatus3 = (PtrStatus3) obj; return new EqualsBuilder() .append(getDevice(), ptrStatus3.getDevice()) .append(getMedia(), ptrStatus3.getMedia()) .append(getPaper(), ptrStatus3.getPaper()) .append(getToner(), ptrStatus3.getToner()) .append(getInk(), ptrStatus3.getInk()) .append(getLamp(), ptrStatus3.getLamp()) .append(getRetractBins().orElse(null), ptrStatus3.getRetractBins().orElse(null)) .append(getMediaOnStacker(), ptrStatus3.getMediaOnStacker()) .append(getExtra(), ptrStatus3.getExtra()) .isEquals(); } return false; }
protected void set(PtrStatus3 copy) { device.set(copy.getDevice()); media.set(copy.getMedia()); paper.set(copy.getPaper()); toner.set(copy.getToner()); ink.set(copy.getInk()); lamp.set(copy.getLamp()); Optional<RetractBin3[]> retractBins = copy.getRetractBins(); if (retractBins.isPresent()) { this.retractBins.pointTo(new RetractBins3(retractBins.get())); } mediaOnStacker.set(copy.getMediaOnStacker()); extra.set(copy.getExtra()); }
@Override protected void execute() { table = new Table(getClass(), "Component", "Value"); try { final PtrStatus3 status = new PTRStatusCallable(service).call(); addRow("Device", status.getDevice()); addRow("Media", status.getMedia()); addPaperSupplyStates(status.getPaper()); addRow("Toner", status.getToner()); addRow("Ink", status.getInk()); addRow("Lamp", status.getLamp()); addRow("RetractBins", status.getRetractBins()); addRow("MediaOnStacker", status.getMediaOnStacker()); addRow("Extra", status.getExtra()); if (status instanceof PtrStatus310) { PtrStatus310 status310 = (PtrStatus310) status; addRow("GuidLights", status310.getGuidLights()); addRow("DevicePosition", status310.getDevicePosition()); addRow("PowerSaveRecoveryTime", status310.getPowerSaveRecoveryTime()); } if (status instanceof PtrStatus320) { PtrStatus320 status320 = (PtrStatus320) status; addRow("PaperTypes", status320.getPaperTypes()); addRow("AntiFraudModule", status320.getAntiFraudModule()); } getContent().setUIElement(table); } catch (final XfsException e) { showException(e); } }