private static MtasTreeItem getMtasTreeItem ( Long ref , AtomicBoolean isSinglePoint , AtomicBoolean isStoreAdditionalIdAndRef , AtomicLong nodeRefApproxOffset , IndexInput in , long objectRefApproxOffset ) throws IOException { try { Boolean isRoot = false ; if ( nodeRefApproxOffset . get ( ) < 0 ) { isRoot = true ; } in . seek ( ref ) ; if ( isRoot ) { nodeRefApproxOffset . set ( in . readVLong ( ) ) ; Byte flag = in . readByte ( ) ; if ( ( flag & MtasTree . SINGLE_POSITION_TREE ) == MtasTree . SINGLE_POSITION_TREE ) { isSinglePoint . set ( true ) ; } if ( ( flag & MtasTree . STORE_ADDITIONAL_ID ) == MtasTree . STORE_ADDITIONAL_ID ) { isStoreAdditionalIdAndRef . set ( true ) ; } } int left = in . readVInt ( ) ; int right = in . readVInt ( ) ; int max = in . readVInt ( ) ; Long leftChild = in . readVLong ( ) + nodeRefApproxOffset . get ( ) ; Long rightChild = in . readVLong ( ) + nodeRefApproxOffset . get ( ) ; int size = 1 ; if ( ! isSinglePoint . get ( ) ) { size = in . readVInt ( ) ; } // initialize long [ ] objectRefs = new long [ size ] ; int [ ] objectAdditionalIds = null ; long [ ] objectAdditionalRefs = null ; // get first long objectRef = in . readVLong ( ) ; long objectRefPrevious = objectRef + objectRefApproxOffset ; objectRefs [ 0 ] = objectRefPrevious ; if ( isStoreAdditionalIdAndRef . get ( ) ) { objectAdditionalIds = new int [ size ] ; objectAdditionalRefs = new long [ size ] ; objectAdditionalIds [ 0 ] = in . readVInt ( ) ; objectAdditionalRefs [ 0 ] = in . readVLong ( ) ; } // get others for ( int t = 1 ; t < size ; t ++ ) { objectRef = objectRefPrevious + in . readVLong ( ) ; objectRefs [ t ] = objectRef ; objectRefPrevious = objectRef ; if ( isStoreAdditionalIdAndRef . get ( ) ) { objectAdditionalIds [ t ] = in . readVInt ( ) ; objectAdditionalRefs [ t ] = in . readVLong ( ) ; } } return new MtasTreeItem ( left , right , max , objectRefs , objectAdditionalIds , objectAdditionalRefs , ref , leftChild , rightChild ) ; } catch ( Exception e ) { throw new IOException ( e . getMessage ( ) ) ; } }
Gets the mtas tree item .