Package synalp.generation.jeni.selection.patterns.templates

Source Code of synalp.generation.jeni.selection.patterns.templates.RewritingTemplate

package synalp.generation.jeni.selection.patterns.templates;

import synalp.commons.semantics.Semantics;
import synalp.commons.unification.InstantiationContext;
import synalp.generation.jeni.semantics.rules.operators.ReplaceOperator;

/**
* A RewritingTemplate rewrites parts of the input semantics.
* @author Alexandre Denis
*
*/
public class RewritingTemplate extends SelectionTemplate
{
  private ReplaceOperator operator;
 
  /**
   *
   * @param oldSem
   * @param newSem
   */
  public RewritingTemplate(Semantics oldSem, Semantics newSem)
  {
    this.operator = new ReplaceOperator(newSem, oldSem);
  }
 
  /**
   *
   * @param semantics
   * @param context
   */
  public void applyRewriting(Semantics semantics, InstantiationContext context)
  {
    if (operator.getOld().doesSubsume(semantics, context))
      operator.apply(semantics, context);
  }
 
}
TOP

Related Classes of synalp.generation.jeni.selection.patterns.templates.RewritingTemplate

TOP
Copyright © 2018 www.massapi.com. 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.