C# – IEnumerator and IEnumerable

IEnumerator and IEnumerable are interfaces that are used to enumerate through a collection.
IEnumerator has a non generic correspondence IEnumerator which has MoveNext() method that returns a boolean, Current read only property that returns the current item in the collection. Reset, which resets the pointer (Enumerator) to -1. IEnumerator pointers begin with -1, and upon moving to the next element, pointer becomes 0, which we usually start processing. Classes that implments IEnumerable interface should implement GetEnumerator, IEnumerable.GetEnumerator methods which exposes the Enumerator to the caller.

Moreover, classes that implements IEnumerable and IEnumerator should implements all the methods and properties that belong to IEnumerator and IEnumerable, and also Dispose method.

class MyEnumerator : IEnumerator, IEnumerable
{
private List list;
private int pointer = -1;

public MyEnumerator()
{
list = new List();
}

public T this[int i]
{
set
{
list.Add(value);
}

get
{
return list[i];
}
}

public T Current
{
get
{
return list[pointer];
}
}

object IEnumerator.Current
{
get
{
return list[pointer];
}
}

public bool MoveNext()
{
if (++pointer < list.Count) { return true; } else { return false; } } public void Reset() { } public void Dispose() { } public IEnumerator GetEnumerator()
{
return this;
}

IEnumerator IEnumerable.GetEnumerator()
{
return this;
}

}

C# Operator Overloading

C# allows programmers to overload all of the operators.

Equality ( == ) operator can be overloaded as follows:

public static bool operator ==(T item1, T Item2)
{
return item1.SomeProperty == item2.SomeProperty && item1.AnotherProperty == item2.AnotherProperty;
}

public static bool operator !=(T item1, T item2)
{
return !(item1==item2);
}

public static bool operator <(T item1, T item2) { return item1.SomeProperty < item2.SomeProperty; } etc. Operators that can be Overloaded: +, -, *, /, %, &, |, <<, >> All C# binary operators can be overloaded.

+, -, !, ~, ++, –, true, false All C# unary operators can be overloaded.

==, !=, <, >, <= , >= All relational operators can be overloaded,
but only as pairs.

&&, || They can’t be overloaded

() (Conversion operator) They can’t be overloaded

+=, -=, *=, /=, %= These compound assignment operators can be
overloaded. But in C#, these operators are
automatically overloaded when the respective
binary operator is overloaded.

=, . , ?:, ->, new, is, as, size of These operators can’t be overloaded

Scalable data center networks – scalability- incremental expansion-fault tolerance

Scalable Data Center Networks

Firat Atagun

Abstract

Data centers offer many benefits for hosting and colocating applications, data storage, servers and services. As the demand to data center’s services and resources increases; number of servers and hardware in the data centers increases exponentially. Interconnecting exponentially increasing number of services, hardware and servers while offering scalability, reliability, efficiency, fault tolerance, easily maintainability, and high network capacity becomes a challenge for data center networks. Other difficulties while designing and deploying a data center network are physical expansion, routing and forwarding inside the data center which should be scalable, reliable, and fault tolerant. In this paper I will research the characteristics, similarities and differences of approaching scalable data center network that are studied in the following three papers, [1] DCell: A scalable and fault tolerant network structure for data centers; recursively defined network architecture is explained to interconnect servers while scalability, fault tolerance and network resource usage is utilized. In [2] Portland: A scalable fault tolerant layer 2 data center network fabric; offers scalable, fault tolerant data center network design with conventional but improved data center network by using “Fat Tree” based structure. In [3] VL2: A scalable and flexible data center network; scalability, reliability and fault tolerance of a new approach to data center network is explained by network transparency, abstraction, load balancing and incremental expansion methods.

General Terms:
Design, Algorithms, Scalability, Fault Tolerance

Keywords:
Data center network, Scalability, Fault tolerance

Presentation : Scalable Data Center Networks

Paper: Scalable Data Center Networks