Exemplo n.º 1
0
        private static IEnumerable<DynamicPropertyResult> SquareDistanceCalculator(IQueryContext context, Name x1, Name y1, Name x2, Name y2)
        {
            foreach (var subSet in context.Constraints)
            {
                foreach (var x1Subs in context.AskPossibleProperties(x1).ToList())
                {
                    foreach (var y1Subs in context.AskPossibleProperties(y1).ToList())
                    {
                        foreach(var x2Subs in context.AskPossibleProperties(x2).ToList())
                        {
                            foreach(var y2Subs in context.AskPossibleProperties(y2).ToList())
                            {
                                var x1Value = float.Parse(x1Subs.Item1.Value.ToString());
                                var y1Value = float.Parse(y1Subs.Item1.Value.ToString());
                                var x2Value = float.Parse(x2Subs.Item1.Value.ToString());
                                var y2Value = float.Parse(y2Subs.Item1.Value.ToString());

                                var res = Math.Pow((x2Value - x1Value), 2) + Math.Pow((y2Value - y1Value), 2);
                                yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private IEnumerable <DynamicPropertyResult> WorkingMemoryProperty(IQueryContext context, Name name, Name value)
        {
            foreach (var c in context.Constraints)
            {
                var n = context.AskPossibleProperties(name).ToList().FirstOrDefault()?.Item1.Value;
                var v = context.AskPossibleProperties(value).ToList().FirstOrDefault()?.Item1.Value;

                if (n == null || v == null)
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName("Fail")), c));
                }
                else if (!n.IsGrounded || !v.IsGrounded)
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName("Fail")), c));
                }
                else if (n.IsComposed || v.IsComposed)
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName("Fail")), c));
                }
                else
                {
                    this.SetValue(n, v);
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName("OK")), c));
                }
            }
        }
Exemplo n.º 3
0
        private static IEnumerable <DynamicPropertyResult> MathPropertyCalculator(IQueryContext context, Name x, Name op, Name y)
        {
            if (op.IsVariable || op.IsComposed)
            {
                yield break;
            }

            //TODO: Make sure that every dynamic property checks for empty constraints set
            var constraintsSets = context.Constraints.Any() ? context.Constraints : new[] { new SubstitutionSet() };

            foreach (var subSet in constraintsSets)
            {
                foreach (var xSubs in context.AskPossibleProperties(x).ToList())
                {
                    foreach (var ySubs in context.AskPossibleProperties(y).ToList())
                    {
                        if (xSubs.Item1.Value == Name.NIL_SYMBOL || ySubs.Item1.Value == Name.NIL_SYMBOL)
                        {
                            throw new Exception("Trying to perform a MATH operation on a Nil value");
                        }

                        float i = 0;

                        if (!float.TryParse(xSubs.Item1.Value.ToString(), out i) || !float.TryParse(ySubs.Item1.Value.ToString(), out i))
                        {
                            yield break;
                        }


                        var xValue = float.Parse(xSubs.Item1.Value.ToString(), CultureInfo.InvariantCulture);
                        var yValue = float.Parse(ySubs.Item1.Value.ToString(), CultureInfo.InvariantCulture);

                        if (op.ToString().EqualsIgnoreCase("Plus"))
                        {
                            var res = xValue + yValue;
                            yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet));
                        }

                        if (op.ToString().EqualsIgnoreCase("Minus"))
                        {
                            var res = xValue - yValue;
                            yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet));
                        }

                        if (op.ToString().EqualsIgnoreCase("Times"))
                        {
                            var res = xValue * yValue;
                            yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet));
                        }

                        if (op.ToString().EqualsIgnoreCase("Div"))
                        {
                            var res = xValue / yValue;
                            yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet));
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 private static IEnumerable <DynamicPropertyResult> Test_Concat_Dynamic_Property(IQueryContext context, Name x, Name y)
 {
     foreach (var v1 in context.AskPossibleProperties(x))
     {
         foreach (var v2 in context.AskPossibleProperties(y))
         {
             var c2 = Name.BuildName((Name)"Con", v1.Item1.Value, v2.Item1.Value);
             foreach (var s in v2.Item2)
             {
                 yield return(new DynamicPropertyResult(new ComplexValue(c2), s));
             }
         }
     }
 }
Exemplo n.º 5
0
        private IEnumerable <DynamicPropertyResult> TellDynamicProperty(IQueryContext context, Name property, Name value)
        {
            var constraintsSets = context.Constraints.Any() ? context.Constraints : new[] { new SubstitutionSet() };

            foreach (var c in constraintsSets)
            {
                if (property.IsPrimitive)
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(value), c));
                }
                else
                {
                    Name val;
                    if (!value.IsPrimitive)
                    {
                        val = context.AskPossibleProperties(value).FirstOrDefault()?.Item1.Value;
                        if (val == null)
                        {
                            val = Name.NIL_SYMBOL;
                        }
                        this.Tell(property, val);
                        yield return(new DynamicPropertyResult(new ComplexValue(val), c));
                    }
                    else
                    {
                        this.Tell(property, value);
                        yield return(new DynamicPropertyResult(new ComplexValue(value), c));
                    }
                }
            }
        }
Exemplo n.º 6
0
        private static IEnumerable <DynamicPropertyResult> AskDynamicProperty(IQueryContext context, Name property)
        {
            var constraintsSets = context.Constraints.Any() ? context.Constraints : new[] { new SubstitutionSet() };

            foreach (var c in constraintsSets)
            {
                Name propValue = null;

                if (!property.IsComposed)
                {
                    propValue = property;
                }
                else
                {
                    propValue = context.AskPossibleProperties(property).FirstOrDefault()?.Item1.Value;
                }

                if (propValue == null)
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.NIL_SYMBOL), c));
                }
                else
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(propValue), c));
                }
            }
        }
 private IEnumerable <DynamicPropertyResult> SIPropertyCalculator(IQueryContext context, Name target)
 {
     foreach (var t in context.AskPossibleProperties(target))
     {
         var si = internal_GetSocialImportance(t.Item1.Value, context.Perspective);
         foreach (var s in t.Item2)
         {
             yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(si)), s));
         }
     }
 }
Exemplo n.º 8
0
		private static IEnumerable<DynamicPropertyResult> CountPropertyCalculator_new(IQueryContext context, Name x)
		{
			var set = context.AskPossibleProperties(x).ToList();
			Name count = Name.BuildName(set.Count);
			IEnumerable<SubstitutionSet> sets;
			if (set.Count == 0)
				sets = context.Constraints;
			else
				sets = set.SelectMany(s => s.Item2).Distinct();

			foreach (var d in sets)
				yield return new DynamicPropertyResult(new ComplexValue(count,1.0f), d);
		}
Exemplo n.º 9
0
        private IEnumerable <DynamicPropertyResult> MoodPropertyCalculator(IQueryContext context, Name x)

        // Should only accept SELF, its rpc Name our a variable that should be subbed by its name
        {
            if (context.Perspective != Name.SELF_SYMBOL)
            {
                yield break;
            }


            if (x.IsVariable)
            {
                foreach (var resultPair in context.AskPossibleProperties(x))
                {
                    var v = m_emotionalState.Mood;
                    foreach (var c in resultPair.Item2)
                    {
                        yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(v)), c));
                    }
                }
            }
            else
            {
                if (x != Name.SELF_SYMBOL && x != (Name)context.Queryable.Perspective)
                {
                    yield break;
                }

                var v = m_emotionalState.Mood;

                foreach (var c in context.Constraints)
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(v)), c));
                }

                if (!context.Constraints.Any())
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(v)), new SubstitutionSet()));
                }
            }
        }
Exemplo n.º 10
0
        private IEnumerable <DynamicPropertyResult> EventAgePropertyCalculator(IQueryContext context, Name id)
        {
            if (id.IsVariable)
            {
                foreach (var record in m_registry.Values)
                {
                    var idSub = new Substitution(id, new ComplexValue(Name.BuildName(record.Id)));
                    foreach (var c in context.Constraints)
                    {
                        if (c.Conflicts(idSub))
                        {
                            continue;
                        }

                        var newSet = new SubstitutionSet(c);
                        newSet.AddSubstitution(idSub);

                        var value = Tick - record.Timestamp;
                        yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(value)), newSet));
                    }
                }
                yield break;
            }

            foreach (var pair in context.AskPossibleProperties(id))
            {
                uint idValue;
                if (!pair.Item1.Value.TryConvertToValue(out idValue))
                {
                    continue;
                }

                var record = m_registry[idValue];
                var value  = (Tick - record.Timestamp);
                foreach (var c in pair.Item2)
                {
                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(value)), c));
                }
            }
        }
Exemplo n.º 11
0
        public IEnumerable <DynamicPropertyResult> VolitionPropertyCalculator(IQueryContext context, Name socialMoveName, Name Step, Name Target, Name Mode)
        {
            Dictionary <SubstitutionSet, Name> ret = new Dictionary <SubstitutionSet, Name>();

            var  stringVolition = "";
            var  possibleSE     = new List <SocialExchange>();
            bool SEConstraint   = false;


            if (context.Perspective != Name.SELF_SYMBOL)
            {
                yield break;
            }

            if (this.m_kB.Perspective == Target)
            {
                yield break;
            }

            List <Name> possibleSEs = new List <Name>();

            if (socialMoveName.IsVariable)
            {
                foreach (var s in context.AskPossibleProperties(socialMoveName))
                {
                    possibleSEs.Add(s.Item1.Value);
                }

                foreach (var se in this.m_SocialExchanges)
                {
                    possibleSEs.Add(se.Name);
                }
            }
            else if (socialMoveName.IsUniversal)
            {
                foreach (var se in this.m_SocialExchanges)
                {
                    possibleSEs.Add(se.Name);
                }
            }

            else
            {
                possibleSEs.Add(socialMoveName);
            }

            List <Name> possibleTargets = new List <Name>();

            if (Target.IsVariable)
            {
                foreach (var s in context.AskPossibleProperties(Target))
                {
                    possibleTargets.Add(s.Item1.Value);
                }
            }
            else
            {
                possibleTargets.Add(Target);
            }



            List <Name> possibleModes = new List <Name>();

            if (Mode.IsVariable)
            {
                foreach (var s in context.AskPossibleProperties(Mode))
                {
                    possibleModes.Add(s.Item1.Value);
                }
            }

            else
            {
                possibleModes.Add(Mode);
            }

            foreach (var seName in possibleSEs)
            {
                if (!m_SocialExchanges.Exists(x => x.Name == seName))
                {
                    continue;
                }


                foreach (var targ in possibleTargets)
                {
                    var actualStep = FilterStep(seName, targ);

                    if (actualStep.ToString() == "-")
                    {
                        continue;
                    }

                    foreach (var seMode in possibleModes)
                    {
                        var volValue = CalculateSocialMoveVolition(seName, actualStep, targ, seMode);


                        if (volValue != Single.NegativeInfinity)
                        {
                            var subSet = new SubstitutionSet();

                            if (socialMoveName.IsVariable)
                            {
                                var sub = new Substitution(socialMoveName, new ComplexValue(seName, 1));
                                subSet.AddSubstitution(sub);
                            }


                            if (Step.IsVariable)
                            {
                                var sub = new Substitution(Step, new ComplexValue(actualStep, 1));
                                subSet.AddSubstitution(sub);
                            }


                            if (Target.IsVariable)
                            {
                                var sub = new Substitution(Target, new ComplexValue(targ, 1));
                                subSet.AddSubstitution(sub);
                            }

                            if (Mode.IsVariable)
                            {
                                var sub = new Substitution(Mode, new ComplexValue(seMode, 1));
                                subSet.AddSubstitution(sub);
                            }

                            if (context.Constraints.Count() > 0)
                            {
                                foreach (var c in context.Constraints)
                                {
                                    if (c.Conflicts(subSet))
                                    {
                                        continue;
                                    }

                                    var newcontext = new SubstitutionSet();

                                    newcontext.AddSubstitutions(c);

                                    newcontext.AddSubstitutions(subSet);

                                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(volValue)), newcontext));
                                }
                            }

                            else
                            {
                                yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(volValue)), subSet));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
        private IEnumerable <DynamicPropertyResult> EmotionIntensityPropertyCalculator(IQueryContext context, Name x, Name y)
        {
            if (context.Perspective != Name.SELF_SYMBOL)
            {
                yield break;
            }

            Name entity      = x;
            Name emotionName = y;

            if (entity.IsVariable)
            {
                foreach (var entit in context.AskPossibleProperties(entity))
                {
                    if (emotionName.IsVariable)
                    {
                        foreach (var emot in  GetAllActiveEmotions())
                        {
                            foreach (var c in context.Constraints)
                            {
                                var sub  = new Substitution(entity, entit.Item1);
                                var sub2 = new Substitution(emotionName, new ComplexValue(Name.BuildName(emot.Type)));
                                if (c.AddSubstitution(sub))
                                {
                                    if (c.AddSubstitution(sub2))
                                    {
                                        yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(emot.Intensity)), c));
                                    }
                                }
                            }
                        }
                    }


                    else
                    {
                        var gottem = GetAllActiveEmotions().Where(d => d.Type == emotionName.ToString());

                        if (gottem.Any())
                        {
                            foreach (var c in context.Constraints)
                            {
                                var sub = new Substitution(entity, entit.Item1);
                                if (c.AddSubstitution(sub))
                                {
                                    yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(gottem.FirstOrDefault().Intensity)), c));
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (emotionName.IsVariable)
                {
                    foreach (var emot in  GetAllActiveEmotions())
                    {
                        foreach (var c in context.Constraints)
                        {
                            var sub2 = new Substitution(emotionName, new ComplexValue(Name.BuildName(emot.Type)));
                            if (c.AddSubstitution(sub2))
                            {
                                yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(emot.Intensity)), c));
                            }
                        }
                    }
                }

                else
                {
                    var gottem = GetAllActiveEmotions().Where(d => d.Type == emotionName.ToString());
                    if (gottem.Any())
                    {
                        foreach (var c in context.Constraints)
                        {
                            yield return(new DynamicPropertyResult(new ComplexValue(Name.BuildName(gottem.FirstOrDefault().Intensity)), c));
                        }
                    }
                }
            }
        }
Exemplo n.º 13
0
        private IEnumerable <DynamicPropertyResult> StrongestEmotionForEventCalculator(IQueryContext context, Name x, Name cause)
        {
            if (context.Perspective != Name.SELF_SYMBOL)
            {
                yield break;
            }

            Dictionary <Name, IActiveEmotion> emoList = new Dictionary <Name, IActiveEmotion>();

            if (cause.IsVariable) // Event is a variable
            {
                foreach (var ev in context.AskPossibleProperties(cause))
                {
                    var emo = m_emotionalState.GetStrongestEmotion(cause, m_am);
                    if (emo != null)
                    {
                        var emoValue = emo.EmotionType;

                        var causeSub = new Substitution(cause, ev.Item1);


                        if (x.IsVariable)
                        {
                            var sub = new Substitution(x, new ComplexValue(context.Queryable.Perspective));
                            foreach (var c in context.Constraints)
                            {
                                if (c.AddSubstitution(causeSub))
                                {
                                    if (c.AddSubstitution(sub))
                                    {
                                        yield return(new DynamicPropertyResult(new ComplexValue((Name)emoValue),
                                                                               c));
                                    }
                                }
                            }
                        }
                        else
                        {
                            foreach (var resultPair in context.AskPossibleProperties(x))
                            {
                                foreach (var c in resultPair.Item2)
                                {
                                    if (c.AddSubstitution(causeSub))
                                    {
                                        yield return(new DynamicPropertyResult(new ComplexValue((Name)emoValue), c));
                                    }
                                }
                            }
                        }
                    }
                }

                foreach (var eve in this.EventRecords)           // If cause is a variable Im going through all events and emotions associated with them

                {
                    var sub = new Substitution(cause, new ComplexValue((Name)eve.Event));

                    var resultingEmotions = this.GetAllActiveEmotions().Where(y => y.CauseEventId == eve.Id);

                    var emoValue = resultingEmotions.MaxValue(e => e.Intensity);

                    foreach (var c in context.Constraints)
                    {
                        if (c.AddSubstitution(sub))
                        {
                            yield return(new DynamicPropertyResult(
                                             new ComplexValue(Name.BuildName(emoValue.Intensity)), c));
                        }
                    }
                }
            }

            else
            {
                var emo = m_emotionalState.GetStrongestEmotion(cause, m_am);

                if (emo == null)
                {
                    yield break;
                }

                var emoValue = emo.EmotionType;

                if (x.IsVariable)
                {
                    var sub = new Substitution(x, new ComplexValue(context.Queryable.Perspective));
                    foreach (var c in context.Constraints)
                    {
                        if (c.AddSubstitution(sub))
                        {
                            yield return(new DynamicPropertyResult(new ComplexValue((Name)emoValue), c));
                        }
                    }
                }
                else
                {
                    foreach (var resultPair in context.AskPossibleProperties(x))
                    {
                        foreach (var c in resultPair.Item2)
                        {
                            yield return(new DynamicPropertyResult(new ComplexValue((Name)emoValue), c));
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
        private IEnumerable<DynamicPropertyResult> EventAgePropertyCalculator(IQueryContext context, Name id)
        {
            if(!context.Perspective.Match(Name.SELF_SYMBOL))
                yield break;

            if (id.IsVariable)
            {
                foreach (var record in m_registry.Values)
                {
                    var idSub = new Substitution(id, Name.BuildName(record.Id));
                    foreach (var c in context.Constraints)
                    {
                        if (c.Conflicts(idSub))
                            continue;

                        var newSet = new SubstitutionSet(c);
                        newSet.AddSubstitution(idSub);

                        var value = Tick - record.Timestamp;
                        yield return new DynamicPropertyResult(Name.BuildName(value), newSet);
                    }
                }
                yield break;
            }

            foreach (var pair in context.AskPossibleProperties(id))
            {
                uint idValue;
                if(!pair.Item1.TryConvertToValue(out idValue))
                    continue;

                var record = m_registry[idValue];
                var value = (Tick - record.Timestamp);
                foreach (var c in pair.Item2)
                    yield return new DynamicPropertyResult(Name.BuildName(value), c);
            }
        }
Exemplo n.º 15
0
 private static IEnumerable<DynamicPropertyResult> Test_Concat_Dynamic_Property(IQueryContext context, Name x, Name y)
 {
     foreach (var v1 in context.AskPossibleProperties(x))
     {
         foreach (var v2 in context.AskPossibleProperties(y))
         {
             var c2 = Name.BuildName((Name)"Con", v1.Item1, v2.Item1);
             foreach (var s in v2.Item2)
             {
                 yield return new DynamicPropertyResult(c2, s);
             }
         }
     }
 }
Exemplo n.º 16
0
        private static IEnumerable<DynamicPropertyResult> CountPropertyCalculator_new(IQueryContext context, Name x)
        {
            var set = context.AskPossibleProperties(x).ToList();
            Name count = Name.BuildName(set.Count);
            IEnumerable<SubstitutionSet> sets;
            if (set.Count == 0)
                sets = context.Constraints;
            else
                sets = set.SelectMany(s => s.Item2).Distinct();

            foreach (var d in sets)
                yield return new DynamicPropertyResult(count, d);
        }
Exemplo n.º 17
0
        private static IEnumerable<DynamicPropertyResult> MathPropertyCalculator(IQueryContext context, Name x, Name op, Name y)
        {
            if (op.IsVariable || op.IsComposed)
                yield break;

            foreach (var subSet in context.Constraints)
            {
                foreach (var xSubs in context.AskPossibleProperties(x).ToList())
                {
                    foreach(var ySubs in context.AskPossibleProperties(y).ToList())
                    {
                        var xValue = float.Parse(xSubs.Item1.Value.ToString());
                        var yValue = float.Parse(ySubs.Item1.Value.ToString());

                        if (op.ToString().EqualsIgnoreCase("Plus"))
                        {
                            var res = xValue + yValue;
                            yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet);
                        }

                        if (op.ToString().EqualsIgnoreCase("Minus"))
                        {
                            var res = xValue - yValue;
                            yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet);
                        }

                        if (op.ToString().EqualsIgnoreCase("Times"))
                        {
                            var res = xValue * yValue;
                            yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet);
                        }

                        if (op.ToString().EqualsIgnoreCase("Div"))
                        {
                            var res = xValue / yValue;
                            yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), subSet);
                        }

                    }
                }
            }

            if (context.Constraints.IsEmpty())
            {
                var xValue = float.Parse(x.ToString());
                var yValue = float.Parse(y.ToString());

                if (op.ToString().EqualsIgnoreCase("Plus"))
                {
                    var res = xValue + yValue;
                    yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), new SubstitutionSet());
                }

                if (op.ToString().EqualsIgnoreCase("Minus"))
                {
                    var res = xValue - yValue;
                    yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), new SubstitutionSet());
                }

                if (op.ToString().EqualsIgnoreCase("Times"))
                {
                    var res = xValue * yValue;
                    yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), new SubstitutionSet());
                }

                if (op.ToString().EqualsIgnoreCase("Div"))
                {
                    var res = xValue / yValue;
                    yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(res)), new SubstitutionSet());
                }
            }
        }
Exemplo n.º 18
0
		private static IEnumerable<DynamicPropertyResult> HasLiteralPropertyCalculator(IQueryContext context, Name x, Name y)
		{
			if (!(y.IsVariable || y.IsComposed))
				return Enumerable.Empty<DynamicPropertyResult>();

			List<DynamicPropertyResult> results = ObjectPool<List<DynamicPropertyResult>>.GetObject();
			try
			{
				IEnumerable<Name> candidates;
				if (y.IsVariable)
				{
					candidates = context.Constraints.Select(s => s[y]).Where(n => n != null);
				}
				else if (!y.IsGrounded)
				{
					candidates = context.Constraints.Select(y.MakeGround).Where(c => c.IsConstant);
				}
				else
				{
					candidates = new[] { y };
				}

				foreach (var c in candidates)
				{
					foreach (var t in c.GetTerms())
					{
						if (x.IsVariable)
						{
							var sub = new Substitution(x,new ComplexValue(t));
							foreach (var g in context.Constraints)
							{
								if(g.Conflicts(sub))
									continue;

								var s = new SubstitutionSet(g);
								s.AddSubstitution(sub);
								results.Add(new DynamicPropertyResult(new ComplexValue(Name.BuildName(true)),s));
							}
						}
						else
						{
							foreach (var x2 in context.AskPossibleProperties(x))
							{
                                if (x2.Item1.Value == t)
								{
									var r = Name.BuildName(true);
									foreach (var s in x2.Item2)
									{
										results.Add(new DynamicPropertyResult(new ComplexValue(r), s));
									}
								}
							}
						}
					}
				}

				return results.ToArray();
			}
			finally
			{
				results.Clear();
				ObjectPool<List<DynamicPropertyResult>>.Recycle(results);
			}
		}