<commit_before>wesabe.provide('canvas.geometry.Point')

class wesabe.canvas.geometry.Point
  constructor: (x, y) ->
    @x = x
    @y = y

  @__defineGetter__ 'ZeroPoint', ->
    new this(0, 0)

  this::__defineGetter__ 'nearestPixel',
    new this.constructor(Math.round(@x, @y))

  withOffset: (x, y) ->
    if not y?
      y = x.y || x.height
      x = x.x || x.width

    new this.constructor(@x + x, @y + y)

  clone: ->
    new this.constructor(@x, @y)

  inspect: (refs, color, tainted) ->
    s = new wesabe.util.Colorizer()
    s.disabled = !color
    s
      .yellow('#<')
      .bold(this.constructor?.__module__?.name || 'Object')
      .print(' ')
      .yellow('{')
      .print(@x)
      .print(', ')
      .print(@y)
      .yellow('}')
      .yellow('>')
      .toString()<commit_msg>Make wesabe.canvas.geometry.Point CommonJS-compatible.<commit_after>Colorizer = require 'util/Colorizer'

class Point
  constructor: (@x, @y) ->

  @__defineGetter__ 'ZeroPoint', ->
    new this 0, 0

  @::__defineGetter__ 'nearestPixel',
    new @constructor Math.round(@x), Math.round(@y)

  withOffset: (x, y) ->
    if not y?
      y = x.y or x.height
      x = x.x or x.width

    new @constructor @x + x, @y + y

  clone: ->
    new @constructor @x, @y

  inspect: (refs, color, tainted) ->
    s = new Colorizer()
    s.disabled = !color
    s
      .yellow('#<')
      .bold(@constructor?.__module__?.name || 'Object')
      .print(' ')
      .yellow('{')
      .print(@x)
      .print(', ')
      .print(@y)
      .yellow('}')
      .yellow('>')
      .toString()


module.exports = Point
{'fraction_non_alphanumeric': 0.1859737006887915, 'fraction_numerical': 0.002504696305572949, 'mean_word_length': 2.2813141683778233, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1086732', 'n_tokens_mistral': 598, 'n_tokens_neox': 576, 'n_words': 131}