Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9009 for trunk/sources


Ignore:
Timestamp:
12/06/12 15:52:29 (11 years ago)
Author:
abeham
Message:

#1991: Implemented review comments

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Collections/3.3/BidirectionalDictionary.cs

    r9000 r9009  
    2121
    2222using System;
     23using System.Linq;
     24using System.Collections;
    2325using System.Collections.Generic;
    2426using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2628namespace HeuristicLab.Collections {
    2729  [StorableClass]
    28   public class BidirectionalDictionary<TFirst, TSecond> {
     30  [Serializable]
     31  public class BidirectionalDictionary<TFirst, TSecond> : IEnumerable<KeyValuePair<TFirst, TSecond>> {
    2932    [Storable]
    3033    private readonly Dictionary<TFirst, TSecond> firstToSecond;
     
    5356      secondToFirst = new Dictionary<TSecond, TFirst>(secondComparer);
    5457    }
     58    public BidirectionalDictionary(BidirectionalDictionary<TFirst, TSecond> other)
     59      : base() {
     60      firstToSecond = new Dictionary<TFirst, TSecond>(other.firstToSecond, other.firstToSecond.Comparer);
     61      secondToFirst = new Dictionary<TSecond, TFirst>(other.secondToFirst, other.secondToFirst.Comparer);
     62    }
    5563
    5664    #region Properties
     
    6573    public IEnumerable<TSecond> SecondValues {
    6674      get { return secondToFirst.Keys; }
    67     }
    68 
    69     public IEnumerable<KeyValuePair<TFirst, TSecond>> FirstEnumerable {
    70       get { return firstToSecond; }
    71     }
    72 
    73     public IEnumerable<KeyValuePair<TSecond, TFirst>> SecondEnumerable {
    74       get { return secondToFirst; }
    7575    }
    7676    #endregion
     
    139139      secondToFirst.Clear();
    140140    }
     141
     142    public IEnumerator<KeyValuePair<TFirst, TSecond>> GetEnumerator() {
     143      return firstToSecond.GetEnumerator();
     144    }
     145
     146    IEnumerator IEnumerable.GetEnumerator() {
     147      return GetEnumerator();
     148    }
    141149    #endregion
    142150  }
  • trunk/sources/HeuristicLab.Collections/3.3/BidirectionalLookup.cs

    r9000 r9009  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Linq;
     
    2627namespace HeuristicLab.Collections {
    2728  [StorableClass]
     29  [Serializable]
    2830  public class BidirectionalLookup<TFirst, TSecond> {
    2931    [Storable]
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/BidirectionalLookup.cs

    r7259 r9009  
    2626namespace HeuristicLab.Operators.Views.GraphVisualization {
    2727  [StorableClass]
     28  [Obsolete("Use BidirectionalDictionary in HeuristicLab.Collections")]
    2829  public class BidirectionalLookup<TFirst, TSecond> {
    2930    [Storable]
Note: See TracChangeset for help on using the changeset viewer.