}
return index;
}
protected IndexItem insert(int insertPos,Object value){
IndexItem index=null;
try{
if(value!=null){
StoreLocation data=dataManager.storeDataItem(marshaller,value);
index=indexManager.createNewIndex();
index.setValueData(data);
IndexItem prev=null;
IndexItem next=null;
if(insertPos<=0){
prev=root;
next=indexList.getNextEntry(root);
}else if(insertPos>=indexList.size()){
prev=indexList.getLast();
next=null;
}else{
prev=indexList.get(insertPos);
prev=prev!=null?prev:root;
next=indexList.getNextEntry(prev);
}
prev.setNextItem(index.getOffset());
index.setPreviousItem(prev.getOffset());
updateIndexes(prev);
if(next!=null){
next.setPreviousItem(index.getOffset());
index.setNextItem(next.getOffset());
updateIndexes(next);
}
storeIndex(index);
}
}catch(IOException e){