Changeset View
Changeset View
Standalone View
Standalone View
java/src/main/java/org/softwareheritage/graph/AllowedEdges.java
package org.softwareheritage.graph; | package org.softwareheritage.graph; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
/** | /** | ||||
* Edge restriction based on node types, used when visiting the graph. | * Edge restriction based on node types, used when visiting the graph. | ||||
* <p> | * <p> | ||||
* <a href="https://docs.softwareheritage.org/devel/swh-model/data-model.html">Software Heritage | * <a href="https://docs.softwareheritage.org/devel/swh-model/data-model.html">Software Heritage | ||||
* graph</a> contains multiple node types (contents, directories, revisions, ...) and restricting | * graph</a> contains multiple node types (contents, directories, revisions, ...) and restricting | ||||
* the traversal to specific node types is necessary for many querying operations: <a | * the traversal to specific node types is necessary for many querying operations: | ||||
* href="https://docs.softwareheritage.org/devel/swh-graph/use-cases.html">use cases</a>. | * <a href="https://docs.softwareheritage.org/devel/swh-graph/use-cases.html">use cases</a>. | ||||
* | * | ||||
haltode: Fix space between `href` and quote. | |||||
* @author The Software Heritage developers | * @author The Software Heritage developers | ||||
*/ | */ | ||||
public class AllowedEdges { | public class AllowedEdges { | ||||
/** | /** | ||||
* 2D boolean matrix storing access rights for all combination of src/dst node types (first | * 2D boolean matrix storing access rights for all combination of src/dst node types (first | ||||
* dimension is source, second dimension is destination), when edge restriction is not enforced | * dimension is source, second dimension is destination), when edge restriction is not enforced this | ||||
* this array is set to null for early bypass. | * array is set to null for early bypass. | ||||
*/ | */ | ||||
public boolean[][] restrictedTo; | public boolean[][] restrictedTo; | ||||
/** | /** | ||||
* Constructor. | * Constructor. | ||||
* | * | ||||
* @param edgesFmt a formatted string describing <a | * @param edgesFmt a formatted string describing <a href= | ||||
* href="https://docs.softwareheritage.org/devel/swh-graph/api.html#terminology">allowed edges</a> | * "https://docs.softwareheritage.org/devel/swh-graph/api.html#terminology">allowed | ||||
* edges</a> | |||||
*/ | */ | ||||
public AllowedEdges(String edgesFmt) { | public AllowedEdges(String edgesFmt) { | ||||
int nbNodeTypes = Node.Type.values().length; | int nbNodeTypes = Node.Type.values().length; | ||||
this.restrictedTo = new boolean[nbNodeTypes][nbNodeTypes]; | this.restrictedTo = new boolean[nbNodeTypes][nbNodeTypes]; | ||||
// Special values (null, empty, "*") | // Special values (null, empty, "*") | ||||
if (edgesFmt == null || edgesFmt.isEmpty()) { | if (edgesFmt == null || edgesFmt.isEmpty()) { | ||||
return; | return; | ||||
} | } | ||||
Show All 37 Lines |
Fix space between href and quote.