@Override public Void visit(DigitsFacet t, Restriction restriction) { int fraction = t.getFraction(); if (fraction > 0) { restriction.setFractionDigits(fraction); restriction.setTotalDigits(fraction + t.getInteger()); } else if (fraction == 0) { restriction.setTotalDigits(t.getInteger()); } return null; }
public Void visit(DigitsFacet t, Restriction restriction) { int fraction = t.getFraction(); if (fraction > 0) { restriction.setFractionDigits(fraction); restriction.setTotalDigits(fraction + t.getInteger()); } else if (fraction == 0) { restriction.setTotalDigits(t.getInteger()); } 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()); } }