- public void setSource(final String source) {
- this.source = source;
- }
-
- public static final class ModuleImpl implements Module {
- private URI namespace;
- private final String name;
- private final String sourcePath;
- private Date revision;
- private String prefix;
- private String yangVersion;
- private String description;
- private String reference;
- private String organization;
- private String contact;
- private final Set<ModuleImport> imports = new HashSet<>();
- private final Set<FeatureDefinition> features = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
- private final Set<TypeDefinition<?>> typeDefinitions = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
- private final Set<NotificationDefinition> notifications = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
- private final Set<AugmentationSchema> augmentations = new HashSet<>();
- private final Set<RpcDefinition> rpcs = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
- private final Set<Deviation> deviations = new HashSet<>();
- private final Set<DataSchemaNode> childNodes = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
- private final Set<GroupingDefinition> groupings = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
- private final Set<UsesNode> uses = new HashSet<>();
- private final List<ExtensionDefinition> extensionNodes = new ArrayList<>();
- private final Set<IdentitySchemaNode> identities = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
- private final List<UnknownSchemaNode> unknownNodes = new ArrayList<>();
- private String source;
-
- private ModuleImpl(final String name, final String sourcePath) {
- this.name = name;
- this.sourcePath = sourcePath;
- }
-
- @Override
- public String getModuleSourcePath() {
- return sourcePath;
- }
-
- @Override
- public URI getNamespace() {
- return namespace;
- }
-
- private void setNamespace(final URI namespace) {
- this.namespace = namespace;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public Date getRevision() {
- return revision;
- }
-
- private void setRevision(final Date revision) {
- this.revision = revision;
- }
-
- @Override
- public String getPrefix() {
- return prefix;
- }
-
- private void setPrefix(final String prefix) {
- this.prefix = prefix;
- }
-
- @Override
- public String getYangVersion() {
- return yangVersion;
- }
-
- private void setYangVersion(final String yangVersion) {
- this.yangVersion = yangVersion;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- private void setDescription(final String description) {
- this.description = description;
- }
-
- @Override
- public String getReference() {
- return reference;
- }
-
- private void setReference(final String reference) {
- this.reference = reference;
- }
-
- @Override
- public String getOrganization() {
- return organization;
- }
-
- private void setOrganization(final String organization) {
- this.organization = organization;
- }
-
- @Override
- public String getContact() {
- return contact;
- }
-
- private void setContact(final String contact) {
- this.contact = contact;
- }
-
- @Override
- public Set<ModuleImport> getImports() {
- return imports;
- }
-
- private void setImports(final Set<ModuleImport> imports) {
- if (imports != null) {
- this.imports.addAll(imports);
- }
- }
-
- @Override
- public Set<FeatureDefinition> getFeatures() {
- return features;
- }
-
- private void setFeatures(final Set<FeatureDefinition> features) {
- if (features != null) {
- this.features.addAll(features);
- }
- }
-
- @Override
- public Set<TypeDefinition<?>> getTypeDefinitions() {
- return typeDefinitions;
- }
-
- private void setTypeDefinitions(final Set<TypeDefinition<?>> typeDefinitions) {
- if (typeDefinitions != null) {
- this.typeDefinitions.addAll(typeDefinitions);
- }
- }
-
- @Override
- public Set<NotificationDefinition> getNotifications() {
- return notifications;
- }
-
- private void setNotifications(final Set<NotificationDefinition> notifications) {
- if (notifications != null) {
- this.notifications.addAll(notifications);
- }
- }
-
- @Override
- public Set<AugmentationSchema> getAugmentations() {
- return augmentations;
- }
-
- private void setAugmentations(final Set<AugmentationSchema> augmentations) {
- if (augmentations != null) {
- this.augmentations.addAll(augmentations);
- }
- }
-
- @Override
- public Set<RpcDefinition> getRpcs() {
- return rpcs;
- }
-
- private void setRpcs(final Set<RpcDefinition> rpcs) {
- if (rpcs != null) {
- this.rpcs.addAll(rpcs);
- }
- }
-
- @Override
- public Set<Deviation> getDeviations() {
- return deviations;
- }
-
- private void setDeviations(final Set<Deviation> deviations) {
- if (deviations != null) {
- this.deviations.addAll(deviations);
- }
- }
-
- @Override
- public Set<DataSchemaNode> getChildNodes() {
- return Collections.unmodifiableSet(childNodes);
- }
-
- private void addChildNodes(final Collection<DataSchemaNode> childNodes) {
- if (childNodes != null) {
- this.childNodes.addAll(childNodes);
- }
- }
-
- @Override
- public Set<GroupingDefinition> getGroupings() {
- return groupings;
- }
-
- private void setGroupings(final Set<GroupingDefinition> groupings) {
- if (groupings != null) {
- this.groupings.addAll(groupings);
- }
- }
-
- @Override
- public Set<UsesNode> getUses() {
- return uses;
- }
-
- private void setUses(final Set<UsesNode> uses) {
- if (uses != null) {
- this.uses.addAll(uses);
- }
- }
-
- @Override
- public List<ExtensionDefinition> getExtensionSchemaNodes() {
- Collections.sort(extensionNodes, Comparators.SCHEMA_NODE_COMP);
- return extensionNodes;
- }
-
- private void setExtensionSchemaNodes(final List<ExtensionDefinition> extensionNodes) {
- if (extensionNodes != null) {
- this.extensionNodes.addAll(extensionNodes);
- }
- }
-
- @Override
- public Set<IdentitySchemaNode> getIdentities() {
- return identities;
- }
-
- private void setIdentities(final Set<IdentitySchemaNode> identities) {
- if (identities != null) {
- this.identities.addAll(identities);
- }
- }
-
- @Override
- public List<UnknownSchemaNode> getUnknownSchemaNodes() {
- return unknownNodes;
- }
-
- private void setUnknownSchemaNodes(final List<UnknownSchemaNode> unknownNodes) {
- if (unknownNodes != null) {
- this.unknownNodes.addAll(unknownNodes);
- }
- }
-
- @Override
- public DataSchemaNode getDataChildByName(final QName name) {
- return getChildNode(childNodes, name);
- }
-
- @Override
- public DataSchemaNode getDataChildByName(final String name) {
- return getChildNode(childNodes, name);
- }
-
- void setSource(final String source){
- this.source = source;
- }
-
- public String getSource() {
- return source;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((revision == null) ? 0 : revision.hashCode());
- result = prime * result + ((yangVersion == null) ? 0 : yangVersion.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ModuleImpl other = (ModuleImpl) obj;
- if (namespace == null) {
- if (other.namespace != null) {
- return false;
- }
- } else if (!namespace.equals(other.namespace)) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (revision == null) {
- if (other.revision != null) {
- return false;
- }
- } else if (!revision.equals(other.revision)) {
- return false;
- }
- if (yangVersion == null) {
- if (other.yangVersion != null) {
- return false;
- }
- } else if (!yangVersion.equals(other.yangVersion)) {
- return false;
- }
- return true;