These three variables are in fact constant and record initial state --
i.e. they shadow two of the method's arguments. So let's remove them
them and create a startLevel variable to hold the initial set.
JIRA: NETCONF-820
Change-Id: Ic31bf706b28c94edd8e63159c62455422b2f890f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
private void parseInput(final @NonNull String input, final @NonNull QNameModule startQNameModule,
final @NonNull DataSchemaContextNode<?> startNode,
final @NonNull List<Set<T>> parsed, final SchemaContext context) {
private void parseInput(final @NonNull String input, final @NonNull QNameModule startQNameModule,
final @NonNull DataSchemaContextNode<?> startNode,
final @NonNull List<Set<T>> parsed, final SchemaContext context) {
+ final Set<T> startLevel = new HashSet<>();
+ parsed.add(startLevel);
+
int currentPosition = 0;
int startPosition = 0;
DataSchemaContextNode<?> currentNode = startNode;
QNameModule currentQNameModule = startQNameModule;
int currentPosition = 0;
int startPosition = 0;
DataSchemaContextNode<?> currentNode = startNode;
QNameModule currentQNameModule = startQNameModule;
-
- Set<T> currentLevel = new HashSet<>();
- parsed.add(currentLevel);
-
- DataSchemaContextNode<?> parenthesisNode = currentNode;
- Set<T> parenthesisLevel = currentLevel;
- QNameModule parenthesisQNameModule = currentQNameModule;
+ Set<T> currentLevel = startLevel;
while (currentPosition < input.length()) {
final char currentChar = input.charAt(currentPosition);
while (currentPosition < input.length()) {
final char currentChar = input.charAt(currentPosition);
currentPosition++;
// next nodes can be placed on already utilized level-s
currentPosition++;
// next nodes can be placed on already utilized level-s
- currentNode = parenthesisNode;
- currentQNameModule = parenthesisQNameModule;
- currentLevel = parenthesisLevel;
+ currentNode = startNode;
+ currentQNameModule = startQNameModule;
+ currentLevel = startLevel;
break;
default:
throw new RestconfDocumentedException(
break;
default:
throw new RestconfDocumentedException(