if ( parentId.equals( Partition.ROOT_ID ) )
{
return;
}
ParentIdAndRdn parent = rdnIdx.reverseLookup( parentId );
while ( parent != null )
{
if ( isFirst )
{
if ( addRemove == ADD_CHILD )
{
parent.setNbChildren( parent.getNbChildren() + 1 );
}
else
{
parent.setNbChildren( parent.getNbChildren() - 1 );
}
isFirst = false;
}
if ( addRemove == ADD_CHILD )
{
parent.setNbDescendants( parent.getNbDescendants() + ( nbDescendant + 1 ) );
}
else
{
parent.setNbDescendants( parent.getNbDescendants() - ( nbDescendant + 1 ) );
}
// Inject the modified element into the index
// we first need to drop it so that the key can be replaced
rdnIdx.drop( parentId );
rdnIdx.add( parent, parentId );
parentId = parent.getParentId();
parent = rdnIdx.reverseLookup( parentId );
}
}