예제 #1
0
        internal override void Select(GremlinToSqlContext currentContext, string label)
        {
            int index = ProjectKeys.FindIndex(p => p == label);

            if (index < 0)
            {
                base.Select(currentContext, label);
            }
            else
            {
                if (ProjectContextList[index % ProjectContextList.Count].PivotVariable is GremlinGhostVariable)
                {
                    var ghostVar =
                        ProjectContextList[index % ProjectContextList.Count].PivotVariable as GremlinGhostVariable;
                    var newGhostVar = GremlinGhostVariable.Create(ghostVar.RealVariable, ghostVar.AttachedVariable,
                                                                  label);
                    currentContext.VariableList.Add(newGhostVar);
                    currentContext.SetPivotVariable(newGhostVar);
                }
                else
                {
                    GremlinGhostVariable newVariable = GremlinGhostVariable.Create(ProjectContextList[index % ProjectContextList.Count].PivotVariable, this, label);
                    currentContext.VariableList.Add(newVariable);
                    currentContext.SetPivotVariable(newVariable);
                }
            }
        }
예제 #2
0
        internal List <GremlinVariable> Select(string label, GremlinVariable stopVariable = null)
        {
            List <GremlinVariable> taggedVariableList = ParentContext?.Select(label, HomeVariable);

            if (taggedVariableList == null)
            {
                taggedVariableList = new List <GremlinVariable>();
            }

            var stopIndex = stopVariable == null ? VariableList.Count : VariableList.IndexOf(stopVariable);

            for (var i = 0; i < stopIndex; i++)
            {
                if (VariableList[i].Labels.Contains(label))
                {
                    taggedVariableList.Add(new GremlinContextVariable(VariableList[i]));
                }
                else
                {
                    if (VariableList[i].ContainsLabel(label))
                    {
                        List <GremlinVariable> subContextVariableList = VariableList[i].PopulateAllTaggedVariable(label);
                        foreach (var subContextVar in subContextVariableList)
                        {
                            if (subContextVar is GremlinGhostVariable)
                            {
                                var ghostVar    = subContextVar as GremlinGhostVariable;
                                var newGhostVar = GremlinGhostVariable.Create(ghostVar.RealVariable,
                                                                              ghostVar.AttachedVariable, label);
                                taggedVariableList.Add(newGhostVar);
                            }
                            else
                            {
                                GremlinGhostVariable newVariable = GremlinGhostVariable.Create(subContextVar,
                                                                                               VariableList[i], label);
                                taggedVariableList.Add(newVariable);
                            }
                        }
                    }
                }
            }
            return(taggedVariableList);
        }