Skip to content

Commit

Permalink
0.9.52
Browse files Browse the repository at this point in the history
  • Loading branch information
landawn committed Feb 21, 2017
1 parent a3488fe commit 56d09ef
Show file tree
Hide file tree
Showing 26 changed files with 296 additions and 132 deletions.
8 changes: 6 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@

========Changes in 0.9.52=========================================================================

1, Refactoring: SQLBuilder and CQLBuilder.
1*, Reverse the condition to break the for loop in forEach : forEach(seed, accumulator, conditionToContinue) to forEach(seed, accumulator, conditionToBreak) in DataSet/Stream/N/ObjectList/Seq/Multiset/LongMultiset/Multimap.

3, Improvements and bug fix.
2, Remove type parameter from SQLBuilder and CQLBuilder.

3, Import collapse from StreamEx.

4, Improvements and bug fix.


========Changes in 0.9.51=========================================================================
Expand Down
Binary file modified lib/abacus-util-0.9.52.jar
Binary file not shown.
Binary file modified lib/abacus-util-all-0.9.52.jar
Binary file not shown.
32 changes: 17 additions & 15 deletions src/com/landawn/abacus/DataSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
import java.util.Map;
import java.util.Set;

import com.landawn.abacus.util.Sheet;
import com.landawn.abacus.util.Multimap;
import com.landawn.abacus.util.Multiset;
import com.landawn.abacus.util.ObjectList;
import com.landawn.abacus.util.Optional;
import com.landawn.abacus.util.OptionalDouble;
import com.landawn.abacus.util.OptionalNullable;
import com.landawn.abacus.util.Properties;
import com.landawn.abacus.util.Sheet;
import com.landawn.abacus.util.function.BiFunction;
import com.landawn.abacus.util.function.BiPredicate;
import com.landawn.abacus.util.function.Consumer;
Expand Down Expand Up @@ -850,47 +850,49 @@ public interface DataSet extends Iterable<Object[]> {
*/
void forEach(Collection<String> columnNames, int fromRowIndex, int toRowIndex, Consumer<? super Object[]> action, boolean shareRowArray);

<R> R forEach(R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> predicate);
<R> R forEach(R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> conditionToBreak);

<R> R forEach(R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> predicate, boolean shareRowArray);
<R> R forEach(R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> conditionToBreak, boolean shareRowArray);

<R> R forEach(Collection<String> columnNames, R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> predicate);
<R> R forEach(Collection<String> columnNames, R seed, BiFunction<R, ? super Object[], R> accumulator,
BiPredicate<? super Object[], ? super R> conditionToBreak);

/**
* Execute <code>accumulator</code> on each element till <code>predicate</code> returns false.
* Execute <code>accumulator</code> on each element till <code>true</code> is returned by <code>conditionToBreak</code>
*
* @param columnNames
* @param seed
* @param accumulator
* @param predicate break if the <code>predicate</code> returns false.
* @param conditionToBreak break if <code>true</code> is return.
* @param shareRowArray
* @return
*/
<R> R forEach(Collection<String> columnNames, R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> predicate,
boolean shareRowArray);
<R> R forEach(Collection<String> columnNames, R seed, BiFunction<R, ? super Object[], R> accumulator,
BiPredicate<? super Object[], ? super R> conditionToBreak, boolean shareRowArray);

<R> R forEach(int fromRowIndex, int toRowIndex, R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> predicate);
<R> R forEach(int fromRowIndex, int toRowIndex, R seed, BiFunction<R, ? super Object[], R> accumulator,
BiPredicate<? super Object[], ? super R> conditionToBreak);

<R> R forEach(int fromRowIndex, int toRowIndex, R seed, BiFunction<R, ? super Object[], R> accumulator, BiPredicate<? super Object[], ? super R> predicate,
boolean shareRowArray);
<R> R forEach(int fromRowIndex, int toRowIndex, R seed, BiFunction<R, ? super Object[], R> accumulator,
BiPredicate<? super Object[], ? super R> conditionToBreak, boolean shareRowArray);

<R> R forEach(Collection<String> columnNames, int fromRowIndex, int toRowIndex, R seed, BiFunction<R, ? super Object[], R> accumulator,
BiPredicate<? super Object[], ? super R> predicate);
BiPredicate<? super Object[], ? super R> conditionToBreak);

/**
* Execute <code>accumulator</code> on each element till <code>predicate</code> returns false.
* Execute <code>accumulator</code> on each element till <code>true</code> is returned by <code>conditionToBreak</code>
*
* @param columnNames
* @param fromRowIndex
* @param toRowIndex
* @param seed
* @param accumulator
* @param predicate break if the <code>predicate</code> returns false.
* @param conditionToBreak break if <code>true</code> is return.
* @param shareRowArray
* @return
*/
<R> R forEach(Collection<String> columnNames, int fromRowIndex, int toRowIndex, R seed, BiFunction<R, ? super Object[], R> accumulator,
BiPredicate<? super Object[], ? super R> predicate, boolean shareRowArray);
BiPredicate<? super Object[], ? super R> conditionToBreak, boolean shareRowArray);

/**
*
Expand Down
8 changes: 4 additions & 4 deletions src/com/landawn/abacus/util/LongMultiset.java
Original file line number Diff line number Diff line change
Expand Up @@ -1113,20 +1113,20 @@ public void forEach(BiConsumer<? super E, Long> action) {
}

/**
* Execute <code>accumulator</code> on each element till <code>predicate</code> returns false.
* Execute <code>accumulator</code> on each element till <code>true</code> is returned by <code>conditionToBreak</code>
*
* @param seed
* @param accumulator
* @param predicate break if the <code>predicate</code> returns false.
* @param conditionToBreak break if <code>true</code> is return.
* @return
*/
public <R> R forEach(final R seed, TriFunction<R, ? super E, Long, R> accumulator, final TriPredicate<? super E, Long, ? super R> predicate) {
public <R> R forEach(final R seed, TriFunction<R, ? super E, Long, R> accumulator, final TriPredicate<? super E, Long, ? super R> conditionToBreak) {
R result = seed;

for (Map.Entry<E, MutableLong> entry : valueMap.entrySet()) {
result = accumulator.apply(result, entry.getKey(), entry.getValue().value());

if (predicate.test(entry.getKey(), entry.getValue().value(), result) == false) {
if (conditionToBreak.test(entry.getKey(), entry.getValue().value(), result)) {
break;
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/com/landawn/abacus/util/Multimap.java
Original file line number Diff line number Diff line change
Expand Up @@ -967,20 +967,21 @@ public void forEach(BiConsumer<? super K, ? super V> action) {
}

/**
* Execute <code>accumulator</code> on each element till <code>predicate</code> returns false.
* Execute <code>accumulator</code> on each element till <code>true</code> is returned by <code>conditionToBreak</code>
*
* @param seed
* @param accumulator
* @param predicate break if the <code>predicate</code> returns false.
* @param conditionToBreak break if <code>true</code> is return.
* @return
*/
public <R> R forEach(final R seed, TriFunction<R, ? super K, ? super V, R> accumulator, final TriPredicate<? super K, ? super V, ? super R> predicate) {
public <R> R forEach(final R seed, TriFunction<R, ? super K, ? super V, R> accumulator,
final TriPredicate<? super K, ? super V, ? super R> conditionToBreak) {
R result = seed;

for (Map.Entry<K, V> entry : valueMap.entrySet()) {
result = accumulator.apply(result, entry.getKey(), entry.getValue());

if (predicate.test(entry.getKey(), entry.getValue(), result) == false) {
if (conditionToBreak.test(entry.getKey(), entry.getValue(), result)) {
break;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/com/landawn/abacus/util/Multiset.java
Original file line number Diff line number Diff line change
Expand Up @@ -1082,20 +1082,20 @@ public void forEach(BiConsumer<? super E, Integer> action) {
}

/**
* Execute <code>accumulator</code> on each element till <code>predicate</code> returns false.
* Execute <code>accumulator</code> on each element till <code>true</code> is returned by <code>conditionToBreak</code>
*
* @param seed
* @param accumulator
* @param predicate break if the <code>predicate</code> returns false.
* @param conditionToBreak break if <code>true</code> is return.
* @return
*/
public <R> R forEach(final R seed, TriFunction<R, ? super E, Integer, R> accumulator, final TriPredicate<? super E, Integer, ? super R> predicate) {
public <R> R forEach(final R seed, TriFunction<R, ? super E, Integer, R> accumulator, final TriPredicate<? super E, Integer, ? super R> conditionToBreak) {
R result = seed;

for (Map.Entry<E, MutableInt> entry : valueMap.entrySet()) {
result = accumulator.apply(result, entry.getKey(), entry.getValue().value());

if (predicate.test(entry.getKey(), entry.getValue().value(), result) == false) {
if (conditionToBreak.test(entry.getKey(), entry.getValue().value(), result)) {
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableBoolean.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ public MutableBoolean setValue(final boolean value) {
}

public boolean getAndSet(final boolean value) {
boolean result = value;
final boolean result = this.value;
this.value = value;
return result;
}

public boolean setAndGet(final boolean value) {
this.value = value;
return value;
return this.value;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableByte.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public MutableByte setValue(final byte value) {
}

public byte getAndSet(final byte value) {
byte result = value;
final byte result = this.value;
this.value = value;
return result;
}

public byte setAndGet(final byte value) {
this.value = value;
return value;
return this.value;
}

//-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableChar.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public MutableChar setValue(final char value) {
}

public char getAndSet(final char value) {
char result = value;
final char result = this.value;
this.value = value;
return result;
}

public char setAndGet(final char value) {
this.value = value;
return value;
return this.value;
}

//-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableDouble.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public MutableDouble setValue(final double value) {
}

public double getAndSet(final double value) {
double result = value;
final double result = this.value;
this.value = value;
return result;
}

public double setAndGet(final double value) {
this.value = value;
return value;
return this.value;
}

//-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableFloat.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public MutableFloat setValue(final float value) {
}

public float getAndSet(final float value) {
float result = value;
final float result = this.value;
this.value = value;
return result;
}

public float setAndGet(final float value) {
this.value = value;
return value;
return this.value;
}

//-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableInt.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public MutableInt setValue(final int value) {
}

public int getAndSet(final int value) {
int result = value;
final int result = this.value;
this.value = value;
return result;
}

public int setAndGet(final int value) {
this.value = value;
return value;
return this.value;
}

//-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableLong.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public MutableLong setValue(final long value) {
}

public long getAndSet(final long value) {
long result = value;
final long result = this.value;
this.value = value;
return result;
}

public long setAndGet(final long value) {
this.value = value;
return value;
return this.value;
}

//-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/com/landawn/abacus/util/MutableShort.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public MutableShort setValue(final short value) {
}

public short getAndSet(final short value) {
short result = value;
final short result = this.value;
this.value = value;
return result;
}

public short setAndGet(final short value) {
this.value = value;
return value;
return this.value;
}

//-----------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 56d09ef

Please sign in to comment.