Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions salt-api/src/main/java/org/corpus_tools/salt/core/SGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ public void traverse(List<? extends SNode> startNodes, GRAPH_TRAVERSE_TYPE trave
* @param layerName
* Name of the layer to search for
* @return A complete list of all matching layers. Is never null.
* @deprecated Use {@link #getLayersByName(String)}
*/
@Deprecated
public List<SLayer> getLayerByName(String layerName);

/**
* Searches for a layer or a set of layers having the given layer name.
*
* @param layerName
* Name of the layer to search for
* @return A complete list of all matching layers. Is never null.
*/
public List<SLayer> getLayersByName(String layerName);

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public List<SRelation> getRelationsByName(String relationName) {

/** {@inheritDoc} **/
@Override
@Deprecated
public List<SLayer> getLayerByName(String layerName) {
if ((layerName == null) || (layerName.isEmpty())) {
return (null);
Expand All @@ -123,6 +124,25 @@ public List<SLayer> getLayerByName(String layerName) {
return result;
}

/** {@inheritDoc} **/
@Override
public List<SLayer> getLayersByName(String layerName) {
if ((layerName == null) || (layerName.isEmpty())) {
return (null);
}

List<SLayer> result = new ArrayList<>();
for (SLayer l : getLayers()) {
if ((l.getName() == null) || (l.getName().isEmpty())) {
break;
}
if (layerName.equals(l.getName())) {
result.add(l);
}
}
return result;
}

/** {@inheritDoc} */
@Override
public List<SNode> getRoots() {
Expand Down