Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.DifferenceNameClass


    public void connect(ExpressionPool pool, Grammar[] others) {
        found = null;
        super.connect(pool,others);
       
        NameClass rest = new DifferenceNameClass(namespaces,found).simplify();
        // build up lax content model
        ReferenceExp r = new ReferenceExp("lax");
        r.exp = pool.createZeroOrMore(pool.createChoice(
            pool.createAnyString(),
            pool.createChoice(
View Full Code Here


     * that represents this element.
     */
    protected NameClass annealNameClass( NameClass nameClass ) {
        NameClass r = getMainNameClass();
        if( nameClass!=null )
            r = new DifferenceNameClass( r, nameClass );
        return r;
    }
View Full Code Here

                }
            }
        }

        // laxNc - names in namespaces that are not allowed.
        return new DifferenceNameClass( laxNc, new NotNameClass(allowedNc) );
    }
View Full Code Here

           
            if( src.accepts(uris[i],MAGIC)!=src.accepts(MAGIC,MAGIC) ) {
                if(tmp==null)
                    tmp = new NamespaceNameClass(uris[i]);
                else
                    tmp = new DifferenceNameClass( new NamespaceNameClass(uris[i]), tmp );
            }
           
            if(r==null)        r = tmp;
            else            r = new ChoiceNameClass(r,tmp);
        }
       
        if( src.accepts(MAGIC,MAGIC) ) {
            if( r==null )
                r = NameClass.ALL;
            else
                r = new DifferenceNameClass( NameClass.ALL, r );
        } else {
            if(r==null) {
                // this name class accepts nothing.
                // by adding notAllowed to the content model, this element
                // will match nothing.
View Full Code Here

            for( int i=0; i<items.length; i++ ) {
                if( items[i].namespaceURI==NAMESPACE_WILDCARD
                 || items[i].localName==LOCALNAME_WILDCARD )
                    continue;
               
                nc = new DifferenceNameClass(nc,
                    new SimpleNameClass(items[i]));
            }
            equivalentNameClass = nc;
        }
       
View Full Code Here

            }
            if(possibleNames.contains(new StringPair(uri,MAGIC))) {
                if(local==null)
                    local = new NamespaceNameClass(uri);
                else
                    local = new DifferenceNameClass(new NamespaceNameClass(uri),local);
            }
           
            if(local!=null) {
                if(result==null)    result = local;
                else                result = new ChoiceNameClass(result,local);
View Full Code Here

* @author <a href="mailto:kohsuke.kawaguchi@eng.sun.com">Kohsuke KAWAGUCHI</a>
*/
public class NameClassDifferenceState extends NameClassWithChildState {
    protected NameClass castNameClass( NameClass halfCasted, NameClass newChild ) {
        if( halfCasted==null )    return newChild;    // first item
        else return new DifferenceNameClass( halfCasted, newChild );
    }
View Full Code Here

        assertSame(
            NameClass.ALL,
            NameClassSimplifier.simplify(
                new ChoiceNameClass(
                    NameClass.ALL,
                    new DifferenceNameClass(
                        new NamespaceNameClass("abc"),
                        new SimpleNameClass("abc","def")))));
    }
View Full Code Here

                        new SimpleNameClass("abc","def")))));
    }
   
    public void testSimplifier2() throws Exception {
        NameClass nc = NameClassSimplifier.simplify(
            new DifferenceNameClass(
                new ChoiceNameClass(
                    NameClass.ALL,
                    new NamespaceNameClass("abc")
                ),
                new SimpleNameClass("abc","def")));
View Full Code Here

        assertEquals( snc.localName, "def");
    }
   
    public void testSimplifier3() throws Exception {
        NameClass nc = NameClassSimplifier.simplify(
            new DifferenceNameClass(
                 NameClass.ALL,
                new DifferenceNameClass(
                    new NamespaceNameClass("abc"),
                    new SimpleNameClass("abc","def"))));
       
        assertTrue( nc instanceof NotNameClass );
        NotNameClass nnc = (NotNameClass)nc;
        assertTrue( nnc.child instanceof DifferenceNameClass );
        DifferenceNameClass dnc = (DifferenceNameClass)nnc.child;
        assertTrue( dnc.nc1 instanceof NamespaceNameClass );
        NamespaceNameClass nc1 = (NamespaceNameClass)dnc.nc1;
        assertEquals( "abc",nc1.namespaceURI );
        assertTrue( dnc.nc2 instanceof SimpleNameClass );
        SimpleNameClass nc2 = (SimpleNameClass)dnc.nc2;
View Full Code Here

TOP

Related Classes of com.sun.msv.grammar.DifferenceNameClass

Copyright © 2018 www.massapicom. 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.