Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions api/src/main/java/org/eclipse/daanse/olap/api/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
*/
package org.eclipse.daanse.olap.api;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -44,7 +42,7 @@
*/
public interface Context<C extends Connection> {

List<String> KEYWORD_LIST = Collections.unmodifiableList(Arrays.asList("$AdjustedProbability",
List<String> KEYWORD_LIST = List.of("$AdjustedProbability",
"$Distance", "$Probability", "$ProbabilityStDev", "$ProbabilityStdDeV", "$ProbabilityVariance", "$StDev",
"$StdDeV", "$Support", "$Variance", "AddCalculatedMembers", "Action", "After", "Aggregate", "All", "Alter",
"Ancestor", "And", "Append", "As", "ASC", "Axis", "Automatic", "Back_Color", "BASC", "BDESC", "Before",
Expand Down Expand Up @@ -78,7 +76,7 @@ public interface Context<C extends Connection> {
"Solve_Order", "Sort", "StdDev", "Stdev", "StripCalculatedMembers", "StrToSet", "StrToTuple", "SubSet",
"Support", "Tail", "Text", "Thresholds", "ToggleDrillState", "TopCount", "TopPercent", "TopSum",
"TupleToStr", "Under", "Uniform", "UniqueName", "Use", "Value", "Var", "Variance", "VarP", "VarianceP",
"VisualTotals", "When", "Where", "With", "WTD", "Xor"));
"VisualTotals", "When", "Where", "With", "WTD", "Xor");

CatalogCache getCatalogCache();
/**
Expand Down
52 changes: 13 additions & 39 deletions api/src/main/java/org/eclipse/daanse/olap/api/calc/ResultStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

package org.eclipse.daanse.olap.api.calc;

import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -80,66 +79,41 @@ public enum ResultStyle {
// collections of result styles.

public static final List<ResultStyle> ANY_LIST =
Arrays.asList(
ANY);
List.of(ANY);

public static final List<ResultStyle> ITERABLE_ONLY =
Arrays.asList(
ITERABLE);
List.of(ITERABLE);

public static final List<ResultStyle> MUTABLELIST_ONLY =
Arrays.asList(
MUTABLE_LIST);
List.of(MUTABLE_LIST);

public static final List<ResultStyle> LIST_ONLY =
Arrays.asList(
LIST);
List.of(LIST);

public static final List<ResultStyle> ITERABLE_ANY =
Arrays.asList(
ITERABLE,
ANY);
List.of(ITERABLE, ANY);

public static final List<ResultStyle> ITERABLE_LIST =
Arrays.asList(
ITERABLE,
LIST);
List.of(ITERABLE, LIST);

public static final List<ResultStyle> ITERABLE_MUTABLELIST =
Arrays.asList(
ITERABLE,
MUTABLE_LIST);
List.of(ITERABLE, MUTABLE_LIST);

public static final List<ResultStyle> ITERABLE_LIST_MUTABLELIST =
Arrays.asList(
ITERABLE,
LIST,
MUTABLE_LIST);
List.of(ITERABLE, LIST, MUTABLE_LIST);

public static final List<ResultStyle> LIST_MUTABLELIST =
Arrays.asList(
LIST,
MUTABLE_LIST);
List.of(LIST, MUTABLE_LIST);

public static final List<ResultStyle> MUTABLELIST_LIST =
Arrays.asList(
MUTABLE_LIST,
LIST);
List.of(MUTABLE_LIST, LIST);

public static final List<ResultStyle> ITERABLE_LIST_MUTABLELIST_ANY =
Arrays.asList(
ITERABLE,
LIST,
MUTABLE_LIST,
ANY);
List.of(ITERABLE, LIST, MUTABLE_LIST, ANY);

public static final List<ResultStyle> ITERABLE_MUTABLELIST_LIST =
Arrays.asList(
ITERABLE,
MUTABLE_LIST,
LIST);
List.of(ITERABLE, MUTABLE_LIST, LIST);

public static final List<ResultStyle> ANY_ONLY =
Arrays.asList(
ANY);
List.of(ANY);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

package org.eclipse.daanse.olap.api.result;

import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;

public interface Property {
Expand Down Expand Up @@ -87,11 +85,9 @@ enum TypeFlag {
private final int xmlaOrdinal;

public static final Set<Property.TypeFlag> CELL_TYPE_FLAG =
Collections.unmodifiableSet(
EnumSet.of(Property.TypeFlag.CELL));
Set.of(Property.TypeFlag.CELL);
public static final Set<Property.TypeFlag> MEMBER_TYPE_FLAG =
Collections.unmodifiableSet(
EnumSet.of(Property.TypeFlag.MEMBER));
Set.of(Property.TypeFlag.MEMBER);



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -282,7 +281,7 @@ private List<Member> lookupChildrenByNames(
}
// don't want to fail at this point. Member resolution still has
// another chance to succeed.
return Collections.emptyList();
return List.of();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
*/
package org.eclipse.daanse.olap.common;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -451,8 +449,8 @@ private StandardProperty(String name, Datatype type, boolean internal, boolean m
/**
* The various property names which define a format string.
*/
public static final Set<String> FORMAT_PROPERTIES = new HashSet<>(
Arrays.asList("format", "format_string", "FORMAT", FORMAT_STRING.getName()));
public static final Set<String> FORMAT_PROPERTIES =
Set.of("format", "format_string", "FORMAT", FORMAT_STRING.getName());

@Override
public MemberPropertyFormatter getFormatter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

package org.eclipse.daanse.olap.fun;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -74,14 +72,11 @@ public class MemberExtractingVisitor extends MdxVisitorImpl {
* one of these expressions would result in a set of members
* that cannot be determined from the expression itself.
*/
private static final String[] unsafeFuncNames = new String[] {
private static final List<String> blacklist = List.of(
"Ytd", "Mtd", "Qtd", "Wtd", "BottomCount", "TopCount", "ClosingPeriod",
"Cousin", "FirstChild", "FirstSibling", "LastChild", "LastPeriods",
"LastSibling", "ParallelPeriod", "PeriodsToDate", "Parent",
"PrevMember", "NextMember", "Ancestor", "Ancestors"
};
private static final List<String> blacklist = Collections.unmodifiableList(
Arrays.asList(MemberExtractingVisitor.unsafeFuncNames));
"PrevMember", "NextMember", "Ancestor", "Ancestors");

public MemberExtractingVisitor(
Set<Member> memberSet, ResolvedFunCall call, boolean mapToAllMember)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.eclipse.daanse.olap.api.Evaluator;
import org.eclipse.daanse.olap.api.calc.Calc;
Expand Down Expand Up @@ -85,7 +84,7 @@ private List<Member> dependentMembers( List<Member> tuple ) {
getDependentHierarchiesIndices( tuple );
return Arrays.stream( dependentHierarchiesIndices )
.mapToObj( tuple::get )
.collect( Collectors.toList() );
.toList();
}

private void getDependentHierarchiesIndices( List<Member> tuple ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public List<FunctionResolver> getResolvers(OperationAtom operationAtom) {
FunctionAtomCompareKey key = new FunctionAtomCompareKey(operationAtom);
List<FunctionResolver> matchingResolvers = mapNameToResolvers.get(key);
if (matchingResolvers == null) {
matchingResolvers = Collections.emptyList();
matchingResolvers = List.of();
}
return matchingResolvers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.daanse.olap.function.def.descendants;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.daanse.olap.api.CatalogReader;
Expand Down Expand Up @@ -100,7 +99,7 @@ private void descendantsByLevel(
// (a city). This is why we repeat the before/self/after logic for
// each member.
final int levelDepth = level.getDepth();
List<Member> members = Collections.singletonList( ancestor );
List<Member> members = List.of( ancestor );
// Each pass, "fertileMembers" has the same contents as "members",
// except that we omit members whose children we are not interested
// in. We allocate it once, and clear it each pass, to save a little
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.daanse.olap.function.def.lastperiods;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.daanse.olap.api.Evaluator;
Expand Down Expand Up @@ -54,7 +53,7 @@ public TupleList evaluateInternal(Evaluator evaluator) {
private List<Member> lastPeriods(Member member, Evaluator evaluator, Integer indexValue) {
// empty set
if ((indexValue == 0) || member.isNull()) {
return Collections.emptyList();
return List.of();
}
List<Member> list = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.daanse.olap.function.def.set.ascendants;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.daanse.olap.api.CatalogReader;
Expand All @@ -40,7 +39,7 @@ public TupleList evaluateInternal(Evaluator evaluator) {

private List<Member> ascendants(CatalogReader schemaReader, Member member) {
if (member.isNull()) {
return Collections.emptyList();
return List.of();
}
final List<Member> result = new ArrayList<>();
result.add(member);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package org.eclipse.daanse.olap.function.def.set.siblings;

import java.util.Collections;
import java.util.List;

import org.eclipse.daanse.olap.api.CatalogReader;
Expand All @@ -40,7 +39,7 @@ public TupleList evaluateInternal(Evaluator evaluator) {
private List<Member> memberSiblings(Member member, Evaluator evaluator) {
if (member.isNull()) {
// the null member has no siblings -- not even itself
return Collections.emptyList();
return List.of();
}
Member parent = member.getParentMember();
final CatalogReader schemaReader = evaluator.getCatalogReader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.daanse.olap.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -113,7 +112,7 @@ public List<Property> getProperties() {
private List<Hierarchy> getHierarchiesNonFilter() {
final Expression exp = queryAxis.getSet();
if (exp == null) {
return Collections.emptyList();
return List.of();
}
List<Hierarchy> hierarchyList = new ArrayList<>();
hierarchyList.addAll(TypeUtil.getHierarchies(exp.getType()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.daanse.olap.api.CatalogReader;
Expand Down Expand Up @@ -68,7 +67,7 @@ public DrillThroughImpl(
this.query = query;
this.maxRowCount = maxRowCount;
this.firstRowOrdinal = firstRowOrdinal;
this.returnList = Collections.unmodifiableList(
this.returnList = List.copyOf(
resolveReturnList(returnList));
}

Expand Down Expand Up @@ -118,7 +117,7 @@ public List<OlapElement> getReturnList() {

private List<OlapElement> resolveReturnList(List<Expression> returnList) {
if (returnList == null) {
return Collections.emptyList();
return List.of();
}
List<OlapElement> returnClauseElements = new ArrayList<>();
CatalogReader reader = query.getCatalogReader(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.daanse.olap.api.DataType;
Expand Down Expand Up @@ -65,7 +64,7 @@ public class IdImpl
* @param segment Segment, consisting of a name and quoting style
*/
public IdImpl(Segment segment) {
segments = Collections.singletonList(segment);
segments = List.of(segment);
}

public IdImpl(List<Segment> segments) {
Expand Down Expand Up @@ -111,7 +110,7 @@ public String[] toStringArray() {

@Override
public List<Segment> getSegments() {
return Collections.unmodifiableList(this.segments);
return List.copyOf(this.segments);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
import java.text.FieldPosition;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -1477,7 +1475,7 @@ private static Token nfe(

public static List<Token> getTokenList()
{
return Collections.unmodifiableList(Arrays.asList(tokens));
return List.of(tokens);
}

/**
Expand Down
Loading
Loading