public void AddSubstitutions_V3_Fail(string s1, string s2) { var set1 = new SubstitutionSet(new Substitution(s1)); var set2 = new SubstitutionSet(new Substitution(s2)); set2.AddSubstitutions(set1); }
public void AddSubstitutions_V3_Pass(params string[] substitutions) { var s = new SubstitutionSet(substitutions.Select(s1 => new Substitution(s1))); var s2 = new SubstitutionSet(); s2.AddSubstitutions(s); }
public void AddSubstitutions_V4_Fail(string[] s1, string[] s2) { var set1 = new SubstitutionSet(s1.Select(str => new Substitution(str))); set1.AddSubstitutions(s2.Select(str => new Substitution(str))); }
public void AddSubstitutions_V2_Fail(params string[] substitutions) { var s = new SubstitutionSet(); s.AddSubstitutions(substitutions.Select(s1 => new Substitution(s1))); }
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)); } } } } } }