-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
601 fixing nightly build #606
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2cd3013
Tests
abdelr 2dc17e0
fix
abdelr 8982c99
Extending unitDefinitionImporter with the ability to translate SBML u…
abdelr b5518f3
Using unitDefinitionImporter successfully
abdelr a6ec4fb
Changing registration so importers can be injected
abdelr d75350c
Adding default event
abdelr 9b51a93
Refactoring for code readability
abdelr 2e0cb62
Do not mask all exceptions
abdelr 54e37fa
Merge branch 'develop' into 598_create_default_building_blocks_on_sbm…
abdelr 16d2ef5
Only ASTHandler as to be extra registered
abdelr 460dc9d
using AllNames
abdelr e1eebcf
Merge branch '598_create_default_building_blocks_on_sbml_import' into…
abdelr 7272bab
Singletons need to be initialized before each import process
abdelr 970f2d0
Resolving UnitDefinitionImpoter by its interface
abdelr fe3c6bd
Create an entry in the unit conversion dictionary also for directly i…
abdelr 77566b7
Merge branch 'develop' into 601_fixing_nightly_build
abdelr 6b3a518
Using IStartable
abdelr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace MoBi.Engine | ||
{ | ||
public interface ISBMLInitializableImporter | ||
{ | ||
void Initialize(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ public interface IUnitDefinitionImporter : ISBMLImporter | |
double[] ToMobiBaseUnit(string unit, IEnumerable<double> value); | ||
} | ||
|
||
public class UnitDefinitionImporter : SBMLImporter, IUnitDefinitionImporter | ||
public class UnitDefinitionImporter : SBMLImporter, ISBMLInitializableImporter, IUnitDefinitionImporter | ||
{ | ||
private readonly IMoBiDimensionFactory _moBiDimensionFactory; | ||
private readonly IDictionary<int, Unit> _baseUnitsDictionary; | ||
|
@@ -98,6 +98,7 @@ public IDimension ConvertUnit(UnitDefinition unitDefinition) | |
if (dimension != Constants.Dimension.NO_DIMENSION) | ||
{ | ||
_sbmlInformation.MobiDimension[sbmlUnit] = dimension; | ||
_unitConvertionDictionary.Add(sbmlUnit, new UnitConvertionInfo() { Dimension = dimension, Unit = dimension.DefaultUnit, Rate = 1 }); | ||
return dimension; | ||
} | ||
|
||
|
@@ -114,6 +115,7 @@ public IDimension ConvertUnit(UnitDefinition unitDefinition) | |
return unitDimension; | ||
} | ||
} | ||
_unitConvertionDictionary.Add(sbmlUnit, new UnitConvertionInfo() { Dimension = dimension, Unit = dimension.DefaultUnit, Rate = 1 }); | ||
return dimension; | ||
} | ||
|
||
|
@@ -136,6 +138,11 @@ public double[] ToMobiBaseUnit(string unit, IEnumerable<double> value) | |
var convertionData = _unitConvertionDictionary[unit]; | ||
return convertionData.Dimension.UnitValuesToBaseUnitValues(convertionData.Unit, value.Select(v => v * convertionData.Rate)); | ||
} | ||
|
||
public void Initialize() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't know about IStartable... already committed. |
||
{ | ||
_unitConvertionDictionary.Clear(); | ||
} | ||
} | ||
|
||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this class FunctionDefinitionImporter singleton? Why isn't it done in constructor?
We have a IStartable interface also... maybe that should be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a singleton yes. Then if you load a file and load a second file, it will remember all the units and functions defined so you need to clearly trigger "this is a new file" and reset to a clean state. This is why for example tests were failing.