KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > common > MapDiff


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.common;
13
14 import com.versant.core.util.OIDObjectOutput;
15 import com.versant.core.util.OIDObjectInput;
16
17 import java.io.IOException JavaDoc;
18
19 /**
20  * This holds the differences between two maps. It is stored in the new State
21  * when changes to a map field are persisted.
22  */

23 public class MapDiff extends CollectionDiff {
24
25     public MapDiff() {
26     }
27
28     public MapDiff(VersantFieldMetaData fmd) {
29         super(fmd);
30     }
31
32     /**
33      * The deleted keys.
34      */

35     public Object JavaDoc[] deletedKeys;
36
37     /**
38      * The inserted keys. This array will be the same size as insertedValues.
39      * The value for each key is the element of insertedValues at the same
40      * index.
41      */

42     public Object JavaDoc[] insertedKeys;
43
44     public void writeExternal(OIDObjectOutput out) throws IOException JavaDoc {
45         super.writeExternal(out);
46         write(out, fmd.getKeyTypeCode(), fmd.isKeyTypePC(), deletedKeys);
47         write(out, fmd.getKeyTypeCode(), fmd.isKeyTypePC(), insertedKeys);
48     }
49
50     public void readExternal(OIDObjectInput in) throws IOException JavaDoc,
51             ClassNotFoundException JavaDoc {
52         super.readExternal(in);
53         deletedKeys = read(in, fmd.getKeyTypeCode(), fmd.isKeyTypePC());
54         insertedKeys = read(in, fmd.getKeyTypeCode(), fmd.isKeyTypePC());
55     }
56
57 }
58
Popular Tags