some renamings in GroupBy

This commit is contained in:
Timo Westkämper 2011-09-14 15:08:43 +03:00
parent c92073879c
commit d4438447ac
3 changed files with 12 additions and 11 deletions

View File

@ -61,6 +61,9 @@ public interface Group {
@Nullable
<T> List<T> getList(Expression<T> expr);
/**
* @return
*/
int size();
}

View File

@ -34,9 +34,7 @@ public class GroupBy implements ResultTransformer<Collection<Group>> {
public GroupBy(Expression<?> groupBy, Expression<?>... args) {
expressions = new Expression<?>[args.length + 1];
expressions[0] = groupBy;
for (int i=0; i < args.length; i++) {
expressions[i+1] = args[i];
}
System.arraycopy(args, 0, expressions, 1, args.length);
}
@Override
@ -49,9 +47,9 @@ public class GroupBy implements ResultTransformer<Collection<Group>> {
Object[] row = iter.next();
Object groupBy = row[0];
// groups.values() should return Collection<GTuple> instead of Collection<? extends GTuple>
GTupleImpl group = (GTupleImpl) groups.get(groupBy);
GroupImpl group = (GroupImpl) groups.get(groupBy);
if (group == null) {
group = new GTupleImpl();
group = new GroupImpl();
groups.put(groupBy, group);
}
group.add(row);
@ -72,7 +70,7 @@ public class GroupBy implements ResultTransformer<Collection<Group>> {
}
@SuppressWarnings("unchecked")
private class GTupleImpl implements Group {
private class GroupImpl implements Group {
private final List<Object[]> values = new ArrayList<Object[]>();

View File

@ -20,11 +20,11 @@ import com.mysema.query.types.path.StringPath;
public class GroupByTest {
private final NumberExpression<Integer> postId = new NumberPath(Integer.class, null, "postId");
private final NumberExpression<Integer> postId = new NumberPath<Integer>(Integer.class, "postId");
private final StringExpression postName = new StringPath(null, "postName");
private final StringExpression postName = new StringPath("postName");
private final NumberExpression<Integer> commentId = new NumberPath(Integer.class, null, "commentId");
private final NumberExpression<Integer> commentId = new NumberPath<Integer>(Integer.class, "commentId");
/**
* <ol>
@ -98,7 +98,7 @@ public class GroupByTest {
return row;
}
private static <T> CloseableIterator<T> iterator(Object[]... rows) {
return new IteratorAdapter(Arrays.asList(rows).iterator());
private static <T> CloseableIterator<T> iterator(T... rows) {
return new IteratorAdapter<T>(Arrays.asList(rows).iterator());
}
}