source: ether_statistics/common/interface/com/ether/Pair.java @ 569

Last change on this file since 569 was 569, checked in by vmipsl, 12 years ago

Nouveau projet

File size: 1.3 KB
Line 
1package com.ether;
2
3/**
4 * User: vmipsl
5 * Date: 25 juily 2011
6 */
7public class Pair<V1, V2>
8{
9    public Pair()
10    {
11        this( null, null );
12    }
13
14    public Pair( final V1 firstValue,
15                 final V2 secondValue )
16    {
17        _firstValue = firstValue;
18        _secondValue = secondValue;
19    }
20
21    public final V1 getFirstValue()
22    {
23        return _firstValue;
24    }
25
26    public final void setFirstValue( final V1 firstValue )
27    {
28        _firstValue = firstValue;
29    }
30
31    public V2 getSecondValue()
32    {
33        return _secondValue;
34    }
35
36    public void setSecondValue( final V2 secondValue )
37    {
38        _secondValue = secondValue;
39    }
40
41    public String toString()
42    {
43        return String.format( "<%s,%s>", _firstValue, _secondValue );
44    }
45
46    public boolean equals( final Object o )
47    {
48        if( this == o ) return true;
49        if( !( o instanceof Pair ) ) return false;
50
51        final Pair pair = (Pair) o;
52
53        if( _firstValue != null ? !_firstValue.equals( pair._firstValue ) : pair._firstValue != null ) return false;
54        if( _secondValue != null ? !_secondValue.equals( pair._secondValue ) : pair._secondValue != null ) return false;
55
56        return true;
57    }
58
59    private V1 _firstValue;
60    private V2 _secondValue;
61}
Note: See TracBrowser for help on using the repository browser.