Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
openmole
openmole
Commits
6ab44e0a
Commit
6ab44e0a
authored
Jun 16, 2019
by
Romain Reuillon
Browse files
[Plugin] enh: accept int and long in delta task
parent
0d0809f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
openmole/gui/client/org.openmole.gui.client.core/src/main/scala/org/openmole/gui/client/core/AuthenticationPanel.scala
View file @
6ab44e0a
...
...
@@ -46,9 +46,7 @@ class AuthenticationPanel {
lazy
val
authenticationSelector
:
Options
[
AuthenticationPluginFactory
]
=
{
val
factories
=
Plugins
.
authenticationFactories
.
now
val
currentInd
=
{
val
ind
=
factories
.
map
{
_
.
name
}.
indexOf
(
currentFactory
.
name
)
val
ind
=
factories
.
map
{
_
.
name
}.
indexOf
(
currentFactory
.
name
)
if
(
ind
==
-
1
)
0
else
ind
}
...
...
openmole/gui/client/org.openmole.gui.client.core/src/main/scala/org/openmole/gui/client/core/files/FileToolBar.scala
View file @
6ab44e0a
...
...
@@ -211,13 +211,13 @@ class FileToolBar(treeNodePanel: TreeNodePanel) {
def
resetFilterThresold
=
{
thresholdInput
.
value
=
"1000"
thresholdChanged
()
=
true
thresholdChanged
()
=
true
}
def
resetFilterTools
:
Unit
=
{
Try
{
val
th
=
thresholdInput
.
value
.
toInt
if
(
th
>
1000
||
thresholdInput
.
value
==
""
)
resetFilterThresold
if
(
th
>
1000
||
thresholdInput
.
value
==
""
)
resetFilterThresold
else
thresholdChanged
()
=
false
}
match
{
case
Failure
(
exception
)
⇒
...
...
openmole/plugins/org.openmole.plugin.method.evolution/src/main/scala/org/openmole/plugin/method/evolution/DeltaTask.scala
View file @
6ab44e0a
package
org.openmole.plugin.method.evolution
import
org.openmole.core.dsl._
import
org.openmole.core.workflow.task.ClosureTask
import
org.openmole.core.context.Variable
import
org.openmole.core.workflow.builder.DefinitionScope
import
org.openmole.core.dsl.extension._
import
org.openmole.tool.types.ToDouble
object
DeltaTask
{
def
apply
(
objective
:
(
Val
[
Double
],
Double
)*)(
implicit
name
:
sourcecode.Name
,
definitionScope
:
DefinitionScope
)
=
ClosureTask
(
"DeltaTask"
)
{
(
context
,
_
,
_
)
⇒
context
++
objective
.
map
{
case
(
v
,
o
)
⇒
Variable
(
v
,
math
.
abs
(
context
(
v
)
-
o
))
}
def
apply
(
objective
:
Delta*
)(
implicit
name
:
sourcecode.Name
,
definitionScope
:
DefinitionScope
)
=
Task
(
"DeltaTask"
)
{
p
⇒
import
p._
context
++
objective
.
map
{
case
DeltaDouble
(
v
,
o
)
⇒
Variable
(
v
,
math
.
abs
(
context
(
v
)
-
o
))
case
DeltaInt
(
v
,
o
)
⇒
Variable
(
v
,
math
.
abs
(
context
(
v
)
-
o
))
case
DeltaLong
(
v
,
o
)
⇒
Variable
(
v
,
math
.
abs
(
context
(
v
)
-
o
))
}
}
set
(
(
inputs
,
outputs
)
+=
(
objective
.
map
(
_
.
_1
)
:
_
*
)
(
inputs
,
outputs
)
+=
(
objective
.
map
(
Delta
.
v
)
:
_
*
)
)
sealed
trait
Delta
case
class
DeltaDouble
(
v
:
Val
[
Double
],
objective
:
Double
)
extends
Delta
case
class
DeltaInt
(
v
:
Val
[
Int
],
objective
:
Int
)
extends
Delta
case
class
DeltaLong
(
v
:
Val
[
Long
],
objective
:
Long
)
extends
Delta
object
Delta
{
implicit
def
fromTupleDouble
[
T
](
t
:
(
Val
[
Double
],
T
))(
implicit
toDouble
:
ToDouble
[
T
])
=
DeltaDouble
(
t
.
_1
,
toDouble
(
t
.
_2
))
implicit
def
fromTupleInt
(
t
:
(
Val
[
Int
],
Int
))
=
DeltaInt
(
t
.
_1
,
t
.
_2
)
implicit
def
fromTupleLong
(
t
:
(
Val
[
Long
],
Long
))
=
DeltaLong
(
t
.
_1
,
t
.
_2
)
def
v
(
delta
:
Delta
)
=
delta
match
{
case
DeltaDouble
(
v
,
_
)
⇒
v
case
DeltaInt
(
v
,
_
)
⇒
v
case
DeltaLong
(
v
,
_
)
⇒
v
}
}
}
object
Delta
{
import
org.openmole.core.workflow.builder.DefinitionScope
def
apply
(
dsl
:
DSL
,
objective
:
(
Val
[
Double
],
Double
)
*)(
implicit
definitionScope
:
DefinitionScope
)
=
def
apply
(
dsl
:
DSL
,
objective
:
DeltaTask.Delta
*
)(
implicit
definitionScope
:
DefinitionScope
)
=
dsl
--
DeltaTask
(
objective
:
_
*
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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