001package org.hl7.fhir.validation.instance.utils;
002
003import java.util.List;
004
005import org.hl7.fhir.r5.elementmodel.Element;
006import org.hl7.fhir.r5.model.ElementDefinition;
007import org.hl7.fhir.utilities.validation.ValidationMessage;
008
009public class ElementInfo {
010
011  public List<ValidationMessage> sliceInfo;
012  public int index; // order of definition in overall order. all slices get the index of the slicing definition
013  public int sliceindex; // order of the definition in the slices (if slice != null)
014  public int count;
015  public ElementDefinition definition;
016  public ElementDefinition slice;
017  public boolean additionalSlice; // If true, indicates that this element is an additional slice
018  private Element element;
019  private String name;
020  private String path;
021
022  public ElementInfo(String name, Element element, String path, int count) {
023    this.name = name;
024    this.element = element;
025    this.path = path;
026    this.count = count;
027  }
028
029    public List<ValidationMessage> getSliceInfo() {
030        return sliceInfo;
031    }
032
033    public ElementInfo setSliceInfo(List<ValidationMessage> sliceInfo) {
034        this.sliceInfo = sliceInfo;
035        return this;
036    }
037
038    public int getIndex() {
039        return index;
040    }
041
042    public ElementInfo setIndex(int index) {
043        this.index = index;
044        return this;
045    }
046
047    public int getSliceindex() {
048        return sliceindex;
049    }
050
051    public ElementInfo setSliceindex(int sliceindex) {
052        this.sliceindex = sliceindex;
053        return this;
054    }
055
056    public int getCount() {
057        return count;
058    }
059
060    public ElementInfo setCount(int count) {
061        this.count = count;
062        return this;
063    }
064
065    public ElementDefinition getDefinition() {
066        return definition;
067    }
068
069    public ElementInfo setDefinition(ElementDefinition definition) {
070        this.definition = definition;
071        return this;
072    }
073
074    public ElementDefinition getSlice() {
075        return slice;
076    }
077
078    public ElementInfo setSlice(ElementDefinition slice) {
079        this.slice = slice;
080        return this;
081    }
082
083    public boolean isAdditionalSlice() {
084        return additionalSlice;
085    }
086
087    public ElementInfo setAdditionalSlice(boolean additionalSlice) {
088        this.additionalSlice = additionalSlice;
089        return this;
090    }
091
092    public Element getElement() {
093        return element;
094    }
095
096    public ElementInfo setElement(Element element) {
097        this.element = element;
098        return this;
099    }
100
101    public String getName() {
102        return name;
103    }
104
105    public ElementInfo setName(String name) {
106        this.name = name;
107        return this;
108    }
109
110    public String getPath() {
111        return path;
112    }
113
114    public int col() {
115    return element.col();
116  }
117
118  public int line() {
119    return element.line();
120  }
121
122  @Override
123  public String toString() {
124    return path;
125  }
126}