Repository: reef Updated Branches: refs/heads/master da0936ea4 -> 96279b048
http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashMap.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashMap.cs b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashMap.cs index 6b2d083..8c41781 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashMap.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashMap.cs @@ -21,7 +21,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Util { - public class MonotonicHashMap<T, U> : Dictionary<T, U> + public sealed class MonotonicHashMap<T, U> : Dictionary<T, U> { private static readonly Logger LOGGER = Logger.GetLogger(typeof(MonotonicHashMap<T, U>)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashSet.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashSet.cs b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashSet.cs index f418b59..073e474 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashSet.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicHashSet.cs @@ -23,7 +23,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Util { - public class MonotonicHashSet<T> : HashSet<T> + public sealed class MonotonicHashSet<T> : HashSet<T> { private static readonly Logger LOGGER = Logger.GetLogger(typeof(MonotonicHashSet<T>)); private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); @@ -52,7 +52,7 @@ namespace Org.Apache.REEF.Tang.Util { var ex = new ArgumentException("Attempt to re-add " + e + " to MonotonicSet!"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } return base.Add(e); } @@ -76,7 +76,7 @@ namespace Org.Apache.REEF.Tang.Util { var ex = new ArgumentException("Attempt to re-add " + t + " to MonotonicSet!"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } base.Add(t); } @@ -117,12 +117,12 @@ namespace Org.Apache.REEF.Tang.Util public new void Clear() { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException("Attempt to clear MonotonicSet!"), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException("Attempt to clear MonotonicSet!"), LOGGER); } public bool Remove(object o) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException("Attempt to remove " + o + " from MonotonicSet!"), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException("Attempt to remove " + o + " from MonotonicSet!"), LOGGER); return false; } } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiHashMap.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiHashMap.cs b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiHashMap.cs index e7e11b6..83db9e1 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiHashMap.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiHashMap.cs @@ -19,7 +19,7 @@ using System.Collections.Generic; namespace Org.Apache.REEF.Tang.Util { - public class MonotonicMultiHashMap<K, V> : AbstractMonotonicMultiMap<K, V> + public sealed class MonotonicMultiHashMap<K, V> : AbstractMonotonicMultiMap<K, V> { public MonotonicMultiHashMap() : base(new MonotonicHashMap<K, ISet<V>>()) { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiMap.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiMap.cs b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiMap.cs index ed571dd..3ab53f6 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiMap.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicMultiMap.cs @@ -19,7 +19,7 @@ using System.Collections.Generic; namespace Org.Apache.REEF.Tang.Util { - public class MonotonicMultiMap<K, V> : AbstractMonotonicMultiMap<K, V> + public sealed class MonotonicMultiMap<K, V> : AbstractMonotonicMultiMap<K, V> { public MonotonicMultiMap() : base(new MonotonicTreeMap<K, ISet<V>>()) { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicSet.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicSet.cs b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicSet.cs index ec7dc75..35bd013 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicSet.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicSet.cs @@ -21,7 +21,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Util { - public class MonotonicSet<T> : SortedSet<T> + public sealed class MonotonicSet<T> : SortedSet<T> { private static readonly Logger LOGGER = Logger.GetLogger(typeof(MonotonicSet<T>)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicTreeMap.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicTreeMap.cs b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicTreeMap.cs index 2703f40..1865355 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicTreeMap.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/MonotonicTreeMap.cs @@ -22,7 +22,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Util { - public class MonotonicTreeMap<TKey, TVal> : SortedDictionary<TKey, TVal> + public sealed class MonotonicTreeMap<TKey, TVal> : SortedDictionary<TKey, TVal> { private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); @@ -38,7 +38,7 @@ namespace Org.Apache.REEF.Tang.Util { var ex = new ArgumentException("Attempt to re-add: [" + key + "]\n old value: " + val + " new value " + value); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } else { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs b/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs index f6c7ecb..8a65b1e 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs @@ -28,7 +28,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Util { // TODO[REEF-842] Act on the obsoletes - public class ReflectionUtilities + public static class ReflectionUtilities { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ReflectionUtilities)); @@ -45,7 +45,7 @@ namespace Org.Apache.REEF.Tang.Util { if (name == null) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ArgumentException("null is passed in FullName() in ReflectionUtilities"), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ArgumentException("null is passed in FullName() in ReflectionUtilities"), LOGGER); } Type t = EnsureInterfaceType(name); @@ -133,7 +133,7 @@ namespace Org.Apache.REEF.Tang.Util var ex = new ApplicationException(string.Format(CultureInfo.CurrentCulture, "The type passed in IsGenericTypeof is null: iface : {0} type: {1}. ", iface, type)); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } if (type.IsGenericType) { @@ -244,7 +244,7 @@ namespace Org.Apache.REEF.Tang.Util } else { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException( + Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException( "Encountered unknown primitive type!"), LOGGER); return c; } @@ -372,7 +372,7 @@ namespace Org.Apache.REEF.Tang.Util } if (t == null) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw( + Utilities.Diagnostics.Exceptions.Throw( new ApplicationException("Not able to get Type from the name provided: " + name), LOGGER); } @@ -407,7 +407,7 @@ namespace Org.Apache.REEF.Tang.Util { if (t == null) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ApplicationException("The Type passed to GetEnclosingClassShortNames is null"), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ApplicationException("The Type passed to GetEnclosingClassShortNames is null"), LOGGER); } Type[] ts = GetEnclosingClasses(t); string[] result = new string[ts.Length]; @@ -429,7 +429,7 @@ namespace Org.Apache.REEF.Tang.Util { if (fullName == null) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ApplicationException("The name passed to GetEnclosingClassShortNames is null"), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ApplicationException("The name passed to GetEnclosingClassShortNames is null"), LOGGER); } Type t = ReflectionUtilities.GetTypeByName(fullName); return GetEnclosingClassNames(t); @@ -452,33 +452,33 @@ namespace Org.Apache.REEF.Tang.Util { var ex = new ClassHierarchyException("Named parameter " + GetName(type) + " implements " + "multiple interfaces. It is only allowed to implement Name<T>"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } else if (intfs.Length == 0 || !IsName(intfs[0])) { var ex = new ClassHierarchyException("Found illegal [NamedParameter " + GetName(type) + " does not implement Name<T>"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } Type[] args = intfs[0].GetGenericArguments(); if (args.Length > 1) { var ex = new ClassHierarchyException("Found illegal [NamedParameter " + GetName(type) + " that has more than one arguments"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } if (args.Length == 0) { var ex = new ClassHierarchyException("Found illegal [NamedParameter " + GetName(type) + " that has no argument"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } if (HasConstructor(type) || HasInjectableConstructor(type)) { var ex = new ClassHierarchyException("Named parameter " + GetName(type) + " has " + (HasInjectableConstructor(type) ? "an injectable" : "a") + " constructor. " + " Named parameters must not declare any constructors."); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } return args[0]; @@ -489,7 +489,7 @@ namespace Org.Apache.REEF.Tang.Util // Implement Name<> but no [NamedParameter] attribute var ex = new ClassHierarchyException("Named parameter " + GetName(type) + " is missing its [NamedParameter] attribute."); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } return null; } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/SetValuedKey.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/SetValuedKey.cs b/lang/cs/Org.Apache.REEF.Tang/Util/SetValuedKey.cs index d2ef0d6..9401a03 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/SetValuedKey.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/SetValuedKey.cs @@ -15,13 +15,12 @@ // specific language governing permissions and limitations // under the License. -using System; using System.Collections.Generic; using System.Linq; namespace Org.Apache.REEF.Tang.Util { - class SetValuedKey + internal sealed class SetValuedKey { public IList<object> key;
