@Override public void setPartitionLimit(int partitionLimit) { getPartitions().clear(); for (int i = 0; i < partitionLimit; i++) { PartitionImpl partition = new PartitionImpl(); partition.setSequencerPartitionContainer(this); partition.setPartitionNumber(i + 1); getPartitions().add(partition); } }
@Override public int hashCode() { if (getId() != PartitionImpl.UNSAVED_ID) { return (int) getId(); } else { final int PRIME = 37; int hashcode = -1; if (getPartitionNumber() != null) hashcode = PRIME * hashcode + getPartitionNumber().hashCode(); if (getSequencerPartitionContainer() != null) hashcode = PRIME * hashcode + getSequencerPartitionContainer().hashCode(); if (getLoadingConcentration() != null) hashcode = PRIME * hashcode + getLoadingConcentration().hashCode(); if (getLoadingConcentrationUnits() != null) hashcode = PRIME * hashcode + getLoadingConcentrationUnits().hashCode(); return hashcode; } }
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getId()); sb.append(" : "); sb.append(getPartitionNumber()); if (getPool() != null) { sb.append(" : "); sb.append(getPool().getId()); } return sb.toString(); }
public static Partition to(@Nonnull PartitionDto dto) { Partition to = new PartitionImpl(); to.setId(dto.getId()); return to; }
@Override public int compareTo(Partition t) { if (getId() != 0L && t.getId() != 0L) { if (getId() < t.getId()) return -1; if (getId() > t.getId()) return 1; } else { if (getPartitionNumber() < t.getPartitionNumber()) return -1; if (getPartitionNumber() > t.getPartitionNumber()) return 1; } return 0; }
/** * Equivalency is based on getProjectId() if set, otherwise on name, description and creation date. */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PartitionImpl other = (PartitionImpl) obj; // If not saved, then compare resolved actual objects. Otherwise // just compare IDs. if (getId() == PartitionImpl.UNSAVED_ID || other.getId() == PartitionImpl.UNSAVED_ID) { if (loadingConcentration == null) { if (other.loadingConcentration != null) return false; } else if (!loadingConcentration.equals(other.loadingConcentration)) return false; if (loadingConcentrationUnits != other.loadingConcentrationUnits) return false; if (partitionNumber == null) { if (other.partitionNumber != null) return false; } else if (!partitionNumber.equals(other.partitionNumber)) return false; if (pool == null) { if (other.pool != null) return false; } else if (!pool.equals(other.pool)) return false; if (sequencerPartitionContainer == null) { if (other.sequencerPartitionContainer != null) return false; } else if (!sequencerPartitionContainer.equals(other.sequencerPartitionContainer)) return false; return true; } else { return this.getId() == other.getId(); } }
newContainer.setPartitionLimit(laneCount); newContainer.setPartitions(IntStream.range(0, laneCount) .mapToObj(i -> new PartitionImpl(newContainer, i + 1)) .collect(Collectors.toList())); updatePartitionContents(getLaneContents, newContainer);