1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.impl.query;
14 import org.simantics.db.procedure.ListenerBase;
18 public static final Object NO_VALUE = new Object() {
20 public String toString() { return "NO_VALUE"; };
23 public static final Object NOT_CHANGED = new Object() {
25 public String toString() { return "NOT_CHANGED"; };
29 public ListenerBase base;
30 public Object procedure;
31 public CacheEntry entry;
33 private Object lastKnownResult;
35 public ListenerEntry(CacheEntry entry, ListenerBase base, Object procedure) {
38 this.procedure = procedure;
40 this.lastKnownResult = entry.getResult();
42 this.lastKnownResult = NO_VALUE;
46 public void setLastKnown(Object object) {
47 lastKnownResult = object;
50 public Object getLastKnown() {
51 return lastKnownResult;
55 public String toString() {
56 // return "[ListenerEntry last = " + lastKnownResult + ", procedure = " + procedure + "]";
57 return "[ListenerEntry " + ", procedure = " + procedure + " base=" + base + "]";
61 public int hashCode() {
62 return base.hashCode();
66 public boolean equals(Object obj) {
68 if(obj == this) return true;
69 if(obj == null) return false;
70 if(obj.getClass() != this.getClass()) return false;
71 ListenerEntry other = (ListenerEntry)obj;
72 return base.equals(other.base);