*/
package org.opendaylight.yangtools.yang.parser.builder.impl;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Deque;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.parser.util.RefineHolder;
import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Deque;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
/**
* Builder of Module object. If this module is dependent on external
* module/modules, these dependencies must be resolved before module is built,
private String belongsTo;
private ModuleBuilder parent;
- public ModuleBuilder getParent() {
+ @Override
+ public ModuleBuilder getParent() {
return parent;
}
- public void setParent(ModuleBuilder parent) {
+ public void setParent(final ModuleBuilder parent) {
this.parent = parent;
}
private final Set<ModuleImport> imports = new HashSet<ModuleImport>();
- private final Set<AugmentationSchema> augments = new HashSet<>();
+ private final Set<AugmentationSchema> augments = new LinkedHashSet<>();
private final List<AugmentationSchemaBuilder> augmentBuilders = new ArrayList<>();
private final List<AugmentationSchemaBuilder> allAugments = new ArrayList<>();
super(name, 0, null);
this.name = name;
this.sourcePath = sourcePath;
- schemaPath = new SchemaPath(Collections.<QName> emptyList(), true);
+ schemaPath = SchemaPath.create(Collections.<QName> emptyList(), true);
this.submodule = submodule;
instance = new ModuleImpl(name, sourcePath);
actualPath.push(this);
}
- public ModuleBuilder(Module base) {
+ public ModuleBuilder(final Module base) {
super(base.getName(), 0, null);
this.name = base.getName();
this.sourcePath = base.getModuleSourcePath();
- schemaPath = new SchemaPath(Collections.<QName> emptyList(), true);
+ schemaPath = SchemaPath.create(Collections.<QName> emptyList(), true);
submodule = false;
instance = new ModuleImpl(base.getName(), base.getModuleSourcePath());
instance.setYangVersion(base.getYangVersion());
}
@Override
- public void setParent(Builder parent) {
+ public void setParent(final Builder parent) {
throw new YangParseException(name, 0, "Can not set parent to module");
}
return belongsTo;
}
- public void setBelongsTo(String belongsTo) {
+ public void setBelongsTo(final String belongsTo) {
this.belongsTo = belongsTo;
}
return builder;
}
- public AugmentationSchemaBuilder addAugment(final int line, final String augmentTargetStr) {
- final AugmentationSchemaBuilder builder = new AugmentationSchemaBuilderImpl(name, line, augmentTargetStr);
+ public AugmentationSchemaBuilder addAugment(final int line, final String augmentTargetStr, final int order) {
+ final AugmentationSchemaBuilder builder = new AugmentationSchemaBuilderImpl(name, line, augmentTargetStr, order);
Builder parent = getActualNode();
builder.setParent(parent);
}
@Override
- public void addUsesNode(UsesNodeBuilder usesBuilder) {
+ public void addUsesNode(final UsesNodeBuilder usesBuilder) {
addedUsesNodes.add(usesBuilder);
allUsesNodes.add(usesBuilder);
}
return outputBuilder;
}
- public void addNotification(NotificationDefinition notification) {
+ public void addNotification(final NotificationDefinition notification) {
notifications.add(notification);
}
}
@Override
- public void addTypedef(TypeDefinitionBuilder typedefBuilder) {
+ public void addTypedef(final TypeDefinitionBuilder typedefBuilder) {
String nodeName = typedefBuilder.getQName().getLocalName();
for (TypeDefinitionBuilder tdb : addedTypedefs) {
if (tdb.getQName().getLocalName().equals(nodeName)) {
return "module " + name;
}
- public void setSource(String source) {
+ public void setSource(final String source) {
this.source = source;
}
private final List<UnknownSchemaNode> unknownNodes = new ArrayList<>();
private String source;
- private ModuleImpl(String name, String sourcePath) {
+ private ModuleImpl(final String name, final String sourcePath) {
this.name = name;
this.sourcePath = sourcePath;
}
return namespace;
}
- private void setNamespace(URI namespace) {
+ private void setNamespace(final URI namespace) {
this.namespace = namespace;
}
return revision;
}
- private void setRevision(Date revision) {
+ private void setRevision(final Date revision) {
this.revision = revision;
}
return prefix;
}
- private void setPrefix(String prefix) {
+ private void setPrefix(final String prefix) {
this.prefix = prefix;
}
return yangVersion;
}
- private void setYangVersion(String yangVersion) {
+ private void setYangVersion(final String yangVersion) {
this.yangVersion = yangVersion;
}
return description;
}
- private void setDescription(String description) {
+ private void setDescription(final String description) {
this.description = description;
}
return reference;
}
- private void setReference(String reference) {
+ private void setReference(final String reference) {
this.reference = reference;
}
return organization;
}
- private void setOrganization(String organization) {
+ private void setOrganization(final String organization) {
this.organization = organization;
}
return contact;
}
- private void setContact(String contact) {
+ private void setContact(final String contact) {
this.contact = contact;
}
return imports;
}
- private void setImports(Set<ModuleImport> imports) {
+ private void setImports(final Set<ModuleImport> imports) {
if (imports != null) {
this.imports.addAll(imports);
}
return features;
}
- private void setFeatures(Set<FeatureDefinition> features) {
+ private void setFeatures(final Set<FeatureDefinition> features) {
if (features != null) {
this.features.addAll(features);
}
return typeDefinitions;
}
- private void setTypeDefinitions(Set<TypeDefinition<?>> typeDefinitions) {
+ private void setTypeDefinitions(final Set<TypeDefinition<?>> typeDefinitions) {
if (typeDefinitions != null) {
this.typeDefinitions.addAll(typeDefinitions);
}
return notifications;
}
- private void setNotifications(Set<NotificationDefinition> notifications) {
+ private void setNotifications(final Set<NotificationDefinition> notifications) {
if (notifications != null) {
this.notifications.addAll(notifications);
}
return augmentations;
}
- private void setAugmentations(Set<AugmentationSchema> augmentations) {
+ private void setAugmentations(final Set<AugmentationSchema> augmentations) {
if (augmentations != null) {
this.augmentations.addAll(augmentations);
}
return rpcs;
}
- private void setRpcs(Set<RpcDefinition> rpcs) {
+ private void setRpcs(final Set<RpcDefinition> rpcs) {
if (rpcs != null) {
this.rpcs.addAll(rpcs);
}
return deviations;
}
- private void setDeviations(Set<Deviation> deviations) {
+ private void setDeviations(final Set<Deviation> deviations) {
if (deviations != null) {
this.deviations.addAll(deviations);
}
return Collections.unmodifiableSet(childNodes);
}
- private void addChildNodes(Set<DataSchemaNode> childNodes) {
+ private void addChildNodes(final Set<DataSchemaNode> childNodes) {
if (childNodes != null) {
this.childNodes.addAll(childNodes);
}
return groupings;
}
- private void setGroupings(Set<GroupingDefinition> groupings) {
+ private void setGroupings(final Set<GroupingDefinition> groupings) {
if (groupings != null) {
this.groupings.addAll(groupings);
}
return uses;
}
- private void setUses(Set<UsesNode> uses) {
+ private void setUses(final Set<UsesNode> uses) {
if (uses != null) {
this.uses.addAll(uses);
}
}
@Override
- public DataSchemaNode getDataChildByName(QName name) {
+ public DataSchemaNode getDataChildByName(final QName name) {
return getChildNode(childNodes, name);
}
@Override
- public DataSchemaNode getDataChildByName(String name) {
+ public DataSchemaNode getDataChildByName(final String name) {
return getChildNode(childNodes, name);
}
- void setSource(String source){
+ void setSource(final String source){
this.source = source;
}
return source;
}
- // FIXME: perhaps namespace should not be taken into consideration
@Override
public int hashCode() {
final int prime = 31;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}