MCPcopy Create free account
hub / github.com/antlr/codebuff / toComponentPosition

Method toComponentPosition

output/java8/1.4.12/STViz.java:347–357  ·  view source on GitHub ↗
(JTextComponent component, int position)

Source from the content-addressed store, hash-verified

345 }
346
347 protected int toComponentPosition(JTextComponent component, int position) {
348 int[] windowsLineEndings = (int[])component.getDocument().getProperty(WINDOWS_LINE_ENDINGS);
349 if ( windowsLineEndings==null || windowsLineEndings.length==0 ) {
350 return position;
351 }
352 int index = Arrays.binarySearch(windowsLineEndings, position);
353 if ( index>=0 ) {
354 return position-index;
355 }
356 return position-(-index-1);
357 }
358
359 protected int toEventPosition(JTextComponent component, int position) {
360 int result = position;

Callers 2

toEventPositionMethod · 0.95
highlightMethod · 0.95

Calls 2

getPropertyMethod · 0.65
binarySearchMethod · 0.45

Tested by

no test coverage detected