org.shapelogic.logic
Class LetterTaskFactory

java.lang.Object
  extended by org.shapelogic.logic.LetterTaskFactory

public class LetterTaskFactory
extends java.lang.Object

Should create all the rules used for letter matching. Contains 2 sets of rules for letter matching 1: A simple set that only works for straight letters using simple properties 2: A more complex set of rules works for straight and curved letters This uses annotations

Author:
Sami Badawi

Field Summary
static java.lang.String POLYGON
           
static boolean USE_LEGACY_SYNTAX
          To test if rules with old syntax still works
 
Constructor Summary
LetterTaskFactory()
           
 
Method Summary
static BaseTask createLetterTasksFromRule(BaseTask parentTask, java.util.List<NumericRule> allNumericRules, java.lang.String letterSelector)
          Create a letter task from all NumericRules of the underlying letters.
static java.lang.String filter(java.lang.String expression)
          Transform base expression to expression filter with size applied.
static NumericRule[] getSimpleNumericRuleForAllLetters(java.lang.String polygon)
          Generate all rule that are needed for matching all the capital letter using new complex filter rules.
static java.lang.String matchPolygonToLetterUsingTask(Polygon rawPolygon, Polygon polygon, NumericRule[] rulesArrayForLetterMatching)
           
static java.lang.String size(java.lang.String expression)
          Transform base expression to expression with size applied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLYGON

public static final java.lang.String POLYGON
See Also:
Constant Field Values

USE_LEGACY_SYNTAX

public static final boolean USE_LEGACY_SYNTAX
To test if rules with old syntax still works

See Also:
Constant Field Values
Constructor Detail

LetterTaskFactory

public LetterTaskFactory()
Method Detail

size

public static java.lang.String size(java.lang.String expression)
Transform base expression to expression with size applied.

E.g: getPoints() -> size(#.getPoints())


filter

public static java.lang.String filter(java.lang.String expression)
Transform base expression to expression filter with size applied.

E.g: PointLeftOfFilter(0.5) -> #.filter('PointLeftOfFilter(0.5)').size()


getSimpleNumericRuleForAllLetters

public static NumericRule[] getSimpleNumericRuleForAllLetters(java.lang.String polygon)
Generate all rule that are needed for matching all the capital letter using new complex filter rules.

This is used in the MaxDistanceVectorizer

This uses the new uniform syntax that is creating ParametricRuleTask for all task.

Parameters:
polygon - is a String that contain the context variable that the rules will be applied to

createLetterTasksFromRule

public static BaseTask createLetterTasksFromRule(BaseTask parentTask,
                                                 java.util.List<NumericRule> allNumericRules,
                                                 java.lang.String letterSelector)
Create a letter task from all NumericRules of the underlying letters.

Parameters:
parentTask - To insert this task into, will often be the RootTask
allNumericRules - all the Numeric Rules that are used
letterSelector - if you only want to match against on letter for debugging problems
Returns:
task representing a lowest level rule

matchPolygonToLetterUsingTask

public static java.lang.String matchPolygonToLetterUsingTask(Polygon rawPolygon,
                                                             Polygon polygon,
                                                             NumericRule[] rulesArrayForLetterMatching)


Copyright © 2009. All Rights Reserved.