MCPcopy Create free account
hub / github.com/boxbeam/RedLib / splitOnComma

Method splitOnComma

src/redempt/redlib/config/ConfigType.java:61–89  ·  view source on GitHub ↗
(String str, int start, int end)

Source from the content-addressed store, hash-verified

59 }
60
61 private static List<String> splitOnComma(String str, int start, int end) {
62 int depth = 0;
63 StringBuilder current = new StringBuilder();
64 List<String> split = new ArrayList<>();
65 for (int i = start; i < end; i++) {
66 char c = str.charAt(i);
67 switch (c) {
68 case '<':
69 depth++;
70 break;
71 case '>':
72 depth--;
73 break;
74 case ',':
75 if (depth != 0) {
76 break;
77 }
78 split.add(current.toString().trim());
79 current = new StringBuilder();
80 continue;
81 }
82 current.append(c);
83 }
84 String last = current.toString().trim();
85 if (last.length() != 0) {
86 split.add(last);
87 }
88 return split;
89 }
90
91 /**
92 * Constructs a ConfigType from a base class type and a list of component ConfigTypes

Callers 1

createMethod · 0.95

Calls 4

appendMethod · 0.80
toStringMethod · 0.65
addMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected