View Javadoc
1   /*
2    * Created on Jul 8, 2007
3    *
4    * Copyright (c) 2007, The JUNG Authors 
5    *
6    * All rights reserved.
7    *
8    * This software is open-source under the BSD license; see either
9    * "license.txt" or
10   * https://github.com/jrtom/jung/blob/master/LICENSE for a description.
11   */
12  package edu.uci.ics.jung.algorithms.scoring.util;
13  
14  /**
15   * Convenience class for associating a vertex and an edge.  Used, for example,
16   * in contexts in which it is necessary to know the origin for an edge traversal
17   * (that is, the direction in which an (undirected) edge is being traversed).
18   *
19   * @param <V> the vertex type
20   * @param <E> the edge type
21   */
22  public class VEPair<V, E>
23  {
24      private V v;
25      private E e;
26      
27      /**
28       * Creates an instance with the specified vertex and edge
29       * @param v the vertex to add
30       * @param e the edge to add
31       */
32      public VEPair(V v, E e)
33      {
34          if (v == null || e == null)
35              throw new IllegalArgumentException("elements must be non-null");
36          
37          this.v = v;
38          this.e = e;
39      }
40      
41      /**
42       * @return the vertex of this pair
43       */
44      public V getV()
45      {
46          return v;
47      }
48      
49      /**
50       * @return the edge of this pair
51       */
52      public E getE()
53      {
54          return e;
55      }
56  }