-/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
+/*******************************************************************************
+ * Copyright (c) 2010 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
package org.simantics.databoard.accessor.binary;
-import java.io.IOException;\r
-import java.lang.ref.WeakReference;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.Map.Entry;\r
-import java.util.SortedMap;\r
-import java.util.TreeMap;\r
-\r
-import org.simantics.databoard.accessor.Accessor;\r
-import org.simantics.databoard.accessor.ArrayAccessor;\r
-import org.simantics.databoard.accessor.StreamAccessor;\r
-import org.simantics.databoard.accessor.error.AccessorConstructionException;\r
-import org.simantics.databoard.accessor.error.AccessorException;\r
-import org.simantics.databoard.accessor.error.ReferenceException;\r
-import org.simantics.databoard.accessor.event.ArrayElementAdded;\r
-import org.simantics.databoard.accessor.event.ArrayElementRemoved;\r
-import org.simantics.databoard.accessor.event.Event;\r
-import org.simantics.databoard.accessor.event.ValueAssigned;\r
-import org.simantics.databoard.accessor.file.FileArrayAccessor;\r
-import org.simantics.databoard.accessor.impl.AccessorParams;\r
-import org.simantics.databoard.accessor.impl.ListenerEntry;\r
-import org.simantics.databoard.accessor.interestset.ArrayInterestSet;\r
-import org.simantics.databoard.accessor.interestset.InterestSet;\r
-import org.simantics.databoard.accessor.reference.ChildReference;\r
-import org.simantics.databoard.accessor.reference.IndexReference;\r
-import org.simantics.databoard.accessor.reference.LabelReference;\r
-import org.simantics.databoard.adapter.AdaptException;\r
-import org.simantics.databoard.binding.ArrayBinding;\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.error.BindingException;\r
-import org.simantics.databoard.binding.mutable.MutableVariant;\r
-import org.simantics.databoard.serialization.Serializer;\r
-import org.simantics.databoard.serialization.SerializerConstructionException;\r
-import org.simantics.databoard.type.ArrayType;\r
-import org.simantics.databoard.type.Datatype;\r
-import org.simantics.databoard.util.binary.Blob;\r
-import org.simantics.databoard.util.binary.RandomAccessBinary.ByteSide;\r
+import java.io.IOException;
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.simantics.databoard.accessor.Accessor;
+import org.simantics.databoard.accessor.ArrayAccessor;
+import org.simantics.databoard.accessor.StreamAccessor;
+import org.simantics.databoard.accessor.error.AccessorConstructionException;
+import org.simantics.databoard.accessor.error.AccessorException;
+import org.simantics.databoard.accessor.error.ReferenceException;
+import org.simantics.databoard.accessor.event.ArrayElementAdded;
+import org.simantics.databoard.accessor.event.ArrayElementRemoved;
+import org.simantics.databoard.accessor.event.Event;
+import org.simantics.databoard.accessor.event.ValueAssigned;
+import org.simantics.databoard.accessor.file.FileArrayAccessor;
+import org.simantics.databoard.accessor.impl.AccessorParams;
+import org.simantics.databoard.accessor.impl.ListenerEntry;
+import org.simantics.databoard.accessor.interestset.ArrayInterestSet;
+import org.simantics.databoard.accessor.interestset.InterestSet;
+import org.simantics.databoard.accessor.reference.ChildReference;
+import org.simantics.databoard.accessor.reference.IndexReference;
+import org.simantics.databoard.accessor.reference.LabelReference;
+import org.simantics.databoard.adapter.AdaptException;
+import org.simantics.databoard.binding.ArrayBinding;
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.binding.error.BindingException;
+import org.simantics.databoard.binding.mutable.MutableVariant;
+import org.simantics.databoard.serialization.Serializer;
+import org.simantics.databoard.serialization.SerializerConstructionException;
+import org.simantics.databoard.type.ArrayType;
+import org.simantics.databoard.type.Datatype;
+import org.simantics.databoard.util.binary.Blob;
+import org.simantics.databoard.util.binary.RandomAccessBinary.ByteSide;
/**
* Binary Array is accessor to a byte backed array of elements.
@Override
public void setNoflush(int index, Binding rcb, Object rcv)
throws AccessorException {
- assert b.isOpen();\r
+ assert b.isOpen();
writeLock();
try {
- \r
+
// Write
Serializer rcs = params.serializerScheme.getSerializer( rcb );
long pos = getStartPosition(index);
b.position(pos);
rcs.serialize(b, null, rcv);
- // Update Blobs\r
+ // Update Blobs
/*
- BinaryObject sa = getExistingAccessor(index);\r
+ BinaryObject sa = getExistingAccessor(index);
if (sa!=null && newSize != oldSize) {
sa.b.setPositionInSource(pos, newSize);
}*/
throw new AccessorException(e);
} catch (AdaptException e) {
throw new AccessorException(e);
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException(e);\r
- } finally {\r
- writeUnlock();\r
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException(e);
+ } finally {
+ writeUnlock();
}
}
*/
@Override
public void setValueNoflush(Binding arrayBinding, Object newArray)
- throws AccessorException {\r
- assert b.isOpen();\r
+ throws AccessorException {
+ assert b.isOpen();
writeLock();
try {
// Write
//long endPos = b.position();
//long len = endPos - startPos;
- // update location\r
+ // update location
/*
BinaryObject sa = getExistingAccessor(index);
if (sa!=null) {
throw new AccessorException(e);
} catch (AdaptException e) {
throw new AccessorException(e);
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException(e);\r
- } finally {\r
- writeUnlock(); \r
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException(e);
+ } finally {
+ writeUnlock();
}
}
@Override
- public void addNoflush(int index, Binding rcb, Object rcv) throws AccessorException {\r
- assert b.isOpen();\r
+ public void addNoflush(int index, Binding rcb, Object rcv) throws AccessorException {
+ assert b.isOpen();
writeLock();
try {
Serializer rcs = params.serializerScheme.getSerializer( rcb );
boolean lastEntry = index == oldCount;
if (index>oldCount) throw new AccessorException("Index out of range");
int newCount = oldCount +1;
- b.position(0L);\r
+ b.position(0L);
b.writeInt(newCount);
long pos = getStartPosition(index);
throw new AccessorException(e);
} catch (AdaptException e) {
throw new AccessorException(e);
- } catch (SerializerConstructionException e) { \r
- throw new AccessorException(e);\r
- } finally {\r
- writeUnlock();\r
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException(e);
+ } finally {
+ writeUnlock();
}
}
@Override
public void addAllNoflush(int index, Binding rcb, Object[] rcvs)
throws AccessorException {
- if (index<0||index>size()) throw new AccessorException("Index out of bounds");\r
- assert b.isOpen();\r
+ if (index<0||index>size()) throw new AccessorException("Index out of bounds");
+ assert b.isOpen();
writeLock();
try {
Serializer rcs = params.serializerScheme.getSerializer( rcb );
int oldCount = b.readInt();
int newCount = oldCount + rcvs.length;
if (index>oldCount) throw new AccessorException("Index out of range");
- b.position(0L);\r
+ b.position(0L);
b.writeInt(newCount);
boolean lastEntry = index == oldCount;
if (cis != null) {
Accessor sa = getAccessor(i);
}
- }\r
+ }
*/
}
throw new AccessorException(e);
} catch (AdaptException e) {
throw new AccessorException(e);
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException(e);\r
- } finally {\r
- writeUnlock();\r
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException(e);
+ } finally {
+ writeUnlock();
+ }
+ }
+
+ void addRepeatNoflush(int index, Binding rcb, Object obj, int repeatCount) throws AccessorException {
+ if (index<0||index>size()) throw new AccessorException("Index out of bounds");
+ assert b.isOpen();
+ writeLock();
+ try {
+ Serializer rcs = params.serializerScheme.getSerializer( rcb );
+ // Write
+ b.position(0L);
+ int oldCount = b.readInt();
+ int newCount = oldCount + repeatCount;
+ if (index>oldCount) throw new AccessorException("Index out of range");
+ b.position(0L);
+ b.writeInt(newCount);
+ boolean lastEntry = index == oldCount;
+
+ int size = rcs.getSize(obj) * repeatCount;
+ long pos = getStartPosition(index);
+ b.position(pos);
+ b.insertBytes(size, ByteSide.Right);
+
+ b.position(pos);
+ for (int i=0; i<repeatCount; i++) {
+ rcs.serialize(b, obj);
+ }
+
+ // Update child map keys
+ if (!lastEntry && !children.isEmpty()) {
+ Integer key = children.lastKey();
+ while (key!=null && key >= index) {
+ java.lang.ref.Reference<BinaryObject> value = children.remove(key);
+ if (value.get()!=null) children.put(key+repeatCount, value);
+ key = children.lowerKey(key);
+ }
+ }
+
+ // Notify Listeners
+ ListenerEntry le = listeners;
+ while (le!=null) {
+ ArrayInterestSet is = le.getInterestSet();
+ if (is.inNotifications()) {
+ for (int i=0; i<repeatCount; i++) {
+ MutableVariant newValue = null;
+ if (is.inValues()) newValue = new MutableVariant(rcb, obj/*rcb.isImmutable() ? obj : cb.clone(obj)*/);
+ ArrayElementAdded e = new ArrayElementAdded(index, newValue);
+ emitEvent(le, e);
+ }
+ }
+
+ // Update indices of interest sets
+ if (is.componentInterests!=null) {
+ Map<Integer, InterestSet> oldCis = is.componentInterests;
+ boolean needUpdates = false;
+ for (Integer i : oldCis.keySet()) {
+ needUpdates |= i>=index;
+ if (needUpdates) break;
+ }
+
+ if (needUpdates) {
+ Map<Integer, InterestSet> newCis = new HashMap<Integer, InterestSet>(oldCis.size());
+ for (Integer i : oldCis.keySet())
+ {
+ Integer oldKey = i;
+ Integer newKey = i>=index ? i+repeatCount : i;
+ InterestSet oldValue = oldCis.get(oldKey);
+ newCis.put(newKey, oldValue);
+ }
+ is.componentInterests = newCis;
+ }
+
+ }
+
+ le = le.next;
+ }
+
+ } catch (IOException e) {
+ throw new AccessorException(e);
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException(e);
+ } finally {
+ writeUnlock();
}
}
-\r
- void addRepeatNoflush(int index, Binding rcb, Object obj, int repeatCount) throws AccessorException {\r
- if (index<0||index>size()) throw new AccessorException("Index out of bounds");\r
- assert b.isOpen();\r
- writeLock();\r
- try {\r
- Serializer rcs = params.serializerScheme.getSerializer( rcb ); \r
- // Write \r
- b.position(0L);\r
- int oldCount = b.readInt();\r
- int newCount = oldCount + repeatCount;\r
- if (index>oldCount) throw new AccessorException("Index out of range");\r
- b.position(0L);\r
- b.writeInt(newCount);\r
- boolean lastEntry = index == oldCount;\r
- \r
- int size = rcs.getSize(obj) * repeatCount;\r
- long pos = getStartPosition(index);\r
- b.position(pos);\r
- b.insertBytes(size, ByteSide.Right);\r
- \r
- b.position(pos);\r
- for (int i=0; i<repeatCount; i++) {\r
- rcs.serialize(b, obj); \r
- }\r
- \r
- // Update child map keys\r
- if (!lastEntry && !children.isEmpty()) {\r
- Integer key = children.lastKey();\r
- while (key!=null && key >= index) {\r
- java.lang.ref.Reference<BinaryObject> value = children.remove(key);\r
- if (value.get()!=null) children.put(key+repeatCount, value);\r
- key = children.lowerKey(key);\r
- }\r
- }\r
- \r
- // Notify Listeners\r
- ListenerEntry le = listeners;\r
- while (le!=null) { \r
- ArrayInterestSet is = le.getInterestSet();\r
- if (is.inNotifications()) {\r
- for (int i=0; i<repeatCount; i++) {\r
- MutableVariant newValue = null;\r
- if (is.inValues()) newValue = new MutableVariant(rcb, obj/*rcb.isImmutable() ? obj : cb.clone(obj)*/); \r
- ArrayElementAdded e = new ArrayElementAdded(index, newValue);\r
- emitEvent(le, e);\r
- }\r
- }\r
- \r
- // Update indices of interest sets\r
- if (is.componentInterests!=null) {\r
- Map<Integer, InterestSet> oldCis = is.componentInterests;\r
- boolean needUpdates = false;\r
- for (Integer i : oldCis.keySet()) {\r
- needUpdates |= i>=index;\r
- if (needUpdates) break;\r
- }\r
- \r
- if (needUpdates) {\r
- Map<Integer, InterestSet> newCis = new HashMap<Integer, InterestSet>(oldCis.size()); \r
- for (Integer i : oldCis.keySet())\r
- {\r
- Integer oldKey = i;\r
- Integer newKey = i>=index ? i+repeatCount : i;\r
- InterestSet oldValue = oldCis.get(oldKey);\r
- newCis.put(newKey, oldValue); \r
- }\r
- is.componentInterests = newCis;\r
- }\r
- \r
- }\r
- \r
- le = le.next;\r
- }\r
- \r
- } catch (IOException e) {\r
- throw new AccessorException(e);\r
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException(e);\r
- } finally {\r
- writeUnlock();\r
- }\r
- }\r
@Override
- public void removeNoflush(int index, int count) throws AccessorException {\r
- assert b.isOpen();\r
+ public void removeNoflush(int index, int count) throws AccessorException {
+ assert b.isOpen();
writeLock();
try {
// Write
} catch (IOException e) {
throw new AccessorException( e );
- } finally {\r
- writeUnlock();\r
+ } finally {
+ writeUnlock();
}
}
@Override
- public Object get(int index, Binding valueBinding) throws AccessorException {\r
- assert b.isOpen();\r
+ public Object get(int index, Binding valueBinding) throws AccessorException {
+ assert b.isOpen();
readLock();
try {
long pos = getStartPosition(index);
- b.position(pos);\r
+ b.position(pos);
Serializer s = params.serializerScheme.getSerializer(valueBinding);
return s.deserialize(b);
} catch (IOException e) {
throw new AccessorException(e);
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException(e);\r
- } finally {\r
- readUnlock();\r
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException(e);
+ } finally {
+ readUnlock();
+ }
+ }
+
+ @Override
+ public void get(int index, Binding valueBinding, Object dst) throws AccessorException {
+ assert b.isOpen();
+ readLock();
+ try {
+ long pos = getStartPosition(index);
+ b.position(pos);
+ Serializer s = params.serializerScheme.getSerializer(valueBinding);
+ s.deserializeTo(b, dst);
+ } catch (IOException e) {
+ throw new AccessorException(e);
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException(e);
+ } finally {
+ readUnlock();
}
}
-\r
- @Override\r
- public void get(int index, Binding valueBinding, Object dst) throws AccessorException {\r
- assert b.isOpen();\r
- readLock();\r
- try {\r
- long pos = getStartPosition(index);\r
- b.position(pos);\r
- Serializer s = params.serializerScheme.getSerializer(valueBinding);\r
- s.deserializeTo(b, dst);\r
- } catch (IOException e) {\r
- throw new AccessorException(e);\r
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException(e);\r
- } finally {\r
- readUnlock();\r
- }\r
- }\r
-\r
+
@SuppressWarnings("unchecked")
@Override
public <T extends Accessor> T getAccessor(int index)
- throws AccessorConstructionException {\r
- assert b.isOpen();\r
+ throws AccessorConstructionException {
+ assert b.isOpen();
readLock();
try {
b.position(0L);
throw new AccessorConstructionException(e);
} catch (AccessorException e) {
throw new AccessorConstructionException(e);
- } finally {\r
- readUnlock();\r
+ } finally {
+ readUnlock();
}
}
public <T extends Accessor> T getComponent(ChildReference reference)
throws AccessorConstructionException {
if (reference==null) return (T) this;
- if (reference instanceof LabelReference) {\r
- LabelReference lr = (LabelReference) reference;\r
- try {\r
- Integer index = new Integer( lr.label );\r
- Accessor result = getAccessor(index);\r
- if (reference.getChildReference() != null)\r
- result = result.getComponent(reference.getChildReference());\r
- return (T) result;\r
- } catch ( NumberFormatException nfe ) {\r
- throw new ReferenceException(nfe);\r
- } \r
+ if (reference instanceof LabelReference) {
+ LabelReference lr = (LabelReference) reference;
+ try {
+ Integer index = new Integer( lr.label );
+ Accessor result = getAccessor(index);
+ if (reference.getChildReference() != null)
+ result = result.getComponent(reference.getChildReference());
+ return (T) result;
+ } catch ( NumberFormatException nfe ) {
+ throw new ReferenceException(nfe);
+ }
} else if (reference instanceof IndexReference) {
IndexReference ref = (IndexReference) reference;
int index = ref.getIndex();
@Override
public void getAll(Binding valueBinding, Object[] array)
- throws AccessorException {\r
- assert b.isOpen();\r
+ throws AccessorException {
+ assert b.isOpen();
readLock();
try {
b.position(0L);
int size = b.readInt();
- if (size > array.length) throw new AccessorException("Argument array too short");\r
+ if (size > array.length) throw new AccessorException("Argument array too short");
Serializer s = params.serializerScheme.getSerializer(valueBinding);
for (int i=0; i<size; i++) {
array[i] = s.deserialize(b);
}
} catch (IOException e) {
throw new AccessorException( e );
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException( e );\r
- } finally {\r
- readUnlock();\r
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException( e );
+ } finally {
+ readUnlock();
}
}
@Override
public void getAll(Binding valueBinding, Collection<Object> values)
- throws AccessorException {\r
- assert b.isOpen();\r
+ throws AccessorException {
+ assert b.isOpen();
readLock();
try {
b.position(0L);
- int size = b.readInt();\r
+ int size = b.readInt();
Serializer s = params.serializerScheme.getSerializer(valueBinding);
for (int i=0; i<size; i++) {
values.add( s.deserialize(b) );
}
} catch (IOException e) {
throw new AccessorException( e );
- } catch (SerializerConstructionException e) {\r
- throw new AccessorException( e );\r
- } finally {\r
- readUnlock();\r
+ } catch (SerializerConstructionException e) {
+ throw new AccessorException( e );
+ } finally {
+ readUnlock();
}
}
- @Override\r
- public void setSizeNoflush(int newSize) throws AccessorException {\r
- assert b.isOpen();\r
- writeLock();\r
- try {\r
- int oldSize = size();\r
-\r
- // Remove instances \r
- if (newSize<oldSize) {\r
- remove(newSize, oldSize-newSize);\r
- }\r
- \r
- // Add dummy instances\r
- if (newSize>oldSize) {\r
- Object dummy = cb.createDefault();\r
- int count = newSize-oldSize;\r
- addRepeatNoflush(oldSize, cb, dummy, count);\r
- }\r
- \r
- } catch (BindingException e) {\r
- throw new AccessorException( e );\r
- } finally {\r
- writeUnlock();\r
- }\r
+ @Override
+ public void setSizeNoflush(int newSize) throws AccessorException {
+ assert b.isOpen();
+ writeLock();
+ try {
+ int oldSize = size();
+
+ // Remove instances
+ if (newSize<oldSize) {
+ remove(newSize, oldSize-newSize);
+ }
+
+ // Add dummy instances
+ if (newSize>oldSize) {
+ Object dummy = cb.createDefault();
+ int count = newSize-oldSize;
+ addRepeatNoflush(oldSize, cb, dummy, count);
+ }
+
+ } catch (BindingException e) {
+ throw new AccessorException( e );
+ } finally {
+ writeUnlock();
+ }
+ }
+
+ @Override
+ public void setSize(int newSize) throws AccessorException {
+ assert b.isOpen();
+ writeLock();
+ try {
+ setSizeNoflush(newSize);
+ b.flush();
+ } catch (IOException e) {
+ throw new AccessorException( e );
+ } finally {
+ writeUnlock();
+ }
}
-\r
- @Override\r
- public void setSize(int newSize) throws AccessorException {\r
- assert b.isOpen();\r
- writeLock();\r
- try {\r
- setSizeNoflush(newSize);\r
- b.flush();\r
- } catch (IOException e) {\r
- throw new AccessorException( e );\r
- } finally {\r
- writeUnlock();\r
- }\r
- }\r
@Override
- public int size() throws AccessorException {\r
- assert b.isOpen();\r
+ public int size() throws AccessorException {
+ assert b.isOpen();
readLock();
try {
b.position(0L);
- int size = b.readInt();\r
- if (size<0) throw new AccessorException("Malformed file");\r
+ int size = b.readInt();
+ if (size<0) throw new AccessorException("Malformed file");
return size;
} catch (IOException e) {
throw new AccessorException( e );
- } finally {\r
- readUnlock();\r
+ } finally {
+ readUnlock();
}
}
@Override
Event applyLocal(Event e, boolean makeRollback) throws AccessorException {
- Event rollback = null;\r
- if (e instanceof ValueAssigned) {\r
- ValueAssigned va = (ValueAssigned) e;\r
- if (makeRollback) rollback = new ValueAssigned(cb, getValue(cb)); \r
- setValueNoflush(va.newValue.getBinding(), va.newValue.getValue());\r
+ Event rollback = null;
+ if (e instanceof ValueAssigned) {
+ ValueAssigned va = (ValueAssigned) e;
+ if (makeRollback) rollback = new ValueAssigned(cb, getValue(cb));
+ setValueNoflush(va.newValue.getBinding(), va.newValue.getValue());
} else
if (e instanceof ArrayElementAdded) {
ArrayElementAdded aa = (ArrayElementAdded) e;
@Override
- public void add(Binding binding, Object value) throws AccessorException {\r
- assert b.isOpen();\r
- writeLock();\r
+ public void add(Binding binding, Object value) throws AccessorException {
+ assert b.isOpen();
+ writeLock();
try {
addNoflush(binding, value);
b.flush();
} catch (IOException e) {
throw new AccessorException( e );
- } finally {\r
- writeUnlock();\r
+ } finally {
+ writeUnlock();
}
}
@Override
public void add(int index, Binding binding, Object value)
- throws AccessorException {\r
- assert b.isOpen();\r
- writeLock();\r
+ throws AccessorException {
+ assert b.isOpen();
+ writeLock();
try {
addNoflush(index, binding, value);
b.flush();
} catch (IOException e) {
throw new AccessorException( e );
- } finally {\r
- writeUnlock();\r
+ } finally {
+ writeUnlock();
}
}
@Override
public void addAll(Binding binding, Object[] values)
- throws AccessorException {\r
- assert b.isOpen();\r
+ throws AccessorException {
+ assert b.isOpen();
writeLock();
try {
addAllNoflush(binding, values);
b.flush();
} catch (IOException e) {
throw new AccessorException( e );
- } finally {\r
- writeUnlock();\r
+ } finally {
+ writeUnlock();
}
}
@Override
public void addAll(int index, Binding binding, Object[] values)
- throws AccessorException {\r
- assert b.isOpen();\r
+ throws AccessorException {
+ assert b.isOpen();
writeLock();
try {
addAllNoflush(index, binding, values);
b.flush();
} catch (IOException e) {
throw new AccessorException( e );
- } finally {\r
- writeUnlock(); \r
+ } finally {
+ writeUnlock();
}
}
@Override
- public void remove(int index, int count) throws AccessorException {\r
- assert b.isOpen();\r
+ public void remove(int index, int count) throws AccessorException {
+ assert b.isOpen();
writeLock();
try {
removeNoflush(index, count);
b.flush();
} catch (IOException e) {
throw new AccessorException( e );
- } finally {\r
- writeUnlock();\r
+ } finally {
+ writeUnlock();
}
}
@Override
public void set(int index, Binding binding, Object value)
- throws AccessorException {\r
- assert b.isOpen();\r
+ throws AccessorException {
+ assert b.isOpen();
writeLock();
try {
setNoflush(index, binding, value);
b.flush();
} catch (IOException e) {
throw new AccessorException(e);
- } finally {\r
- writeUnlock();\r
+ } finally {
+ writeUnlock();
}
}