Package urban.transformers

Examples of urban.transformers.RuleToRuleGraphTransformer


   * @param g Generator for the rule
   * @param in Rule which the rates will be calculated from
   * @return A new rule with a calculated rate, if no shape or generator matches then the rates will be 1
   */
  public Rule calculateRates(Generator g, Rule in){
    RuleGraph rg = new RuleToRuleGraphTransformer().transform(in);
    Double forward = Math.pow(Math.E, getConstant(g) + shapes(g,rg, false, 0) - shapes(g,rg, true, 0) );
    Double backward = Math.pow(Math.E, getConstant(g) + shapes(g,rg, false, 1) - shapes(g,rg, true, 1) );
   
    return new Rule(in.getName(), in.getLhs(), in.getRhs(), true, forward, backward);
  }
View Full Code Here


   * @param r2 second rule
   * @return merged rule
   */
  public static Rule merge(Rule r, Rule r2) {
    try {
      RuleGraph rg1 = new RuleToRuleGraphTransformer().transform(r);
      RuleGraph rg2 = new RuleToRuleGraphTransformer().transform(r2);
     
      return new RuleGraphToRuleTransformer().transform(new RuleMerger(rg1,rg2).merge());
    } catch (IllegalArgumentException ex){
      return null;
    }
View Full Code Here

TOP

Related Classes of urban.transformers.RuleToRuleGraphTransformer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.