diva.sketch.parser2d
Class SingleRule

java.lang.Object
  extended by diva.sketch.parser2d.SingleRule
All Implemented Interfaces:
Rule

public class SingleRule
extends Object
implements Rule

A parse rule implementation that matches the RHS of a production and generates the LHS. Subclasses fill in the match() method to impose the constraints of the rule.

Version:
$Revision: 1.3 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Constructor Summary
SingleRule(String lhsType, String rhsName, String rhsType)
          A utility constructor which simply takes strings with single words separated by whitespace, separates these strings into arrays, and calls the standard array constructor.
 
Method Summary
 Type getLHSType()
          Return the LHS type of the rule.
 String[] getRHSNames()
          Return the RHS names of the rule.
 Type[] getRHSTypes()
          Return the RHS types of the rule.
 CompositeElement match(CompositeElement[] rhs, Scene db)
          Match the given scene elements and return a resulting element, or return null if there is no match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleRule

public SingleRule(String lhsType,
                  String rhsName,
                  String rhsType)
A utility constructor which simply takes strings with single words separated by whitespace, separates these strings into arrays, and calls the standard array constructor.

Method Detail

getLHSType

public Type getLHSType()
Return the LHS type of the rule.

Specified by:
getLHSType in interface Rule

getRHSTypes

public Type[] getRHSTypes()
Return the RHS types of the rule.

Specified by:
getRHSTypes in interface Rule

getRHSNames

public String[] getRHSNames()
Return the RHS names of the rule.

Specified by:
getRHSNames in interface Rule

match

public CompositeElement match(CompositeElement[] rhs,
                              Scene db)
Match the given scene elements and return a resulting element, or return null if there is no match.

Specified by:
match in interface Rule


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.