private IObjectPath convertedPath(IObjectPath objectPath, IContainer rootContainer, bool addSimulationName)
        {
            if (!objectPath.Any())
            {
                return(objectPath);
            }

            //Path starts with the root element, this needs to be remove no matter what
            if (string.Equals(objectPath.ElementAt(0), Constants.ROOT))
            {
                return(removeFirstEntryOf(objectPath));
            }

            if (rootContainer == null)
            {
                return(objectPath);
            }

            //now this is an simulation absolute path (the second entry in the path is either Organism,  neighborhoods)
            if (rootContainer.ContainerType == ContainerType.Simulation && !addSimulationName)
            {
                return(removeFirstEntryOf(objectPath));
            }

            //the path is either relative or should stay as is. Return
            return(objectPath);
        }
Ejemplo n.º 2
0
        public void ReplaceIn(IObjectPath objectPath)
        {
            //no element
            if (!objectPath.Any())
            {
                return;
            }

            var firstPathElement = objectPath.ElementAt(0);

            if (string.Equals(firstPathElement, _rootName))
            {
                return;
            }

            if (!_topContainerNames.Contains(firstPathElement))
            {
                return;
            }

            objectPath.AddAtFront(_rootName);
        }