[
https://issues.apache.org/jira/browse/PIO-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16142594#comment-16142594
]
ASF GitHub Bot commented on PIO-110:
------------------------------------
Github user takezoe commented on a diff in the pull request:
https://github.com/apache/incubator-predictionio/pull/425#discussion_r135380673
--- Diff:
core/src/main/scala/org/apache/predictionio/controller/PAlgorithm.scala ---
@@ -115,15 +115,12 @@ abstract class PAlgorithm[PD, M, Q, P]
algoParams: Params,
bm: Any): Any = {
val m = bm.asInstanceOf[M]
- if (m.isInstanceOf[PersistentModel[_]]) {
- if (m.asInstanceOf[PersistentModel[Params]].save(
- modelId, algoParams, sc)) {
- PersistentModelManifest(className = m.getClass.getName)
- } else {
- ()
- }
- } else {
- ()
+ m match {
+ case m: PersistentModel[Params] @unchecked =>
+ if(m.save(modelId, algoParams, sc)){
+ PersistentModelManifest(className = m.getClass.getName)
+ } else ()
+ case _ => ()
--- End diff --
> This code will be simpler to read by joining the if guard with the case
statement.
Yes, but I want to keep the form of code as same as other algorithms.
> Which is correct?
I don't know. In any case, I think that I shouldn't modify current behavior
in this pull request because this pull request is for refactoring.
> Refactor common code shared by CreateServer and BatchPredict
> ------------------------------------------------------------
>
> Key: PIO-110
> URL: https://issues.apache.org/jira/browse/PIO-110
> Project: PredictionIO
> Issue Type: Improvement
> Components: Core
> Affects Versions: 0.12.0-incubating
> Reporter: Donald Szeto
> Assignee: Naoki Takezoe
> Labels: newbie
>
> {{BatchPredict}} was created in PIO-105 and has a substantial amount of
> shared code with {{CreateServer}}. It would be beneficial to refactor both of
> them to share as much common code as possible.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)