01: /*
02: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * [See end of file]
04: */
05:
06: package com.hp.hpl.jena.shared.uuid;
07:
08: /** The nil UUID. There is only one in the system.
09: *
10: * @author Andy Seaborne
11: * @version $Id: UUID_nil.java,v 1.3 2008/01/02 12:06:07 andy_seaborne Exp $
12: */
13:
14: public final class UUID_nil extends JenaUUID {
15: private static final String nilStr = "00000000-0000-0000-0000-000000000000";
16: private static UUID_nil nil = new UUID_nil();
17:
18: // Constants
19: static final int version = 0;
20: static final int variant = 0;
21:
22: // The only state-per-object
23: long bitsMostSignificant = 0;
24: long bitsLeastSignificant = 0;
25:
26: private UUID_nil() {
27: }
28:
29: public long getMostSignificantBits() {
30: return bitsMostSignificant;
31: }
32:
33: public long getLeastSignificantBits() {
34: return bitsLeastSignificant;
35: }
36:
37: public String toString() {
38: return nilStr;
39: }
40:
41: public boolean equals(Object other) {
42: if (!(other instanceof UUID_nil))
43: return false;
44: UUID_nil x = (UUID_nil) other;
45: return this .bitsMostSignificant == x.bitsMostSignificant
46: && this .bitsLeastSignificant == x.bitsLeastSignificant;
47: }
48:
49: public int getVariant() {
50: return variant;
51: }
52:
53: public int getVersion() {
54: return version;
55: }
56:
57: // Testing only.
58: public static UUID_nil getNil() {
59: return nil;
60: }
61:
62: public static String getNilString() {
63: return nilStr;
64: }
65: }
66:
67: /*
68: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
69: * All rights reserved.
70: *
71: * Redistribution and use in source and binary forms, with or without
72: * modification, are permitted provided that the following conditions
73: * are met:
74: * 1. Redistributions of source code must retain the above copyright
75: * notice, this list of conditions and the following disclaimer.
76: * 2. Redistributions in binary form must reproduce the above copyright
77: * notice, this list of conditions and the following disclaimer in the
78: * documentation and/or other materials provided with the distribution.
79: * 3. The name of the author may not be used to endorse or promote products
80: * derived from this software without specific prior written permission.
81: *
82: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
83: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
84: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
85: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
86: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
87: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
88: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
89: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
90: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
91: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
92: */
|