MCPcopy Index your code
hub / github.com/antlr/codebuff / toComponentPosition

Method toComponentPosition

output/java8/1.4.16/STViz.java:352–363  ·  view source on GitHub ↗
(JTextComponent component, int position)

Source from the content-addressed store, hash-verified

350 }
351
352 protected int toComponentPosition(JTextComponent component, int position) {
353 int[] windowsLineEndings = (int[])component.getDocument().getProperty(WINDOWS_LINE_ENDINGS);
354 if ( windowsLineEndings==null || windowsLineEndings.length==0 ) {
355 return position;
356 }
357
358 int index = Arrays.binarySearch(windowsLineEndings, position);
359 if ( index>=0 ) {
360 return position-index;
361 }
362 return position-(-index-1);
363 }
364
365 protected int toEventPosition(JTextComponent component, int position) {
366 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