Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DependencyGraphWalker |
|
| 1.0;1 |
1 | package org.apache.maven.archiva.dependency.graph.walk; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import org.apache.commons.collections.Predicate; | |
23 | import org.apache.maven.archiva.dependency.graph.DependencyGraph; | |
24 | import org.apache.maven.archiva.dependency.graph.DependencyGraphNode; | |
25 | import org.apache.maven.archiva.model.ArtifactReference; | |
26 | ||
27 | /** | |
28 | * Walk nodes of the {@link DependencyGraph}. | |
29 | * | |
30 | * @version $Id: DependencyGraphWalker.java 718864 2008-11-19 06:33:35Z brett $ | |
31 | */ | |
32 | public interface DependencyGraphWalker | |
33 | { | |
34 | /** | |
35 | * A {@link #getNodeVisitState(ArtifactReference)} for a node not yet seen in the walker. | |
36 | */ | |
37 | public static final Integer UNSEEN = new Integer( 0 ); | |
38 | ||
39 | /** | |
40 | * A {@link #getNodeVisitState(ArtifactReference)} for a node that is actively being processed, | |
41 | * but not yet finished processing. | |
42 | */ | |
43 | public static final Integer PROCESSING = new Integer( 1 ); | |
44 | ||
45 | /** | |
46 | * A {@link #getNodeVisitState(ArtifactReference)} for a node that has been seen, and fully processed. | |
47 | */ | |
48 | public static final Integer SEEN = new Integer( 2 ); | |
49 | ||
50 | /** | |
51 | * For a provided node, get the current node visit state. | |
52 | * | |
53 | * @param node the node that you are interested in. | |
54 | * @return the state of that node. (Can be {@link #UNSEEN}, {@link #PROCESSING}, or {@link #SEEN} ) | |
55 | */ | |
56 | public Integer getNodeVisitState( ArtifactReference artifact ); | |
57 | ||
58 | /** | |
59 | * Get the predicate used to determine if the walker should traverse an edge (or not). | |
60 | * | |
61 | * @return the Predicate that returns true for edges that should be traversed. | |
62 | */ | |
63 | public Predicate getEdgePredicate(); | |
64 | ||
65 | /** | |
66 | * Set the predicate used for edge traversal | |
67 | * | |
68 | * @param edgePredicate the Predicate that returns true for edges that should be traversed. | |
69 | */ | |
70 | public void setEdgePredicate( Predicate edgePredicate ); | |
71 | ||
72 | /** | |
73 | * Visit every node and edge in the graph from the startNode. | |
74 | * | |
75 | * @param graph the graph to visit. | |
76 | * @param startNode the node to start the visit on. | |
77 | * @param visitor the visitor object to use during this visit. | |
78 | */ | |
79 | public void visit( DependencyGraph graph, DependencyGraphNode startNode, DependencyGraphVisitor visitor ); | |
80 | ||
81 | /** | |
82 | * Visit every node and edge in the entire graph. | |
83 | * | |
84 | * @param graph the graph to visit. | |
85 | * @param visitor the visitor object to use during this visit. | |
86 | */ | |
87 | public void visit( DependencyGraph graph, DependencyGraphVisitor visitor ); | |
88 | } |