protected IFormulaUsablePath CreateAlwaysAbsolutePaths(IObjectBase objectBase, IFormulaUsable formulaUsable) { if (formulaUsable.IsAtMolecule()) { return(_objectPathFactory.CreateAbsoluteFormulaUsablePath(formulaUsable)); } return(CreateFormulaUsablePathFrom(new[] { getReactionNameFor(formulaUsable), objectBase.Name }, formulaUsable)); }
private IFormulaUsablePath createRelativePathBase(IFormulaUsable formulaUsable, IEntity refObject) { if (refObject == null) { return(null); } if (formulaUsable.IsAtMolecule() && formulaUsable.RootContainer.Equals(formulaUsable.ParentContainer)) { return(CreateFormulaUsablePathFrom(new[] { formulaUsable.ParentContainer.Name, formulaUsable.Name }, formulaUsable)); } return(_objectPathFactory.CreateRelativeFormulaUsablePath(refObject, formulaUsable)); }
protected override IFormulaUsablePath CreateRelativePath(IFormulaUsable formulaUseable, IEntity refObject, IUsingFormula editedObject) { IFormulaUsablePath path; if (!formulaUseable.IsAtMolecule()) { path = base.CreateRelativePath(formulaUseable, refObject, editedObject); } else { path = GenerateLocalReference(formulaUseable, editedObject); if (Equals(formulaUseable.ParentContainer, editedObject.ParentContainer)) { path.Replace(editedObject.ParentContainer.Name, ObjectPathKeywords.MOLECULE); } } return(path); }
protected override IFormulaUsablePath CreateRelativePath(IFormulaUsable formulaUsable, IEntity refObject, IUsingFormula editedObject) { // relative paths are only used for parameter in the same event group if (refObject != null && formulaUsable.RootContainer.Equals(refObject.RootContainer)) { IFormulaUsablePath path; if (formulaUsable.IsAtMolecule()) { if (formulaUsable.IsAnImplementationOf <IParameter>()) { path = _objectPathFactory.CreateAbsoluteFormulaUsablePath(formulaUsable) .AndAddAtFront((ObjectPath.PARENT_CONTAINER)); } else { //Molecule replace With Amount path = CreateFormulaUsablePathFrom(new[] { ObjectPath.PARENT_CONTAINER, formulaUsable.Name }, formulaUsable.Name, Constants.Dimension.MOLAR_AMOUNT); } correctPath(path, refObject as IContainer); } else { if (formulaUsable.IsAtReaction()) { path = CreateFormulaUsablePathFrom(new[] { formulaUsable.Name }, formulaUsable); correctPath(path, refObject as IContainer); } else { path = base.CreateRelativePath(formulaUsable, refObject, editedObject); } } return(path); } return(CreateAbsolutePath(formulaUsable)); }