Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created July 31, 2012 15:22
Show Gist options
  • Select an option

  • Save levinotik/3217779 to your computer and use it in GitHub Desktop.

Select an option

Save levinotik/3217779 to your computer and use it in GitHub Desktop.
trait RectangleLike {
def getX(): Double
def getY(): Double
def getHeight(): Double
def getWidth(): Double
def setLocation(x: Double, y: Double, width: Double, height: Double): Unit
def translate(dx: Double, dy: Double){setLocation(getX()+dx, getY()+dy, getWidth(), getHeight)}
def grow(horizontal: Double, vertical: Double){setLocation(getX(), getY(), getWidth()+horizontal, getHeight()+vertical)}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment