forked from themerius/scaltex-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
112 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package scaltex.utils | ||
|
||
import scaltex.RootActor | ||
import akka.actor.ActorRef | ||
|
||
class ParentPreviousHelper(val ref: ActorRef, topology: Map[String, Map[String, String]]) { | ||
|
||
val id = ref.path.name | ||
|
||
def next(id: String) = if (topology.contains(id)) topology(id)("next") else "" | ||
def firstChild(id: String) = if (topology.contains(id)) topology(id)("firstChild") else "" | ||
def next: String = next(id) | ||
def firstChild: String = firstChild(id) | ||
|
||
def parent = ref.path.parent.name | ||
def previous = { | ||
val elemPrev = topology.filter(_._2("next") == id) | ||
if (elemPrev.nonEmpty) elemPrev.keys.head else "" | ||
} | ||
|
||
def previousNext = next(previous) | ||
def previousFirstChild = firstChild(previous) | ||
|
||
def parentNext = next(parent) | ||
def parentFirstChild = firstChild(parent) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters