5 public partial class Matcher {
7 public string[] componentNames;
11 public override string ToString() {
12 if(_toStringCache == null) {
13 var sb =
new StringBuilder();
14 if(_allOfIndices != null) {
15 appendIndices(sb,
"AllOf", _allOfIndices, componentNames);
17 if(_anyOfIndices != null) {
18 if(_allOfIndices != null) {
21 appendIndices(sb,
"AnyOf", _anyOfIndices, componentNames);
23 if(_noneOfIndices != null) {
24 appendIndices(sb,
".NoneOf", _noneOfIndices, componentNames);
26 _toStringCache = sb.ToString();
29 return _toStringCache;
32 static void appendIndices(StringBuilder sb,
string prefix,
int[] indexArray,
string[] componentNames) {
33 const string separator =
", ";
36 var lastSeparator = indexArray.Length - 1;
37 for (
int i = 0; i < indexArray.Length; i++) {
38 var index = indexArray[i];
39 if(componentNames == null) {
42 sb.Append(componentNames[index]);
45 if(i < lastSeparator) {