/
Consistent Hashing - class HashRingNode<T>
Consistent Hashing - class HashRingNode<T>
Interface for HashRingLocation<T>
public class HashRingNode<T>: INotifyPropertyChanged
{
public UInt32 Key { get; set; }
public T Item { get; set; }
public HashRingNode<T> Next { get; set; }
//Protected INotifyPropertyChanged Implementation
//Property changed event
public event PropertyChangedEventHandler PropertyChanged;
// Set the property and notifies any listeners that it changed (if it did)
protected void SetProperty<T>(ref T field, T value, Expression<Func<T>> memberExpression, params Expression<Func<object> >[] moreNotifications)
{
// Must have member expression to find property name
if (memberExpression == null){throw new ArgumentNullException(); }
var bodyExpr = memberExpression.Body as MemberExpression;
// Member expression must have a body (a property)
if (bodyExpr == null){throw new ArgumentNullException();}
// don't do anything unless the value changes
if (EqualityComparer<T>.Default.Equals(field, value)) { return; }
field = value;
RaisePropertyChanged(memberExpression, moreNotifications);
}
// Raise property changed by names only (value needs to be reread)
protected void RaisePropertyChanged<T>(Expression<Func<T>> memberExpression, params Expression<Func<object>>[] moreNotifications)
{
// Must have member expression to find property name
if (memberExpression == null){ throw new ArgumentNullException(); }
var bodyExpr = memberExpression.Body as MemberExpression;
// Member expression must have a body (a property)
if (bodyExpr == null){ throw new ArgumentNullException();}
var handler = PropertyChanged;
if (handler != null){
handler(this, new PropertyChangedEventArgs(bodyExpr.Member.Name));
foreach (Expression<Func<object>> notifyAlso in moreNotifications)
{
if (notifyAlso != null){
var alsoExpr = notifyAlso.Body as MemberExpression;
handler(this, new PropertyChangedEventArgs(alsoExpr.Member.Name));
}
}
}
}
}
, multiple selections available,