internal static CustomObject FromBytes(byte[] entryBytes, AttributeDefinition attributeDefinition)
        {
            CustomObject obj = new CustomObject()
            {
                AttributeDefinition = attributeDefinition
            };

            switch (attributeDefinition.Type)
            {
            case ValueType.String:
                obj.Value = System.Text.Encoding.UTF8.GetString(entryBytes);
                break;

            case ValueType.Integer:
                obj.Value = BitConverter.ToInt32(entryBytes, 0);
                break;

            case ValueType.UnsignedInteger:
                obj.Value = BitConverter.ToUInt32(entryBytes, 0);
                break;

            case ValueType.Boolean:
                obj.Value = BitConverter.ToBoolean(entryBytes, 0);
                break;
            }

            return(obj);
        }
Example #2
0
        internal bool Joins(CustomTuple rightTuple, AttributeDefinition leftJoinColumn, AttributeDefinition rightJoinColumn)
        {
            CustomObject left  = GetEntryFor(leftJoinColumn.Name);
            CustomObject right = rightTuple.GetEntryFor(rightJoinColumn.Name);

            if (left.IsEqualTo(right))
            {
                return(true);
            }

            return(false);
        }
Example #3
0
        internal CustomTuple FromRecord(Record record)
        {
            int i  = 0;
            int ii = 0;

            foreach (AttributeDefinition attributeDefinition in Relation)
            {
                int    nextOffsetBytes = record.Offsets.Count > ii + 1 ? record.Offsets[ii + 1].Bytes : record.Content.Length;
                byte[] entryBytes      = record.Content.Skip(i).Take(nextOffsetBytes - record.Offsets[ii].Bytes).ToArray();

                Entries.Add(CustomObject.FromBytes(entryBytes, attributeDefinition));

                i += entryBytes.Length;
                ii++;
            }

            return(this);
        }
        public bool IsEqualTo(CustomObject otherObject)
        {
            CustomValueComparer comparer = Comparers.GetComparer(AttributeDefinition.Type);

            return(comparer.IsEqualTo(Value, otherObject.Value));
        }