com.sun.msv.grammar.util
Class NameClassComparator

java.lang.Object
  extended by com.sun.msv.grammar.util.NameClassComparator
All Implemented Interfaces:
NameClassVisitor
Direct Known Subclasses:
NameClassCollisionChecker

public abstract class NameClassComparator
extends Object
implements NameClassVisitor

Abstract implementation of a function

   NameClass x NameClass ->  boolean
 
Override the probe method to define the actual function.

To compute, create an instance and call the check method. This class is not reentrant, so the caller is responsible not to reuse the same object by multiple threads.

Author:
Kohsuke KAWAGUCHI

Field Summary
protected  RuntimeException eureka
          This exception will be thrown when a collision is found.
protected  NameClass nc1
          Two name classes to be tested.
protected  NameClass nc2
          Two name classes to be tested.
 
Constructor Summary
NameClassComparator()
           
 
Method Summary
 boolean check(NameClass _new, NameClass _old)
          Returns true if two name classes collide.
 Object onAnyName(AnyNameClass nc)
           
 Object onChoice(ChoiceNameClass nc)
           
 Object onDifference(DifferenceNameClass nc)
           
 Object onNot(NotNameClass nc)
           
 Object onNsName(NamespaceNameClass nc)
           
 Object onSimple(SimpleNameClass nc)
           
protected abstract  void probe(String uri, String local)
          Throw eureka to return true from the probe method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nc1

protected NameClass nc1
Two name classes to be tested.


nc2

protected NameClass nc2
Two name classes to be tested.


eureka

protected final RuntimeException eureka
This exception will be thrown when a collision is found.

Constructor Detail

NameClassComparator

public NameClassComparator()
Method Detail

check

public boolean check(NameClass _new,
                     NameClass _old)
Returns true if two name classes collide.


probe

protected abstract void probe(String uri,
                              String local)
Throw eureka to return true from the probe method.


onAnyName

public Object onAnyName(AnyNameClass nc)
Specified by:
onAnyName in interface NameClassVisitor

onNsName

public Object onNsName(NamespaceNameClass nc)
Specified by:
onNsName in interface NameClassVisitor

onSimple

public Object onSimple(SimpleNameClass nc)
Specified by:
onSimple in interface NameClassVisitor

onNot

public Object onNot(NotNameClass nc)
Specified by:
onNot in interface NameClassVisitor

onDifference

public Object onDifference(DifferenceNameClass nc)
Specified by:
onDifference in interface NameClassVisitor

onChoice

public Object onChoice(ChoiceNameClass nc)
Specified by:
onChoice in interface NameClassVisitor


MSV