1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # This sample has been implemented to show you how simple is it to play
18 # with native callbacks (C) through an high level with NIT program.
20 module callback_chimpanze
21 import callback_monkey
24 super MonkeyActionCallable
28 var monkey
= new Monkey
29 print
"Hum, I'm sleeping ..."
30 # Invoking method which will take some time to compute, and
31 # will be back in wokeUp method with information.
32 # - Callback method defined in MonkeyActionCallable Interface
33 monkey
.wokeUpAction
(self, "Hey, I'm awake.")
36 # Inherit callback method, defined by MonkeyActionCallable interface
37 # - Back of wokeUpAction method
38 redef fun wokeUp
( sender
:Monkey, message
:Object )