MCPcopy Create free account
hub / github.com/BaseXdb/basex / addToPath

Method addToPath

basex-core/src/main/java/org/basex/data/MetaData.java:195–209  ·  view source on GitHub ↗

Adds a segment to the path if it is valid. @param sb string builder @param list list of segments @return result flag

(final StringBuilder sb, final StringList list)

Source from the content-addressed store, hash-verified

193 * @return result flag
194 */
195 private static boolean addToPath(final StringBuilder sb, final StringList list) {
196 if(!sb.isEmpty()) {
197 final String segment = sb.toString();
198 if(Strings.endsWith(segment, '.')) {
199 if(!segment.equals(".")) return false;
200 } else if(segment.equals("..")) {
201 if(list.isEmpty()) return false;
202 list.remove(list.size() - 1);
203 } else {
204 list.add(segment);
205 }
206 sb.setLength(0);
207 }
208 return true;
209 }
210
211 /**
212 * Calculates the database size.

Callers 1

normPathMethod · 0.95

Calls 7

endsWithMethod · 0.95
toStringMethod · 0.65
removeMethod · 0.65
sizeMethod · 0.65
addMethod · 0.65
isEmptyMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected