All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.msv.grammar.DifferenceNameClass Maven / Gradle / Ivy

There is a newer version: 2.2.5.1
Show newest version
/*
 * @(#)$Id: DifferenceNameClass.java,v 1.6 2003/06/09 20:37:17 kk122374 Exp $
 *
 * 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;

/**
 * <difference> name class.
 * 
 * @author Kohsuke KAWAGUCHI
 */
public class DifferenceNameClass extends NameClass {
    public final NameClass nc1;
    public final NameClass nc2;
    
    /**
     * accepts a name if it is accepted by nc1 and not by nc2.
     */
    public boolean accepts( String namespaceURI, String localPart ) {
        return nc1.accepts(namespaceURI,localPart)
            && !nc2.accepts(namespaceURI,localPart);
    }
    
    public Object visit( NameClassVisitor visitor ) {
        return visitor.onDifference(this);
    }
    
    public DifferenceNameClass( 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