-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* temp * fixing build * changing the namespace naming * adding the serializer initial implementation * trying to update expression profile * updating the serializer * temporarily hard coding the icon name * expanding ExpressionParameter * ExpressionParameter serializer test * second try * third try * fourth try * fifth try * sixth try * removing abstract identifier * adding ExpressionParameter empty constructor * skipping formulas with value only * Create OSMOSES branch * remove older nupkg files for each deploy * update build-scripts * automatically update applications with -m -p arguments * add batch files for rake tasks * working import/export * resharper * building * building * building * adding tests for ExpressionProfileBuildingBlock * corecting appveyor.yml * adding serialization test * adding tests for expressionParameter * correcting appveyor * Serialize expression type. * moved constants to Core location * consolidating assets in Core * comparison of expression profile building block properties * adding objectType * code review changes * adding name * changing PKSimVersion type * correcting build * PR comments Co-authored-by: Robert McIntosh <[email protected]>
- Loading branch information
1 parent
a2f2ec5
commit 148c260
Showing
19 changed files
with
692 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/OSPSuite.Core/Comparison/ExpressionProfileDiffBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using OSPSuite.Core.Domain.Builder; | ||
|
||
namespace OSPSuite.Core.Comparison | ||
{ | ||
public class ExpressionProfileBuildingBlockDiffBuilder : BuildingBlockDiffBuilder<ExpressionProfileBuildingBlock, ExpressionParameter> | ||
{ | ||
public ExpressionProfileBuildingBlockDiffBuilder(ObjectBaseDiffBuilder objectBaseDiffBuilder, EnumerableComparer enumerableComparer) : base(objectBaseDiffBuilder, enumerableComparer) | ||
{ | ||
|
||
} | ||
|
||
public override void Compare(IComparison<ExpressionProfileBuildingBlock> comparison) | ||
{ | ||
base.Compare(comparison); | ||
CompareValues(x => x.PKSimVersion, x => x.PKSimVersion, comparison); | ||
CompareStringValues(x => x.Name, x => x.Name, comparison); | ||
CompareValues(x => x.Type, x => x.Type, comparison); | ||
} | ||
} | ||
|
||
internal class ExpressionParameterDiffBuilder : StartValueDiffBuilder<ExpressionParameter> | ||
{ | ||
public ExpressionParameterDiffBuilder(IObjectComparer objectComparer, EntityDiffBuilder entityDiffBuilder, WithValueOriginComparison<ExpressionParameter> valueOriginComparison) : base(objectComparer, entityDiffBuilder, valueOriginComparison) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using OSPSuite.Core.Domain.Services; | ||
|
||
namespace OSPSuite.Core.Domain.Builder | ||
{ | ||
public class ExpressionParameter : PathAndValueEntity, IStartValue | ||
{ | ||
/// <summary> | ||
/// Do not use! When refactoring on promotion to core, this should be removed | ||
/// </summary> | ||
public double? StartValue { get; set; } | ||
|
||
public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager) | ||
{ | ||
base.UpdatePropertiesFrom(source, cloneManager); | ||
|
||
if (!(source is ExpressionParameter sourceExpressionParameter)) | ||
return; | ||
|
||
StartValue = sourceExpressionParameter.StartValue; | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/OSPSuite.Core/Domain/Builder/ExpressionProfileBuildingBlock.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using OSPSuite.Core.Domain.Services; | ||
using static OSPSuite.Core.Domain.Constants.ContainerName; | ||
|
||
namespace OSPSuite.Core.Domain.Builder | ||
{ | ||
public class ExpressionProfileBuildingBlock : StartValueBuildingBlock<ExpressionParameter> | ||
{ | ||
public override string Icon => Type.IconName; | ||
|
||
public virtual string MoleculeName { get; private set; } | ||
|
||
public string Species { get; private set; } | ||
|
||
public ExpressionType Type { set; get; } | ||
|
||
public string PKSimVersion { set; get; } | ||
|
||
public virtual string Category { get; private set; } | ||
|
||
public override string Name | ||
{ | ||
get => ExpressionProfileName(MoleculeName, Species, Category); | ||
set | ||
{ | ||
if (string.Equals(Name, value)) | ||
{ | ||
return; | ||
} | ||
|
||
var (moleculeName, species, category) = NamesFromExpressionProfileName(value); | ||
if (string.IsNullOrEmpty(moleculeName)) | ||
return; | ||
|
||
Species = species; | ||
Category = category; | ||
MoleculeName = moleculeName; | ||
OnPropertyChanged(() => Name); | ||
} | ||
} | ||
|
||
public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager) | ||
{ | ||
base.UpdatePropertiesFrom(source, cloneManager); | ||
var sourceExpressionProfile = source as ExpressionProfileBuildingBlock; | ||
if (sourceExpressionProfile == null) return; | ||
|
||
Type = sourceExpressionProfile.Type; | ||
PKSimVersion = sourceExpressionProfile.PKSimVersion; | ||
|
||
// Name is required because our base objects will the private property | ||
// But in this case the name is decomposed and stored in 3 other properties | ||
Name = sourceExpressionProfile.Name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using OSPSuite.Utility.Collections; | ||
|
||
namespace OSPSuite.Core.Domain.Builder | ||
{ | ||
|
||
public enum ExpressionTypesId | ||
{ | ||
Transport, | ||
Enzyme, | ||
BindingPartner | ||
} | ||
|
||
public static class ExpressionTypes | ||
{ | ||
public static ExpressionType TransportProtein = new ExpressionType(ExpressionTypesId.Transport, Assets.IconNames.Transporter, Assets.Captions.Transporter); | ||
public static ExpressionType MetabolizingEnzyme = new ExpressionType(ExpressionTypesId.Enzyme, Assets.IconNames.Enzyme, Assets.Captions.Enzyme); | ||
public static ExpressionType ProteinBindingPartner = new ExpressionType(ExpressionTypesId.BindingPartner, Assets.IconNames.Protein, Assets.Captions.Protein); | ||
|
||
private static readonly ICache<ExpressionTypesId, ExpressionType> _typesCache = new Cache<ExpressionTypesId, ExpressionType>(x => x.Id) | ||
{ | ||
TransportProtein, | ||
MetabolizingEnzyme, | ||
ProteinBindingPartner | ||
}; | ||
|
||
public static ExpressionType ById(ExpressionTypesId expressionTypeId) | ||
{ | ||
return _typesCache[expressionTypeId]; | ||
} | ||
} | ||
|
||
public class ExpressionType | ||
{ | ||
public ExpressionTypesId Id { get; } | ||
public string IconName { get; } | ||
public string DisplayName { get; } | ||
public ExpressionType(ExpressionTypesId expressionTypesId, string iconName, string displayName) | ||
{ | ||
Id = expressionTypesId; | ||
IconName = iconName; | ||
DisplayName = displayName; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return DisplayName; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.