private void recordLocalSymbolInIonRep ( IonStruct ionRep , String symbolName , int sid ) { assert sid >= myFirstLocalSid ; ValueFactory sys = ionRep . getSystem ( ) ; // TODO this is crazy inefficient and not as reliable as it looks // since it doesn't handle the case where's theres more than one list IonValue syms = ionRep . get ( SYMBOLS ) ; while ( syms != null && syms . getType ( ) != IonType . LIST ) { ionRep . remove ( syms ) ; syms = ionRep . get ( SYMBOLS ) ; } if ( syms == null ) { syms = sys . newEmptyList ( ) ; ionRep . put ( SYMBOLS , syms ) ; } int this_offset = sid - myFirstLocalSid ; IonValue name = sys . newString ( symbolName ) ; ( ( IonList ) syms ) . add ( this_offset , name ) ; }
NOT SYNCHRONIZED! Call within constructor or from synched method .