Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
Change function name for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbos committed Apr 11, 2017
1 parent f0be650 commit 8f1a77c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static double castToDouble(Value value) throws FunctionCallException {
throw new FunctionCallException("cannot cast " + value.getValue().getClass() + " to a number");
}

public static int checkLength(List<ValueList> arguments) {
public static int checkEqualLength(List<ValueList> arguments) {
int length = 1;
boolean first = true;
for(ValueList list:arguments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public ValueList evaluate(RuleEvaluation evaluation, ModelReference statement) {
if(variable != null) {
//resolve variable and add path prefix
ValueList value = evaluation.getVariableMap().get(variable);
if(value == null) {
throw new RuntimeException("Variable " + variable + " not defined");
}
if(value.size() > 1) {
throw new IllegalStateException("");
} else if (value.size() == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
import com.nedap.archie.rules.evaluation.ValueList;

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

import static com.nedap.archie.rules.evaluation.evaluators.FunctionUtil.castToDouble;
import static com.nedap.archie.rules.evaluation.evaluators.FunctionUtil.checkAndHandleNull;
import static com.nedap.archie.rules.evaluation.evaluators.FunctionUtil.checkLength;
import static com.nedap.archie.rules.evaluation.evaluators.FunctionUtil.checkEqualLength;

/**
* Created by pieter.bos on 07/04/2017.
Expand All @@ -32,7 +31,7 @@ public ValueList evaluate(List<ValueList> arguments) throws FunctionCallExceptio
return possiblyNullResult;
}
//check that all valueList are equal length or 1 length
int length = checkLength(arguments);
int length = checkEqualLength(arguments);
if(length == -1) {
throw new FunctionCallException("value lists of min operator not the same length");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.nedap.archie.rules.evaluation.FunctionImplementation;
import com.nedap.archie.rules.evaluation.Value;
import com.nedap.archie.rules.evaluation.ValueList;
import com.nedap.archie.rules.evaluation.evaluators.BinaryOperatorEvaluator;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -30,7 +29,7 @@ public ValueList evaluate(List<ValueList> arguments) throws FunctionCallExceptio
return possiblyNullResult;
}
//check that all valueList are equal length or 1 length
int length = checkLength(arguments);
int length = checkEqualLength(arguments);
if(length == -1) {
throw new FunctionCallException("value lists of min operator not the same length");
}
Expand Down

0 comments on commit 8f1a77c

Please sign in to comment.