-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree: Should treePathToPath handle null? And how? #4
Comments
Good points. Java Swing tends to treat TreePaths as always nullable, which would mean a faithful Scala representation would either be an Option[Path] or an ADT with a NullPath case. Path is currently a rebadged IndexedSeq, which I like, but that means an ADT is impossible. OTOH, having the treePathToPath/pathToTreePath methods use Option[Path] would either be very clumsy, or asymmetric. So I don't have a better thought than passing on the nulls for the conversion methods. For getClosestPathForLocation though, I totally agree: this should return Option[Path]. Someone looking for "closest X to Y" should have no expectation of a definite result. Another interesting one: should getClosestRowForLocation return Option[Int] rather than -1? |
Using I put the change for getClosestPathForLocation in the pull request 2352a3f |
I reckon yes to both. I'll push when I get back later, and have some time to play around with it. |
Hey Sciss, do you know if this got resolved? The last commit of note is your pull request #3 . |
Hey Ken; sorry no, I don't remember. I would have to investigate this again... |
The documentation says
And
treePathToPath
mapsnull
tonull
. Since as I understand, the Scala version drops root from the path, we cannot usePath.empty
here, right?Then I suggest that
getClosestPathForLocation
should return anOption[Path[A]]
instead of a nullablePath[A]
.The text was updated successfully, but these errors were encountered: