All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.eugene.models.extension.model.ModelExtensionElement Maven / Gradle / Ivy

The newest version!
package org.nuiton.eugene.models.extension.model;

/*-
 * #%L
 * EUGene :: EUGene
 * %%
 * Copyright (C) 2004 - 2017 Code Lutin
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

/**
 * Created on 10/09/16.
 *
 * @author Tony Chemit - [email protected]
 * @since 3.0
 */
public class ModelExtensionElement implements Comparable {

    protected final String name;
    protected final Map tagValues;

    public ModelExtensionElement(String name) {
        this.name = name;
        this.tagValues = new TreeMap<>();
    }

    public String getName() {
        return name;
    }

    public Map getTagValues() {
        return tagValues;
    }

    public Set getStereotypes() {
        Set result = new LinkedHashSet<>();
        for (Map.Entry entry : tagValues.entrySet()) {
            if ("true".equals(entry.getValue())) {
                result.add(entry.getKey());
            }
        }
        return result;
    }

    @Override
    public int compareTo(ModelExtensionElement o) {
        return name.compareTo(o.name);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy