@Override public Void visit(SizeFacet t, Restriction restriction) { int minLength = t.getMin(); int maxLength = t.getMax(); if (minLength == maxLength) { restriction.setLength(minLength); } else { // 0 is the default minBoundary. if (minLength > 0) restriction.setMinLength(minLength); // 2^31 is the default maxBoundary. if (maxLength < Integer.MAX_VALUE) restriction.setMaxLength(maxLength); } return null; } };
public Void visit(SizeFacet t, Restriction restriction) { int minLength = t.getMin(); int maxLength = t.getMax(); if (minLength == maxLength) { restriction.setLength(minLength); } else { // 0 is the default minBoundary. if (minLength > 0) restriction.setMinLength(minLength); // 2^31 is the default maxBoundary. if (maxLength < Integer.MAX_VALUE) restriction.setMaxLength(maxLength); } return null; } };
/** * Overwrites attributes of this restriction with attributes of the argument, * if they are not null. * * @param restriction */ public void mergeWith(Restriction restriction) { if (restriction.getAll() != null) this.setAll(restriction.getAll()); if (restriction.getAnyAttribute() != null) this.setAnyAttribute(restriction.getAnyAttribute()); // if (restriction.getBaseType()) // this one doesn't make sense to do // if (restriction.getSimpleType()) // this one doesn't make sense to do if (restriction.getTypeDefParticle() != null) this.setTypeDefParticle(restriction.getTypeDefParticle()); // not sure if this one makes sense if (restriction.getSequence() != null) this.setSequence(restriction.getSequence()); if (restriction.getChoice() != null) this.setChoice(restriction.getChoice()); if (restriction.getEnumerationFacets() != null) this.setEnumerationFacets(restriction.getEnumerationFacets()); if (restriction.getPatterns() != null) this.setPatterns(restriction.getPatterns()); // restriction.getPatterns() is "always" not null if (restriction.getMaxInclusive() != null) this.setMaxInclusive(restriction.getMaxInclusive()); if (restriction.getMinInclusive() != null) this.setMinInclusive(restriction.getMinInclusive()); if (restriction.getMaxExclusive() != null) this.setMaxExclusive(restriction.getMaxExclusive()); if (restriction.getMinExclusive() != null) this.setMinExclusive(restriction.getMinExclusive()); if (restriction.getTotalDigits() != null) this.setFractionDigits(restriction.getTotalDigits()); if (restriction.getFractionDigits() != null) this.setFractionDigits(restriction.getFractionDigits()); if (restriction.getLength() != null) this.setLength(restriction.getLength()); if (restriction.getMinLength() != null) this.setMinLength(restriction.getMinLength()); if (restriction.getMaxLength() != null) this.setMaxLength(restriction.getMaxLength()); } }
/** * Overwrites attributes of this restriction with attributes of the argument, * if they are not null. * * @param restriction */ public void mergeWith(Restriction restriction) { if (restriction.getAll() != null) this.setAll(restriction.getAll()); if (restriction.getAnyAttribute() != null) this.setAnyAttribute(restriction.getAnyAttribute()); // if (restriction.getBaseType()) // this one doesn't make sense to do // if (restriction.getSimpleType()) // this one doesn't make sense to do if (restriction.getTypeDefParticle() != null) this.setTypeDefParticle(restriction.getTypeDefParticle()); // not sure if this one makes sense if (restriction.getSequence() != null) this.setSequence(restriction.getSequence()); if (restriction.getChoice() != null) this.setChoice(restriction.getChoice()); if (restriction.getEnumerationFacets() != null) this.setEnumerationFacets(restriction.getEnumerationFacets()); if (restriction.getPatterns() != null) this.setPatterns(restriction.getPatterns()); if (restriction.getPattern() != null) this.setPattern(restriction.getPattern()); if (restriction.getMaxInclusive() != null) this.setMaxInclusive(restriction.getMaxInclusive()); if (restriction.getMinInclusive() != null) this.setMinInclusive(restriction.getMinInclusive()); if (restriction.getMaxExclusive() != null) this.setMaxExclusive(restriction.getMaxExclusive()); if (restriction.getMinExclusive() != null) this.setMinExclusive(restriction.getMinExclusive()); if (restriction.getTotalDigits() != null) this.setFractionDigits(restriction.getTotalDigits()); if (restriction.getFractionDigits() != null) this.setFractionDigits(restriction.getFractionDigits()); if (restriction.getLength() != null) this.setLength(restriction.getLength()); if (restriction.getMinLength() != null) this.setMinLength(restriction.getMinLength()); if (restriction.getMaxLength() != null) this.setMaxLength(restriction.getMaxLength()); } }