use of org.osate.aadl2.Element in project palladian by palladian.
the class RawDateParserModule method parse.
@Override
public Module parse(Element element, Locale locale) {
RawDateModule rawDateModule = new RawDateModuleImpl();
List<Element> children = element.getChildren();
for (Element childElement : children) {
// search for a node containing "date" in its name
if (childElement.getName().toLowerCase().contains("date")) {
// LOGGER.debug("found " + childElement.getName() + " in element " + element.getTextNormalize());
rawDateModule.setRawDate(childElement.getText());
break;
}
}
return rawDateModule;
}
use of org.osate.aadl2.Element in project sonar-cxx by SonarOpenCommunity.
the class CxxSquidConfiguration method add.
/**
* Add a single key/value pair (property) to the database.
*
* @param level The level parameter defines the level on which the data should be inserted. For level a predefined
* name can be used or a new one can be defined. <br>
* - If level is an identifier, the information is created in an element with the level-name directly under root.<br>
* - If level is a path, the information is stored on Files level. In that case the level-string is normalized and
* converted to lower case letters to simplify the following search.
* @param key the key to be placed into the database.
* @param value the value corresponding to key. Several values can be assigned to one key. Internally a value-list for
* key is created. The method can be called several times for this, but more effective is the method
* {@code add(String, String, List<String>)}.
*/
public void add(String level, String key, @Nullable String value) {
if (value != null && !value.isEmpty()) {
Element eKey = getKey(level, key);
setValue(eKey, value);
}
}
use of org.osate.aadl2.Element in project sonar-cxx by SonarOpenCommunity.
the class CxxSquidConfiguration method getChildrenValues.
/**
* Used to read multi-valued properties.
*
* Collects all found values over all children. Further found values in parent levels are added to the end of the
* list. The method can return an empty list if the property is not set.
*
* @param level start level from which the values of all children are returned
* @param key property key that is searched for in all children
* @return the values with the specified key value
*/
public List<String> getChildrenValues(String level, String key) {
List<String> result = new ArrayList<>();
Element eLevel = findLevel(level, parentList.getFirst());
if (eLevel != null) {
for (var child : eLevel.getChildren()) {
Element eKey = child.getChild(key);
if (eKey != null) {
for (var value : eKey.getChildren("Value")) {
result.add(value.getText());
}
}
}
}
// add content of shared parents only once at the end
eLevel = getParentElement(eLevel);
if (eLevel != null) {
result.addAll(getValues(eLevel.getName(), key));
}
return result;
}
use of org.osate.aadl2.Element in project sonar-cxx by SonarOpenCommunity.
the class CxxSquidConfiguration method getLevelValues.
/**
* Used to read multi-valued properties from one level.
*
* The method can return an empty list if the property is not set.
*
* @param level level to read
* @param property key that is searched for
* @return the values with the specified key value
*/
public List<String> getLevelValues(String level, String key) {
List<String> result = new ArrayList<>();
Element eLevel = findLevel(level, null);
if (eLevel != null) {
Element eKey = eLevel.getChild(key);
if (eKey != null) {
for (var value : eKey.getChildren("Value")) {
result.add(value.getText());
}
}
}
return result;
}
use of org.osate.aadl2.Element in project sonar-cxx by SonarOpenCommunity.
the class CxxSquidConfiguration method add.
/**
* Add a single key/value pair (property) to the database.
*
* Same as {@code add(String, String, String)} for an {@code Optional<String>}.
*
* @param level defines the level on which the data should be inserted
* @param key the key to be placed into the database
* @param value the value corresponding to key
*/
public void add(String level, String key, Optional<String> value) {
if (value.isPresent()) {
Element eKey = getKey(level, key);
setValue(eKey, value.get());
}
}
Aggregations