LEADTOOLS Barcode (Leadtools.Barcode assembly)
LEAD Technologies, Inc

GetNextDuplicated Method








A zero-based index of the current duplicated barcode. The value returned by this method will be greater than this value.
Returns the index of the next barcode in the array that is a duplicate of the barcode at the specified index. .NET support
Syntax
public int GetNextDuplicated( 
   int index
)
'Declaration
 
Public Function GetNextDuplicated( _
   ByVal index As Integer _
) As Integer
'Usage
 
Dim instance As BarcodeData
Dim index As Integer
Dim value As Integer
 
value = instance.GetNextDuplicated(index)
public int GetNextDuplicated( 
   int index
)
ObjectiveC Syntax
 function Leadtools.Barcode.Deprecated.BarcodeData.GetNextDuplicated( 
   index 
)
public:
int GetNextDuplicated( 
   int index
) 

Parameters

index
A zero-based index of the current duplicated barcode. The value returned by this method will be greater than this value.

Return Value

>=0, the index of the next barcode in the array that is a duplicate of the barcode at the specified index; otherwise, this method will throw an exception. An alternative way to avoid the exception, check the value of IndexDuplicate if it equals 0xFF, that means this the last duplicated one.
Remarks

LEADTOOLS provides a number of functions to let you work with duplicated barcodes. They let you:

To determine whether a barcode is duplicated, use the IsDuplicated property. If a barcode is duplicated, the DuplicatedIndex property will return the index of the first barcode in the array after the specified barcode, which is a duplicate of the specified barcode. The DuplicateCount property will get the total number of barcodes duplicated for the current barcode.

If you know the index of a barcode within an array, use the IndexDuplicate property to get the next instance of a duplicated barcode. Call the GetFirstDuplicatedIndex method to find the index of the first barcode in the array that is a duplicate of the barcode at the specified index. Call the GetNextDuplicated method to find the index of the next barcode in the array that is a duplicate of the barcode at the specified index.

As an example, assume a call to the BarcodeEngine.Read method is made to read ten barcodes in an array of BarcodeData. Suppose the BarcodeData.IsDuplicated property is called for the item at index 3 in the array, and TRUE is returned. This indicates one or more barcodes in the array are duplicates of the specified item. Calling the BarcodeData.GetFirstDuplicated method returns the index of the first barcode in the array that is a diplicate of the barcode at index 3 in the array. Suppose this value is 0. The barcode present at index zero in the array is the first duplicate of the barcode at index 3. Calling this method with the index set to 3 will return the index of the next barcode in the array that is a duplicate of the barcodes at index 0 and 3. Suppose this value is 9. This means the barcodes at index 0, index 3, and index 9 of the array are all duplicates.

To find out how many sets of barcodes are duplicated (for example, in an array of ten barcodes, the first, third, and fifth might be duplicates of each other, while the 4th, 8th and 9th are duplicates of a different barcode), use the following code:

VB

 
            Private Function GetSetsCount(ByRef barcodeData As RasterCollection(Of BarcodeData)) As Integer
               Dim i As Integer
               Dim j As Integer
               Dim count As Integer
               Dim visited() As Boolean
               ReDim visited(barcodeData.Count)
               count = 0
               For i = 0 To barcodeData.Count - 1
                  If visited(i) Then
                      Continue For
                  End If
                  visited(i) = True
                  count += 1
                  j = i
                  While barcodeData(j).IndexDuplicate <> -1 And barcodeData(j).IndexDuplicate <> 255
                      j = barcodeData(j).IndexDuplicate
                      visited(j) = True
                  End While
                  Next
               Return count
            End Function
            

C#

            public int GetSetsCount(RasterCollection<BarcodeData> barcodeData)
            {
              int i, j, count;
              bool [] visited = new bool [barcodeData.Count];
              count = 0;
              
              for (i = 0; i < barcodeData.Count; i++)
              {
                  if (visited[i])
                  continue;
                  visited[i] = true;
                  count++;
                  j = i;
                  while (barcodeData[j].IndexDuplicate != -1 &&
                      barcodeData[j].IndexDuplicate != 255)
                  {
                      j = barcodeData[j].IndexDuplicate;
                      visited[j] = true;
                  }
              }
              return count;
            }
            

After this code is executed, count will contain the number of different sets of barcodes.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

BarcodeData Class
BarcodeData Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Barcode requires a Barcode Module license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features