@@ -2460,7 +2460,7 @@ public ITsString LongNameSortedTSS
24602460 {
24612461 get
24622462 {
2463- return GetFeatureValueStringSorted ( ) ;
2463+ return GetFeatureValueString ( true ) ;
24642464 }
24652465 }
24662466 /// <summary>
@@ -2494,17 +2494,6 @@ private ITsString GetFeatureValueString(bool fLongForm)
24942494 return tisb . GetString ( ) ;
24952495 }
24962496
2497- private ITsString GetFeatureValueStringSorted ( )
2498- {
2499- var tisb = TsStringUtils . MakeIncStrBldr ( ) ;
2500- tisb . SetIntPropValues ( ( int ) FwTextPropType . ktptWs ,
2501- 0 , Cache . DefaultAnalWs ) ;
2502- var sFeature = GetFeatureString ( true ) ;
2503- tisb . Append ( sFeature ) ;
2504- tisb . AppendTsString ( ( ValueOA as FsFeatStruc ) . GetFeatureValueStringSorted ( ) ) ;
2505- return tisb . GetString ( ) ;
2506- }
2507-
25082497 private string GetValueString ( bool fLongForm )
25092498 {
25102499 var sValue = "" ;
@@ -3794,7 +3783,7 @@ public ITsString LongNameSortedTSS
37943783 {
37953784 get
37963785 {
3797- return GetFeatureValueStringSorted ( ) ;
3786+ return GetFeatureValueString ( true ) ;
37983787 }
37993788 }
38003789 /// <summary>
@@ -3947,7 +3936,10 @@ private ITsString GetFeatureValueString(bool fLongForm)
39473936 tisb . Append ( "[" ) ;
39483937 }
39493938 var count = 0 ;
3950- foreach ( var spec in FeatureSpecsOC )
3939+ var sortedSpecs = from s in FeatureSpecsOC
3940+ orderby FeatureSpecKey ( s )
3941+ select s ;
3942+ foreach ( var spec in sortedSpecs )
39513943 {
39523944 if ( count ++ > 0 )
39533945 {
@@ -3994,56 +3986,25 @@ private ITsString GetFeatureValueString(bool fLongForm)
39943986 return tisb . GetString ( ) ;
39953987 }
39963988
3997- internal ITsString GetFeatureValueStringSorted ( )
3989+ private string FeatureSpecKey ( IFsFeatureSpecification spec )
39983990 {
3999- var tisb = TsStringUtils . MakeIncStrBldr ( ) ;
4000- var iCount = FeatureSpecsOC . Count ;
4001- if ( iCount > 0 )
3991+ // specs with features in the type go first (because they begin with 0),
3992+ // then specs with features (because they begin with 1),
3993+ // then specs without features (because they begin with 2).
3994+ if ( spec . FeatureRA == null )
3995+ return "2" + spec . Guid . ToString ( ) ;
3996+ if ( TypeRA != null )
40023997 {
4003- tisb . SetIntPropValues ( ( int ) FwTextPropType . ktptWs , ( int ) FwTextPropVar . ktpvDefault ,
4004- m_cache . DefaultAnalWs ) ;
4005- tisb . Append ( "[" ) ;
4006- }
4007- var count = 0 ;
4008- var sortedSpecs = from s in FeatureSpecsOC
4009- orderby s . FeatureRA . Name . BestAnalysisAlternative . Text
4010- select s ;
4011- foreach ( var spec in sortedSpecs )
4012- {
4013- if ( count ++ > 0 )
4014- {
4015- tisb . SetIntPropValues ( ( int ) FwTextPropType . ktptWs , ( int ) FwTextPropVar . ktpvDefault ,
4016- m_cache . DefaultAnalWs ) ;
4017- tisb . Append ( " " ) ; // insert space except for first item
4018- }
4019- var cv = spec as IFsClosedValue ;
4020- if ( cv != null )
4021- {
4022- tisb . AppendTsString ( ( cv as FsClosedValue ) . LongNameTSS ) ;
4023- }
4024- else
3998+ int index = TypeRA . FeaturesRS . IndexOf ( spec . FeatureRA ) ;
3999+ if ( index >= 0 )
40254000 {
4026- var complex = spec as IFsComplexValue ;
4027- if ( complex != null )
4028- {
4029- tisb . AppendTsString ( ( complex as FsComplexValue ) . LongNameSortedTSS ) ;
4030- }
4001+ // This won't work properly if there are more than 999 features in TypeRA.
4002+ return index . ToString ( "0000" ) ;
40314003 }
40324004 }
4033- if ( iCount > 0 )
4034- {
4035- tisb . SetIntPropValues ( ( int ) FwTextPropType . ktptWs , ( int ) FwTextPropVar . ktpvDefault ,
4036- m_cache . DefaultAnalWs ) ;
4037- tisb . Append ( "]" ) ;
4038- }
4039- if ( tisb . Text == null )
4040- {
4041- // Ensure that we have a ws for the empty string! See FWR-1122.
4042- tisb . SetIntPropValues ( ( int ) FwTextPropType . ktptWs , ( int ) FwTextPropVar . ktpvDefault ,
4043- m_cache . DefaultAnalWs ) ;
4044- }
4045- return tisb . GetString ( ) ;
4005+ return "1" + spec . FeatureRA . Name . BestAnalysisAlternative . Text ;
40464006 }
4007+
40474008 /// <summary>
40484009 /// Provide a "Name" for this (is a long name)
40494010 /// </summary>
0 commit comments