CSharpTest.Net
Invert Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > OrdinalList Class : Invert Method

ceiling

Glossary Item Box

Returns the 1's compliment (inverts) of the list up to Ceiling

Syntax

Visual Basic (Declaration) 
Public Function Invert( _
   ByVal ceiling As Integer _
) As OrdinalList
C# 
public OrdinalList Invert( 
   int ceiling
)

Parameters

ceiling

Example

Library/Library.Test/TestOrdinalList.cs

C#Copy Code
OrdinalList lista = new OrdinalList(new int[] {0, 2, 4, 6, 8, 10, 12});
OrdinalList listb = new OrdinalList(new int[] {1, 3, 5, 7, 9, 11, 13});

OrdinalList invta = lista.Invert(13);
string invtatext = "", listbtext = "";
foreach (int i in invta)
    invtatext += "," + i;
foreach (int i in listb)
    listbtext += "," + i;
Assert.AreEqual(listbtext, invtatext);

lista = new OrdinalList(new int[] { 0 });
listb = new OrdinalList(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 });
invta = lista.Invert(13);
invtatext = "";
listbtext = "";
foreach (int i in invta)
    invtatext += "," + i;
foreach (int i in listb)
    listbtext += "," + i;
Assert.AreEqual(listbtext, invtatext);

lista = new OrdinalList(new int[] { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 13 });
listb = new OrdinalList(new int[] { 3 });
invta = lista.Invert(4);
invtatext = "";
listbtext = "";
foreach (int i in invta)
    invtatext += "," + i;
foreach (int i in listb)
    listbtext += "," + i;
Assert.AreEqual(listbtext, invtatext);
VB.NETCopy Code
Dim lista As New OrdinalList(New Integer() {0, 2, 4, 6, 8, 10, _
    12})
Dim listb As New OrdinalList(New Integer() {1, 3, 5, 7, 9, 11, _
    13})

Dim invta As OrdinalList = lista.Invert(13)
Dim invtatext As String = "", listbtext As String = ""
For Each i As Integer In invta
    invtatext += "," + i
Next
For Each i As Integer In listb
    listbtext += "," + i
Next
Assert.AreEqual(listbtext, invtatext)

lista = New OrdinalList(New Integer() {0})
listb = New OrdinalList(New Integer() {1, 2, 3, 4, 5, 6, _
    7, 8, 9, 10, 11, 12, _
    13})
invta = lista.Invert(13)
invtatext = ""
listbtext = ""
For Each i As Integer In invta
    invtatext += "," + i
Next
For Each i As Integer In listb
    listbtext += "," + i
Next
Assert.AreEqual(listbtext, invtatext)

lista = New OrdinalList(New Integer() {0, 1, 2, 4, 5, 6, _
    7, 8, 9, 10, 11, 13})
listb = New OrdinalList(New Integer() {3})
invta = lista.Invert(4)
invtatext = ""
listbtext = ""
For Each i As Integer In invta
    invtatext += "," + i
Next
For Each i As Integer In listb
    listbtext += "," + i
Next
Assert.AreEqual(listbtext, invtatext)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys