OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE.md file. | |
4 | |
5 // Generated file. Do not edit. | |
6 | |
7 package immi; | |
8 | |
9 import java.util.HashMap; | |
10 import java.util.Map; | |
11 | |
12 import dartino.ImmiServiceLayer; | |
13 import dartino.MessageBuilder; | |
14 import dartino.PresenterDataBuilder; | |
15 import dartino.Uint16ListBuilder; | |
16 | |
17 public final class ImmiService { | |
18 | |
19 public ImmiRoot registerPresenter(AnyNodePresenter presenter, String name) { | |
20 assert !roots.containsKey(name); | |
21 int length = name.length(); | |
22 int space = 48 + PresenterDataBuilder.kSize + length; | |
23 MessageBuilder message = new MessageBuilder(space); | |
24 PresenterDataBuilder builder = new PresenterDataBuilder(); | |
25 message.initRoot(builder, PresenterDataBuilder.kSize); | |
26 Uint16ListBuilder chars = builder.initNameData(length); | |
27 for (int i = 0; i < length; ++i) chars.set(i, name.charAt(i)); | |
28 int id = ImmiServiceLayer.getPresenter(builder); | |
29 ImmiRoot root = new ImmiRoot(id, presenter); | |
30 roots.put(name, root); | |
31 return root; | |
32 } | |
33 | |
34 private Map<String, ImmiRoot> roots = new HashMap<String, ImmiRoot>(); | |
35 } | |
OLD | NEW |