| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | * Copyright (c) 2003, the JUNG Project and the Regents of the University | |
| 3 | * of California | |
| 4 | * All rights reserved. | |
| 5 | * | |
| 6 | * This software is open-source under the BSD license; see either | |
| 7 | * "license.txt" or | |
| 8 | * http://jung.sourceforge.net/license.txt for a description. | |
| 9 | */ | |
| 10 | package edu.uci.ics.jung.graph.decorators; | |
| 11 | ||
| 12 | import edu.uci.ics.jung.utils.UserDataContainer; | |
| 13 | ||
| 14 | /** | |
| 15 | * Abstract decorator for cases where attributes are to be stored along with the graph/edge/vertex which they describe | |
| 16 | * @author Scott White | |
| 17 | */ | |
| 18 | public abstract class Decorator { | |
| 19 | private Object mKey; | |
| 20 | private UserDataContainer.CopyAction mCopyAction; | |
| 21 | ||
| 22 | /** | |
| 23 | * Constructs and initializes the decorator | |
| 24 | * @param key | |
| 25 | * @param action | |
| 26 | */ | |
| 27 | 43 | protected Decorator(Object key,UserDataContainer.CopyAction action) { |
| 28 | 43 | mKey = key; |
| 29 | 43 | mCopyAction = action; |
| 30 | 43 | } |
| 31 | ||
| 32 | /** | |
| 33 | * Retrieves the user datum copy action that this decorator uses when setting new values | |
| 34 | * @return the copy action | |
| 35 | */ | |
| 36 | 856 | public UserDataContainer.CopyAction getCopyAction() { return mCopyAction; } |
| 37 | ||
| 38 | /** | |
| 39 | * Retrieves the user datum key that this decorator uses when setting new values | |
| 40 | */ | |
| 41 | 8036 | public Object getKey() { return mKey; } |
| 42 | ||
| 43 | /** | |
| 44 | * @return the hash code for the user datum key | |
| 45 | */ | |
| 46 | public int hashCode() { | |
| 47 | 0 | return mKey.hashCode(); |
| 48 | } | |
| 49 | ||
| 50 | /** | |
| 51 | * Removes the values from the user data container | |
| 52 | * @param udc the vertex/edge/graph being whose value is being removed | |
| 53 | */ | |
| 54 | public void removeValue(UserDataContainer udc) { | |
| 55 | 77 | udc.removeUserDatum(mKey); |
| 56 | 77 | } |
| 57 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |