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

Method toComponentPosition

output/java/1.4.13/STViz.java:346–356  ·  view source on GitHub ↗
(JTextComponent component, int position)

Source from the content-addressed store, hash-verified

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