Exemplo n.º 1
0
 public override Exceptional<IExpressionGraph> TypeOperation(AExpressionDefinition myLeftValueObject, AExpressionDefinition myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, IExpressionGraph result, Boolean aggregateAllowed = true)
 {
     return new Exceptional<IExpressionGraph>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
 }
Exemplo n.º 2
0
        private Exceptional<Boolean> GetComplexMatch(IEnumerable<Tuple<GraphDBType, AAttributeIndex>> myIDX, Dictionary<DBObjectStream, AOperationDefinition> operands, DBObjectCache dbObjectCache, IDChainDefinition primIDNode, IDChainDefinition operandIDNode, DBContext dbContext, TypesOfAssociativity associativity, ref IExpressionGraph resultGraph, SessionSettings mySessionToken)
        {
            LevelKey primLevelKey = CreateLevelKey(primIDNode, dbContext.DBTypeManager);
            LevelKey operandLevelKey = CreateLevelKey(operandIDNode, dbContext.DBTypeManager);

            foreach (var aIDX in myIDX)
            {
                if (aIDX.Item2.IsUUIDIndex)
                {
                    #region UUID idx

                    var currentIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(aIDX.Item2.IndexRelatedTypeUUID);

                    foreach (var aOperand in operands)
                    {

                        foreach (var _ObjectUUIDs in ((UUIDIndex)aIDX.Item2).GetAllUUIDs(currentIndexRelatedType, dbContext))
                        {
                            var DBObjectStream = dbObjectCache.LoadDBObjectStream(aIDX.Item1, _ObjectUUIDs);
                            if (DBObjectStream.Failed())
                            {
                                return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                            }

                            if (IsValidDBObjectStreamForBinExpr(DBObjectStream.Value, primIDNode.LastAttribute, dbContext.DBTypeManager))
                            {
                                var aCtype = GraphDBTypeMapper.ConvertGraph2CSharp(primIDNode.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);
                                IObject dbos = GetDbos(primIDNode, DBObjectStream.Value, dbContext, mySessionToken, dbObjectCache);

                                Exceptional<AOperationDefinition> tempResult;
                                if (aCtype == BasicType.SetOfDBObjects)
                                {
                                    tempResult = this.SimpleOperation(new TupleDefinition(aCtype, dbos, primIDNode.LastAttribute.GetDBType(dbContext.DBTypeManager)), aOperand.Value, TypesOfBinaryExpression.Complex);
                                }
                                else
                                {
                                    tempResult = this.SimpleOperation(new ValueDefinition(aCtype, dbos), aOperand.Value, TypesOfBinaryExpression.Complex);

                                }

                                if (tempResult.Failed())
                                    return new Exceptional<bool>(tempResult);

                                var tempOperatorResult = ((ValueDefinition)tempResult.Value);

                                if ((Boolean)tempOperatorResult.Value.Value)
                                {
                                    switch (associativity)
                                    {
                                        case TypesOfAssociativity.Neutral:
                                        case TypesOfAssociativity.Left:

                                            IntegrateInGraph(aOperand.Key, resultGraph, operandLevelKey, dbContext, dbObjectCache);

                                            break;
                                        case TypesOfAssociativity.Right:

                                            IntegrateInGraph(DBObjectStream.Value, resultGraph, primLevelKey, dbContext, dbObjectCache);

                                            break;
                                        default:

                                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                    }
                                }
                            }
                        }
                    }

                    #endregion
                }
                else
                {
                    return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                }
            }

            return new Exceptional<bool>(true);
        }
Exemplo n.º 3
0
 public abstract Exceptional<IExpressionGraph> TypeOperation(AExpressionDefinition myLeftValueObject, AExpressionDefinition myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, IExpressionGraph result, Boolean aggregateAllowed = true);
Exemplo n.º 4
0
        private Exceptional<Boolean> MatchComplexData(TypesOfAssociativity associativity, DataContainer data, DBContext dbContext, DBObjectCache dbObjectCache, TypesOfBinaryExpression typeOfBinExpr, IEnumerable<Tuple<GraphDBType, AAttributeIndex>> leftIndices, IEnumerable<Tuple<GraphDBType, AAttributeIndex>> rightIndices, ref List<GraphDBError> errors, ref IExpressionGraph result, SessionSettings mySessionToken)
        {
            #region data

            Dictionary<DBObjectStream, AOperationDefinition> operandsLeft = null;
            Dictionary<DBObjectStream, AOperationDefinition> operandsRight = null;

            #endregion

            #region handle extraordinaries

            if (data.Extraordinaries.Item1 != null)
            {
                #region left extraordinary
                //there is something like a function or so

                operandsLeft = new Dictionary<DBObjectStream, AOperationDefinition>();

                //we have to calculate the real operand.
                //TODO: try to use attribute idx instead of uuid idx

                foreach (var aLeftIDX in leftIndices)
                {
                    AAttributeIndex currentLeftIdx = null;

                    #region get UUID idx
                    if (!(aLeftIDX.Item2.IsUUIDIndex))
                    {
                        currentLeftIdx = aLeftIDX.Item1.GetUUIDIndex(dbContext);
                    }
                    else
                    {
                        currentLeftIdx = aLeftIDX.Item2;
                    }

                    #endregion

                    var currentIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(currentLeftIdx.IndexRelatedTypeUUID);

                    foreach (var aObjectUUIDs_Left in currentLeftIdx.GetAllValues(currentIndexRelatedType, dbContext))
                    {
                        foreach (var aObjectUUID_Left in aObjectUUIDs_Left)
                        {
                            var leftDBObject = dbObjectCache.LoadDBObjectStream(aLeftIDX.Item1, aObjectUUID_Left);
                            if (leftDBObject.Failed())
                            {
                                throw new NotImplementedException();
                            }

                            if (IsValidDBObjectStreamForBinExpr(leftDBObject.Value, data.IDChainDefinitions.Item1.LastAttribute, dbContext.DBTypeManager))
                            {
                                var oper = GetOperand(data.IDChainDefinitions.Item1, data.Extraordinaries.Item1, dbContext, leftDBObject.Value, dbObjectCache, mySessionToken);
                                if (oper.Failed())
                                    return new Exceptional<bool>(oper);

                                if (oper != null)
                                {
                                    operandsLeft.Add(leftDBObject.Value, oper.Value);
                                }
                            }
                        }
                    }
                }

                //from now on the binary expression is right complex, because there are atom values on the left
                typeOfBinExpr = TypesOfBinaryExpression.RightComplex;

                #endregion
            }

            if (data.Extraordinaries.Item2 != null)
            {
                #region right extraordinary
                //there is something like a function or so
                operandsRight = new Dictionary<DBObjectStream, AOperationDefinition>();

                foreach (var aRightIDX in rightIndices)
                {
                    AAttributeIndex currentRightIdx = null;

                    #region get UUID idx
                    //we have to calculate the real operand.
                    //TODO: try to use attribute idx instead of uuid idx

                    if (!(aRightIDX.Item2.IsUUIDIndex))
                    {
                        currentRightIdx = aRightIDX.Item1.GetUUIDIndex(dbContext);
                    }
                    else
                    {
                        currentRightIdx = aRightIDX.Item2;
                    }

                    #endregion

                    var currentIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(currentRightIdx.IndexRelatedTypeUUID);

                    foreach (var aObjectUUIDs_Right in currentRightIdx.GetAllValues(currentIndexRelatedType, dbContext))
                    {
                        foreach (var aObjectUUID_Right in aObjectUUIDs_Right)
                        {
                            var rightDBObject = dbObjectCache.LoadDBObjectStream(aRightIDX.Item1, aObjectUUID_Right);
                            if (rightDBObject.Failed())
                            {
                                throw new NotImplementedException();
                            }

                            if (IsValidDBObjectStreamForBinExpr(rightDBObject.Value, data.IDChainDefinitions.Item2.LastAttribute, dbContext.DBTypeManager))
                            {
                                var oper = GetOperand(data.IDChainDefinitions.Item2, data.Extraordinaries.Item2, dbContext, rightDBObject.Value, dbObjectCache, mySessionToken);
                                if (oper.Failed())
                                    return new Exceptional<bool>(oper);

                                if (oper != null)
                                {
                                    operandsRight.Add(rightDBObject.Value, oper.Value);
                                }
                            }
                        }
                    }
                }

                if (typeOfBinExpr == TypesOfBinaryExpression.RightComplex)
                {
                    typeOfBinExpr = TypesOfBinaryExpression.Atom;
                }

                #endregion
            }

            #endregion

            switch (typeOfBinExpr)
            {
                case TypesOfBinaryExpression.Atom:

                    #region atom

                    switch (associativity)
                    {
                        case TypesOfAssociativity.Unknown:
                        case TypesOfAssociativity.Neutral:
                            GetComplexAtom(dbContext, operandsLeft, operandsRight, data.IDChainDefinitions.Item1, dbObjectCache, ref result);
                            GetComplexAtom(dbContext, operandsRight, operandsLeft, data.IDChainDefinitions.Item2, dbObjectCache, ref result);
                            break;

                        case TypesOfAssociativity.Left:

                            GetComplexAtom(dbContext, operandsLeft, operandsRight, data.IDChainDefinitions.Item1, dbObjectCache, ref result);

                            break;
                        case TypesOfAssociativity.Right:

                            GetComplexAtom(dbContext, operandsRight, operandsLeft, data.IDChainDefinitions.Item2, dbObjectCache, ref result);

                            break;

                        default:
                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                    }

                    #endregion

                    break;
                case TypesOfBinaryExpression.LeftComplex:

                    #region Left complex

                    GetComplexMatch(leftIndices, operandsRight, dbObjectCache, data.IDChainDefinitions.Item1, data.IDChainDefinitions.Item2, dbContext, associativity, ref result, mySessionToken);

                    #endregion

                    break;
                case TypesOfBinaryExpression.RightComplex:

                    #region Right complex

                    GetComplexMatch(rightIndices, operandsLeft, dbObjectCache, data.IDChainDefinitions.Item2, data.IDChainDefinitions.Item1, dbContext, associativity, ref result, mySessionToken);

                    #endregion

                    break;
                case TypesOfBinaryExpression.Complex:

                    #region Complex

                    LevelKey leftLevelKey = CreateLevelKey(data.IDChainDefinitions.Item1, dbContext.DBTypeManager);
                    LevelKey rightLevelKey = CreateLevelKey(data.IDChainDefinitions.Item2, dbContext.DBTypeManager);
                    GraphDBType leftGraphDBType = data.IDChainDefinitions.Item1.LastType;
                    GraphDBType rightGraphDBType = data.IDChainDefinitions.Item2.LastType;

                    #region exception

                    if (leftIndices.CountIsGreater(1) || rightIndices.CountIsGreater(1))
                    {
                        return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                    }

                    #endregion

                    var leftIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(leftIndices.First().Item2.IndexRelatedTypeUUID);
                    var rightIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(rightIndices.First().Item2.IndexRelatedTypeUUID);

                    foreach (var ObjectUUIDs_left in leftIndices.First().Item2.GetAllValues(leftIndexRelatedType, dbContext))
                    {
                        foreach (var aLeftUUID in ObjectUUIDs_left)
                        {
                            var leftDBObject = dbObjectCache.LoadDBObjectStream(leftIndices.First().Item1, aLeftUUID);
                            if (leftDBObject.Failed())
                            {
                                return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                            }

                            if (IsValidDBObjectStreamForBinExpr(leftDBObject.Value, data.IDChainDefinitions.Item1.LastAttribute, dbContext.DBTypeManager))
                            {

                                foreach (var ObjectUUIDs_right in rightIndices.First().Item2.GetAllValues(rightIndexRelatedType, dbContext))
                                {
                                    foreach (var aRightUUID in ObjectUUIDs_right)
                                    {

                                        var rightDBObject = dbObjectCache.LoadDBObjectStream(rightIndices.First().Item1, aRightUUID);
                                        if (rightDBObject.Failed())
                                        {
                                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                        }

                                        if (IsValidDBObjectStreamForBinExpr(rightDBObject.Value, data.IDChainDefinitions.Item2.LastAttribute, dbContext.DBTypeManager))
                                        {
                                            //everything is valid

                                            var leftType = GraphDBTypeMapper.ConvertGraph2CSharp(data.IDChainDefinitions.Item1.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);
                                            var rightType = GraphDBTypeMapper.ConvertGraph2CSharp(data.IDChainDefinitions.Item2.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);

                                            AOperationDefinition leftValue;
                                            AOperationDefinition rightValue;

                                            if (data.IDChainDefinitions.Item1.LastAttribute.KindOfType == KindsOfType.SetOfReferences
                                                || data.IDChainDefinitions.Item1.LastAttribute.KindOfType == KindsOfType.ListOfNoneReferences || data.IDChainDefinitions.Item1.LastAttribute.KindOfType == KindsOfType.SetOfNoneReferences)
                                                leftValue = new TupleDefinition(leftType, leftDBObject.Value.GetAttribute(data.IDChainDefinitions.Item1.LastAttribute.UUID), data.IDChainDefinitions.Item1.LastAttribute.GetDBType(dbContext.DBTypeManager));
                                            else
                                                leftValue = new ValueDefinition(leftType, leftDBObject.Value.GetAttribute(data.IDChainDefinitions.Item1.LastAttribute.UUID, data.IDChainDefinitions.Item1.LastAttribute.GetRelatedType(dbContext.DBTypeManager), dbContext));

                                            if (data.IDChainDefinitions.Item2.LastAttribute.KindOfType == KindsOfType.SetOfReferences
                                                || data.IDChainDefinitions.Item2.LastAttribute.KindOfType == KindsOfType.ListOfNoneReferences || data.IDChainDefinitions.Item2.LastAttribute.KindOfType == KindsOfType.SetOfNoneReferences)
                                                rightValue = new TupleDefinition(rightType, rightDBObject.Value.GetAttribute(data.IDChainDefinitions.Item2.LastAttribute.UUID), data.IDChainDefinitions.Item2.LastAttribute.GetDBType(dbContext.DBTypeManager));
                                            else
                                                rightValue = new ValueDefinition(rightType, rightDBObject.Value.GetAttribute(data.IDChainDefinitions.Item2.LastAttribute.UUID, data.IDChainDefinitions.Item2.LastAttribute.GetRelatedType(dbContext.DBTypeManager), dbContext));

                                            var tempSimpleOperationResult = this.SimpleOperation(leftValue, rightValue, typeOfBinExpr);
                                            if (tempSimpleOperationResult.Failed())
                                                return new Exceptional<bool>(tempSimpleOperationResult);

                                            var tempOperatorResult = tempSimpleOperationResult.Value;

                                            if ((Boolean)(tempOperatorResult as ValueDefinition).Value.Value)
                                            {
                                                //found sth that is really true

                                                #region insert into graph

                                                switch (associativity)
                                                {
                                                    case TypesOfAssociativity.Neutral:
                                                    case TypesOfAssociativity.Left:

                                                        IntegrateInGraph(leftDBObject.Value, result, leftLevelKey, dbContext, dbObjectCache);

                                                        break;
                                                    case TypesOfAssociativity.Right:

                                                        IntegrateInGraph(rightDBObject.Value, result, rightLevelKey, dbContext, dbObjectCache);

                                                        break;
                                                    case TypesOfAssociativity.Unknown:

                                                        if (Type == TypesOfOperators.AffectsLowerLevels)
                                                        {
                                                            result.AddNodesWithComplexRelation(leftDBObject, leftLevelKey, rightDBObject, rightLevelKey, dbObjectCache, 1);
                                                        }
                                                        else
                                                        {
                                                            result.AddNodesWithComplexRelation(leftDBObject, leftLevelKey, rightDBObject, rightLevelKey, dbObjectCache, 0);
                                                        }

                                                        break;
                                                    default:

                                                        return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                                }

                                                #endregion
                                            }
                                        }
                                    }
                                }

                                #region clean lower levels

                                if (Type == TypesOfOperators.AffectsLowerLevels)
                                {
                                    switch (associativity)
                                    {
                                        case TypesOfAssociativity.Neutral:
                                        case TypesOfAssociativity.Left:

                                            CleanLowerLevel(leftLevelKey, dbContext, dbObjectCache, result);

                                            break;
                                        case TypesOfAssociativity.Right:

                                            CleanLowerLevel(rightLevelKey, dbContext, dbObjectCache, result);

                                            break;
                                        case TypesOfAssociativity.Unknown:

                                            CleanLowerLevel(leftLevelKey, dbContext, dbObjectCache, result);
                                            CleanLowerLevel(rightLevelKey, dbContext, dbObjectCache, result);

                                            break;
                                        default:

                                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                    }
                                }

                                #endregion
                            }
                        }
                    }

                    #endregion

                    break;
                default:

                    return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
            }

            return new Exceptional<bool>(true);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Finds matching result corresponding to a binary expression.
        /// </summary>
        /// <param name="myLeftValueObject">The left value of a binary expression.</param>
        /// <param name="myRightValueObject">The right value of a binary expression.</param>
        /// <param name="currentTypeDefinitione"></param>
        /// <param name="dbContext">The TypeManager of the database.</param>
        /// <param name="typeOfBinExpr">The type of the binary expression.</param>
        /// <param name="associativity">The associativity of the binary expression.</param>
        /// <param name="referenceList"></param>
        /// <param name="queryCache">The per query DBObject/BackwardEdge cache.</param>
        /// <returns></returns>
        public override Exceptional<IExpressionGraph> TypeOperation(AExpressionDefinition myLeftValueObject, AExpressionDefinition myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, IExpressionGraph resultGr, Boolean aggregateAllowed = true)
        {
            #region Data

            //list of errors
            List<GraphDBError> errors = new List<GraphDBError>();

            //DataContainer for all data that is used by a binary expression/comparer
            Exceptional<DataContainer> data;

            //the index of the left attribute
            IEnumerable<Tuple<GraphDBType, AAttributeIndex>> leftIndex = null;

            //the index of the right attribute
            IEnumerable<Tuple<GraphDBType, AAttributeIndex>> rightIndex = null;

            #endregion

            #region extract data

            //data extraction with an eye on the type of the binary expression

            switch (typeOfBinExpr)
            {
                case TypesOfBinaryExpression.Atom:

                    //sth like 3 = 4
                    #region Get Atom data

                    //no further data has to be generated

                    //data = new DataContainer(null, new Tuple<Object, Object>(myLeftValueObject, myRightValueObject), null);
                    data = new Exceptional<DataContainer>();

                    #endregion

                    break;
                case TypesOfBinaryExpression.LeftComplex:

                    //sth like U.Age = 21
                    #region Get LeftComplex data

                    data = ExtractData(myLeftValueObject, myRightValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
                    if (!data.Success())
                    {
                        return new Exceptional<IExpressionGraph>(data);
                    }

                    #endregion

                    break;
                case TypesOfBinaryExpression.RightComplex:

                    //sth like 21 = U.Age
                    #region Get RightComplex data

                    data = ExtractData(myRightValueObject, myLeftValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
                    if (!data.Success())
                    {
                        return new Exceptional<IExpressionGraph>(data);
                    }

                    #endregion

                    break;
                case TypesOfBinaryExpression.Complex:

                    //sth like U.Age = F.Alter
                    #region Get Complex data

                    var leftData = ExtractData(myLeftValueObject, myRightValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
                    if (!leftData.Success())
                    {
                        return new Exceptional<IExpressionGraph>(leftData);
                    }

                    var rightData = ExtractData(myRightValueObject, myLeftValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
                    if (!rightData.Success())
                    {
                        return new Exceptional<IExpressionGraph>(rightData);
                    }

                    if (typeOfBinExpr == TypesOfBinaryExpression.Unknown)
                    {
                        typeOfBinExpr = SetTypeOfBinaryExpression(leftData, rightData);

                        switch (typeOfBinExpr)
                        {
                            case TypesOfBinaryExpression.Atom:

                                data = new Exceptional<DataContainer>(new DataContainer(new Tuple<IDChainDefinition, IDChainDefinition>(null, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(leftData.Value.Operands.Item1, leftData.Value.Operands.Item1), new Tuple<AExpressionDefinition, AExpressionDefinition>(null, null)));

                                break;
                            case TypesOfBinaryExpression.LeftComplex:

                                data = new Exceptional<DataContainer>(new DataContainer(new Tuple<IDChainDefinition, IDChainDefinition>(leftData.Value.IDChainDefinitions.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(rightData.Value.Operands.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(null, null)));

                                break;
                            case TypesOfBinaryExpression.RightComplex:

                                data = new Exceptional<DataContainer>(new DataContainer(new Tuple<IDChainDefinition, IDChainDefinition>(rightData.Value.IDChainDefinitions.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(leftData.Value.Operands.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(null, null)));

                                break;
                            case TypesOfBinaryExpression.Complex:
                            case TypesOfBinaryExpression.Unknown:
                            default:

                                throw new GraphDBException(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                        }

                    }
                    else
                    {
                        data = new Exceptional<DataContainer>(JoinData(leftData.Value, rightData.Value));
                    }

                    #endregion

                    break;
                default:

                    throw new ArgumentException();
            }

            #region handle errors

            if (data.Failed())
            {
                return new Exceptional<IExpressionGraph>(data);
            }

            #endregion

            #endregion

            #region get indexes

            switch (typeOfBinExpr)
            {
                case TypesOfBinaryExpression.LeftComplex:

                    leftIndex = GetIndex(data.Value.IDChainDefinitions.Item1.LastAttribute, dbContext, data.Value.IDChainDefinitions.Item1.LastType, data.Value.Extraordinaries.Item1);

                    break;

                case TypesOfBinaryExpression.RightComplex:

                    //data.IdNodes.TupelElement1 is correct, because of correct handling in extract data (data.IdNodes.TupelElement2 should be null here)
                    rightIndex = GetIndex(data.Value.IDChainDefinitions.Item1.LastAttribute, dbContext, data.Value.IDChainDefinitions.Item1.LastType, data.Value.Extraordinaries.Item1);

                    break;

                case TypesOfBinaryExpression.Complex:

                    //both indexe have to be catched

                    leftIndex = GetIndex(data.Value.IDChainDefinitions.Item1.LastAttribute, dbContext, data.Value.IDChainDefinitions.Item1.LastType, data.Value.Extraordinaries.Item1);
                    rightIndex = GetIndex(data.Value.IDChainDefinitions.Item2.LastAttribute, dbContext, data.Value.IDChainDefinitions.Item2.LastType, data.Value.Extraordinaries.Item1);

                    break;
            }

            #endregion

            //time to compare some things
            Exceptional<Boolean> matchDataResult = null;

            if (IsValidIndexOperation(data.Value, dbContext, typeOfBinExpr))
            {
                #region match data

                switch (typeOfBinExpr)
                {
                    case TypesOfBinaryExpression.Atom:

                        #region Atom

                        //do nothing 3 = 3 (or 2 != 3) doesnt bother U

                        #endregion

                        break;

                    case TypesOfBinaryExpression.LeftComplex:

                        #region LeftComplex

                        matchDataResult = MatchData(data.Value, dbContext, dbContext.DBObjectCache, typeOfBinExpr, leftIndex, resultGr, dbContext.SessionSettings);

                        #endregion

                        break;

                    case TypesOfBinaryExpression.RightComplex:

                        #region RightComplex

                        matchDataResult = MatchData(data.Value, dbContext, dbContext.DBObjectCache, typeOfBinExpr, rightIndex, resultGr, dbContext.SessionSettings);

                        #endregion

                        break;

                    case TypesOfBinaryExpression.Complex:

                        #region Complex

                        matchDataResult = MatchComplexData(associativity, data.Value, dbContext, dbContext.DBObjectCache, typeOfBinExpr, leftIndex, rightIndex, ref errors, ref resultGr, dbContext.SessionSettings);

                        #endregion

                        break;
                }

                #endregion
            }
            else
            {
                return new Exceptional<IExpressionGraph>(new Error_InvalidBinaryExpression(this, data.Value.IDChainDefinitions, data.Value.Operands, typeOfBinExpr));
            }

            if (matchDataResult != null && matchDataResult.Failed())
                return new Exceptional<IExpressionGraph>(matchDataResult);
            else
                return new Exceptional<IExpressionGraph>(resultGr);
        }
Exemplo n.º 6
0
        public override Exceptional<IExpressionGraph> TypeOperation(IExpressionGraph myLeftValueObject, IExpressionGraph myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, IExpressionGraph result, bool aggregateAllowed = true)
        {
            myLeftValueObject.UnionWith(myRightValueObject);

            return new Exceptional<IExpressionGraph>(myLeftValueObject);
        }
Exemplo n.º 7
0
 public abstract Exceptional<IExpressionGraph> TypeOperation(IExpressionGraph myLeftValueObject, IExpressionGraph myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, ExpressionGraph.IExpressionGraph result, bool aggregateAllowed = true);
Exemplo n.º 8
0
 public override Exceptional<IExpressionGraph> TypeOperation(AExpressionDefinition myLeftValueObject, AExpressionDefinition myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, ExpressionGraph.IExpressionGraph result, bool aggregateAllowed = true)
 {
     throw new NotImplementedException();
 }