switching back to for loops
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend
index b30c74a..cccad45 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend
@@ -43,12 +43,10 @@
else {
var aggregateSize = 0.0
- var position = 0
- while (position < segmentPosition) {
+ for (position : 0 ..< segmentPosition) {
val segmentId = getIdOfSegmentPosition(position)
val underlyingSegmentPosition = underlyingAxis.getSegmentPositionOfId(segmentId)
aggregateSize = aggregateSize + underlyingAxis.getPixelSizeOfSegmentPosition(underlyingSegmentPosition)
- position = position + 1
}
segmentPositionToStartPixelMap.put(segmentPosition, aggregateSize)
@@ -59,12 +57,10 @@
override getSegmentPositionOfPixelLocation(double pixelLocation) {
if (pixelLocation < 0) return -1
- var segmentPosition = 0
- while (segmentPosition <= segmentCount) {
+ for (segmentPosition : 0 .. segmentCount) {
val startPixel = getStartPixelOfSegmentPosition(segmentPosition)
if (startPixel > pixelLocation)
return segmentPosition - 1
- segmentPosition = segmentPosition + 1
}
return segmentCount
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend
index 7abe9df..a822adc 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend
@@ -29,11 +29,8 @@
def void setUnderlyingAxis(Axis underlyingAxis) {
this.underlyingAxis = underlyingAxis
- var segmentPosition = 0
- while (segmentPosition < underlyingAxis.segmentCount) {
+ for (segmentPosition : 0 ..< underlyingAxis.segmentCount)
reorderedSegmentIds += underlyingAxis.getIdOfSegmentPosition(segmentPosition)
- segmentPosition = segmentPosition + 1
- }
}
// Axis interface
@@ -49,12 +46,10 @@
else {
var aggregateSize = 0.0
- var position = 0
- while (position < segmentPosition) {
+ for (position : 0 ..< segmentPosition) {
val segmentId = reorderedSegmentIds.get(position)
val underlyingSegmentPosition = underlyingAxis.getSegmentPositionOfId(segmentId)
aggregateSize = aggregateSize + underlyingAxis.getPixelSizeOfSegmentPosition(underlyingSegmentPosition)
- position = position + 1
}
segmentPositionToStartPixelMap.put(segmentPosition, aggregateSize)
@@ -65,12 +60,10 @@
override getSegmentPositionOfPixelLocation(double pixelLocation) {
if (pixelLocation < 0) return -1
- var segmentPosition = 0
- while (segmentPosition <= segmentCount) {
+ for (segmentPosition : 0 .. segmentCount) {
val startPixel = getStartPixelOfSegmentPosition(segmentPosition)
if (startPixel > pixelLocation)
return segmentPosition - 1
- segmentPosition = segmentPosition + 1
}
return segmentCount