Exemple #1
0
 public override Pattern CreatePattern()
 {
     if (!Patterns.ContainsKey(PatternType.Pyramide))
     {
         Patterns[PatternType.Pyramide] = new PatternPyramide();
     }
     return(Patterns[PatternType.Pyramide]);
 }
 public string GetPattern(string key)
 {
     if (Patterns == null || !Patterns.ContainsKey(key))
     {
         return(null);
     }
     return(Patterns[key]);
 }
Exemple #3
0
 public override Pattern CreatePattern()
 {
     if (!Patterns.ContainsKey(PatternType.Box))
     {
         Patterns[PatternType.Box] = new PatternBox();
     }
     return(Patterns[PatternType.Box]);
 }
Exemple #4
0
 public void AddPattern(string name, List <IGeneratorCommand> commands)
 {
     if (Patterns.ContainsKey(name))
     {
         throw new ToffeeGeneratorException("Cannot have two patterns that share the same name. Pattern '{0}' already exists.", name);
     }
     Patterns.Add(name, commands);
     Log("Add Pattern (Name: {0}, Size: {1})", name, commands.Count);
 }
Exemple #5
0
 public string this[string key]
 {
     get
     {
         if (Patterns.ContainsKey(key))
         {
             return(Patterns[key]);
         }
         return(string.Empty);
     }
 }
 public void AddPatternParam(string localID, object model)
 {
     if (Patterns.ContainsKey(localID))
     {
         Patterns[localID] = model;
     }
     else
     {
         Patterns.Add(localID, model);
     }
 }
 public object GetPatternParam(string localID)
 {
     if (Patterns.ContainsKey(localID))
     {
         return(Patterns[localID]);
     }
     else
     {
         return(null);
     }
 }
Exemple #8
0
        public static Patterns FindPatterns(List <Phrase> phrases)
        {
            var patterns = new Patterns();

            foreach (var phrase in phrases)
            {
                var phrasePatterns = FindPatterns(phrase);

                foreach (var pattern in phrasePatterns)
                {
                    if (!patterns.ContainsKey(pattern.Key))
                    {
                        patterns.Add(pattern.Key, pattern.Value);
                    }
                }
            }
            return(patterns);
        }
Exemple #9
0
 public bool HasPattern(string name)
 {
     return(Patterns.ContainsKey(name));
 }