com.partnersoft.data
Class MagicCookie
java.lang.Object
com.partnersoft.data.MagicCookie
public class MagicCookie
- extends java.lang.Object
From the Hacker's Map/Jargon file:
<b>magic cookie</b> [UNIX] n. 1. Something passed between routines
or programs that enables the receiver to perform some operation;
a capability ticket or opaque identifier. Especially used of small
data objects that contain data encoded in a strange or intrinsically
machine-dependent way.
...
The phrase <i>it hands you a magic cookie</i> means it returns
a result whose contents are not defined but which can be passed
back to the same or some other program later.
I generally use MagicCookies as objects whose only property is their own
identity; this is useful when, for instance, traversing directed acyclic (or
heck, cyclic) digraphs when you need some mechanism of tracking whether this
traversal has already happened at a node without actually saving a list of
traversed nodes. Also use it when a data source/model is updated
asynchronously to its display/viewing, but you need a quick verification of
whether the source has changed.
Be sure to use the equals() function to check if two cookies match; it is
currently done based on object identity but that will change if I start
passing them across memory spaces for some reason.
Copyright 1997-2006 Partner Software, Inc.
- Version:
- $Id: MagicCookie.java 1012 2007-11-24 18:30:02Z paul $
- Author:
- Paul Reavis
|
Method Summary |
boolean |
equals(java.lang.Object nother)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MagicCookie
public MagicCookie()
equals
public boolean equals(java.lang.Object nother)
- Overrides:
equals in class java.lang.Object