self.top >= other.bottom and other.top >= self.bottom
end
- # Create a bounding box that englobes the actual bounding box.
+ # Create a bounding box that encloses the actual bounding box.
# `dist` is the distance between the inner boundaries and the outer boundaries.
# ~~~
# var p = new Point[Int](5,10)
# var b = p.padded(3)
- # assert b.top == 2 and b.bot = 8 and b.left == 7 and b.right == 13
+ # assert b.left == 2 and b.right == 8 and b.top == 13 and b.bottom == 7
# ~~~
fun padded(dist: N): Box[N] do return new Box[N].lrtb(left - dist, right + dist, top + dist, bottom - dist)
end
#
# require: `self.is_numeric`
#
- # assert "1.234".to_json_value.to_numeric = 1.234
- # assert "1234".to_json_value.to_numeric = 1234
+ # assert "1.234".to_json_value.to_numeric == 1.234
+ # assert "1234".to_json_value.to_numeric == 1234
fun to_numeric: Numeric
do
if is_int then return to_i
# can use it to make a persistent snapshot of a locator at any
# point during a document parse:
#
-# module example
-# #
-# import sax::helpers::SAXLocatorImpl
-# import sax::ContentHandler
-# #
+# import sax::helpers::sax_locator_impl
+# import sax::content_handler
+#
# class Example super ContentHandler
-# private var _locator: nullable SAXLocator = null
+# private var locator: SAXLocator
# private var start_loc: nullable SAXLocator = null
-# #
-# fun locator=(Locator locator) do
-# # note the locator
-# _locator = locator
-# end
-# #
-# fun start_document do
+#
+# redef fun start_document do
# # save the location of the start of the document
# # for future use.
-# start_loc = new SAXLocatorImpl.from(locator)
+# start_loc = new SAXLocatorImpl.with(locator)
# end
# end
#
# This method must be implemented for each specific view.
# A traditional way of implementation is to use a double-dispatch mechanism
#
- # Exemple:
# class MyView
+ # super View
# redef fun draw_sprite(s) do s.draw_on_myview(self)
# end
# redef class Sprite
# r.handle_signal(sigint, true)
# r.handle_signal(sigalarm, true)
#
-# Ask system to receive a `sigalarm` signal in 1 second
+# # Ask system to receive a `sigalarm` signal in 1 second
# set_alarm(1)
#
# loop
#
# SEE: `Char::is_letter` for the definition of a letter.
#
- # var b = new FlatBuffer.from("jAVAsCriPt")"
+ # var b = new FlatBuffer.from("jAVAsCriPt")
# b.capitalize
# assert b == "Javascript"
# b = new FlatBuffer.from("i am root")