From 248ecd648e592e3587fff10063dd3c57fe8e4d5c Mon Sep 17 00:00:00 2001 From: dloughlin Date: Sun, 28 May 2023 16:16:17 +0200 Subject: [PATCH] Apply spotless --- .../compiler/DynamicContextVisitor.java | 35 +++++------ .../compiler/RuntimeIteratorVisitor.java | 5 +- .../compiler/StaticContextVisitor.java | 15 +++-- .../DuplicateKeyOnUpdateApplyException.java | 8 ++- .../DuplicateObjectInsertSourceException.java | 6 +- ...yRenamesOnSameTargetSelectorException.java | 6 +- ...ReplacesOnSameTargetSelectorException.java | 12 ++-- .../expressions/update/DeleteExpression.java | 1 + .../java/org/rumbledb/items/ObjectItem.java | 3 +- .../control/TypeswitchRuntimeIterator.java | 16 ++--- .../clauses/ReturnClauseSparkIterator.java | 10 ++- .../runtime/update/PendingUpdateList.java | 61 +++++++++++++------ .../expression/AppendExpressionIterator.java | 17 +++++- .../expression/DeleteExpressionIterator.java | 32 ++++++++-- .../expression/InsertExpressionIterator.java | 45 ++++++++++---- .../expression/RenameExpressionIterator.java | 26 +++++--- .../expression/ReplaceExpressionIterator.java | 33 ++++++++-- .../TransformExpressionIterator.java | 12 ++-- .../primitives/DeleteFromArrayPrimitive.java | 6 +- .../primitives/DeleteFromObjectPrimitive.java | 9 +-- .../primitives/InsertIntoArrayPrimitive.java | 1 - .../primitives/RenameInObjectPrimitive.java | 13 +++- .../primitives/ReplaceInArrayPrimitive.java | 13 +++- .../primitives/ReplaceInObjectPrimitive.java | 13 +++- .../update/primitives/UpdatePrimitive.java | 8 ++- .../primitives/UpdatePrimitiveFactory.java | 33 ++++++++-- 26 files changed, 306 insertions(+), 133 deletions(-) diff --git a/src/main/java/org/rumbledb/compiler/DynamicContextVisitor.java b/src/main/java/org/rumbledb/compiler/DynamicContextVisitor.java index 0e724947e..ccfe65778 100644 --- a/src/main/java/org/rumbledb/compiler/DynamicContextVisitor.java +++ b/src/main/java/org/rumbledb/compiler/DynamicContextVisitor.java @@ -41,15 +41,12 @@ import org.rumbledb.expressions.AbstractNodeVisitor; import org.rumbledb.expressions.Expression; import org.rumbledb.expressions.Node; -import org.rumbledb.expressions.flowr.ReturnClause; import org.rumbledb.expressions.module.FunctionDeclaration; import org.rumbledb.expressions.module.LibraryModule; import org.rumbledb.expressions.module.Prolog; import org.rumbledb.expressions.module.TypeDeclaration; import org.rumbledb.expressions.module.VariableDeclaration; import org.rumbledb.expressions.primary.InlineFunctionExpression; -import org.rumbledb.expressions.update.CopyDeclaration; -import org.rumbledb.expressions.update.TransformExpression; import org.rumbledb.items.ItemFactory; import org.rumbledb.items.parsing.ItemParser; import org.rumbledb.runtime.RuntimeIterator; @@ -116,22 +113,22 @@ public DynamicContext visitFunctionDeclaration(FunctionDeclaration declaration, return defaultAction(expression, argument); } -// @Override -// public DynamicContext visitTransformExpression(TransformExpression expression, DynamicContext argument) { -// -// for (CopyDeclaration copyDecl : expression.getCopyDeclarations()) { -// Expression child = copyDecl.getSourceExpression(); -// this.visit(child, argument); -// RuntimeIterator iterator = VisitorHelpers.generateRuntimeIterator(child, this.configuration); -// iterator.bindToVariableInDynamicContext(argument, copyDecl.getVariableName(), argument); -// } -// -// this.visit(expression.getModifyExpression(), argument); -// -// this.visit(expression.getReturnExpression(), argument); -// -// return argument; -// } + // @Override + // public DynamicContext visitTransformExpression(TransformExpression expression, DynamicContext argument) { + // + // for (CopyDeclaration copyDecl : expression.getCopyDeclarations()) { + // Expression child = copyDecl.getSourceExpression(); + // this.visit(child, argument); + // RuntimeIterator iterator = VisitorHelpers.generateRuntimeIterator(child, this.configuration); + // iterator.bindToVariableInDynamicContext(argument, copyDecl.getVariableName(), argument); + // } + // + // this.visit(expression.getModifyExpression(), argument); + // + // this.visit(expression.getReturnExpression(), argument); + // + // return argument; + // } @Override public DynamicContext visitVariableDeclaration(VariableDeclaration variableDeclaration, DynamicContext argument) { diff --git a/src/main/java/org/rumbledb/compiler/RuntimeIteratorVisitor.java b/src/main/java/org/rumbledb/compiler/RuntimeIteratorVisitor.java index 6b623e0ba..6308988ef 100644 --- a/src/main/java/org/rumbledb/compiler/RuntimeIteratorVisitor.java +++ b/src/main/java/org/rumbledb/compiler/RuntimeIteratorVisitor.java @@ -139,7 +139,6 @@ import org.rumbledb.runtime.primary.ObjectConstructorRuntimeIterator; import org.rumbledb.runtime.primary.StringRuntimeIterator; import org.rumbledb.runtime.primary.VariableReferenceIterator; -import org.rumbledb.runtime.update.PendingUpdateList; import org.rumbledb.runtime.update.expression.*; import org.rumbledb.types.BuiltinTypesCatalogue; import org.rumbledb.types.SequenceType; @@ -401,7 +400,9 @@ public RuntimeIterator visitInsertExpression(InsertExpression expression, Runtim RuntimeIterator mainIterator = this.visit(expression.getMainExpression(), argument); RuntimeIterator toInsertIterator = this.visit(expression.getToInsertExpression(), argument); - RuntimeIterator positionIterator = expression.hasPositionExpression() ? this.visit(expression.getPositionExpression(), argument) : null; + RuntimeIterator positionIterator = expression.hasPositionExpression() + ? this.visit(expression.getPositionExpression(), argument) + : null; RuntimeIterator runtimeIterator = new InsertExpressionIterator( mainIterator, diff --git a/src/main/java/org/rumbledb/compiler/StaticContextVisitor.java b/src/main/java/org/rumbledb/compiler/StaticContextVisitor.java index 7abe3ea77..b5aadf72f 100644 --- a/src/main/java/org/rumbledb/compiler/StaticContextVisitor.java +++ b/src/main/java/org/rumbledb/compiler/StaticContextVisitor.java @@ -348,16 +348,21 @@ public StaticContext visitTransformExpression(TransformExpression expression, St return argument; } - private StaticContext visitCopyDecl(CopyDeclaration copyDeclaration, StaticContext argument, StaticContext copyContext) { + private StaticContext visitCopyDecl( + CopyDeclaration copyDeclaration, + StaticContext argument, + StaticContext copyContext + ) { this.visit(copyDeclaration.getSourceExpression(), copyContext); StaticContext result = new StaticContext(argument); result.addVariable( - copyDeclaration.getVariableName(), - copyDeclaration.getSourceSequenceType(), - copyDeclaration.getSourceExpression().getMetadata() + copyDeclaration.getVariableName(), + copyDeclaration.getSourceSequenceType(), + copyDeclaration.getSourceExpression().getMetadata() ); - copyDeclaration.getSourceSequenceType().resolve(copyContext, copyDeclaration.getSourceExpression().getMetadata()); + copyDeclaration.getSourceSequenceType() + .resolve(copyContext, copyDeclaration.getSourceExpression().getMetadata()); return result; } diff --git a/src/main/java/org/rumbledb/exceptions/DuplicateKeyOnUpdateApplyException.java b/src/main/java/org/rumbledb/exceptions/DuplicateKeyOnUpdateApplyException.java index e29f2cd4a..89de47398 100644 --- a/src/main/java/org/rumbledb/exceptions/DuplicateKeyOnUpdateApplyException.java +++ b/src/main/java/org/rumbledb/exceptions/DuplicateKeyOnUpdateApplyException.java @@ -8,9 +8,11 @@ public class DuplicateKeyOnUpdateApplyException extends RumbleException { public DuplicateKeyOnUpdateApplyException(String keyInfo, ExceptionMetadata metadata) { super( - "Dynamic Updating error; Duplicate keys inserted into target object during update application: " + keyInfo + ".", - ErrorCode.DuplicateKeyOnUpdateApplyErrorCode, - metadata + "Dynamic Updating error; Duplicate keys inserted into target object during update application: " + + keyInfo + + ".", + ErrorCode.DuplicateKeyOnUpdateApplyErrorCode, + metadata ); } } diff --git a/src/main/java/org/rumbledb/exceptions/DuplicateObjectInsertSourceException.java b/src/main/java/org/rumbledb/exceptions/DuplicateObjectInsertSourceException.java index 6bfaa262f..fbaffcd38 100644 --- a/src/main/java/org/rumbledb/exceptions/DuplicateObjectInsertSourceException.java +++ b/src/main/java/org/rumbledb/exceptions/DuplicateObjectInsertSourceException.java @@ -8,9 +8,9 @@ public class DuplicateObjectInsertSourceException extends RumbleException { public DuplicateObjectInsertSourceException(String keyInfo, ExceptionMetadata metadata) { super( - "Dynamic Updating error; Duplicate keys to insert into object: " + keyInfo + ".", - ErrorCode.DuplicateObjectInsertSourceErrorCode, - metadata + "Dynamic Updating error; Duplicate keys to insert into object: " + keyInfo + ".", + ErrorCode.DuplicateObjectInsertSourceErrorCode, + metadata ); } diff --git a/src/main/java/org/rumbledb/exceptions/TooManyRenamesOnSameTargetSelectorException.java b/src/main/java/org/rumbledb/exceptions/TooManyRenamesOnSameTargetSelectorException.java index 65bd8b1f8..727874a37 100644 --- a/src/main/java/org/rumbledb/exceptions/TooManyRenamesOnSameTargetSelectorException.java +++ b/src/main/java/org/rumbledb/exceptions/TooManyRenamesOnSameTargetSelectorException.java @@ -8,9 +8,9 @@ public class TooManyRenamesOnSameTargetSelectorException extends RumbleException public TooManyRenamesOnSameTargetSelectorException(String keyInfo, ExceptionMetadata metadata) { super( - "Dynamic Updating error; Too many renames on same object at key: " + keyInfo + ".", - ErrorCode.TooManyRenamesOnSameTargetSelectorErrorCode, - metadata + "Dynamic Updating error; Too many renames on same object at key: " + keyInfo + ".", + ErrorCode.TooManyRenamesOnSameTargetSelectorErrorCode, + metadata ); } diff --git a/src/main/java/org/rumbledb/exceptions/TooManyReplacesOnSameTargetSelectorException.java b/src/main/java/org/rumbledb/exceptions/TooManyReplacesOnSameTargetSelectorException.java index 7f7808383..3808044f5 100644 --- a/src/main/java/org/rumbledb/exceptions/TooManyReplacesOnSameTargetSelectorException.java +++ b/src/main/java/org/rumbledb/exceptions/TooManyReplacesOnSameTargetSelectorException.java @@ -6,11 +6,15 @@ public class TooManyReplacesOnSameTargetSelectorException extends RumbleExceptio private static final long serialVersionUID = 1L; - public TooManyReplacesOnSameTargetSelectorException(String targetInfo, String selectorInfo, ExceptionMetadata metadata) { + public TooManyReplacesOnSameTargetSelectorException( + String targetInfo, + String selectorInfo, + ExceptionMetadata metadata + ) { super( - "Dynamic Updating error; Too many replaces on " + targetInfo + " at: " + selectorInfo + ".", - ErrorCode.TooManyReplacesOnSameTargetSelectorErrorCode, - metadata + "Dynamic Updating error; Too many replaces on " + targetInfo + " at: " + selectorInfo + ".", + ErrorCode.TooManyReplacesOnSameTargetSelectorErrorCode, + metadata ); } } diff --git a/src/main/java/org/rumbledb/expressions/update/DeleteExpression.java b/src/main/java/org/rumbledb/expressions/update/DeleteExpression.java index 2882473bb..57e536849 100644 --- a/src/main/java/org/rumbledb/expressions/update/DeleteExpression.java +++ b/src/main/java/org/rumbledb/expressions/update/DeleteExpression.java @@ -13,6 +13,7 @@ public class DeleteExpression extends Expression { private Expression mainExpression; private Expression locatorExpression; + public DeleteExpression( Expression mainExpression, Expression locatorExpression, diff --git a/src/main/java/org/rumbledb/items/ObjectItem.java b/src/main/java/org/rumbledb/items/ObjectItem.java index 5705141fc..c6f535ac5 100644 --- a/src/main/java/org/rumbledb/items/ObjectItem.java +++ b/src/main/java/org/rumbledb/items/ObjectItem.java @@ -205,6 +205,7 @@ public boolean getEffectiveBooleanValue() { public int getMutabilityLevel() { return this.mutabilityLevel; } + @Override public void setMutabilityLevel(int mutabilityLevel) { this.mutabilityLevel = mutabilityLevel; @@ -212,4 +213,4 @@ public void setMutabilityLevel(int mutabilityLevel) { item.setMutabilityLevel(mutabilityLevel); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/rumbledb/runtime/control/TypeswitchRuntimeIterator.java b/src/main/java/org/rumbledb/runtime/control/TypeswitchRuntimeIterator.java index 86c55cff7..1f8b23e60 100644 --- a/src/main/java/org/rumbledb/runtime/control/TypeswitchRuntimeIterator.java +++ b/src/main/java/org/rumbledb/runtime/control/TypeswitchRuntimeIterator.java @@ -203,10 +203,10 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { if (localMatchingIterator != null) { if (typeSwitchCase.getVariableName() != null) { context.getVariableValues() - .addVariableValue( - typeSwitchCase.getVariableName(), - Collections.singletonList(this.testValue) - ); + .addVariableValue( + typeSwitchCase.getVariableName(), + Collections.singletonList(this.testValue) + ); } return localMatchingIterator.getPendingUpdateList(context); @@ -215,10 +215,10 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { if (this.defaultCase.getVariableName() != null) { context.getVariableValues() - .addVariableValue( - this.defaultCase.getVariableName(), - Collections.singletonList(this.testValue) - ); + .addVariableValue( + this.defaultCase.getVariableName(), + Collections.singletonList(this.testValue) + ); } return this.defaultCase.getReturnIterator().getPendingUpdateList(context); diff --git a/src/main/java/org/rumbledb/runtime/flwor/clauses/ReturnClauseSparkIterator.java b/src/main/java/org/rumbledb/runtime/flwor/clauses/ReturnClauseSparkIterator.java index fe6b67066..5819db728 100644 --- a/src/main/java/org/rumbledb/runtime/flwor/clauses/ReturnClauseSparkIterator.java +++ b/src/main/java/org/rumbledb/runtime/flwor/clauses/ReturnClauseSparkIterator.java @@ -20,7 +20,6 @@ package org.rumbledb.runtime.flwor.clauses; -import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet; import org.apache.log4j.LogManager; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.sql.Dataset; @@ -399,10 +398,15 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { while (this.child.hasNext()) { FlworTuple tuple = this.child.next(); this.tupleContext.getVariableValues().removeAllVariables(); // clear the previous variables - this.tupleContext.getVariableValues().setBindingsFromTuple(tuple, getMetadata()); // assign new variables + this.tupleContext.getVariableValues().setBindingsFromTuple(tuple, getMetadata()); // assign new + // variables // from new tuple - result = PendingUpdateList.mergeUpdates(result, this.expression.getPendingUpdateList(this.tupleContext), this.getMetadata()); + result = PendingUpdateList.mergeUpdates( + result, + this.expression.getPendingUpdateList(this.tupleContext), + this.getMetadata() + ); } this.child.close(); diff --git a/src/main/java/org/rumbledb/runtime/update/PendingUpdateList.java b/src/main/java/org/rumbledb/runtime/update/PendingUpdateList.java index cfec75912..6e5643471 100644 --- a/src/main/java/org/rumbledb/runtime/update/PendingUpdateList.java +++ b/src/main/java/org/rumbledb/runtime/update/PendingUpdateList.java @@ -1,15 +1,11 @@ package org.rumbledb.runtime.update; -import org.apache.hadoop.mapred.lib.DelegatingInputFormat; import org.rumbledb.api.Item; import org.rumbledb.exceptions.ExceptionMetadata; import org.rumbledb.exceptions.OurBadException; import org.rumbledb.exceptions.TooManyRenamesOnSameTargetSelectorException; import org.rumbledb.exceptions.TooManyReplacesOnSameTargetSelectorException; -import org.rumbledb.items.ItemFactory; import org.rumbledb.runtime.update.primitives.*; -import org.rumbledb.types.ItemType; -import shapeless.ops.zipper; import java.util.*; @@ -125,7 +121,9 @@ public void applyUpdates(ExceptionMetadata metadata) { for (Item target : renameObjMap.keySet()) { tempSelSrcMap = renameObjMap.get(target); for (Item locator : tempSelSrcMap.keySet()) { - objectPUL.add(upFactory.createRenameInObjectPrimitive(target, locator, tempSelSrcMap.get(locator), metadata)); + objectPUL.add( + upFactory.createRenameInObjectPrimitive(target, locator, tempSelSrcMap.get(locator), metadata) + ); } } @@ -144,7 +142,11 @@ public void applyUpdates(ExceptionMetadata metadata) { } else { up = upFactory.createReplaceInArrayPrimitive(target, locator, tempSrc, metadata); } - int index = Collections.binarySearch(tempArrayPULs, up, Comparator.comparing(UpdatePrimitive::getIntSelector)); + int index = Collections.binarySearch( + tempArrayPULs, + up, + Comparator.comparing(UpdatePrimitive::getIntSelector) + ); if (index < 0) { index = -index - 1; } @@ -161,7 +163,11 @@ public void applyUpdates(ExceptionMetadata metadata) { tempSelSrcListMap = insertArrayMap.get(target); for (Item locator : tempSelSrcListMap.keySet()) { up = upFactory.createInsertIntoArrayPrimitive(target, locator, tempSelSrcListMap.get(locator)); - int index = Collections.binarySearch(tempArrayPULs, up, Comparator.comparing(UpdatePrimitive::getIntSelector)); + int index = Collections.binarySearch( + tempArrayPULs, + up, + Comparator.comparing(UpdatePrimitive::getIntSelector) + ); if (index < 0) { index = -index - 1; } @@ -187,7 +193,11 @@ public void applyUpdates(ExceptionMetadata metadata) { } - public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpdateList pul2, ExceptionMetadata metadata) { + public static PendingUpdateList mergeUpdates( + PendingUpdateList pul1, + PendingUpdateList pul2, + ExceptionMetadata metadata + ) { PendingUpdateList res = new PendingUpdateList(); Map tempSelSrcMap; Map> tempSelSrcListMap; @@ -207,7 +217,7 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda for (Item selector : tempSelSrcMap.keySet()) { tempSelSrcResMap.put(selector, tempSelSrcMap.get(selector)); } - res.delReplaceObjMap.put(target,tempSelSrcResMap); + res.delReplaceObjMap.put(target, tempSelSrcResMap); } for (Item target : pul2.delReplaceObjMap.keySet()) { @@ -218,13 +228,17 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda if (tempSelSrcResMap.containsKey(selector)) { tempSrc = tempSelSrcResMap.get(selector); if (tempSrc != null) { - throw new TooManyReplacesOnSameTargetSelectorException(target.getDynamicType().getName().toString(), selector.getStringValue(), metadata); + throw new TooManyReplacesOnSameTargetSelectorException( + target.getDynamicType().getName().toString(), + selector.getStringValue(), + metadata + ); } continue; } tempSelSrcResMap.put(selector, tempSelSrcMap.get(selector)); } - res.delReplaceObjMap.put(target,tempSelSrcResMap); + res.delReplaceObjMap.put(target, tempSelSrcResMap); } // INSERTS @@ -236,7 +250,7 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda if (res.insertObjMap.containsKey(target)) { tempSrc = InsertIntoObjectPrimitive.mergeSources(res.insertObjMap.get(target), tempSrc, metadata); } - res.insertObjMap.put(target,tempSrc); + res.insertObjMap.put(target, tempSrc); } // RENAME @@ -248,7 +262,7 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda for (Item selector : tempSelSrcMap.keySet()) { tempSelSrcResMap.put(selector, tempSelSrcMap.get(selector)); } - res.renameObjMap.put(target,tempSelSrcResMap); + res.renameObjMap.put(target, tempSelSrcResMap); } for (Item target : pul2.renameObjMap.keySet()) { @@ -261,7 +275,7 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda } tempSelSrcResMap.put(selector, tempSelSrcMap.get(selector)); } - res.renameObjMap.put(target,tempSelSrcResMap); + res.renameObjMap.put(target, tempSelSrcResMap); } ////// ARRAYS @@ -275,7 +289,7 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda for (Item selector : tempSelSrcMap.keySet()) { tempSelSrcResMap.put(selector, tempSelSrcMap.get(selector)); } - res.delReplaceArrayMap.put(target,tempSelSrcResMap); + res.delReplaceArrayMap.put(target, tempSelSrcResMap); } for (Item target : pul2.delReplaceArrayMap.keySet()) { @@ -286,13 +300,17 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda if (tempSelSrcResMap.containsKey(selector)) { tempSrc = tempSelSrcResMap.get(selector); if (tempSrc != null) { - throw new TooManyReplacesOnSameTargetSelectorException(target.getDynamicType().getName().toString(), Integer.toString(selector.getIntValue()), metadata); + throw new TooManyReplacesOnSameTargetSelectorException( + target.getDynamicType().getName().toString(), + Integer.toString(selector.getIntValue()), + metadata + ); } continue; } tempSelSrcResMap.put(selector, tempSelSrcMap.get(selector)); } - res.delReplaceArrayMap.put(target,tempSelSrcResMap); + res.delReplaceArrayMap.put(target, tempSelSrcResMap); } // INSERTS @@ -304,7 +322,7 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda for (Item selector : tempSelSrcListMap.keySet()) { tempSelSrcResListMap.put(selector, tempSelSrcListMap.get(selector)); } - res.insertArrayMap.put(target,tempSelSrcResListMap); + res.insertArrayMap.put(target, tempSelSrcResListMap); } for (Item target : pul2.insertArrayMap.keySet()) { @@ -313,9 +331,12 @@ public static PendingUpdateList mergeUpdates(PendingUpdateList pul1, PendingUpda for (Item selector : tempSelSrcListMap.keySet()) { tempSrcList = tempSelSrcResListMap.getOrDefault(selector, new ArrayList<>()); - tempSelSrcResListMap.put(selector, InsertIntoArrayPrimitive.mergeSources( tempSrcList, tempSelSrcListMap.get(selector))); + tempSelSrcResListMap.put( + selector, + InsertIntoArrayPrimitive.mergeSources(tempSrcList, tempSelSrcListMap.get(selector)) + ); } - res.insertArrayMap.put(target,tempSelSrcResListMap); + res.insertArrayMap.put(target, tempSelSrcResListMap); } return res; diff --git a/src/main/java/org/rumbledb/runtime/update/expression/AppendExpressionIterator.java b/src/main/java/org/rumbledb/runtime/update/expression/AppendExpressionIterator.java index b079f777f..6f49070d0 100644 --- a/src/main/java/org/rumbledb/runtime/update/expression/AppendExpressionIterator.java +++ b/src/main/java/org/rumbledb/runtime/update/expression/AppendExpressionIterator.java @@ -21,7 +21,12 @@ public class AppendExpressionIterator extends HybridRuntimeIterator { private RuntimeIterator arrayIterator; private RuntimeIterator toAppendIterator; - public AppendExpressionIterator(RuntimeIterator arrayIterator, RuntimeIterator toAppendIterator, ExecutionMode executionMode, ExceptionMetadata iteratorMetadata) { + public AppendExpressionIterator( + RuntimeIterator arrayIterator, + RuntimeIterator toAppendIterator, + ExecutionMode executionMode, + ExceptionMetadata iteratorMetadata + ) { super(Arrays.asList(arrayIterator, toAppendIterator), executionMode, iteratorMetadata); this.arrayIterator = arrayIterator; @@ -77,11 +82,17 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { if (target.isArray()) { Item locator = ItemFactory.getInstance().createIntItem(target.getSize() + 1); if (target.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createInsertIntoArrayPrimitive(target, locator, Collections.singletonList(content)); } else { - throw new InvalidUpdateTargetException("Append expression target must be a single array", this.getMetadata()); + throw new InvalidUpdateTargetException( + "Append expression target must be a single array", + this.getMetadata() + ); } pul.addUpdatePrimitive(up); diff --git a/src/main/java/org/rumbledb/runtime/update/expression/DeleteExpressionIterator.java b/src/main/java/org/rumbledb/runtime/update/expression/DeleteExpressionIterator.java index e93f179cd..49035acf0 100644 --- a/src/main/java/org/rumbledb/runtime/update/expression/DeleteExpressionIterator.java +++ b/src/main/java/org/rumbledb/runtime/update/expression/DeleteExpressionIterator.java @@ -19,7 +19,12 @@ public class DeleteExpressionIterator extends HybridRuntimeIterator { private RuntimeIterator mainIterator; private RuntimeIterator lookupIterator; - public DeleteExpressionIterator(RuntimeIterator mainIterator, RuntimeIterator lookupIterator, ExecutionMode executionMode, ExceptionMetadata iteratorMetadata) { + public DeleteExpressionIterator( + RuntimeIterator mainIterator, + RuntimeIterator lookupIterator, + ExecutionMode executionMode, + ExceptionMetadata iteratorMetadata + ) { super(Arrays.asList(mainIterator, lookupIterator), executionMode, iteratorMetadata); this.mainIterator = mainIterator; this.lookupIterator = lookupIterator; @@ -73,22 +78,37 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { UpdatePrimitive up; if (main.isObject()) { if (!lookup.isString()) { - throw new CannotCastUpdateSelectorException("Delete expression selection cannot be cast to String type", this.getMetadata()); + throw new CannotCastUpdateSelectorException( + "Delete expression selection cannot be cast to String type", + this.getMetadata() + ); } if (main.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createDeleteFromObjectPrimitive(main, Collections.singletonList(lookup), this.getMetadata()); } else if (main.isArray()) { if (!lookup.isInt()) { - throw new CannotCastUpdateSelectorException("Delete expression selection cannot be cast to Int type", this.getMetadata()); + throw new CannotCastUpdateSelectorException( + "Delete expression selection cannot be cast to Int type", + this.getMetadata() + ); } if (main.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createDeleteFromArrayPrimitive(main, lookup, this.getMetadata()); } else { - throw new InvalidUpdateTargetException("Delete expression target must be a single array or object", this.getMetadata()); + throw new InvalidUpdateTargetException( + "Delete expression target must be a single array or object", + this.getMetadata() + ); } pul.addUpdatePrimitive(up); diff --git a/src/main/java/org/rumbledb/runtime/update/expression/InsertExpressionIterator.java b/src/main/java/org/rumbledb/runtime/update/expression/InsertExpressionIterator.java index c144172f0..443e1a0cc 100644 --- a/src/main/java/org/rumbledb/runtime/update/expression/InsertExpressionIterator.java +++ b/src/main/java/org/rumbledb/runtime/update/expression/InsertExpressionIterator.java @@ -12,10 +12,8 @@ import org.rumbledb.runtime.update.primitives.UpdatePrimitive; import org.rumbledb.runtime.update.primitives.UpdatePrimitiveFactory; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.List; public class InsertExpressionIterator extends HybridRuntimeIterator { @@ -23,13 +21,19 @@ public class InsertExpressionIterator extends HybridRuntimeIterator { private RuntimeIterator toInsertIterator; private RuntimeIterator positionIterator; - public InsertExpressionIterator(RuntimeIterator mainIterator, RuntimeIterator toInsertIterator, RuntimeIterator positionIterator, ExecutionMode executionMode, ExceptionMetadata iteratorMetadata) { + public InsertExpressionIterator( + RuntimeIterator mainIterator, + RuntimeIterator toInsertIterator, + RuntimeIterator positionIterator, + ExecutionMode executionMode, + ExceptionMetadata iteratorMetadata + ) { super( - positionIterator == null - ? Arrays.asList(mainIterator, toInsertIterator) - : Arrays.asList(mainIterator, toInsertIterator, positionIterator), - executionMode, - iteratorMetadata + positionIterator == null + ? Arrays.asList(mainIterator, toInsertIterator) + : Arrays.asList(mainIterator, toInsertIterator, positionIterator), + executionMode, + iteratorMetadata ); this.mainIterator = mainIterator; @@ -95,10 +99,16 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { UpdatePrimitive up; if (main.isObject()) { if (!content.isObject()) { - throw new ObjectInsertContentIsNotObjectSeqException("Insert expression content is not an object", this.getMetadata()); + throw new ObjectInsertContentIsNotObjectSeqException( + "Insert expression content is not an object", + this.getMetadata() + ); } if (main.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createInsertIntoObjectPrimitive(main, content); } else if (main.isArray()) { @@ -106,14 +116,23 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { throw new CannotCastUpdateSelectorException("Insert expression selector is null", this.getMetadata()); } if (!locator.isInt()) { - throw new CannotCastUpdateSelectorException("Insert expression selector cannot be cast to Int type", this.getMetadata()); + throw new CannotCastUpdateSelectorException( + "Insert expression selector cannot be cast to Int type", + this.getMetadata() + ); } if (main.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createInsertIntoArrayPrimitive(main, locator, Collections.singletonList(content)); } else { - throw new InvalidUpdateTargetException("Insert expression target must be a single array or object", this.getMetadata()); + throw new InvalidUpdateTargetException( + "Insert expression target must be a single array or object", + this.getMetadata() + ); } pul.addUpdatePrimitive(up); diff --git a/src/main/java/org/rumbledb/runtime/update/expression/RenameExpressionIterator.java b/src/main/java/org/rumbledb/runtime/update/expression/RenameExpressionIterator.java index 146f4a4c1..1be250c45 100644 --- a/src/main/java/org/rumbledb/runtime/update/expression/RenameExpressionIterator.java +++ b/src/main/java/org/rumbledb/runtime/update/expression/RenameExpressionIterator.java @@ -5,7 +5,6 @@ import org.rumbledb.context.DynamicContext; import org.rumbledb.exceptions.*; import org.rumbledb.expressions.ExecutionMode; -import org.rumbledb.items.ItemFactory; import org.rumbledb.runtime.HybridRuntimeIterator; import org.rumbledb.runtime.RuntimeIterator; import org.rumbledb.runtime.update.PendingUpdateList; @@ -13,8 +12,6 @@ import org.rumbledb.runtime.update.primitives.UpdatePrimitiveFactory; import java.util.Arrays; -import java.util.Collections; -import java.util.List; public class RenameExpressionIterator extends HybridRuntimeIterator { @@ -22,7 +19,13 @@ public class RenameExpressionIterator extends HybridRuntimeIterator { private RuntimeIterator locatorIterator; private RuntimeIterator nameIterator; - public RenameExpressionIterator(RuntimeIterator mainIterator, RuntimeIterator locatorIterator, RuntimeIterator nameIterator, ExecutionMode executionMode, ExceptionMetadata iteratorMetadata) { + public RenameExpressionIterator( + RuntimeIterator mainIterator, + RuntimeIterator locatorIterator, + RuntimeIterator nameIterator, + ExecutionMode executionMode, + ExceptionMetadata iteratorMetadata + ) { super(Arrays.asList(mainIterator, locatorIterator, nameIterator), executionMode, iteratorMetadata); this.mainIterator = mainIterator; @@ -82,14 +85,23 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { UpdatePrimitive up; if (target.isObject()) { if (!locator.isString()) { - throw new CannotCastUpdateSelectorException("Rename expression selection cannot be cast to String type", this.getMetadata()); + throw new CannotCastUpdateSelectorException( + "Rename expression selection cannot be cast to String type", + this.getMetadata() + ); } if (target.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createRenameInObjectPrimitive(target, locator, content, this.getMetadata()); } else { - throw new InvalidUpdateTargetException("Rename expression target must be a single object", this.getMetadata()); + throw new InvalidUpdateTargetException( + "Rename expression target must be a single object", + this.getMetadata() + ); } pul.addUpdatePrimitive(up); diff --git a/src/main/java/org/rumbledb/runtime/update/expression/ReplaceExpressionIterator.java b/src/main/java/org/rumbledb/runtime/update/expression/ReplaceExpressionIterator.java index 2f4899505..4d21860db 100644 --- a/src/main/java/org/rumbledb/runtime/update/expression/ReplaceExpressionIterator.java +++ b/src/main/java/org/rumbledb/runtime/update/expression/ReplaceExpressionIterator.java @@ -23,7 +23,13 @@ public class ReplaceExpressionIterator extends HybridRuntimeIterator { private RuntimeIterator locatorIterator; private RuntimeIterator replacerIterator; - public ReplaceExpressionIterator(RuntimeIterator mainIterator, RuntimeIterator locatorIterator, RuntimeIterator replacerIterator, ExecutionMode executionMode, ExceptionMetadata iteratorMetadata) { + public ReplaceExpressionIterator( + RuntimeIterator mainIterator, + RuntimeIterator locatorIterator, + RuntimeIterator replacerIterator, + ExecutionMode executionMode, + ExceptionMetadata iteratorMetadata + ) { super(Arrays.asList(mainIterator, locatorIterator, replacerIterator), executionMode, iteratorMetadata); this.mainIterator = mainIterator; @@ -95,22 +101,37 @@ public PendingUpdateList getPendingUpdateList(DynamicContext context) { UpdatePrimitive up; if (target.isObject()) { if (!locator.isString()) { - throw new CannotCastUpdateSelectorException("Replace expression selection cannot be cast to String type", this.getMetadata()); + throw new CannotCastUpdateSelectorException( + "Replace expression selection cannot be cast to String type", + this.getMetadata() + ); } if (target.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createReplaceInObjectPrimitive(target, locator, content, this.getMetadata()); } else if (target.isArray()) { if (!locator.isInt()) { - throw new CannotCastUpdateSelectorException("Replace expression selection cannot be cast to Int type", this.getMetadata()); + throw new CannotCastUpdateSelectorException( + "Replace expression selection cannot be cast to Int type", + this.getMetadata() + ); } if (target.getMutabilityLevel() != context.getCurrentMutabilityLevel()) { - throw new TransformModifiesNonCopiedValueException("Attempt to modify currently immutable target", this.getMetadata()); + throw new TransformModifiesNonCopiedValueException( + "Attempt to modify currently immutable target", + this.getMetadata() + ); } up = factory.createReplaceInArrayPrimitive(target, locator, content, this.getMetadata()); } else { - throw new InvalidUpdateTargetException("Replace expression target must be a single array or object", this.getMetadata()); + throw new InvalidUpdateTargetException( + "Replace expression target must be a single array or object", + this.getMetadata() + ); } pul.addUpdatePrimitive(up); diff --git a/src/main/java/org/rumbledb/runtime/update/expression/TransformExpressionIterator.java b/src/main/java/org/rumbledb/runtime/update/expression/TransformExpressionIterator.java index 973dcd7b5..330303cf4 100644 --- a/src/main/java/org/rumbledb/runtime/update/expression/TransformExpressionIterator.java +++ b/src/main/java/org/rumbledb/runtime/update/expression/TransformExpressionIterator.java @@ -3,13 +3,10 @@ import org.apache.spark.api.java.JavaRDD; import org.apache.commons.lang.SerializationUtils; import org.rumbledb.api.Item; -import org.rumbledb.compiler.VisitorHelpers; import org.rumbledb.context.DynamicContext; import org.rumbledb.context.Name; import org.rumbledb.exceptions.ExceptionMetadata; import org.rumbledb.expressions.ExecutionMode; -import org.rumbledb.expressions.Expression; -import org.rumbledb.expressions.update.CopyDeclaration; import org.rumbledb.runtime.HybridRuntimeIterator; import org.rumbledb.runtime.RuntimeIterator; import org.rumbledb.runtime.update.PendingUpdateList; @@ -26,7 +23,14 @@ public class TransformExpressionIterator extends HybridRuntimeIterator { private int mutabilityLevel; - public TransformExpressionIterator(Map copyDeclMap, RuntimeIterator modifyIterator, RuntimeIterator returnIterator, ExecutionMode executionMode, int mutabilityLevel, ExceptionMetadata iteratorMetadata) { + public TransformExpressionIterator( + Map copyDeclMap, + RuntimeIterator modifyIterator, + RuntimeIterator returnIterator, + ExecutionMode executionMode, + int mutabilityLevel, + ExceptionMetadata iteratorMetadata + ) { super(null, executionMode, iteratorMetadata); this.children.addAll(copyDeclMap.values()); this.children.add(modifyIterator); diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromArrayPrimitive.java b/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromArrayPrimitive.java index 4d013869b..8cf51f57b 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromArrayPrimitive.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromArrayPrimitive.java @@ -3,7 +3,6 @@ import org.rumbledb.api.Item; import org.rumbledb.exceptions.CannotResolveUpdateSelectorException; import org.rumbledb.exceptions.ExceptionMetadata; -import org.rumbledb.items.ArrayItem; public class DeleteFromArrayPrimitive implements UpdatePrimitive { @@ -13,7 +12,10 @@ public class DeleteFromArrayPrimitive implements UpdatePrimitive { public DeleteFromArrayPrimitive(Item targetArray, Item positionInt, ExceptionMetadata metadata) { if (positionInt.getIntValue() <= 0 || positionInt.getIntValue() > targetArray.getSize()) { - throw new CannotResolveUpdateSelectorException("Cannot delete item at index out of range of target array", metadata); + throw new CannotResolveUpdateSelectorException( + "Cannot delete item at index out of range of target array", + metadata + ); } this.target = targetArray; this.selector = positionInt; diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromObjectPrimitive.java b/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromObjectPrimitive.java index 79cf30d52..a55b5b9a3 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromObjectPrimitive.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/DeleteFromObjectPrimitive.java @@ -3,8 +3,6 @@ import org.rumbledb.api.Item; import org.rumbledb.exceptions.CannotResolveUpdateSelectorException; import org.rumbledb.exceptions.ExceptionMetadata; -import org.rumbledb.exceptions.OurBadException; -import org.rumbledb.items.ObjectItem; import java.util.ArrayList; import java.util.List; @@ -19,11 +17,14 @@ public DeleteFromObjectPrimitive(Item targetObject, List namesToRemove, Ex for (Item item : namesToRemove) { if (targetObject.getItemByKey(item.getStringValue()) == null) { - throw new CannotResolveUpdateSelectorException("Cannot delete key that does not exist in target object", metadata); + throw new CannotResolveUpdateSelectorException( + "Cannot delete key that does not exist in target object", + metadata + ); } } - this.target = targetObject; + this.target = targetObject; this.content = namesToRemove; } diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/InsertIntoArrayPrimitive.java b/src/main/java/org/rumbledb/runtime/update/primitives/InsertIntoArrayPrimitive.java index 1f595c28a..a6f2d9b4e 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/InsertIntoArrayPrimitive.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/InsertIntoArrayPrimitive.java @@ -1,7 +1,6 @@ package org.rumbledb.runtime.update.primitives; import org.rumbledb.api.Item; -import org.rumbledb.items.ArrayItem; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/RenameInObjectPrimitive.java b/src/main/java/org/rumbledb/runtime/update/primitives/RenameInObjectPrimitive.java index aaff6e349..01c0d4037 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/RenameInObjectPrimitive.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/RenameInObjectPrimitive.java @@ -3,7 +3,6 @@ import org.rumbledb.api.Item; import org.rumbledb.exceptions.CannotResolveUpdateSelectorException; import org.rumbledb.exceptions.ExceptionMetadata; -import org.rumbledb.items.ObjectItem; public class RenameInObjectPrimitive implements UpdatePrimitive { @@ -11,10 +10,18 @@ public class RenameInObjectPrimitive implements UpdatePrimitive { private Item selector; private Item content; - public RenameInObjectPrimitive(Item targetObject, Item targetName, Item replacementName, ExceptionMetadata metadata) { + public RenameInObjectPrimitive( + Item targetObject, + Item targetName, + Item replacementName, + ExceptionMetadata metadata + ) { if (targetObject.getItemByKey(targetName.getStringValue()) == null) { - throw new CannotResolveUpdateSelectorException("Cannot rename key that does not exist in target object", metadata); + throw new CannotResolveUpdateSelectorException( + "Cannot rename key that does not exist in target object", + metadata + ); } diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInArrayPrimitive.java b/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInArrayPrimitive.java index 5522e2b8c..9be2c9820 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInArrayPrimitive.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInArrayPrimitive.java @@ -3,7 +3,6 @@ import org.rumbledb.api.Item; import org.rumbledb.exceptions.CannotResolveUpdateSelectorException; import org.rumbledb.exceptions.ExceptionMetadata; -import org.rumbledb.items.ArrayItem; public class ReplaceInArrayPrimitive implements UpdatePrimitive { @@ -11,9 +10,17 @@ public class ReplaceInArrayPrimitive implements UpdatePrimitive { private Item selector; private Item content; - public ReplaceInArrayPrimitive(Item targetArray, Item positionInt, Item replacementItem, ExceptionMetadata metadata) { + public ReplaceInArrayPrimitive( + Item targetArray, + Item positionInt, + Item replacementItem, + ExceptionMetadata metadata + ) { if (positionInt.getIntValue() <= 0 || positionInt.getIntValue() > targetArray.getSize()) { - throw new CannotResolveUpdateSelectorException("Cannot replace item at index out of range of target array", metadata); + throw new CannotResolveUpdateSelectorException( + "Cannot replace item at index out of range of target array", + metadata + ); } this.target = targetArray; diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInObjectPrimitive.java b/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInObjectPrimitive.java index 77f85e7cc..a4d9e0daf 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInObjectPrimitive.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/ReplaceInObjectPrimitive.java @@ -3,7 +3,6 @@ import org.rumbledb.api.Item; import org.rumbledb.exceptions.CannotResolveUpdateSelectorException; import org.rumbledb.exceptions.ExceptionMetadata; -import org.rumbledb.items.ObjectItem; public class ReplaceInObjectPrimitive implements UpdatePrimitive { @@ -11,10 +10,18 @@ public class ReplaceInObjectPrimitive implements UpdatePrimitive { private Item selector; private Item content; - public ReplaceInObjectPrimitive(Item targetObject, Item targetName, Item replacementItem, ExceptionMetadata metadata) { + public ReplaceInObjectPrimitive( + Item targetObject, + Item targetName, + Item replacementItem, + ExceptionMetadata metadata + ) { if (targetObject.getItemByKey(targetName.getStringValue()) == null) { - throw new CannotResolveUpdateSelectorException("Cannot delete key that does not exist in target object", metadata); + throw new CannotResolveUpdateSelectorException( + "Cannot delete key that does not exist in target object", + metadata + ); } this.target = targetObject; diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitive.java b/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitive.java index 006f7d584..7827587d3 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitive.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitive.java @@ -12,9 +12,13 @@ public interface UpdatePrimitive { Item getTarget(); - default Item getSelector() {throw new UnsupportedOperationException("Operation not defined");} + default Item getSelector() { + throw new UnsupportedOperationException("Operation not defined"); + } - default int getIntSelector() {throw new UnsupportedOperationException("Operation not defined");} + default int getIntSelector() { + throw new UnsupportedOperationException("Operation not defined"); + } default Item getContent() { throw new UnsupportedOperationException("Operation not defined"); diff --git a/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitiveFactory.java b/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitiveFactory.java index 33ad10778..2dc938b1c 100644 --- a/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitiveFactory.java +++ b/src/main/java/org/rumbledb/runtime/update/primitives/UpdatePrimitiveFactory.java @@ -16,11 +16,19 @@ public static UpdatePrimitiveFactory getInstance() { return instance; } - public UpdatePrimitive createDeleteFromArrayPrimitive(Item targetArray, Item selectorInt, ExceptionMetadata metadata) { + public UpdatePrimitive createDeleteFromArrayPrimitive( + Item targetArray, + Item selectorInt, + ExceptionMetadata metadata + ) { return new DeleteFromArrayPrimitive(targetArray, selectorInt, metadata); } - public UpdatePrimitive createDeleteFromObjectPrimitive(Item targetObject, List selectorStrs, ExceptionMetadata metadata) { + public UpdatePrimitive createDeleteFromObjectPrimitive( + Item targetObject, + List selectorStrs, + ExceptionMetadata metadata + ) { return new DeleteFromObjectPrimitive(targetObject, selectorStrs, metadata); } @@ -32,15 +40,30 @@ public UpdatePrimitive createInsertIntoObjectPrimitive(Item targetObject, Item c return new InsertIntoObjectPrimitive(targetObject, contentsObject); } - public UpdatePrimitive createReplaceInArrayPrimitive(Item targetArray, Item selectorInt, Item content, ExceptionMetadata metadata) { + public UpdatePrimitive createReplaceInArrayPrimitive( + Item targetArray, + Item selectorInt, + Item content, + ExceptionMetadata metadata + ) { return new ReplaceInArrayPrimitive(targetArray, selectorInt, content, metadata); } - public UpdatePrimitive createReplaceInObjectPrimitive(Item targetObject, Item selectorStr, Item content, ExceptionMetadata metadata) { + public UpdatePrimitive createReplaceInObjectPrimitive( + Item targetObject, + Item selectorStr, + Item content, + ExceptionMetadata metadata + ) { return new ReplaceInObjectPrimitive(targetObject, selectorStr, content, metadata); } - public UpdatePrimitive createRenameInObjectPrimitive(Item targetObject, Item selectorStr, Item content, ExceptionMetadata metadata) { + public UpdatePrimitive createRenameInObjectPrimitive( + Item targetObject, + Item selectorStr, + Item content, + ExceptionMetadata metadata + ) { return new RenameInObjectPrimitive(targetObject, selectorStr, content, metadata); }