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); }
private bool isRelativePath(IObjectPath objectPath) { if (!objectPath.Any()) return false; if (objectPath[0] == ObjectPath.PARENT_CONTAINER) return true; if (objectPath.Count == 1) return true; return false; }
private bool canResolveMoleculeContainerPath(IObjectPath containerPath) { if (!containerPath.Any()) { return(false); } var templatePath = containerPath.Clone <IObjectPath>(); templatePath.RemoveAt(getMoleculeNameIndex(containerPath)); return(resolveContainerPathInSpatialStructure(templatePath) != null); }
private IParameter resolveMoleculeParameterInSpatialStructure(IObjectPath containerPath, string name) { if (!containerPath.Any() || !canResolveMoleculeContainerPath(containerPath)) { return(null); } var templatePath = containerPath.Clone <IObjectPath>(); templatePath.RemoveAt(getMoleculeNameIndex(containerPath)); templatePath.Add(Constants.MOLECULE_PROPERTIES); return(resolveParameterInSpatialStructure(templatePath, name)); }
private IParameter resolveInMoleculeBuildingBlock(IObjectPath containerPath, string parameterName, ParameterBuildMode buildMode) { if (!containerPath.Any()) { return(null); } var moleculeName = containerPath.Last(); var molecule = _moleculeBuildingBlock[moleculeName]; if (molecule == null) { return(null); } var parameter = molecule.Parameters.FirstOrDefault(p => p.IsNamed(parameterName) && p.BuildMode == buildMode); return(parameter); }
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); }