Esempio n. 1
0
        public override int CompareTo(VirtualValue other, IComparer <AnyValue> comparator)
        {
            if (other == null || !(other is PathValue))
            {
                throw new System.ArgumentException("Cannot compare different virtual values");
            }

            PathValue otherPath = ( PathValue )other;

            NodeValue[]         nodes              = nodes();
            RelationshipValue[] relationships      = relationships();
            NodeValue[]         otherNodes         = otherPath.Nodes();
            RelationshipValue[] otherRelationships = otherPath.Relationships();

            int x = nodes[0].CompareTo(otherNodes[0], comparator);

            if (x == 0)
            {
                int i      = 0;
                int length = Math.Min(relationships.Length, otherRelationships.Length);

                while (x == 0 && i < length)
                {
                    x = relationships[i].CompareTo(otherRelationships[i], comparator);
                    ++i;
                }

                if (x == 0)
                {
                    x = Integer.compare(relationships.Length, otherRelationships.Length);
                }
            }

            return(x);
        }
Esempio n. 2
0
        public override bool Equals(VirtualValue other)
        {
            if (!(other is MapValue))
            {
                return(false);
            }
            MapValue that = ( MapValue )other;
            int      size = size();

            if (size != that.Size())
            {
                return(false);
            }

            IEnumerable <string> keys = KeySet();

            foreach (string key in keys)
            {
                if (!Get(key).Equals(that.Get(key)))
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 3
0
        public override bool Equals(VirtualValue other)
        {
            if (!(other is VirtualNodeValue))
            {
                return(false);
            }
            VirtualNodeValue that = ( VirtualNodeValue )other;

            return(Id() == that.Id());
        }
Esempio n. 4
0
        public override bool Equals(VirtualValue other)
        {
            if (other == null || !(other is PathValue))
            {
                return(false);
            }
            PathValue that = ( PathValue )other;

            return(Size() == that.Size() && Arrays.Equals(Nodes(), that.Nodes()) && Arrays.Equals(Relationships(), that.Relationships()));
        }
Esempio n. 5
0
        public override int CompareTo(VirtualValue other, IComparer <AnyValue> comparator)
        {
            if (!(other is VirtualNodeValue))
            {
                throw new System.ArgumentException("Cannot compare different virtual values");
            }

            VirtualNodeValue otherNode = ( VirtualNodeValue )other;

            return(Long.compare(Id(), otherNode.Id()));
        }
Esempio n. 6
0
        public override int CompareTo(VirtualValue other, IComparer <AnyValue> comparator)
        {
            if (!(other is ListValue))
            {
                throw new System.ArgumentException("Cannot compare different virtual values");
            }

            ListValue otherList = ( ListValue )other;

            if (IterationPreference() == RANDOM_ACCESS && otherList.IterationPreference() == RANDOM_ACCESS)
            {
                return(RandomAccessCompareTo(comparator, otherList));
            }
            else
            {
                return(IteratorCompareTo(comparator, otherList));
            }
        }
Esempio n. 7
0
        public override int CompareTo(VirtualValue other, IComparer <AnyValue> comparator)
        {
            if (!(other is MapValue))
            {
                throw new System.ArgumentException("Cannot compare different virtual values");
            }
            MapValue otherMap = ( MapValue )other;
            int      size     = size();
            int      compare  = Integer.compare(size, otherMap.Size());

            if (compare == 0)
            {
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                string[] thisKeys = StreamSupport.stream(KeySet().spliterator(), false).toArray(string[] ::new);
                Arrays.sort(thisKeys, string.compareTo);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                string[] thatKeys = StreamSupport.stream(otherMap.Keys.spliterator(), false).toArray(string[] ::new);
                Arrays.sort(thatKeys, string.compareTo);
                for (int i = 0; i < size; i++)
                {
                    compare = thisKeys[i].CompareTo(thatKeys[i]);
                    if (compare != 0)
                    {
                        return(compare);
                    }
                }

                for (int i = 0; i < size; i++)
                {
                    string key = thisKeys[i];
                    compare = comparator.Compare(Get(key), otherMap.Get(key));
                    if (compare != 0)
                    {
                        return(compare);
                    }
                }
            }
            return(compare);
        }
Esempio n. 8
0
        public override string ToString()
        {
            //TODO: Добавить различные параметры для различных типов подключения
            string result = "Сигнал\n(\n";

            result += $"\tИдентификатор={Uid}\n";
            result += $"\tИмя={Name}\n";


            if (CompoundSignal == CompoundSignalType.SIMPLE_SIGNAL)
            {
                // Для реального сигнала
                result += $"\tТип={Type.ToString()}\n";
                result += $"\tИдентификаторБлокаДанных={DataBlockUid}\n";
                result += $"\tБайт={Byte}\n";
            }
            else
            {
                // Для виртуального сигнала
                result += $"\tЗначениеВиртуальногоСигнала={VirtualValue.ToString("F2").Replace(",", ".")}\n";
                result += $"\tСоставнойСигнал={CompoundSignal.ToString()}\n";
                result += $"\tЗаписьКлиентами={(UserWrite ? 1 : 0)}\n";
            }

            // result += $"\tИмяСервер={ServerName}\n";
            // result += $"\tТип={Type.ToString()}\n";
            // result += $"\tИдентификаторБлокаДанных={DataBlockUid}\n";
            // result += $"\tБайт={Byte}\n";
            // result += $"\tБит={Bit}\n";
            // result += $"\tЗначениеВиртуальногоСигнала={VirtualValue.ToString("F2").Replace(",", ".")}\n";
            // result += $"\tСоставнойСигнал={CompoundSignal.ToString()}\n";
            // result += $"\tЗаписьКлиентами={(UserWrite ? 1 : 0)}\n";
            // result += $"\tМинимальныйУровеньАналоговогоСигнала={MinAnalogLevel}\n";

            result += ")\n";
            return(result);
        }
Esempio n. 9
0
 public override int CompareTo(VirtualValue other, IComparer <AnyValue> comparator)
 {
     throw _e;
 }
Esempio n. 10
0
 public override bool Equals(VirtualValue other)
 {
     throw _e;
 }
Esempio n. 11
0
 public override bool Equals(VirtualValue other)
 {
     return(other != null && other.SequenceValue && Equals(( SequenceValue )other));
 }