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

Method toComponentPosition

output/java/1.4.19/STViz.java:351–362  ·  view source on GitHub ↗
(JTextComponent component, int position)

Source from the content-addressed store, hash-verified

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