Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 package org.myoodb.collectable; 25 26 public class LogObjectDbImpl extends CollectableDbImpl implements LogObject 27 { 28 protected long m_time; 29 protected LogStore m_logStore; 30 31 public LogObjectDbImpl() 32 { 33 m_time = -1; 34 m_logStore = null; 35 } 36 37 public void onDelete() 38 { 39 if (m_logStore != null) 40 { 41 m_logStore.removeLogObject(this); 42 } 43 } 44 45 public void setTime(long time) 46 { 47 m_time = time; 48 } 49 50 public long getTime() 51 { 52 return m_time; 53 } 54 55 public void setLogStore(LogStore logStore) 56 { 57 m_logStore = logStore; 58 59 if (logStore != null) 60 { 61 m_time = getLocalTime(); 62 } 63 else 64 { 65 m_time = -1; 66 } 67 } 68 69 public LogStore getLogStore() 70 { 71 return m_logStore; 72 } 73 74 public void activate() throws Exception  75 { 76 getContainer().setDeactivationFlag(false); 77 } 78 79 public void deactivate() throws Exception  80 { 81 getContainer().setDeactivationFlag(true); 82 } 83 84 public int hashCode() 85 { 86 return (int) m_time; 87 } 88 89 public boolean equals(Object obj) 90 { 91 if (this == obj) 92 { 93 return true; 94 } 95 else if (obj instanceof LogObject) 96 { 97 return (getTime() == ((LogObject) obj).getTime()); 98 } 99 else 100 { 101 return false; 102 } 103 } 104 105 public int compareTo(Object obj) 106 { 107 if (obj instanceof LogObject) 108 { 109 long diff = getTime()-((LogObject) obj).getTime(); 110 return diff>0?1:diff<0?-1:0; 111 } 112 else 113 { 114 return -1; 115 } 116 } 117 } 118
| Popular Tags
|