Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 1.1 Source Code Directory
JDK 1.1 source code directory contains Java source code for JDK 1.1 core classes: "C:\fyicenter\jdk-1.1.8\src".
Here is the list of Java classes of the JDK 1.1 source code:
✍: FYIcenter
⏎ java/util/BitSet.java
/* * @(#)BitSet.java 1.28 01/12/10 * * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package java.util; /** * A set of bits. The set automatically grows as more bits are needed. * * @version 1.28, 12/10/01 * @author Arthur van Hoff */ public final class BitSet implements Cloneable, java.io.Serializable { private final static int BITS_PER_UNIT = 6; private final static int MASK = (1<<BITS_PER_UNIT)-1; private long bits[]; /** * Convert bitIndex to a subscript into the bits[] array. */ private static int subscript(int bitIndex) { return bitIndex >> BITS_PER_UNIT; } /** * Convert a subscript into the bits[] array to a (maximum) bitIndex. */ private static int bitIndex(int subscript) { return (subscript << BITS_PER_UNIT) + MASK; } private static boolean debugging = (System.getProperty("debug") != null); /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = 7997698588986878753L; /** * Creates an empty set. */ public BitSet() { this(1 << BITS_PER_UNIT); } /** * Creates an empty set with the specified size. * @param nbits the size of the set */ public BitSet(int nbits) { /* nbits can't be negative; size 0 is OK */ if (nbits < 0) { throw new NegativeArraySizeException(Integer.toString(nbits)); } /* On wraparound, truncate size; almost certain to o-flo memory. */ if (nbits + MASK < 0) { nbits = Integer.MAX_VALUE - MASK; } /* subscript(nbits + MASK) is the length of the array needed to hold nbits */ bits = new long[subscript(nbits + MASK)]; } /** * Ensures that the BitSet can hold at least an nth bit. * This cannot leave the bits array at length 0. * @param nth the 0-origin number of the bit to ensure is there. */ private void ensureCapacity(int nth) { /* Doesn't need to be synchronized because it's an internal method. */ int required = subscript(nth) + 1; /* +1 to get length, not index */ if (required > bits.length) { /* Ask for larger of doubled size or required size */ int request = Math.max(2 * bits.length, required); long newBits[] = new long[request]; System.arraycopy(bits, 0, newBits, 0, bits.length); bits = newBits; } } /** * Sets a bit. * @param bit the bit to be set */ public void set(int bit) { if (bit < 0) { throw new IndexOutOfBoundsException(Integer.toString(bit)); } synchronized (this) { ensureCapacity(bit); bits[subscript(bit)] |= (1L << (bit & MASK)); } } /** * Clears a bit. * @param bit the bit to be cleared */ public void clear(int bit) { if (bit < 0) { throw new IndexOutOfBoundsException(Integer.toString(bit)); } synchronized (this) { ensureCapacity(bit); bits[subscript(bit)] &= ~(1L << (bit & MASK)); } } /** * Gets a bit. * @param bit the bit to be gotten */ public boolean get(int bit) { if (bit < 0) { throw new IndexOutOfBoundsException(Integer.toString(bit)); } boolean result = false; synchronized (this) { int n = subscript(bit); /* always positive */ if (n < bits.length) { result = ((bits[n] & (1L << (bit & MASK))) != 0); } } return result; } /** * Logically ANDs this bit set with the specified set of bits. * @param set the bit set to be ANDed with */ public void and(BitSet set) { /* * Need to synchronize both this and set. * This might lead to deadlock if one thread grabs them in one order * while another thread grabs them the other order. * Use a trick from Doug Lea's book on concurrency, * somewhat complicated because BitSet overrides hashCode(). */ if (this == set) { return; } BitSet first = this; BitSet second = set; if (System.identityHashCode(first) > System.identityHashCode(second)) { first = set; second = this; } synchronized (first) { synchronized (second) { int bitsLength = bits.length; int setLength = set.bits.length; int n = Math.min(bitsLength, setLength); for (int i = n ; i-- > 0 ; ) { bits[i] &= set.bits[i]; } for (; n < bitsLength ; n++) { bits[n] = 0; } } } } /** * Logically ORs this bit set with the specified set of bits. * @param set the bit set to be ORed with */ public void or(BitSet set) { if (this == set) { return; } /* See the note about synchronization in and(), above. */ BitSet first = this; BitSet second = set; if (System.identityHashCode(first) > System.identityHashCode(second)) { first = set; second = this; } synchronized (first) { synchronized (second) { int setLength = set.bits.length; if (setLength > 0) { ensureCapacity(bitIndex(setLength-1)); } for (int i = setLength; i-- > 0 ;) { bits[i] |= set.bits[i]; } } } } /** * Logically XORs this bit set with the specified set of bits. * @param set the bit set to be XORed with */ public void xor(BitSet set) { /* See the note about synchronization in and(), above. */ BitSet first = this; BitSet second = set; if (System.identityHashCode(first) > System.identityHashCode(second)) { first = set; second = this; } synchronized (first) { synchronized (second) { int setLength = set.bits.length; if (setLength > 0) { ensureCapacity(bitIndex(setLength-1)); } for (int i = setLength; i-- > 0 ;) { bits[i] ^= set.bits[i]; } } } } /** * Gets the hashcode. */ public int hashCode() { long h = 1234; synchronized (this) { for (int i = bits.length; --i >= 0; ) { h ^= bits[i] * (i + 1); } } return (int)((h >> 32) ^ h); } /** * Calculates and returns the set's size in bits. * The maximum element in the set is the size - 1st element. */ public int size() { /* This doesn't need to be synchronized, since it just reads a field. */ return bits.length << BITS_PER_UNIT; } /** * Compares this object against the specified object. * @param obj the object to compare with * @return true if the objects are the same; false otherwise. */ public boolean equals(Object obj) { if ((obj != null) && (obj instanceof BitSet)) { if (this == obj) { return true; } BitSet set = (BitSet) obj; /* See the note about synchronization in and(), above. */ BitSet first = this; BitSet second = set; if (System.identityHashCode(first) > System.identityHashCode(second)) { first = set; second = this; } synchronized (first) { synchronized (second) { int bitsLength = bits.length; int setLength = set.bits.length; int n = Math.min(bitsLength, setLength); for (int i = n ; i-- > 0 ;) { if (bits[i] != set.bits[i]) { return false; } } if (bitsLength > n) { for (int i = bitsLength ; i-- > n ;) { if (bits[i] != 0) { return false; } } } else if (setLength > n) { for (int i = setLength ; i-- > n ;) { if (set.bits[i] != 0) { return false; } } } } } return true; } return false; } /** * Clones the BitSet. */ public Object clone() { BitSet result = null; synchronized (this) { try { result = (BitSet) super.clone(); } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); } result.bits = new long[bits.length]; System.arraycopy(bits, 0, result.bits, 0, result.bits.length); } return result; } /** * Converts the BitSet to a String. */ public String toString() { StringBuffer buffer = new StringBuffer(); boolean needSeparator = false; buffer.append('{'); synchronized (this) { int limit = size(); for (int i = 0 ; i < limit ; i++) { if (get(i)) { if (needSeparator) { buffer.append(", "); } else { needSeparator = true; } buffer.append(i); } } } buffer.append('}'); return buffer.toString(); } }
⏎ java/util/BitSet.java
Or download all of them as a single archive file:
File name: jdk-1.1.8-src.zip File size: 1574187 bytes Release date: 2018-11-16 Download
⇒ Backup JDK 1.1 Installation Directory
2018-11-17, 150599👍, 0💬
Popular Posts:
JRE 8 plugin.jar is the JAR file for JRE 8 Java Control Panel Plugin interface and tools. JRE (Java ...
What Is poi-scratchpad-3.5.jar? poi-scratchpad-3.5.jar is one of the JAR files for Apache POI 3.5, w...
How to read XML document with DTD validation from socket connections with the socket\DelayedInput.ja.. .
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
What Is mail.jar of JavaMail 1.3? I got the JAR file from javamail-1_3.zip. mail.jar in javamail-1_3...