private TypeUse onContainer(DContainerPattern p) { TypeUse t=null; for( DPattern child : p ) { TypeUse s = child.accept(this); if(t!=null && t!=s) return CBuiltinLeafInfo.STRING; // heterogenous t = s; } return t; }
private Location parseLocation(DPattern p) { Locator l = p.getLocation(); return sb.makeLocation(l.getSystemId(),l.getLineNumber(),l.getColumnNumber()); }
public boolean isNullable() { return start.isNullable(); }
protected void unwrapGroup(DPattern p) { if (p instanceof DGroupPattern && p.getAnnotation() == DAnnotation.EMPTY) { for (DPattern d : (DGroupPattern) p) { on(d); } } else { on(p); } }
protected void unwrapGroup(DPattern p) { if (p instanceof DGroupPattern && p.getAnnotation() == DAnnotation.EMPTY) { for (DPattern d : (DGroupPattern) p) { on(d); } } else { on(p); } }
private TypeUse onContainer(DContainerPattern p) { TypeUse t=null; for( DPattern child : p ) { TypeUse s = child.accept(this); if(t!=null && t!=s) return CBuiltinLeafInfo.STRING; // heterogenous t = s; } return t; }
public boolean isNullable() { return start.isNullable(); }
private Location parseLocation(DPattern p) { Locator l = p.getLocation(); return sb.makeLocation(l.getSystemId(),l.getLineNumber(),l.getColumnNumber()); }
protected void unwrapChoice(DPattern p) { if (p instanceof DChoicePattern && p.getAnnotation() == DAnnotation.EMPTY) { for (DPattern d : (DChoicePattern) p) { on(d); } } else { on(p); } }
protected void on(DPattern p) { p.accept(this); }
public boolean isNullable() { if(nullable==null) nullable = pattern.isNullable()?Boolean.TRUE:Boolean.FALSE; return nullable.booleanValue(); } }
private Void onRepeated(DPattern p,boolean optional) { RawTypeSet rts = RawTypeSetBuilder.build(compiler, p, optional? Multiplicity.STAR : Multiplicity.PLUS); if(rts.canBeTypeRefs==RawTypeSet.Mode.SHOULD_BE_TYPEREF) { CElementPropertyInfo prop = new CElementPropertyInfo( calcName(p),REPEATED_ELEMENT,ID.NONE,null,null,null,p.getLocation(),!optional); rts.addTo(prop); clazz.addProperty(prop); } else { CReferencePropertyInfo prop = new CReferencePropertyInfo( calcName(p),true,!optional,false/*TODO*/,null,null,p.getLocation(), false, false, false); rts.addTo(prop); clazz.addProperty(prop); } return null; }
protected void unwrapChoice(DPattern p) { if (p instanceof DChoicePattern && p.getAnnotation() == DAnnotation.EMPTY) { for (DPattern d : (DChoicePattern) p) { on(d); } } else { on(p); } }
protected void on(DPattern p) { p.accept(this); }
public boolean isNullable() { if(nullable==null) nullable = pattern.isNullable()?Boolean.TRUE:Boolean.FALSE; return nullable.booleanValue(); } }
private Void onRepeated(DPattern p,boolean optional) { RawTypeSet rts = RawTypeSetBuilder.build(compiler, p, optional? Multiplicity.STAR : Multiplicity.PLUS); if(rts.canBeTypeRefs==RawTypeSet.Mode.SHOULD_BE_TYPEREF) { CElementPropertyInfo prop = new CElementPropertyInfo( calcName(p),REPEATED_ELEMENT,ID.NONE,null,null,null,p.getLocation(),!optional); rts.addTo(prop); clazz.addProperty(prop); } else { CReferencePropertyInfo prop = new CReferencePropertyInfo( calcName(p),true,!optional,false/*TODO*/,null,null,p.getLocation(), false, false, false); rts.addTo(prop); clazz.addProperty(prop); } return null; }
private void bindContentModel(CClassInfo clazz, DPattern pattern) { // first we decide which patterns in it map to properties // then we process each of them by using RawTypeSetBuilder. // much like DefaultParticleBinder in XSD pattern.accept(new ContentModelBinder(this,clazz)); }
public boolean isNullable() { for( DPattern p=firstChild(); p!=null; p=p.next ) if(!p.isNullable()) return false; return true; } public <V> V accept( DPatternVisitor<V> visitor ) {
public boolean isNullable() { for( DPattern p=firstChild(); p!=null; p=p.next ) if(p.isNullable()) return true; return false; } public <V> V accept( DPatternVisitor<V> visitor ) {