src/share/classes/sun/java2d/Spans.java

Print this page
rev 9629 : 8038644: Fix raw and unchecked warnings in sun.java2d.*
Reviewed-by:

*** 47,57 **** /** * Holds a list of individual * Span instances. */ ! private List mSpans = new Vector(kMaxAddsSinceSort); /** * The number of <code>Span</code> * instances that have been added * to this object without a sort --- 47,57 ---- /** * Holds a list of individual * Span instances. */ ! private List<Span> mSpans = new Vector<>(kMaxAddsSinceSort); /** * The number of <code>Span</code> * instances that have been added * to this object without a sort
*** 142,168 **** private void sortAndCollapse() { Collections.sort(mSpans); mAddsSinceSort = 0; ! Iterator iter = mSpans.iterator(); /* Have 'span' start at the first span in * the collection. The collection may be empty * so we're careful. */ Span span = null; if (iter.hasNext()) { ! span = (Span) iter.next(); } /* Loop over the spans collapsing those that intersect * into a single span. */ while (iter.hasNext()) { ! Span nextSpan = (Span) iter.next(); /* The spans are in ascending start position * order and so the next span's starting point * is either in the span we are trying to grow * or it is beyond the first span and thus the --- 142,168 ---- private void sortAndCollapse() { Collections.sort(mSpans); mAddsSinceSort = 0; ! Iterator<Span> iter = mSpans.iterator(); /* Have 'span' start at the first span in * the collection. The collection may be empty * so we're careful. */ Span span = null; if (iter.hasNext()) { ! span = iter.next(); } /* Loop over the spans collapsing those that intersect * into a single span. */ while (iter.hasNext()) { ! Span nextSpan = iter.next(); /* The spans are in ascending start position * order and so the next span's starting point * is either in the span we are trying to grow * or it is beyond the first span and thus the
*** 200,212 **** // For debugging. private void printSpans() { System.out.println("----------"); if (mSpans != null) { ! Iterator iter = mSpans.iterator(); while (iter.hasNext()) { ! Span span = (Span) iter.next(); System.out.println(span); } } System.out.println("----------"); --- 200,212 ---- // For debugging. private void printSpans() { System.out.println("----------"); if (mSpans != null) { ! Iterator<Span> iter = mSpans.iterator(); while (iter.hasNext()) { ! Span span = iter.next(); System.out.println(span); } } System.out.println("----------");
*** 214,224 **** */ /** * Holds a single half-open interval. */ ! static class Span implements Comparable { /** * The span includes the starting point. */ private float mStart; --- 214,224 ---- */ /** * Holds a single half-open interval. */ ! static class Span implements Comparable<Span> { /** * The span includes the starting point. */ private float mStart;
*** 313,324 **** /** * Rank spans according to their starting * position. The end position is ignored * in this ranking. */ ! public int compareTo(Object o) { ! Span otherSpan = (Span) o; float otherStart = otherSpan.getStart(); int result; if (mStart < otherStart) { result = -1; --- 313,323 ---- /** * Rank spans according to their starting * position. The end position is ignored * in this ranking. */ ! public int compareTo(Span otherSpan) { float otherStart = otherSpan.getStart(); int result; if (mStart < otherStart) { result = -1;
*** 343,353 **** * are deemed equal otherwise they are ranked * by their relative position. Use * <code>SpanIntersection.instance</code> to * get the single instance of this class. */ ! static class SpanIntersection implements Comparator { /** * This class is a Singleton and the following * is the single instance. */ --- 342,352 ---- * are deemed equal otherwise they are ranked * by their relative position. Use * <code>SpanIntersection.instance</code> to * get the single instance of this class. */ ! static class SpanIntersection implements Comparator<Span> { /** * This class is a Singleton and the following * is the single instance. */
*** 359,372 **** */ private SpanIntersection() { } ! public int compare(Object o1, Object o2) { int result; - Span span1 = (Span) o1; - Span span2 = (Span) o2; /* Span 1 is entirely to the left of span2. * span1: <-----< * span2: <-----< */ --- 358,369 ---- */ private SpanIntersection() { } ! public int compare(Span span1, Span span2) { int result; /* Span 1 is entirely to the left of span2. * span1: <-----< * span2: <-----< */