| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Functor |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * 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.commons.functor; | |
| 18 | ||
| 19 | /** | |
| 20 | * Functor marker interface. All provided functor interfaces extend this interface. | |
| 21 | * <p> | |
| 22 | * Implementors are encouraged but not required to make their functors | |
| 23 | * {@link java.io.Serializable Serializable}. | |
| 24 | * </p> | |
| 25 | * | |
| 26 | * @since 1.0 | |
| 27 | * @version $Revision: 647297 $ $Date: 2008-04-11 22:14:50 +0200 (Fri, 11 Apr 2008) $ | |
| 28 | */ | |
| 29 | public interface Functor { | |
| 30 | ||
| 31 | /** | |
| 32 | * Returns a human readable description of this functor. | |
| 33 | * Implementators are strongly encouraged but not | |
| 34 | * strictly required to override the default {@link Object} | |
| 35 | * implementation of this method. | |
| 36 | * | |
| 37 | * @return a human readable description of this functor | |
| 38 | */ | |
| 39 | String toString(); | |
| 40 | ||
| 41 | /** | |
| 42 | * Returns a hash code for this functor adhering to the | |
| 43 | * general {@link Object#hashCode Object.hashCode} contract. | |
| 44 | * Implementators are strongly encouraged but not | |
| 45 | * strictly required to override the default {@link Object} | |
| 46 | * implementation of this method. | |
| 47 | * | |
| 48 | * @see #equals | |
| 49 | * @return a hash code for this functor | |
| 50 | */ | |
| 51 | int hashCode(); | |
| 52 | ||
| 53 | /** | |
| 54 | * Indicates whether some other object is "equal to" | |
| 55 | * this functor. This method must adhere to | |
| 56 | * general {@link Object#equals Object.equals} contract. | |
| 57 | * Additionally, this method can return | |
| 58 | * <tt>true</tt> <i>only</i> if the specified Object implements | |
| 59 | * the same functor interface and is known to produce the same | |
| 60 | * results and/or side-effects for the same arguments (if any). | |
| 61 | * <p> | |
| 62 | * While implementators are strongly encouraged to override | |
| 63 | * the default Object implementation of this method, | |
| 64 | * note that the default Object implementation | |
| 65 | * does in fact adhere to the functor <code>equals</code> contract. | |
| 66 | * </p> | |
| 67 | * @param that the object to compare this functor to | |
| 68 | * @see #hashCode | |
| 69 | * @return <code>true</code> iff the given object implements | |
| 70 | * this functor interface, and is known to produce the same | |
| 71 | * results and/or side-effects for the same arguments | |
| 72 | * (if any). | |
| 73 | */ | |
| 74 | boolean equals(Object that); | |
| 75 | } |