Exemple #1
0
        private static OribitngObject CreateObject(HashSet <OribitngObject> map, string[] mapRepresentation, string representation)
        {
            if (representation == null)
            {
                return(new OribitngObject("COM", null));
            }

            var split = representation.Split(')');

            var(left, right) = (split[0], split[1]);
            var directOribitingObject = mapRepresentation.FirstOrDefault(x => x.Substring(x.LastIndexOf(')') + 1) == left && x != representation);

            var newObject = map.FirstOrDefault(x => x.Name == right);

            if (newObject == null)
            {
                newObject = new OribitngObject(right, CreateObject(map, mapRepresentation, directOribitingObject));
                map.Add(newObject);
            }

            return(newObject);
        }
Exemple #2
0
 public Vertex(OribitngObject oribitngObject, int cost)
 {
     OribitngObject = oribitngObject;
     Cost           = cost;
 }