1 11 package org.eclipse.core.internal.watson; 12 13 import java.io.DataInput ; 14 import java.io.IOException ; 15 import org.eclipse.core.internal.dtree.DeltaDataTree; 16 17 26 class ElementTreeReaderImpl_1 extends ElementTreeReader { 27 28 32 ElementTreeReaderImpl_1(IElementInfoFlattener factory) { 33 super(factory); 34 } 35 36 40 public ElementTree readDelta(ElementTree parentTree, DataInput input) throws IOException { 41 DeltaDataTree complete = parentTree.getDataTree(); 42 DeltaDataTree delta = dataTreeReader.readTree(complete, input); 43 44 if (delta.isEmptyDelta()) 46 return parentTree; 47 48 ElementTree tree = new ElementTree(delta); 49 50 IElementTreeData data = parentTree.getTreeData(); 52 if (data != null) { 53 tree.setTreeData((IElementTreeData) data.clone()); 54 } 55 56 delta.immutable(); 60 return tree; 61 } 62 63 68 public ElementTree[] readDeltaChain(DataInput input) throws IOException { 69 70 int treeCount = readNumber(input); 71 ElementTree[] results = new ElementTree[treeCount]; 72 73 if (treeCount <= 0) { 74 return results; 75 } 76 77 78 int[] order = new int[treeCount]; 79 for (int i = 0; i < treeCount; i++) { 80 order[i] = readNumber(input); 81 } 82 83 84 results[order[0]] = super.readTree(input); 85 86 87 for (int i = 1; i < treeCount; i++) { 88 results[order[i]] = super.readDelta(results[order[i - 1]], input); 89 } 90 91 return results; 92 } 93 94 97 public ElementTree readTree(DataInput input) throws IOException { 98 99 102 ElementTree result = new ElementTree(dataTreeReader.readTree(null, input)); 103 return result; 104 } 105 } 106 | Popular Tags |