1 31 package org.pdfbox.persistence.util; 32 33 import org.pdfbox.cos.COSObject; 34 35 41 public class COSObjectKey 42 { 43 private long number; 44 private long generation; 45 46 51 public COSObjectKey(COSObject object) 52 { 53 this( object.getObjectNumber().longValue(), object.getGenerationNumber().longValue() ); 54 } 55 56 62 public COSObjectKey(long num, long gen) 63 { 64 setNumber(num); 65 setGeneration(gen); 66 } 67 68 71 public boolean equals(Object obj) 72 { 73 return (obj instanceof COSObjectKey) && 74 ((COSObjectKey)obj).getNumber() == getNumber() && 75 ((COSObjectKey)obj).getGeneration() == getGeneration(); 76 } 77 78 83 public long getGeneration() 84 { 85 return generation; 86 } 87 92 public long getNumber() 93 { 94 return number; 95 } 96 97 100 public int hashCode() 101 { 102 return (int)(number + generation); 103 } 104 109 public void setGeneration(long newGeneration) 110 { 111 generation = newGeneration; 112 } 113 118 public void setNumber(long newNumber) 119 { 120 number = newNumber; 121 } 122 123 126 public String toString() 127 { 128 return "" + getNumber() + " " + getGeneration() + " R"; 129 } 130 } | Popular Tags |