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

Method init

basex-core/src/main/java/org/basex/util/InputInfo.java:101–113  ·  view source on GitHub ↗

Calculates the column and line number in a string.

()

Source from the content-addressed store, hash-verified

99 * Calculates the column and line number in a string.
100 */
101 private void init() {
102 // positions have already been calculated
103 if(line != 0) return;
104
105 final int cl = Math.min(column, input.length);
106 int l = 1, c = 1;
107 for(int i = 0; i < cl; i++) {
108 final int cp = input[i];
109 if(cp == '\n') { l++; c = 1; } else { c++; }
110 }
111 line = l;
112 column = c;
113 }
114
115 /**
116 * Returns the check flag (invoked by {@link QueryError#get(InputInfo, Object...)}).

Callers 2

lineMethod · 0.95
columnMethod · 0.95

Calls 1

minMethod · 0.45

Tested by

no test coverage detected