tmf: Rename packages to org.eclipse.tracecompass.*
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / internal / tmf / core / synchronization / graph / Edge.java
1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Francis Giraldeau - Initial implementation and API
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.internal.tmf.core.synchronization.graph;
14
15 /**
16 * An edge in the {@link SyncGraph}
17 *
18 * @author Francis Giraldeau <francis.giraldeau@gmail.com>
19 * @param <V>
20 * The vertices type
21 * @param <E>
22 * The edge annotation type
23 */
24 public class Edge<V, E> {
25
26 private final V fFrom;
27 private final V fTo;
28 private final E fLabel;
29
30 /**
31 * An edge constructor
32 *
33 * @param from
34 * The origin vertex
35 * @param to
36 * The destination vertex
37 * @param label
38 * The edge annotation label
39 */
40 public Edge(V from, V to, E label) {
41 fFrom = from;
42 fTo = to;
43 fLabel = label;
44 }
45
46 /**
47 * Get the vertex from
48 *
49 * @return The origin vertex
50 */
51 public V getFrom() {
52 return fFrom;
53 }
54
55 /**
56 * Get the vertex to
57 *
58 * @return The destination vertex
59 */
60 public V getTo() {
61 return fTo;
62 }
63
64 /**
65 * Get the edge label
66 *
67 * @return The edge label
68 */
69 public E getLabel() {
70 return fLabel;
71 }
72
73 @Override
74 public String toString() {
75 return String.format("(%s, %s, %s)", fFrom, fTo, fLabel); //$NON-NLS-1$
76 }
77 }
This page took 0.033479 seconds and 5 git commands to generate.