Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private def equalsArrayDataLink(a1: FArrayDataLink, a2: FArrayDataLink): Boolean = {
- if (a1.uuids.size != a2.uuids.size) {
- false
- } else {
- var equals = true
- a2.uuids.foreach(id =>
- if (!a1.uuids.toSet.contains(id)) {
- equals = false
- }
- )
- equals
- }
- }
- private def columnValues(column: Column, entities: Iterable[Entity]): Map[Type, Iterable[UUID]] = {
- val result = scala.collection.mutable.Map[Type, ListBuffer[UUID]]()
- val links = scala.collection.mutable.Map[String, Type]()
- entities.foreach{
- case (entity) =>
- val value = entity.properties.find(_._1 == column).orNull
- if (value != null) {
- var key = value._2
- value._2 match {
- case links: FArrayDataLink =>
- val link = result.keys.filter(_.isInstanceOf[FArrayDataLink]).find(v => equalsArrayDataLink(v.asInstanceOf[FArrayDataLink], links)).orNull
- if (link == null) {
- result.put(key, new ListBuffer[UUID]())
- } else {
- key = link
- }
- case _ =>
- if (!result.keys.exists(_ == key)) {
- result.put(key, new ListBuffer[UUID]())
- }
- }
- result(key) += entity.key
- }
- }
- result.toMap
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement