Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
biopet.biopet
Commits
789bfa8e
Commit
789bfa8e
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added defaultSample and defaultLibrary
parent
a878479e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
+8
-4
8 additions, 4 deletions
.../scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
with
8 additions
and
4 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
+
8
−
4
View file @
789bfa8e
...
...
@@ -60,7 +60,7 @@ trait Configurable extends ImplicitConversions {
/**
* Class is used for retrieval of config values
*/
protected
class
ConfigFunctions
{
protected
class
ConfigFunctions
(
val
defaultSample
:
Option
[
String
]
=
None
,
val
defaultLibrary
:
Option
[
String
]
=
None
)
{
/**
*
* @param key Name of value
...
...
@@ -79,13 +79,15 @@ trait Configurable extends ImplicitConversions {
freeVar
:
Boolean
=
true
,
sample
:
String
=
null
,
library
:
String
=
null
)
:
ConfigValue
=
{
val
s
=
if
(
sample
!=
null
||
defaultSample
.
isEmpty
)
sample
else
defaultSample
.
get
val
l
=
if
(
library
!=
null
||
defaultLibrary
.
isEmpty
)
library
else
defaultLibrary
.
get
val
m
=
if
(
submodule
!=
null
)
submodule
else
configName
val
p
=
path
(
s
ample
,
library
,
submodule
)
val
p
=
path
(
s
,
l
,
submodule
)
val
d
=
{
val
value
=
Config
.
getValueFromMap
(
defaults
.
toMap
,
ConfigValueIndex
(
m
,
p
,
key
,
freeVar
))
if
(
value
.
isDefined
)
value
.
get
.
value
else
default
}
if
(!
contains
(
key
,
submodule
,
freeVar
,
sample
=
s
ample
,
library
=
l
ibrary
)
&&
d
==
null
)
{
if
(!
contains
(
key
,
submodule
,
freeVar
,
sample
=
s
,
library
=
l
)
&&
d
==
null
)
{
if
(
required
)
{
Logging
.
logger
.
error
(
"Value in config could not be found but it is required, key: "
+
key
+
" module: "
+
m
+
" path: "
+
p
)
throw
new
IllegalStateException
(
"Value in config could not be found but it is required, key: "
+
key
+
" module: "
+
m
+
" path: "
+
p
)
...
...
@@ -109,8 +111,10 @@ trait Configurable extends ImplicitConversions {
freeVar
:
Boolean
=
true
,
sample
:
String
=
null
,
library
:
String
=
null
)
=
{
val
s
=
if
(
sample
!=
null
||
defaultSample
.
isEmpty
)
sample
else
defaultSample
.
get
val
l
=
if
(
library
!=
null
||
defaultLibrary
.
isEmpty
)
library
else
defaultLibrary
.
get
val
m
=
if
(
submodule
!=
null
)
submodule
else
configName
val
p
=
path
(
s
ample
,
library
,
submodule
)
val
p
=
path
(
s
,
l
,
submodule
)
Config
.
global
.
contains
(
m
,
p
,
key
,
freeVar
)
||
!(
Config
.
getValueFromMap
(
defaults
.
toMap
,
ConfigValueIndex
(
m
,
p
,
key
,
freeVar
))
==
None
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment