private void addInternal(final PendingChange newPendingChange){
  Check.notNull(newPendingChange,"newPendingChange");
  Check.notNull(newPendingChange.getServerItem(),"newPendingChange.serverItem");
  final String serverPath=ServerPath.canonicalize(newPendingChange.getServerItem());
  final String[] serverHierarchy=ServerPath.getHierarchy(serverPath);
  String localPath=null;
  String[] localHierarchy=null;
  if (newPendingChange.getLocalItem() != null) {
    localPath=LocalPath.canonicalize(newPendingChange.getLocalItem());
    localHierarchy=LocalPath.getHierarchy(localPath);
  }
  changesByServerPath.put(serverPath,newPendingChange);
  for (int i=0; i < serverHierarchy.length; i++) {
    Set<PendingChange> changesForPath=changesByParentServerPath.get(serverHierarchy[i]);
    if (changesForPath == null) {
      changesForPath=new HashSet<PendingChange>();
      changesByParentServerPath.put(serverHierarchy[i],changesForPath);
    }
    changesForPath.add(newPendingChange);
  }
  if (localPath != null) {
    changesByLocalPath.put(localPath,newPendingChange);
    for (int i=0; i < localHierarchy.length; i++) {
      Set<PendingChange> changesForPath=changesByParentLocalPath.get(localHierarchy[i]);
      if (changesForPath == null) {
        changesForPath=new HashSet<PendingChange>();
        changesByParentLocalPath.put(localHierarchy[i],changesForPath);
      }
      changesForPath.add(newPendingChange);
    }
  }
}

private void addInternal ( final PendingChange newPendingChange ) { Check . notNull ( newPendingChange , "newPendingChange" ) ; Check . notNull ( newPendingChange . getServerItem ( ) , "newPendingChange.serverItem" ) ; final String serverPath = ServerPath . canonicalize ( newPendingChange . getServerItem ( ) ) ; final String [ ] serverHierarchy = ServerPath . getHierarchy ( serverPath ) ; String localPath = null ; String [ ] localHierarchy = null ; if ( newPendingChange . getLocalItem ( ) != null ) { localPath = LocalPath . canonicalize ( newPendingChange . getLocalItem ( ) ) ; localHierarchy = LocalPath . getHierarchy ( localPath ) ; } changesByServerPath . put ( serverPath , newPendingChange ) ; for ( int i = 0 ; i < serverHierarchy . length ; i ++ ) { Set < PendingChange > changesForPath = changesByParentServerPath . get ( serverHierarchy [ i ] ) ; if ( changesForPath == null ) { changesForPath = new HashSet < PendingChange > ( ) ; changesByParentServerPath . put ( serverHierarchy [ i ] , changesForPath ) ; } changesForPath . add ( newPendingChange ) ; } if ( localPath != null ) { changesByLocalPath . put ( localPath , newPendingChange ) ; for ( int i = 0 ; i < localHierarchy . length ; i ++ ) { Set < PendingChange > changesForPath = changesByParentLocalPath . get ( localHierarchy [ i ] ) ; if ( changesForPath == null ) { changesForPath = new HashSet < PendingChange > ( ) ; changesByParentLocalPath . put ( localHierarchy [ i ] , changesForPath ) ; } changesForPath . add ( newPendingChange ) ; } } }
only adds the pending changes to the maps . you must acquire the lock before calling this method .
