KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jalisto > se > impl > InFileAddress


1 /*
2  * Jalisto - JAva LIght STOrage
3  * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Xcalia
20  * 71, rue Desnouettes
21  * 75014 Paris - France
22  * http://www.xcalia.com
23  */

24 package org.objectweb.jalisto.se.impl;
25
26 import java.io.Serializable JavaDoc;
27
28 public class InFileAddress implements Serializable JavaDoc {
29
30     public InFileAddress(String JavaDoc address) {
31         this.address = address;
32         index = 0;
33         fileIndex = 0;
34     }
35
36     public String JavaDoc getAddress() {
37         return address;
38     }
39
40     public InFileAddress getClone() {
41         InFileAddress result = new InFileAddress(address);
42         result.setIndex(index);
43         result.setFileIndex(fileIndex);
44         return result;
45     }
46
47     public void setAddress(String JavaDoc address) {
48         this.address = address;
49     }
50
51     public void setFileIndex(int fileIndex) {
52         this.fileIndex = fileIndex;
53     }
54
55     public int getFileIndex() {
56         return fileIndex;
57     }
58
59     public void setIndex(int index) {
60         this.index = index;
61     }
62
63     public int getIndex() {
64         return index;
65     }
66
67     public void incrementeFileIndex() {
68         index++;
69     }
70
71     public boolean equals(Object JavaDoc obj) {
72         try {
73             InFileAddress candidate = (InFileAddress) obj;
74             return ((candidate.address.equals(this.address)) && (candidate.index == this.index));
75         } catch (Exception JavaDoc e) {
76         }
77         return false;
78     }
79
80     public int hashCode() {
81         return ((index * 100000) + address.hashCode());
82     }
83
84     public String JavaDoc toString() {
85         return "ifa(" + String.valueOf(address) + "," + String.valueOf(fileIndex) + "," + String.valueOf(index) + ")";
86     }
87
88
89     // the physical address of the JalistoObject wrapper
90
private String JavaDoc address;
91     // the index of underlying physical file
92
private int fileIndex;
93     // the index of the data in the page
94
private int index;
95
96
97     static final long serialVersionUID = -7589377069064761459L;
98 }
99
Popular Tags