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

Method toComponentPosition

output/java/1.4.14/STViz.java:348–358  ·  view source on GitHub ↗
(JTextComponent component, int position)

Source from the content-addressed store, hash-verified

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