Search in sources :

Example 1 with LangString

use of org.openlca.ilcd.commons.LangString in project olca-modules by GreenDelta.

the class ContentElement method write.

void write(Element elem) {
    if (elem == null)
        return;
    for (LangString n : name) {
        Element e = Dom.addChild(elem, "epd2:name", Vocab.NS_EPDv2);
        Dom.setLangString(e, n);
    }
    if (massPerc != null) {
        Element e = Dom.addChild(elem, "epd2:weightPerc", Vocab.NS_EPDv2);
        massPerc.write(e);
    }
    if (mass != null) {
        Element e = Dom.addChild(elem, "epd2:mass", Vocab.NS_EPDv2);
        mass.write(e);
    }
    for (LangString c : comment) {
        Element e = Dom.addChild(elem, "epd2:comment", Vocab.NS_EPDv2);
        Dom.setLangString(e, c);
    }
}
Also used : LangString(org.openlca.ilcd.commons.LangString) Element(org.w3c.dom.Element)

Example 2 with LangString

use of org.openlca.ilcd.commons.LangString in project olca-modules by GreenDelta.

the class SafetyMargins method clone.

@Override
public SafetyMargins clone() {
    SafetyMargins clone = new SafetyMargins();
    clone.margins = margins;
    for (LangString d : description) {
        if (d != null)
            clone.description.add(d.clone());
    }
    return clone;
}
Also used : LangString(org.openlca.ilcd.commons.LangString)

Example 3 with LangString

use of org.openlca.ilcd.commons.LangString in project olca-modules by GreenDelta.

the class IO method getName.

@SuppressWarnings("unchecked")
private static String getName(Model m) {
    ModelName mn = Models.getModelName(m);
    if (mn == null)
        return "";
    List<?>[] parts = new List<?>[] { mn.name, mn.technicalDetails, mn.mixAndLocation, mn.flowProperties };
    String name = "";
    for (List<?> part : parts) {
        String s = LangString.getFirst((List<LangString>) part, "en");
        if (Strings.nullOrEmpty(s))
            continue;
        if (name.length() > 0)
            name += "; ";
        name += s.trim();
    }
    return name;
}
Also used : ModelName(org.openlca.ilcd.models.ModelName) LangString(org.openlca.ilcd.commons.LangString) List(java.util.List) ArrayList(java.util.ArrayList) LangString(org.openlca.ilcd.commons.LangString)

Aggregations

LangString (org.openlca.ilcd.commons.LangString)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ModelName (org.openlca.ilcd.models.ModelName)1 Element (org.w3c.dom.Element)1