This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
/
Edge.java
80 lines (68 loc) · 2.4 KB
/
Edge.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package org.apache.archiva.components.graph.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* The edge links a source vertex to a destination vertex.
* A edge instance is always part of a certain graph instance.
*
* @param <V> The vertex implementation.
*/
public interface Edge<V extends Vertex<V>> {
/**
* Returns the identifier of this edge. The id must be unique for given graph.
*
* @return the identifier of this edge
*/
String getId();
/**
* Returns the label of this edge. The label must not be unique.
* If the label was not set, it should return an empty string.
* @return the label of this edge, or a empty string
*/
String getLabel();
/**
* Sets the label of this edge to the given string.
* @param label the label string, that must not be <code>null</code>
* @throws NullPointerException if the label parameter is <code>null</code>
*/
void setLabel(String label) throws NullPointerException;
/**
* Returns the graph where this edge was created.
*
* @return the graph instance
*/
Graph<V> getGraph();
/**
* Returns the vertex, that is on the source end of this edge.
* @return the source vertex
*/
V getSource();
/**
* Returns the vertex, that is on the destination end of this edge.
* @return the destination vertex
*/
V getDestination();
/**
* Returns the weight of this edge. For standard graph implementations the default should be 1.0, but
* graph implementations may decide to set another default.
*
* @return the weight of this edge
*/
double getWeight();
}