Created
October 28, 2018 14:52
-
-
Save olegknyazev/0eb8c4599f1440a78d8dfbd6a822c1bc to your computer and use it in GitHub Desktop.
About Formatting: The empty line dilemma
This file contains hidden or 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
def copyFrom | |
(source: ReadOnlySpace[ShapeT], | |
sourceRegion: CellBox = null, | |
destination: Int3 = this.lower): Unit = { | |
val sourceBounds = | |
if (sourceRegion != null) { | |
Check.argument(source.bounds contains sourceRegion) | |
sourceRegion | |
} else | |
source.bounds | |
val translation = destination - sourceBounds.lower | |
Check.argument(bounds contains (sourceBounds move translation), | |
s"Destination region (${sourceBounds move translation}) doesn't fit within destination space") | |
Check.argument(source zoneIsolated sourceBounds, | |
"Some shapes in source space intersects boundaries of source region") | |
for (cell <- sourceBounds.iterateCells) { | |
val shape = source.at(cell) | |
if (shape != null) | |
insertOrReplace(source.centerOfShapeAt(cell) + translation, shape) | |
else | |
remove(cell + translation) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment