Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class Node[T <: AnyRef](

def filterNode(property: DiscreteProperty[T], value: String): Node[T] = {
val node = new Node[T](this.keyFunc, this.tag)
node populate collection.filter {
nt => property.sensor(nt.apply) == value
}.toSeq.map(_.apply)
node populate collection.collect {
case nt if property.sensor(nt.apply) == value => nt.apply
}
node
}

Expand Down Expand Up @@ -303,15 +303,15 @@ class JoinNode[A <: AnyRef, B <: AnyRef](val na: Node[A], val nb: Node[B], match

private def matchAndAddChildrenA(a: A, train: Boolean = true, populateEdge: Boolean = true): Unit = {
val instances = if (train) nb.getTrainingInstances else nb.getTestingInstances
for ((a, b) <- instances.filter(matcher(a, _)).map(a -> _)) {
for ((a, b) <- instances.collect { case b if matcher(a, b) => a -> b }) {
if (!contains(a -> b))
this addInstance (a -> b, train, populateEdge)
}
}

private def matchAndAddChildrenB(b: B, train: Boolean = true, populateEdge: Boolean = true): Unit = {
val instances = if (train) na.getTrainingInstances else na.getTestingInstances
for ((a, b) <- instances.filter(matcher(_, b)).map(_ -> b)) {
for ((a, b) <- instances.collect { case a if matcher(a, b) => a -> b }) {
if (!contains(a -> b))
this addInstance (a -> b, train, populateEdge)
}
Expand Down