Changeset View
Changeset View
Standalone View
Standalone View
api/server/src/main/java/org/softwareheritage/graph/Node.java
package org.softwareheritage.graph; | package org.softwareheritage.graph; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.List; | import java.util.List; | ||||
public class Node { | public class Node { | ||||
public enum Type { | public enum Type { | ||||
CNT, | CNT, | ||||
DIR, | DIR, | ||||
REL, | REL, | ||||
REV, | REV, | ||||
SNP; | SNP; | ||||
zack: this deserves a comment pointing to some external reference about SWH PIDs, to explain where… | |||||
Done Inline ActionsDev documentation is almost entirely absent for the moment in the code, I was thinking about adding all references/external links in a separate diff (this doc task is already tracked in T1904). haltode: Dev documentation is almost entirely absent for the moment in the code, I was thinking about… | |||||
Done Inline Actions*nod* zack: *nod* | |||||
public static Node.Type fromInt(int intType) { | |||||
switch (intType) { | |||||
case 0: | |||||
return CNT; | |||||
case 1: | |||||
return DIR; | |||||
case 2: | |||||
return REL; | |||||
case 3: | |||||
return REV; | |||||
case 4: | |||||
return SNP; | |||||
} | |||||
return null; | |||||
} | |||||
public static Node.Type fromStr(String strType) { | public static Node.Type fromStr(String strType) { | ||||
Done Inline Actionswe also need ORI here now zack: we also need ORI here now | |||||
Done Inline ActionsI do prefer to add ORI support in another diff as well, there are multiple places to update (here of course, but also the example test graph, the unit tests themselves, and so on). haltode: I do prefer to add ORI support in another diff as well, there are multiple places to update… | |||||
Done Inline Actionsok, fair enough. Please file a dedicated task, for better tracking of this need zack: ok, fair enough. Please file a dedicated task, for better tracking of this need | |||||
Done Inline ActionsSee T1915. haltode: See T1915. | |||||
return Node.Type.valueOf(strType.toUpperCase()); | return Node.Type.valueOf(strType.toUpperCase()); | ||||
} | } | ||||
public static ArrayList<Node.Type> parse(String strType) { | public static ArrayList<Node.Type> parse(String strType) { | ||||
ArrayList<Node.Type> types = new ArrayList<>(); | ArrayList<Node.Type> types = new ArrayList<>(); | ||||
if (strType.equals("*")) { | if (strType.equals("*")) { | ||||
List<Node.Type> nodeTypes = Arrays.asList(Node.Type.values()); | List<Node.Type> nodeTypes = Arrays.asList(Node.Type.values()); | ||||
Show All 9 Lines |
this deserves a comment pointing to some external reference about SWH PIDs, to explain where these weird magic labels come from