// Path: src/main/java/com/goodow/realtime/core/Diff.java
// public interface Diff {
//   public static interface ListTarget<T> {
//     void insert(int startIndex, T values);
// 
//     void remove(int startIndex, int length);
// 
//     void replace(int startIndex, T values);
// 
//     void move(int fromIndex, int toIndex, int length);
//   }
// 
//   void diff(String before, String after, ListTarget<String> target);
// 
//   void diff(JsonArray before, JsonArray after, ListTarget<JsonArray> target,
//             Comparator<Object> comparator);
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Net.java
// public interface Net {
//   WebSocket createWebSocket(String url, JsonObject options);
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Platform.java
// public class Platform {
//   public enum Type {
//     JAVA, HTML, ANDROID, IOS, FLASH, STUB, VERTX
//   }
// 
//   private static PlatformFactory FACTORY;
// 
//   public static Diff diff() {
//     return get().diff();
//   }
// 
//   public static Net net() {
//     return get().net();
//   }
// 
//   public static Scheduler scheduler() {
//     return get().scheduler();
//   }
// 
//   /**
//    * Configures the current {@link Platform}. Do not call this directly unless you're implementing a
//    * new platform.
//    */
//   public static void setFactory(PlatformFactory factory) {
//     FACTORY = factory;
//   }
// 
//   public static Platform.Type type() {
//     return get().type();
//   }
// 
//   private static PlatformFactory get() {
//     assert FACTORY != null :
//         "You must register a platform first by invoke {Java|Android}Platform.register()";
//     return FACTORY;
//   }
// 
//   // Non-instantiable
//   protected Platform() {
//   }
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Platform.java
// public enum Type {
//   JAVA, HTML, ANDROID, IOS, FLASH, STUB, VERTX
// }
// 
// Path: src/main/java/com/goodow/realtime/core/PlatformFactory.java
// public interface PlatformFactory {
//   Diff diff();
// 
//   Net net();
// 
//   Scheduler scheduler();
// 
//   Platform.Type type();
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Scheduler.java
// public interface Scheduler {
//   /**
//    * Cancel the timer with the specified {@code id}. Returns {@code} true if the timer was
//    * successfully cancelled, or {@code false} if the timer does not exist.
//    */
//   boolean cancelTimer(int id);
// 
//   void handle(Object handler, Object event);
// 
//   /**
//    * A deferred command is executed after the event loop returns.
//    */
//   void scheduleDeferred(Handler<Void> handler);
// 
//   /**
//    * Set a one-shot timer to fire after {@code delayMs} milliseconds, at which point {@code handler}
//    * will be called.
//    * 
//    * @return the unique ID of the timer
//    */
//   int scheduleDelay(int delayMs, Handler<Void> handler);
// 
//   /**
//    * Schedules a repeating handler that is scheduled with a constant periodicity. That is, the
//    * handler will be invoked every <code>delayMs</code> milliseconds, regardless of how long the
//    * previous invocation took to complete.
//    * 
//    * @param delayMs the period with which the handler is executed
//    * @param handler the handler to execute
//    * 
//    * @return the unique ID of the timer
//    */
//   int schedulePeriodic(int delayMs, Handler<Void> handler);
// }


import com.goodow.realtime.core.Diff;
import com.goodow.realtime.core.Net;
import com.goodow.realtime.core.Platform;
import com.goodow.realtime.core.Platform.Type;
import com.goodow.realtime.core.PlatformFactory;
import com.goodow.realtime.core.Scheduler;
/*
 * Copyright 2014 Goodow.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.goodow.realtime.objc;


class ObjCPlatform implements PlatformFactory {
  /**
   * Registers the Objective-C platform with a default configuration.
   */
  public static void register() {
    Platform.setFactory(new ObjCPlatform());
  }

  /*-[
    + (void)load {
      [ComGoodowRealtimeObjcObjCPlatform register__];
    }
  ]-*/;

  private final Net net = new ObjCNet();
  private final ObjCScheduler scheduler = new ObjCScheduler();
  private final ObjCDiff diff = new ObjCDiff();

  @Override
  public Diff diff() {
    return diff;
  }

  @Override
// Path: src/main/java/com/goodow/realtime/core/Diff.java
// public interface Diff {
//   public static interface ListTarget<T> {
//     void insert(int startIndex, T values);
// 
//     void remove(int startIndex, int length);
// 
//     void replace(int startIndex, T values);
// 
//     void move(int fromIndex, int toIndex, int length);
//   }
// 
//   void diff(String before, String after, ListTarget<String> target);
// 
//   void diff(JsonArray before, JsonArray after, ListTarget<JsonArray> target,
//             Comparator<Object> comparator);
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Net.java
// public interface Net {
//   WebSocket createWebSocket(String url, JsonObject options);
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Platform.java
// public class Platform {
//   public enum Type {
//     JAVA, HTML, ANDROID, IOS, FLASH, STUB, VERTX
//   }
// 
//   private static PlatformFactory FACTORY;
// 
//   public static Diff diff() {
//     return get().diff();
//   }
// 
//   public static Net net() {
//     return get().net();
//   }
// 
//   public static Scheduler scheduler() {
//     return get().scheduler();
//   }
// 
//   /**
//    * Configures the current {@link Platform}. Do not call this directly unless you're implementing a
//    * new platform.
//    */
//   public static void setFactory(PlatformFactory factory) {
//     FACTORY = factory;
//   }
// 
//   public static Platform.Type type() {
//     return get().type();
//   }
// 
//   private static PlatformFactory get() {
//     assert FACTORY != null :
//         "You must register a platform first by invoke {Java|Android}Platform.register()";
//     return FACTORY;
//   }
// 
//   // Non-instantiable
//   protected Platform() {
//   }
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Platform.java
// public enum Type {
//   JAVA, HTML, ANDROID, IOS, FLASH, STUB, VERTX
// }
// 
// Path: src/main/java/com/goodow/realtime/core/PlatformFactory.java
// public interface PlatformFactory {
//   Diff diff();
// 
//   Net net();
// 
//   Scheduler scheduler();
// 
//   Platform.Type type();
// }
// 
// Path: src/main/java/com/goodow/realtime/core/Scheduler.java
// public interface Scheduler {
//   /**
//    * Cancel the timer with the specified {@code id}. Returns {@code} true if the timer was
//    * successfully cancelled, or {@code false} if the timer does not exist.
//    */
//   boolean cancelTimer(int id);
// 
//   void handle(Object handler, Object event);
// 
//   /**
//    * A deferred command is executed after the event loop returns.
//    */
//   void scheduleDeferred(Handler<Void> handler);
// 
//   /**
//    * Set a one-shot timer to fire after {@code delayMs} milliseconds, at which point {@code handler}
//    * will be called.
//    * 
//    * @return the unique ID of the timer
//    */
//   int scheduleDelay(int delayMs, Handler<Void> handler);
// 
//   /**
//    * Schedules a repeating handler that is scheduled with a constant periodicity. That is, the
//    * handler will be invoked every <code>delayMs</code> milliseconds, regardless of how long the
//    * previous invocation took to complete.
//    * 
//    * @param delayMs the period with which the handler is executed
//    * @param handler the handler to execute
//    * 
//    * @return the unique ID of the timer
//    */
//   int schedulePeriodic(int delayMs, Handler<Void> handler);
// }


// Path: src/main/java/com/goodow/realtime/objc/ObjCPlatform.java
import com.goodow.realtime.core.Diff;
import com.goodow.realtime.core.Net;
import com.goodow.realtime.core.Platform;
import com.goodow.realtime.core.Platform.Type;
import com.goodow.realtime.core.PlatformFactory;
import com.goodow.realtime.core.Scheduler;

/*
 * Copyright 2014 Goodow.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.goodow.realtime.objc;


class ObjCPlatform implements PlatformFactory {
  /**
   * Registers the Objective-C platform with a default configuration.
   */
  public static void register() {
    Platform.setFactory(new ObjCPlatform());
  }

  /*-[
    + (void)load {
      [ComGoodowRealtimeObjcObjCPlatform register__];
    }
  ]-*/;

  private final Net net = new ObjCNet();
  private final ObjCScheduler scheduler = new ObjCScheduler();
  private final ObjCDiff diff = new ObjCDiff();

  @Override
  public Diff diff() {
    return diff;
  }

  @Override
  public Net net() {