1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Reformat.

This commit is contained in:
Cedric Beust 2017-03-18 23:18:01 -07:00
parent 3bdc83b20e
commit 43b037171c

View file

@ -1,7 +1,6 @@
package com.beust.kobalt.internal package com.beust.kobalt.internal
import com.beust.kobalt.api.IProjectAffinity import com.beust.kobalt.api.IProjectAffinity
import com.beust.kobalt.api.ISimpleAffinity
import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
@ -11,19 +10,13 @@ class ActorUtils {
* Return the plug-in actor with the highest affinity. * Return the plug-in actor with the highest affinity.
*/ */
fun <T : IProjectAffinity> selectAffinityActor(project: Project, context: KobaltContext, actors: List<T>) fun <T : IProjectAffinity> selectAffinityActor(project: Project, context: KobaltContext, actors: List<T>)
= actors.maxBy { it.affinity(project, context) } = actors.maxBy { it.affinity(project, context) }
/** /**
* Return all the plug-in actors with a non zero affinity sorted from the highest to the lowest. * Return all the plug-in actors with a non zero affinity sorted from the highest to the lowest.
*/ */
fun <T : IProjectAffinity> selectAffinityActors(project: Project, context: KobaltContext, actors: List<T>) fun <T : IProjectAffinity> selectAffinityActors(project: Project, context: KobaltContext, actors: List<T>)
= actors.filter { it.affinity(project, context) > 0 } = actors.filter { it.affinity(project, context) > 0 }
.sortedByDescending { it.affinity(project, context) } .sortedByDescending { it.affinity(project, context) }
/**
* Return the plug-in actor with the highest affinity.
*/
fun <T : ISimpleAffinity<A>, A> selectAffinityActor(actors: List<T>, arg: A) = actors.maxBy { it.affinity(arg) }
} }
} }