Esempio n. 1
0
        private static void ValidateInput(string anagramCharPool, BlobComposition blob)
        {
            if (blob == null)
            {
                throw new ArgumentException("Can not be null", nameof(blob));
            }

            if (string.IsNullOrEmpty(anagramCharPool))
            {
                throw new ArgumentException("Can not be null or empty", nameof(anagramCharPool));
            }
        }
Esempio n. 2
0
        public BlobComposition(BlobComposition composition, Blob suffix)
        {
            if (suffix == null)
            {
                throw new ArgumentException("Can not be null", nameof(suffix));
            }
            if (composition == null)
            {
                throw new ArgumentException("Can not be null", nameof(composition));
            }

            var blobs = composition.OrderedBlobs.ToList();

            blobs.Add(suffix);
            OrderedBlobs = blobs;
        }
Esempio n. 3
0
        //todo test
        public void Add(string anagramCharPool, BlobComposition composition)
        {
            ValidateInput(anagramCharPool, composition);

            if (_dict.ContainsKey(anagramCharPool))
            {
                var alternatives = _dict[anagramCharPool];
                alternatives.Add(composition);
            }
            else
            {
                _dict.Add(anagramCharPool, new CompositionAlternatives2(anagramCharPool, new List <BlobComposition> {
                    composition
                }));
            }
        }
Esempio n. 4
0
 public void Add(BlobComposition composition)
 {
     _blobCompositions.Add(composition);
 }
Esempio n. 5
0
        private static BlobComposition MakeDeadEnd()
        {
            var blobComposition = new BlobComposition(new List <Blob>());

            return(blobComposition);
        }