示例#1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (OriginalName.Length != 0)
            {
                hash ^= OriginalName.GetHashCode();
            }
            if (Table.Length != 0)
            {
                hash ^= Table.GetHashCode();
            }
            if (OriginalTable.Length != 0)
            {
                hash ^= OriginalTable.GetHashCode();
            }
            if (Schema.Length != 0)
            {
                hash ^= Schema.GetHashCode();
            }
            if (Catalog.Length != 0)
            {
                hash ^= Catalog.GetHashCode();
            }
            if (Collation != 0UL)
            {
                hash ^= Collation.GetHashCode();
            }
            if (FractionalDigits != 0)
            {
                hash ^= FractionalDigits.GetHashCode();
            }
            if (Length != 0)
            {
                hash ^= Length.GetHashCode();
            }
            if (Flags != 0)
            {
                hash ^= Flags.GetHashCode();
            }
            if (ContentType != 0)
            {
                hash ^= ContentType.GetHashCode();
            }
            return(hash);
        }
示例#2
0
        /// <summary>
        /// This method simplifies the truth table.
        /// </summary>
        private char[][] SimplifyTruthTable()
        {
            var originalRows = OriginalTable.Select(s => s.ToArray()).Where(c => c[this.nrOfColumns - 1] == '0').ToList();
            var simplified   = OriginalTable.Select(s => s.ToArray()).Where(c => c[this.nrOfColumns - 1] == '1').ToList();

            bool rowWasSimplified = true;

            // Simplify rows till the algorithm continues making new changes
            while (rowWasSimplified)
            {
                rowWasSimplified = false;
                var toSimplify = simplified.Select(s => s.ToArray()).ToArray();;
                // For every row that needs to be simplified check if it can be simplified with the rest
                for (int i = 0; i < simplified.Count(); i++) // indexOfZero is used because its value determines the start of the rows that needs to be simplified
                {
                    for (int j = 0; j < simplified.Count(); j++)
                    {
                        int numberOfMatches = 0;
                        int indexDiffers    = -1;
                        for (int c = 0; c < this.nrOfColumns - 1; c++)
                        {
                            // To see how many matching symbols are in the row i with row j
                            if (toSimplify[i][c] == toSimplify[j][c])
                            {
                                numberOfMatches++;
                            }
                            else
                            {
                                indexDiffers = c;
                            }
                        }
                        if (numberOfMatches == this.nrOfColumns - 2 && indexDiffers != -1) // -2 because one should be different and the result column is not taken into account
                        {
                            // check if the potentially simplified row doesn't exist in the rows resulting in 0, thus can be actually simplified
                            if (checkIfCanBeSimplified(originalRows, simplified[i], indexDiffers))
                            {
                                simplified[i][indexDiffers] = '*';
                                rowWasSimplified            = true;
                            }
                            // check if the potentially simplified row doesn't exist in the rows resulting in 0,  thus can be actually simplified
                            if (checkIfCanBeSimplified(originalRows, simplified[j], indexDiffers))
                            {
                                simplified[j][indexDiffers] = '*';
                                rowWasSimplified            = true;
                            }
                        }
                    }
                }
            }
            originalRows.AddRange(this.RemoveDuplicates(simplified));
            return(originalRows.ToArray());
        }
示例#3
0
 public OffsetTable([NotNull] OriginalTable orig, int byteOffset)
 {
     this.orig       = orig;
     this.byteOffset = byteOffset;
 }