01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.caching.validity;
18:
19: /**
20: * An External cache event that consists of just a name. Examples
21: * (not necessarily useful) could include "Easter" or "Shutdown"
22: *
23: * @author Geoff Howard (ghoward@apache.org)
24: * @version $Id: NamedEvent.java 433543 2006-08-22 06:22:54Z crossley $
25: */
26: public class NamedEvent extends Event {
27:
28: private String m_name;
29: private int m_hashcode;
30:
31: /**
32: * Constructor takes a simple String as event name.
33: *
34: * @param name name
35: */
36: public NamedEvent(String name) {
37: m_name = name;
38: m_hashcode = name.hashCode();
39: }
40:
41: /**
42: * Every NamedEvent where the name string is equal must
43: * return true.
44: */
45: public boolean equals(Event e) {
46: if (e instanceof NamedEvent) {
47: return m_name.equals(((NamedEvent) e).m_name);
48: }
49: return false;
50: }
51:
52: public int hashCode() {
53: return m_hashcode;
54: }
55:
56: public String toString() {
57: return "NamedEvent[" + m_name + "]";
58: }
59: }
|