Changeset View
Changeset View
Standalone View
Standalone View
java/src/main/java/org/softwareheritage/graph/Node.java
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | public enum Type { | ||||
public static Node.Type fromStr(String strType) { | public static Node.Type fromStr(String strType) { | ||||
if (!strType.matches("cnt|dir|ori|rel|rev|snp")) { | if (!strType.matches("cnt|dir|ori|rel|rev|snp")) { | ||||
throw new IllegalArgumentException("Unknown node type: " + strType); | throw new IllegalArgumentException("Unknown node type: " + strType); | ||||
} | } | ||||
return Node.Type.valueOf(strType.toUpperCase()); | return Node.Type.valueOf(strType.toUpperCase()); | ||||
} | } | ||||
/** | /** | ||||
* Parses SWH node type possible values from formatted string (see the <a | * Parses SWH node type possible values from formatted string (see the | ||||
* href="https://docs.softwareheritage.org/devel/swh-graph/api.html#terminology">API | * <a href="https://docs.softwareheritage.org/devel/swh-graph/api.html#terminology">API syntax</a>). | ||||
* syntax</a>). | |||||
* | * | ||||
* @param strFmtType node types represented as a formatted string | * @param strFmtType node types represented as a formatted string | ||||
* @return a list containing the {@link Node.Type} values | * @return a list containing the {@link Node.Type} values | ||||
* @see org.softwareheritage.graph.Node.Type | * @see org.softwareheritage.graph.Node.Type | ||||
*/ | */ | ||||
public static ArrayList<Node.Type> parse(String strFmtType) { | public static ArrayList<Node.Type> parse(String strFmtType) { | ||||
ArrayList<Node.Type> types = new ArrayList<>(); | ArrayList<Node.Type> types = new ArrayList<>(); | ||||
Show All 11 Lines |