1 29 30 package com.caucho.quercus.env; 31 32 import com.caucho.quercus.page.QuercusPage; 33 34 import java.lang.ref.WeakReference ; 35 36 39 public final class DefinitionKey { 40 private final long _crc; 42 43 private final WeakReference <QuercusPage> _includePageRef; 45 46 DefinitionKey(long crc, QuercusPage includePage) 47 { 48 _crc = crc; 49 _includePageRef = new WeakReference <QuercusPage>(includePage); 50 } 51 52 public int hashCode() 53 { 54 return (int) _crc; 55 } 56 57 public boolean equals(Object o) 58 { 59 if (! (o instanceof DefinitionKey)) 60 return false; 61 62 DefinitionKey key = (DefinitionKey) o; 63 64 QuercusPage page = _includePageRef.get(); 65 QuercusPage keyPage = key._includePageRef.get(); 66 67 if (page == null || keyPage == null) 68 return false; 69 70 return (_crc == key._crc && page.equals(keyPage)); 71 } 72 73 public String toString() 74 { 75 QuercusPage page = _includePageRef.get(); 76 77 return "DefinitionKey[" + _crc + ", " + page + "]"; 78 } 79 } 80 81 | Popular Tags |