misc/vim: inform the user when no results are found
[nit.git] / tests / example_point.nit
index 1481487..a7b89ea 100644 (file)
 
 class Point
 private
-       attr _x: Int    # Abscisse
-       attr _y: Int    # OrdonnĂ©e
-
-
-       meth x: Int
-       do
-               return _x
-       end
-       meth x=(i: Int)
-       do
-               _x = i
-       end
-
-       meth y: Int
-       do
-               return _y
-       end
-       meth y=(i: Int)
-       do
-               _y = i
-       end
+       var x: Int = 0  # Abscisse
+       var y: Int = 0  # OrdonnĂ©e
 
        # Change la position d'un point
-       meth moveto(x: Int, y: Int)
+       fun moveto(x: Int, y: Int)
        do
                _x = x
                _y = y
        end
 
-       redef meth to_s: String
+       redef fun to_s: String
        do
-               var s = "("
-               s.append(_x.to_s)
-               s.add(':')
-               s.append(_y.to_s)
-               s.add(')')
+               var s = "({_x}:{_y})"
                return s
        end
 
-       redef meth ==(p)
+       redef fun ==(p)
        do
-               return not p is null and p isa Point and _x == p.x and _y == p.y
+               return p isa Point and _x == p.x and _y == p.y
        end
 
 
-       init
-       do
-       end
-
        init at(x: Int, y: Int)
        do
                moveto(x, y)