Rearranged methods to follow common structure.

This commit is contained in:
Evgeny Gerashchenko
2013-01-22 21:21:43 +04:00
parent 9cd67dfc5c
commit 797b961484
4 changed files with 28 additions and 28 deletions
+7 -7
View File
@@ -79,6 +79,13 @@ public final class ByteRange implements Range<Byte>, ByteIterable {
return result; return result;
} }
public ByteIterator step(int step) {
if (step < 0)
return new ByteIteratorImpl(getEnd(), -count, -step);
else
return new ByteIteratorImpl(start, count, step);
}
public boolean getIsReversed() { public boolean getIsReversed() {
return count < 0; return count < 0;
} }
@@ -95,13 +102,6 @@ public final class ByteRange implements Range<Byte>, ByteIterable {
return count < 0 ? -count : count; return count < 0 ? -count : count;
} }
public ByteIterator step(int step) {
if (step < 0)
return new ByteIteratorImpl(getEnd(), -count, -step);
else
return new ByteIteratorImpl(start, count, step);
}
@Override @Override
public ByteIterator iterator() { public ByteIterator iterator() {
return new ByteIteratorImpl(start, count, 1); return new ByteIteratorImpl(start, count, 1);
+7 -7
View File
@@ -79,6 +79,13 @@ public final class CharRange implements Range<Character>, CharIterable {
return result; return result;
} }
public CharIterator step(int step) {
if (step < 0)
return new CharIteratorImpl(getEnd(), -count, -step);
else
return new CharIteratorImpl(start, count, step);
}
public boolean getIsReversed() { public boolean getIsReversed() {
return count < 0; return count < 0;
} }
@@ -95,13 +102,6 @@ public final class CharRange implements Range<Character>, CharIterable {
return count < 0 ? -count : count; return count < 0 ? -count : count;
} }
public CharIterator step(int step) {
if (step < 0)
return new CharIteratorImpl(getEnd(), -count, -step);
else
return new CharIteratorImpl(start, count, step);
}
@Override @Override
public CharIterator iterator() { public CharIterator iterator() {
return new CharIteratorImpl(start, count, 1); return new CharIteratorImpl(start, count, 1);
+7 -7
View File
@@ -44,13 +44,6 @@ public final class LongRange implements Range<Long>, LongIterable {
} }
public LongIterator step(long step) {
if (step < 0)
return new LongIteratorImpl(getEnd(), -count, -step);
else
return new LongIteratorImpl(start, count, step);
}
@Override @Override
public boolean contains(Long item) { public boolean contains(Long item) {
if (item == null) return false; if (item == null) return false;
@@ -87,6 +80,13 @@ public final class LongRange implements Range<Long>, LongIterable {
return result; return result;
} }
public LongIterator step(long step) {
if (step < 0)
return new LongIteratorImpl(getEnd(), -count, -step);
else
return new LongIteratorImpl(start, count, step);
}
public boolean getIsReversed() { public boolean getIsReversed() {
return count < 0; return count < 0;
} }
+7 -7
View File
@@ -43,13 +43,6 @@ public final class ShortRange implements Range<Short>, ShortIterable {
} }
} }
public ShortIterator step(int step) {
if (step < 0)
return new ShortIteratorImpl(getEnd(), -count, -step);
else
return new ShortIteratorImpl(start, count, step);
}
@Override @Override
public boolean contains(Short item) { public boolean contains(Short item) {
if (item == null) return false; if (item == null) return false;
@@ -86,6 +79,13 @@ public final class ShortRange implements Range<Short>, ShortIterable {
return result; return result;
} }
public ShortIterator step(int step) {
if (step < 0)
return new ShortIteratorImpl(getEnd(), -count, -step);
else
return new ShortIteratorImpl(start, count, step);
}
public boolean getIsReversed() { public boolean getIsReversed() {
return count < 0; return count < 0;
} }