Skip to content

Commit

Permalink
Fixed code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Udit Sharma committed Jul 21, 2021
1 parent ebf552e commit a430e18
Showing 1 changed file with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
/*******************************************************************************
* Copyright 2020 IBM Corporation and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*******************************************************************************/
package com.ibm.research.ergs.query.process;

Expand Down Expand Up @@ -313,22 +311,22 @@ private Map.Entry<TupleExpr, Long> getConnected(ZeroLengthPath tupleExpr, Set<Va
}

/**
* Finds the {@link TupleExpr} from the subtree of given {@link ArbitraryLengthPath} tupleExpr that
* can be traversed using already visited variables
* Finds the {@link TupleExpr} from the subtree of given {@link ArbitraryLengthPath} tupleExpr
* that can be traversed using already visited variables
*
* @param tupleExpr expression tree
* @param cur {@link Set} of variables already visited by current traversal
* @return most optimal expression reachable using already visited variables along with its cost
*/
private Map.Entry<TupleExpr, Long> getConnected(ArbitraryLengthPath tupleExpr, Set<Var> cur) {
Map.Entry<TupleExpr, Long> ret= getConnected(tupleExpr.getPathExpression(), cur);
if(ret==null) {
return ret;
}else {
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr, ret.getValue());
}
Map.Entry<TupleExpr, Long> ret = getConnected(tupleExpr.getPathExpression(), cur);
if (ret == null) {
return ret;
} else {
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr, ret.getValue());
}
}


/**
* Finds the most optimal {@link TupleExpr} that can be used to start a new traversal from the
Expand Down Expand Up @@ -388,7 +386,8 @@ private Map.Entry<TupleExpr, Long> getFirst(TupleExpr tupleExpr) {
* @return {@link TupleExpression} that can be used to start a new traversal along with its cost
*/
private Map.Entry<TupleExpr, Long> getFirst(Filter tupleExpr) {
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L, (a, b) -> a + b);
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L,
(a, b) -> a + b);
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr, filterCost);
}

Expand All @@ -400,7 +399,8 @@ private Map.Entry<TupleExpr, Long> getFirst(Filter tupleExpr) {
* @return {@link TupleExpression} that can be used to start a new traversal along with its cost
*/
private Map.Entry<TupleExpr, Long> getFirst(Extension tupleExpr) {
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L, (a, b) -> a + b);
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L,
(a, b) -> a + b);
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr, filterCost);
}

Expand Down Expand Up @@ -493,7 +493,8 @@ private Map.Entry<TupleExpr, Long> getFirst(Difference tupleExpr) {
* @return {@link TupleExpression} that can be used to start a new traversal along with its cost
*/
private Map.Entry<TupleExpr, Long> getFirst(StatementPattern tupleExpr) {
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L, (a, b) -> a + b);
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L,
(a, b) -> a + b);
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr, filterCost);
}

Expand All @@ -505,7 +506,8 @@ private Map.Entry<TupleExpr, Long> getFirst(StatementPattern tupleExpr) {
* @return {@link TupleExpression} that can be used to start a new traversal along with its cost
*/
private Map.Entry<TupleExpr, Long> getFirst(ZeroLengthPath tupleExpr) {
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L, (a, b) -> a + b);
Long filterCost = metaData.getIndexedFilter(tupleExpr).stream().map(a -> a.getRank()).reduce(0L,
(a, b) -> a + b);
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr, filterCost);
}

Expand All @@ -517,13 +519,13 @@ private Map.Entry<TupleExpr, Long> getFirst(ZeroLengthPath tupleExpr) {
* @return {@link TupleExpression} that can be used to start a new traversal along with its cost
*/
private Map.Entry<TupleExpr, Long> getFirst(ArbitraryLengthPath tupleExpr) {
Map.Entry<TupleExpr, Long> ret = getFirst(tupleExpr.getPathExpression());
if (ret==null) {
return ret;
}else {
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr,ret.getValue());
}
Map.Entry<TupleExpr, Long> ret = getFirst(tupleExpr.getPathExpression());
if (ret == null) {
return ret;
} else {
return new AbstractMap.SimpleEntry<TupleExpr, Long>(tupleExpr, ret.getValue());
}

}

private Map.Entry<TupleExpr, Long> better(Map.Entry<TupleExpr, Long> first,
Expand Down

0 comments on commit a430e18

Please sign in to comment.