com.nedap.archie.diff.UnconstrainedIntervalRemover Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tools Show documentation
Show all versions of tools Show documentation
tools that operate on the archie reference models and archetype object model
package com.nedap.archie.diff;
import com.nedap.archie.aom.Archetype;
import com.nedap.archie.aom.CArchetypeRoot;
import com.nedap.archie.aom.CAttribute;
import com.nedap.archie.aom.CComplexObject;
import com.nedap.archie.aom.CObject;
import com.nedap.archie.aom.CPrimitiveObject;
import com.nedap.archie.aom.Template;
import com.nedap.archie.aom.TemplateOverlay;
import com.nedap.archie.aom.terminology.ArchetypeTerm;
import com.nedap.archie.aom.utils.AOMUtils;
import com.nedap.archie.aom.utils.NodeIdUtil;
import com.nedap.archie.base.Interval;
import com.nedap.archie.flattener.InMemoryFullArchetypeRepository;
import java.util.ArrayList;
import java.util.List;
public class UnconstrainedIntervalRemover {
public static void removeUnconstrainedIntervals(Archetype archetype) {
removeUnconstrainedIntervals(archetype.getDefinition());
if(archetype instanceof Template) {
Template template = (Template) archetype;
for(TemplateOverlay overlay:template.getTemplateOverlays()) {
removeUnconstrainedIntervals(overlay.getDefinition());
}
}
}
public static void removeUnconstrainedIntervals(CComplexObject cObject) {
for(CAttribute attribute:cObject.getAttributes()) {
removeUnconstrainedIntervals(attribute);
}
}
public static void removeUnconstrainedIntervals(CAttribute cAttribute) {
List cObjectsToRemove = new ArrayList<>();
for(CObject cObject:cAttribute.getChildren()) {
if(cObject instanceof CComplexObject) {
removeUnconstrainedIntervals((CComplexObject) cObject);
} else if (cObject instanceof CPrimitiveObject) {
CPrimitiveObject, ?> cPrimitiveObject = (CPrimitiveObject, ?>) cObject;
List> constraint = cPrimitiveObject.getConstraint();
List