Browse Source

fixing TODOs

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@71 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Andy Clement 18 years ago
parent
commit
7caea5719e
  1. 6
      org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java
  2. 12
      org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/OperatorSoundsLike.java

6
org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java

@ -20,12 +20,12 @@ import java.util.Map; @@ -20,12 +20,12 @@ import java.util.Map;
import org.antlr.runtime.Token;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.spel.ExpressionState;
import org.springframework.expression.spel.SpelException;
import org.springframework.expression.spel.SpelMessages;
import org.springframework.expression.spel.ExpressionState;
// TODO 2 support multidimensional arrays
// TODO 3 support correct syntax for multidimensional [][][] and not [,,,]
// TODO support multidimensional arrays
// TODO support correct syntax for multidimensional [][][] and not [,,,]
/**
* An Indexer can index into some proceeding structure to access a particular piece of it. Supported structures are:
* strings/collections (lists/sets)/arrays

12
org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/OperatorSoundsLike.java

@ -17,9 +17,9 @@ package org.springframework.expression.spel.ast; @@ -17,9 +17,9 @@ package org.springframework.expression.spel.ast;
import org.antlr.runtime.Token;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.spel.ExpressionState;
import org.springframework.expression.spel.SpelException;
import org.springframework.expression.spel.SpelMessages;
import org.springframework.expression.spel.ExpressionState;
public class OperatorSoundsLike extends Operator {
@ -32,19 +32,19 @@ public class OperatorSoundsLike extends Operator { @@ -32,19 +32,19 @@ public class OperatorSoundsLike extends Operator {
Object left = getLeftOperand().getValue(state);
Object right = getRightOperand().getValue(state);
if (!(left instanceof String)) {
throw new SpelException(getCharPositionInLine(), SpelMessages.SOUNDSLIKE_NEEDS_STRING_OPERAND, left.getClass()
.getName());
throw new SpelException(getCharPositionInLine(), SpelMessages.SOUNDSLIKE_NEEDS_STRING_OPERAND, left
.getClass().getName());
}
if (!(right instanceof String)) {
throw new SpelException(getCharPositionInLine(), SpelMessages.SOUNDSLIKE_NEEDS_STRING_OPERAND, right.getClass()
.getName());
throw new SpelException(getCharPositionInLine(), SpelMessages.SOUNDSLIKE_NEEDS_STRING_OPERAND, right
.getClass().getName());
}
String leftSoundex = computeSoundex((String) left);
String rightSoundex = computeSoundex((String) right);
return state.getTypeComparator().compare(leftSoundex, rightSoundex) == 0;
}
// TODO OPTIMIZE better algorithm implementation is possible for soundex
// TODO if we keep soundslike, improve upon this basic implementation
private String computeSoundex(String input) {
if (input == null || input.length() == 0)
return "0000";

Loading…
Cancel
Save