Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
8b93a99d
Commit
8b93a99d
authored
May 17, 2016
by
Peter van 't Hof
Browse files
Fixed typo
parent
f4e420a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/ConfigUtils.scala
View file @
8b93a99d
...
...
@@ -32,14 +32,15 @@ import scala.collection.JavaConversions._
object
ConfigUtils
extends
Logging
{
/**
* This method give back all nested values that does exist in map1 but not in map2
*
* @param map1 input map
* @param map2 input map
* @return Uniqe map1
*/
def
uniqeKeys
(
map1
:
Map
[
String
,
Any
],
map2
:
Map
[
String
,
Any
])
:
Map
[
String
,
Any
]
=
{
def
uniq
u
eKeys
(
map1
:
Map
[
String
,
Any
],
map2
:
Map
[
String
,
Any
])
:
Map
[
String
,
Any
]
=
{
filterEmtpyMapValues
(
map1
.
flatMap
{
case
(
key
,
value
:
Map
[
_
,
_
])
=>
Some
(
key
->
uniqeKeys
(
value
.
asInstanceOf
[
Map
[
String
,
Any
]],
map2
.
getOrElse
(
key
,
Map
()).
asInstanceOf
[
Map
[
String
,
Any
]]))
case
(
key
,
value
:
Map
[
_
,
_
])
=>
Some
(
key
->
uniq
u
eKeys
(
value
.
asInstanceOf
[
Map
[
String
,
Any
]],
map2
.
getOrElse
(
key
,
Map
()).
asInstanceOf
[
Map
[
String
,
Any
]]))
case
(
key
,
value
)
if
!
map2
.
contains
(
key
)
=>
Some
(
key
->
value
)
case
_
=>
None
})
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/config/Config.scala
View file @
8b93a99d
...
...
@@ -215,7 +215,7 @@ class Config(protected var _map: Map[String, Any],
// Positions where values are found
val
found
=
convertIndexValuesToMap
(
foundCache
.
filter
(!
_
.
_2
.
default
).
toList
.
map
(
x
=>
(
x
.
_2
.
foundIndex
,
x
.
_2
.
value
)))
val
fixed
=
convertIndexValuesToMap
(
fixedCache
.
filter
(!
_
.
_2
.
default
).
toList
.
map
(
x
=>
(
x
.
_2
.
foundIndex
,
x
.
_2
.
value
)))
val
unused
=
uniqeKeys
(
map
,
found
)
val
unused
=
uniq
u
eKeys
(
map
,
found
)
def
reportUnused
(
map
:
Map
[
String
,
Any
],
path
:
List
[
String
]
=
Nil
)
:
Unit
=
{
map
.
foreach
{
...
...
biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/ConfigUtilsTest.scala
View file @
8b93a99d
...
...
@@ -233,10 +233,10 @@ class ConfigUtilsTest extends TestNGSuite with Matchers {
}
@Test
def
testUniqeKeys
:
Unit
=
{
ConfigUtils
.
uniqeKeys
(
Map
(
"bla"
->
"bla"
),
Map
(
"bla"
->
"bla"
))
shouldBe
Map
()
ConfigUtils
.
uniqeKeys
(
Map
(
"bla"
->
"bla"
),
Map
())
shouldBe
Map
(
"bla"
->
"bla"
)
ConfigUtils
.
uniqeKeys
(
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
)),
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
)))
shouldBe
Map
()
ConfigUtils
.
uniqeKeys
(
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
)),
Map
(
"bla"
->
Map
()))
shouldBe
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
))
ConfigUtils
.
uniq
u
eKeys
(
Map
(
"bla"
->
"bla"
),
Map
(
"bla"
->
"bla"
))
shouldBe
Map
()
ConfigUtils
.
uniq
u
eKeys
(
Map
(
"bla"
->
"bla"
),
Map
())
shouldBe
Map
(
"bla"
->
"bla"
)
ConfigUtils
.
uniq
u
eKeys
(
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
)),
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
)))
shouldBe
Map
()
ConfigUtils
.
uniq
u
eKeys
(
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
)),
Map
(
"bla"
->
Map
()))
shouldBe
Map
(
"bla"
->
Map
(
"bla"
->
"bla"
))
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment