01: /*
02: * Copyright (c) 2000 by Matt Welsh and The Regents of the University of
03: * California. All rights reserved.
04: *
05: * Permission to use, copy, modify, and distribute this software and its
06: * documentation for any purpose, without fee, and without written agreement is
07: * hereby granted, provided that the above copyright notice and the following
08: * two paragraphs appear in all copies of this software.
09: *
10: * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
11: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
12: * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
13: * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14: *
15: * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
16: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17: * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
18: * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
19: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
20: *
21: * Author: Matt Welsh <mdw@cs.berkeley.edu>
22: *
23: */
24:
25: package seda.nbio;
26:
27: /**
28: * This is a package-internal class used to represent a UNIX file descriptor.
29: */
30: class NBIOFileDescriptor {
31:
32: int fd;
33:
34: NBIOFileDescriptor() {
35: fd = -1;
36: }
37:
38: NBIOFileDescriptor(int fd) {
39: this .fd = fd;
40: }
41:
42: void setFD(int fd) {
43: this .fd = fd;
44: }
45:
46: int getFD() {
47: return fd;
48: }
49:
50: NBIOFileDescriptor getClone() {
51: return new NBIOFileDescriptor(this .fd);
52: }
53:
54: public int hashCode() {
55: return fd;
56: }
57:
58: public boolean equals(Object o) {
59: if (!(o instanceof NBIOFileDescriptor))
60: return false;
61: NBIOFileDescriptor thefd = (NBIOFileDescriptor) o;
62: if (thefd.fd == this .fd)
63: return true;
64: else
65: return false;
66: }
67:
68: }
|