Esempio n. 1
0
 /** {@inheritDoc} */
 public boolean equals(Object o) {
   if (!(o instanceof Block)) {
     return false;
   }
   final Block that = (Block) o;
   // Wildcard generationStamp is ALLOWED here
   return this.blockId == that.blockId
       && GenerationStamp.equalsWithWildcard(this.generationStamp, that.generationStamp);
 }
Esempio n. 2
0
  /** {@inheritDoc} */
  public int compareTo(Block b) {
    // Wildcard generationStamp is NOT ALLOWED here
    validateGenerationStamp(this.generationStamp);
    validateGenerationStamp(b.generationStamp);

    if (blockId < b.blockId) {
      return -1;
    } else if (blockId == b.blockId) {
      return GenerationStamp.compare(generationStamp, b.generationStamp);
    } else {
      return 1;
    }
  }