msv.msv.src.com.sun.msv.grammar.ChoiceNameClass Maven / Gradle / Ivy
/*
* @(#)$Id: ChoiceNameClass.java 1566 2003-06-09 20:37:49Z kk122374 $
*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the proprietary information of Sun Microsystems, Inc.
* Use is subject to license terms.
*
*/
package com.sun.msv.grammar;
/**
* Union of two NameClasses.
*
* @author Kohsuke KAWAGUCHI
*/
public class ChoiceNameClass extends NameClass {
public final NameClass nc1;
public final NameClass nc2;
/** accepts a name if it is accepted by nc1 or nc2. */
public boolean accepts( String namespaceURI, String localPart ) {
return nc1.accepts(namespaceURI,localPart)
|| nc2.accepts(namespaceURI,localPart);
}
public Object visit( NameClassVisitor visitor ) { return visitor.onChoice(this); }
public ChoiceNameClass( NameClass nc1, NameClass nc2 ) {
this.nc1 = nc1;
this.nc2 = nc2;
}
public String toString() {
return '('+nc1.toString()+'|'+nc2.toString()+')';
}
// serialization support
private static final long serialVersionUID = 1;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy