text:
@implementation ALAppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;
@synthesize inicialViewController = _inicialViewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil];
	UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window = window;

    FrontViewController *frontViewController = [storyboard instantiateViewControllerWithIdentifier:@"front"];
	RearViewController *rearViewController = [storyboard instantiateViewControllerWithIdentifier:@"rear"];
    ALPlayerViewController *downViewController = [storyboard instantiateViewControllerWithIdentifier:@"player"];
    ALViewController *initViewController = [storyboard instantiateViewControllerWithIdentifier:@"inicial"];

    UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
    UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearViewController];
    //UIViewController *downNavigationController = [[UINavigationController alloc] initWithRootViewController:downViewController];

    //NSLog(@"front %@ / %@ \n rear %@ / %@ \n player %@ / %@",frontNavigationController, frontNavigationController.view,rearNavigationController, rearNavigationController.view, downViewController, downViewController.view);//downNavigationController, downNavigationController.view);

    SWRevealViewController *mainRevealController = [[SWRevealViewController alloc] initWithRearViewController:rearNavigationController frontViewController:frontNavigationController andDownViewController:downViewController];//downNavigationController];

    //mainRevealController.playerVC = [storyboard instantiateViewControllerWithIdentifier:@"player"];
    mainRevealController.delegate = (id)self;

    self.viewController = mainRevealController;
    initViewController.mainRevealController = self.viewController;
    self.inicialViewController = initViewController;
	[self.viewController.view setBackgroundColor:[UIColor whiteColor]];
	self.window.rootViewController = self.inicialViewController;
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end

redpajama_set_name: RedPajamaGithub


text:
"use strict";

// User configurable.
const ROM_FILENAME = "rom/game.gb";
const ENABLE_REWIND = true;
const ENABLE_PAUSE = false;
const ENABLE_SWITCH_PALETTES = true;
const OSGP_DEADZONE = 0.1; // On screen gamepad deadzone range
const CGB_COLOR_CURVE = 2; // 0: none, 1: Sameboy "Emulate Hardware" 2: Gambatte/Gameboy Online

// List of DMG palettes to switch between. By default it includes all 84
// built-in palettes. If you want to restrict this, change it to an array of
// the palettes you want to use and change DEFAULT_PALETTE_IDX to the index of the
// default palette in that list.
//
// Example: (only allow one palette with index 16):
//   const DEFAULT_PALETTE_IDX = 0;
//   const PALETTES = [16];
//
// Example: (allow three palettes, 16, 32, 64, with default 32):
//   const DEFAULT_PALETTE_IDX = 1;
//   const PALETTES = [16, 32, 64];
//
const DEFAULT_PALETTE_IDX = 83;
const PALETTES = [
  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
  22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
  41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
  60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
  79, 80, 81, 82, 83,
];

const RESULT_OK = 0;
const RESULT_ERROR = 1;
const SCREEN_WIDTH = 160;
const SCREEN_HEIGHT = 144;
const SGB_SCREEN_WIDTH = 256;
const SGB_SCREEN_HEIGHT = 224;
const SGB_SCREEN_LEFT = (SGB_SCREEN_WIDTH - SCREEN_WIDTH) >> 1;
const SGB_SCREEN_RIGHT = (SGB_SCREEN_WIDTH + SCREEN_WIDTH) >> 1;
const SGB_SCREEN_TOP = (SGB_SCREEN_HEIGHT - SCREEN_HEIGHT) >> 1;
const SGB_SCREEN_BOTTOM = (SGB_SCREEN_HEIGHT + SCREEN_HEIGHT) >> 1;
const AUDIO_FRAMES = 4096;
const AUDIO_LATENCY_SEC = 0.1;
const MAX_UPDATE_SEC = 5 / 60;
const CPU_TICKS_PER_SECOND = 4194304;
const EVENT_NEW_FRAME = 1;
const EVENT_AUDIO_BUFFER_FULL = 2;
const EVENT_UNTIL_TICKS = 4;
const REWIND_FRAMES_PER_BASE_STATE = 45;
const REWIND_BUFFER_CAPACITY = 4 * 1024 * 1024;
const REWIND_FACTOR = 1.5;
const REWIND_UPDATE_MS = 16;
const GAMEPAD_POLLING_INTERVAL = 1000 / 60 / 4; // When activated, poll for gamepad input about ~4 times per gameboy frame (~240 times second)
const GAMEPAD_KEYMAP_STANDARD_STR = "standard"; // Try to use "standard" HTML5 mapping config if available

const $ = document.querySelector.bind(document);
let emulator = null;

const controllerEl = $("#controller");
const dpadEl = $("#controller_dpad");
const selectEl = $("#controller_select");
const startEl = $("#controller_start");
const bEl = $("#controller_b");
const aEl = $("#controller_a");

const binjgbPromise = Binjgb();

const sgbEnabled = window.location.href.includes("sgb=true");
if (sgbEnabled) {
  $("canvas").width = SGB_SCREEN_WIDTH;
  $("canvas").height = SGB_SCREEN_HEIGHT;
} else {
  $("canvas").width = SCREEN_WIDTH;
  $("canvas").height = SCREEN_HEIGHT;
}

// Extract stuff from the vue.js implementation in demo.js.
class VM {
  constructor() {
    this.ticks = 0;
    this.extRamUpdated = false;
    this.paused_ = false;
    this.volume = 0.5;
    this.palIdx = DEFAULT_PALETTE_IDX;
    this.canvas = {
      show: true,
      useSgbBorder: sgbEnabled,
      scale: 3,
    };
    this.rewind = {
      minTicks: 0,
      maxTicks: 0,
    };
    setInterval(() => {
      if (this.extRamUpdated) {
        this.updateExtRam();
        this.extRamUpdated = false;
      }
    }, 1000);
  }

  get paused() {
    return this.paused_;
  }
  set paused(newPaused) {
    let oldPaused = this.paused_;
    this.paused_ = newPaused;
    if (!emulator) return;
    if (newPaused == oldPaused) return;
    if (newPaused) {
      emulator.pause();
      this.ticks = emulator.ticks;
      this.rewind.minTicks = emulator.rewind.oldestTicks;
      this.rewind.maxTicks = emulator.rewind.newestTicks;
    } else {
      emulator.resume();
    }
  }

  togglePause() {
    this.paused = !this.paused;
  }

  updateExtRam() {
    if (!emulator) return;
    const extram = emulator.getExtRam();
    localStorage.setItem("extram", JSON.stringify(Array.from(extram)));
  }
}

const vm = new VM();

// Load a ROM.
(async function go() {
  let response = await fetch(ROM_FILENAME);
  let romBuffer = await response.arrayBuffer();
  const extRam = new Uint8Array(JSON.parse(localStorage.getItem("extram")));
  Emulator.start(await binjgbPromise, romBuffer, extRam);
  emulator.setBuiltinPalette(vm.palIdx);
})();

function makeWasmBuffer(module, ptr, size) {
  return new Uint8Array(module.HEAP8.buffer, ptr, size);
}

class Emulator {
  static start(module, romBuffer, extRamBuffer) {
    Emulator.stop();
    emulator = new Emulator(module, romBuffer, extRamBuffer);
    emulator.run();
  }

  static stop() {
    if (emulator) {
      emulator.destroy();
      emulator = null;
    }
  }

  constructor(module, romBuffer, extRamBuffer) {
    this.module = module;
    this.romDataPtr = this.module._malloc(romBuffer.byteLength);
    makeWasmBuffer(this.module, this.romDataPtr, romBuffer.byteLength).set(
      new Uint8Array(romBuffer)
    );
    this.e = this.module._emulator_new_simple(
      this.romDataPtr,
      romBuffer.byteLength,
      Audio.ctx.sampleRate,
      AUDIO_FRAMES,
      CGB_COLOR_CURVE
    );
    if (this.e == 0) {
      throw new Error("Invalid ROM.");
    }

    this.gamepad = new Gamepad(module, this.e);
    this.audio = new Audio(module, this.e);
    this.video = new Video(module, this.e, $("canvas"));
    this.rewind = new Rewind(module, this.e);
    this.rewindIntervalId = 0;

    this.lastRafSec = 0;
    this.leftoverTicks = 0;
    this.fps = 60;

    if (extRamBuffer) {
      this.loadExtRam(extRamBuffer);
    }

    this.bindKeys();
    this.bindTouch();

    this.touchEnabled = "ontouchstart" in document.documentElement;
    this.updateOnscreenGamepad();

    this.gamepad.init();
  }

  destroy() {
    this.gamepad.shutdown();
    this.unbindTouch();
    this.unbindKeys();
    this.cancelAnimationFrame();
    clearInterval(this.rewindIntervalId);
    this.rewind.destroy();
    this.module._emulator_delete(this.e);
    this.module._free(this.romDataPtr);
  }

  withNewFileData(cb) {
    const fileDataPtr = this.module._ext_ram_file_data_new(this.e);
    const buffer = makeWasmBuffer(
      this.module,
      this.module._get_file_data_ptr(fileDataPtr),
      this.module._get_file_data_size(fileDataPtr)
    );
    const result = cb(fileDataPtr, buffer);
    this.module._file_data_delete(fileDataPtr);
    return result;
  }

  loadExtRam(extRamBuffer) {
    this.withNewFileData((fileDataPtr, buffer) => {
      if (buffer.byteLength === extRamBuffer.byteLength) {
        buffer.set(new Uint8Array(extRamBuffer));
        this.module._emulator_read_ext_ram(this.e, fileDataPtr);
      }
    });
  }

  getExtRam() {
    return this.withNewFileData((fileDataPtr, buffer) => {
      this.module._emulator_write_ext_ram(this.e, fileDataPtr);
      return new Uint8Array(buffer);
    });
  }

  get isPaused() {
    return this.rafCancelToken === null;
  }

  pause() {
    if (!this.isPaused) {
      this.cancelAnimationFrame();
      this.audio.pause();
      this.beginRewind();
    }
  }

  resume() {
    if (this.isPaused) {
      this.endRewind();
      this.requestAnimationFrame();
      this.audio.resume();
    }
  }

  setBuiltinPalette(palIdx) {
    this.module._emulator_set_builtin_palette(this.e, PALETTES[palIdx]);
  }

  get isRewinding() {
    return this.rewind.isRewinding;
  }

  beginRewind() {
    this.rewind.beginRewind();
  }

  rewindToTicks(ticks) {
    if (this.rewind.rewindToTicks(ticks)) {
      this.runUntil(ticks);
      this.video.renderTexture();
    }
  }

  endRewind() {
    this.rewind.endRewind();
    this.lastRafSec = 0;
    this.leftoverTicks = 0;
    this.audio.startSec = 0;
  }

  set autoRewind(enabled) {
    if (enabled) {
      this.rewindIntervalId = setInterval(() => {
        const oldest = this.rewind.oldestTicks;
        const start = this.ticks;
        const delta =
          ((REWIND_FACTOR * REWIND_UPDATE_MS) / 1000) * CPU_TICKS_PER_SECOND;
        const rewindTo = Math.max(oldest, start - delta);
        this.rewindToTicks(rewindTo);
        vm.ticks = emulator.ticks;
      }, REWIND_UPDATE_MS);
    } else {
      clearInterval(this.rewindIntervalId);
      this.rewindIntervalId = 0;
    }
  }

  requestAnimationFrame() {
    this.rafCancelToken = requestAnimationFrame(this.rafCallback.bind(this));
  }

  cancelAnimationFrame() {
    cancelAnimationFrame(this.rafCancelToken);
    this.rafCancelToken = null;
  }

  run() {
    this.requestAnimationFrame();
  }

  get ticks() {
    return this.module._emulator_get_ticks_f64(this.e);
  }

  runUntil(ticks) {
    while (true) {
      const event = this.module._emulator_run_until_f64(this.e, ticks);
      if (event & EVENT_NEW_FRAME) {
        this.rewind.pushBuffer();
        this.video.uploadTexture();
      }
      if (event & EVENT_AUDIO_BUFFER_FULL && !this.isRewinding) {
        this.audio.pushBuffer();
      }
      if (event & EVENT_UNTIL_TICKS) {
        break;
      }
    }
    if (this.module._emulator_was_ext_ram_updated(this.e)) {
      vm.extRamUpdated = true;
    }
  }

  rafCallback(startMs) {
    this.requestAnimationFrame();
    let deltaSec = 0;
    if (!this.isRewinding) {
      const startSec = startMs / 1000;
      deltaSec = Math.max(startSec - (this.lastRafSec || startSec), 0);
      const startTicks = this.ticks;
      const deltaTicks =
        Math.min(deltaSec, MAX_UPDATE_SEC) * CPU_TICKS_PER_SECOND;
      const runUntilTicks = startTicks + deltaTicks - this.leftoverTicks;
      this.runUntil(runUntilTicks);
      this.leftoverTicks = (this.ticks - runUntilTicks) | 0;
      this.lastRafSec = startSec;
    }
    const lerp = (from, to, alpha) => alpha * from + (1 - alpha) * to;
    this.fps = lerp(this.fps, Math.min(1 / deltaSec, 10000), 0.3);
    this.video.renderTexture();
  }

  updateOnscreenGamepad() {
    $("#controller").style.display = this.touchEnabled ? "block" : "none";
  }

  bindTouch() {
    this.touchFuncs = {
      controller_b: this.setJoypB.bind(this),
      controller_a: this.setJoypA.bind(this),
      controller_start: this.setJoypStart.bind(this),
      controller_select: this.setJoypSelect.bind(this),
    };

    this.boundButtonTouchStart = this.buttonTouchStart.bind(this);
    this.boundButtonTouchEnd = this.buttonTouchEnd.bind(this);
    selectEl.addEventListener("touchstart", this.boundButtonTouchStart);
    selectEl.addEventListener("touchend", this.boundButtonTouchEnd);
    startEl.addEventListener("touchstart", this.boundButtonTouchStart);
    startEl.addEventListener("touchend", this.boundButtonTouchEnd);
    bEl.addEventListener("touchstart", this.boundButtonTouchStart);
    bEl.addEventListener("touchend", this.boundButtonTouchEnd);
    aEl.addEventListener("touchstart", this.boundButtonTouchStart);
    aEl.addEventListener("touchend", this.boundButtonTouchEnd);

    this.boundDpadTouchStartMove = this.dpadTouchStartMove.bind(this);
    this.boundDpadTouchEnd = this.dpadTouchEnd.bind(this);
    dpadEl.addEventListener("touchstart", this.boundDpadTouchStartMove);
    dpadEl.addEventListener("touchmove", this.boundDpadTouchStartMove);
    dpadEl.addEventListener("touchend", this.boundDpadTouchEnd);

    this.boundTouchRestore = this.touchRestore.bind(this);
    window.addEventListener("touchstart", this.boundTouchRestore);
  }

  unbindTouch() {
    selectEl.removeEventListener("touchstart", this.boundButtonTouchStart);
    selectEl.removeEventListener("touchend", this.boundButtonTouchEnd);
    startEl.removeEventListener("touchstart", this.boundButtonTouchStart);
    startEl.removeEventListener("touchend", this.boundButtonTouchEnd);
    bEl.removeEventListener("touchstart", this.boundButtonTouchStart);
    bEl.removeEventListener("touchend", this.boundButtonTouchEnd);
    aEl.removeEventListener("touchstart", this.boundButtonTouchStart);
    aEl.removeEventListener("touchend", this.boundButtonTouchEnd);

    dpadEl.removeEventListener("touchstart", this.boundDpadTouchStartMove);
    dpadEl.removeEventListener("touchmove", this.boundDpadTouchStartMove);
    dpadEl.removeEventListener("touchend", this.boundDpadTouchEnd);

    window.removeEventListener("touchstart", this.boundTouchRestore);
  }

  buttonTouchStart(event) {
    if (event.currentTarget.id in this.touchFuncs) {
      this.touchFuncs[event.currentTarget.id](true);
      event.currentTarget.classList.add("btnPressed");
      event.preventDefault();
    }
  }

  buttonTouchEnd(event) {
    if (event.currentTarget.id in this.touchFuncs) {
      this.touchFuncs[event.currentTarget.id](false);
      event.currentTarget.classList.remove("btnPressed");
      event.preventDefault();
    }
  }

  dpadTouchStartMove(event) {
    const rect = event.currentTarget.getBoundingClientRect();
    const x =
      (2 * (event.targetTouches[0].clientX - rect.left)) / rect.width - 1;
    const y =
      (2 * (event.targetTouches[0].clientY - rect.top)) / rect.height - 1;

    if (Math.abs(x) > OSGP_DEADZONE) {
      if (y > x && y < -x) {
        this.setJoypLeft(true);
        this.setJoypRight(false);
      } else if (y < x && y > -x) {
        this.setJoypLeft(false);
        this.setJoypRight(true);
      }
    } else {
      this.setJoypLeft(false);
      this.setJoypRight(false);
    }

    if (Math.abs(y) > OSGP_DEADZONE) {
      if (x > y && x < -y) {
        this.setJoypUp(true);
        this.setJoypDown(false);
      } else if (x < y && x > -y) {
        this.setJoypUp(false);
        this.setJoypDown(true);
      }
    } else {
      this.setJoypUp(false);
      this.setJoypDown(false);
    }
    event.preventDefault();
  }

  dpadTouchEnd(event) {
    this.setJoypLeft(false);
    this.setJoypRight(false);
    this.setJoypUp(false);
    this.setJoypDown(false);
    event.preventDefault();
  }

  touchRestore() {
    this.touchEnabled = true;
    this.updateOnscreenGamepad();
  }

  bindKeys() {
    this.keyFuncs = {
      Backspace: this.keyRewind.bind(this),
      " ": this.keyPause.bind(this),
      "[": this.keyPrevPalette.bind(this),
      "]": this.keyNextPalette.bind(this),
    };

    if (customControls.down && customControls.down.length > 0) {
      customControls.down.forEach((k) => {
        this.keyFuncs[k] = this.setJoypDown.bind(this);
      });
    } else {
      this.keyFuncs["ArrowDown"] = this.setJoypDown.bind(this);
      this.keyFuncs["s"] = this.setJoypDown.bind(this);
    }

    if (customControls.left && customControls.left.length > 0) {
      customControls.left.forEach((k) => {
        this.keyFuncs[k] = this.setJoypLeft.bind(this);
      });
    } else {
      this.keyFuncs["ArrowLeft"] = this.setJoypLeft.bind(this);
      this.keyFuncs["a"] = this.setJoypLeft.bind(this);
    }

    if (customControls.right && customControls.right.length > 0) {
      customControls.right.forEach((k) => {
        this.keyFuncs[k] = this.setJoypRight.bind(this);
      });
    } else {
      this.keyFuncs["ArrowRight"] = this.setJoypRight.bind(this);
      this.keyFuncs["d"] = this.setJoypRight.bind(this);
    }

    if (customControls.up && customControls.up.length > 0) {
      customControls.up.forEach((k) => {
        this.keyFuncs[k] = this.setJoypUp.bind(this);
      });
    } else {
      this.keyFuncs["ArrowUp"] = this.setJoypUp.bind(this);
      this.keyFuncs["w"] = this.setJoypUp.bind(this);
    }

    if (customControls.a && customControls.a.length > 0) {
      customControls.a.forEach((k) => {
        this.keyFuncs[k] = this.setJoypA.bind(this);
      });
    } else {
      this.keyFuncs["z"] = this.setJoypA.bind(this);
      this.keyFuncs["j"] = this.setJoypA.bind(this);
      this.keyFuncs["Alt"] = this.setJoypA.bind(this);
    }

    if (customControls.b && customControls.b.length > 0) {
      customControls.b.forEach((k) => {
        this.keyFuncs[k] = this.setJoypB.bind(this);
      });
    } else {
      this.keyFuncs["x"] = this.setJoypB.bind(this);
      this.keyFuncs["k"] = this.setJoypB.bind(this);
      this.keyFuncs["Control"] = this.setJoypB.bind(this);
    }

    if (customControls.start && customControls.start.length > 0) {
      customControls.start.forEach((k) => {
        this.keyFuncs[k] = this.setJoypStart.bind(this);
      });
    } else {
      this.keyFuncs["Enter"] = this.setJoypStart.bind(this);
    }

    if (customControls.select && customControls.select.length > 0) {
      customControls.select.forEach((k) => {
        this.keyFuncs[k] = this.setJoypSelect.bind(this);
      });
    } else {
      this.keyFuncs["Shift"] = this.setJoypSelect.bind(this);
    }

    this.boundKeyDown = this.keyDown.bind(this);
    this.boundKeyUp = this.keyUp.bind(this);

    window.addEventListener("keydown", this.boundKeyDown);
    window.addEventListener("keyup", this.boundKeyUp);
  }

  unbindKeys() {
    window.removeEventListener("keydown", this.boundKeyDown);
    window.removeEventListener("keyup", this.boundKeyUp);
  }

  keyDown(event) {
    if (event.key === "w" && (event.metaKey || event.ctrlKey)) {
      return;
    }
    if (event.key in this.keyFuncs) {
      if (this.touchEnabled) {
        this.touchEnabled = false;
        this.updateOnscreenGamepad();
      }
      this.keyFuncs[event.key](true);
      event.preventDefault();
    }
  }

  keyUp(event) {
    if (event.key in this.keyFuncs) {
      this.keyFuncs[event.key](false);
      event.preventDefault();
    }
  }

  keyRewind(isKeyDown) {
    if (!ENABLE_REWIND) {
      return;
    }
    if (this.isRewinding !== isKeyDown) {
      if (isKeyDown) {
        vm.paused = true;
        this.autoRewind = true;
      } else {
        this.autoRewind = false;
        vm.paused = false;
      }
    }
  }

  keyPause(isKeyDown) {
    if (!ENABLE_PAUSE) {
      return;
    }
    if (isKeyDown) vm.togglePause();
  }

  keyPrevPalette(isKeyDown) {
    if (!ENABLE_SWITCH_PALETTES) {
      return;
    }
    if (isKeyDown) {
      vm.palIdx = (vm.palIdx + PALETTES.length - 1) % PALETTES.length;
      emulator.setBuiltinPalette(vm.palIdx);
    }
  }

  keyNextPalette(isKeyDown) {
    if (!ENABLE_SWITCH_PALETTES) {
      return;
    }
    if (isKeyDown) {
      vm.palIdx = (vm.palIdx + 1) % PALETTES.length;
      emulator.setBuiltinPalette(vm.palIdx);
    }
  }

  setJoypDown(set) {
    this.module._set_joyp_down(this.e, set);
  }
  setJoypUp(set) {
    this.module._set_joyp_up(this.e, set);
  }
  setJoypLeft(set) {
    this.module._set_joyp_left(this.e, set);
  }
  setJoypRight(set) {
    this.module._set_joyp_right(this.e, set);
  }
  setJoypSelect(set) {
    this.module._set_joyp_select(this.e, set);
  }
  setJoypStart(set) {
    this.module._set_joyp_start(this.e, set);
  }
  setJoypB(set) {
    this.module._set_joyp_B(this.e, set);
  }
  setJoypA(set) {
    this.module._set_joyp_A(this.e, set);
  }
}

class Gamepad {
  constructor(module, e) {
    this.module = module;
    this.e = e;
  }

  // Load a key map for gamepad-to-gameboy buttons
  bindKeys(strMapping) {
    this.GAMEPAD_KEYMAP_STANDARD = [
      {
        gb_key: "b",
        gp_button: 0,
        type: "button",
        gp_bind: this.module._set_joyp_B.bind(null, this.e),
      },
      {
        gb_key: "a",
        gp_button: 1,
        type: "button",
        gp_bind: this.module._set_joyp_A.bind(null, this.e),
      },
      {
        gb_key: "select",
        gp_button: 8,
        type: "button",
        gp_bind: this.module._set_joyp_select.bind(null, this.e),
      },
      {
        gb_key: "start",
        gp_button: 9,
        type: "button",
        gp_bind: this.module._set_joyp_start.bind(null, this.e),
      },
      {
        gb_key: "up",
        gp_button: 12,
        type: "button",
        gp_bind: this.module._set_joyp_up.bind(null, this.e),
      },
      {
        gb_key: "down",
        gp_button: 13,
        type: "button",
        gp_bind: this.module._set_joyp_down.bind(null, this.e),
      },
      {
        gb_key: "left",
        gp_button: 14,
        type: "button",
        gp_bind: this.module._set_joyp_left.bind(null, this.e),
      },
      {
        gb_key: "right",
        gp_button: 15,
        type: "button",
        gp_bind: this.module._set_joyp_right.bind(null, this.e),
      },
    ];

    this.GAMEPAD_KEYMAP_DEFAULT = [
      {
        gb_key: "a",
        gp_button: 0,
        type: "button",
        gp_bind: this.module._set_joyp_A.bind(null, this.e),
      },
      {
        gb_key: "b",
        gp_button: 1,
        type: "button",
        gp_bind: this.module._set_joyp_B.bind(null, this.e),
      },
      {
        gb_key: "select",
        gp_button: 2,
        type: "button",
        gp_bind: this.module._set_joyp_select.bind(null, this.e),
      },
      {
        gb_key: "start",
        gp_button: 3,
        type: "button",
        gp_bind: this.module._set_joyp_start.bind(null, this.e),
      },
      {
        gb_key: "up",
        gp_button: 2,
        type: "axis",
        gp_bind: this.module._set_joyp_up.bind(null, this.e),
      },
      {
        gb_key: "down",
        gp_button: 3,
        type: "axis",
        gp_bind: this.module._set_joyp_down.bind(null, this.e),
      },
      {
        gb_key: "left",
        gp_button: 0,
        type: "axis",
        gp_bind: this.module._set_joyp_left.bind(null, this.e),
      },
      {
        gb_key: "right",
        gp_button: 1,
        type: "axis",
        gp_bind: this.module._set_joyp_right.bind(null, this.e),
      },
    ];

    // Try to use the w3c "standard" gamepad mapping if available
    // (Chrome/V8 seems to do that better than Firefox)
    //
    // Otherwise use a default mapping that assigns
    // A/B/Select/Start to the first four buttons,
    // and U/D/L/R to the first two axes.
    if (strMapping === GAMEPAD_KEYMAP_STANDARD_STR) {
      this.gp.keybinds = this.GAMEPAD_KEYMAP_STANDARD;
    } else {
      this.gp.keybinds = this.GAMEPAD_KEYMAP_DEFAULT;
    }
  }

  cacheValues(gamepad) {
    // Read Buttons
    for (let k = 0; k < gamepad.buttons.length; k++) {
      // .value is for analog, .pressed is for boolean buttons
      this.gp.buttons.cur[k] =
        gamepad.buttons[k].value > 0 || gamepad.buttons[k].pressed == true;

      // Update state changed if not on first input pass
      if (this.gp.buttons.last !== undefined) {
        this.gp.buttons.changed[k] =
          this.gp.buttons.cur[k] != this.gp.buttons.last[k];
      }
    }

    // Read Axes
    for (let k = 0; k < gamepad.axes.length; k++) {
      // Decode each dpad axis into two buttons, one for each direction
      this.gp.axes.cur[k * 2] = gamepad.axes[k] < 0;
      this.gp.axes.cur[k * 2 + 1] = gamepad.axes[k] > 0;

      // Update state changed if not on first input pass
      if (this.gp.axes.last !== undefined) {
        this.gp.axes.changed[k * 2] =
          this.gp.axes.cur[k * 2] != this.gp.axes.last[k * 2];
        this.gp.axes.changed[k * 2 + 1] =
          this.gp.axes.cur[k * 2 + 1] != this.gp.axes.last[k * 2 + 1];
      }
    }

    // Save current state for comparison on next input
    this.gp.axes.last = this.gp.axes.cur.slice(0);
    this.gp.buttons.last = this.gp.buttons.cur.slice(0);
  }

  handleButton(keyBind) {
    let buttonCache;

    // Select button / axis cache based on key bind type
    if (keyBind.type === "button") {
      buttonCache = this.gp.buttons;
    } else if (keyBind.type === "axis") {
      buttonCache = this.gp.axes;
    }

    // Make sure the button exists in the cache array
    if (keyBind.gp_button < buttonCache.changed.length) {
      // Send the button state if it's changed
      if (buttonCache.changed[keyBind.gp_button]) {
        if (buttonCache.cur[keyBind.gp_button]) {
          // Gamepad Button Down
          keyBind.gp_bind(true);
        } else {
          // Gamepad Button Up
          keyBind.gp_bind(false);
        }
      }
    }
  }

  getCurrent() {
    // Chrome requires retrieving a new gamepad object
    // every time button state is queried (the existing object
    // will have stale button state). Just do that for all browsers
    let gamepad = navigator.getGamepads()[this.gp.apiID];

    if (gamepad) {
      if (gamepad.connected) {
        return gamepad;
      }
    }

    return undefined;
  }

  update() {
    let gamepad = this.getCurrent();

    if (gamepad !== undefined) {
      // Cache gamepad input values
      this.cacheValues(gamepad);

      // Loop through buttons and send changes if needed
      for (let i = 0; i < this.gp.keybinds.length; i++) {
        this.handleButton(this.gp.keybinds[i]);
      }
    } else {
      // Gamepad is no longer present, disconnect
      this.releaseGamepad();
    }
  }

  startGamepad(gamepad) {
    // Make sure it has enough buttons and axes
    if (
      gamepad.mapping === GAMEPAD_KEYMAP_STANDARD_STR ||
      (gamepad.axes.length >= 2 && gamepad.buttons.length >= 4)
    ) {
      // Save API index for polling (required by Chrome/V8)
      this.gp.apiID = gamepad.index;

      // Assign gameboy keys to the gamepad
      this.bindKeys(gamepad.mapping);

      // Start polling the gamepad for input
      this.gp.timerID = setInterval(
        () => this.update(),
        GAMEPAD_POLLING_INTERVAL
      );
    }
  }

  releaseGamepad() {
    // Stop polling the gamepad for input
    if (this.gp.timerID !== undefined) {
      clearInterval(this.gp.timerID);
    }

    // Clear previous button history and controller info
    this.gp.axes.last = undefined;
    this.gp.buttons.last = undefined;
    this.gp.keybinds = undefined;

    this.gp.apiID = undefined;
  }

  // If a gamepad was already connected on this page
  // and released, it won't fire another connect event.
  // So try to find any that might be present
  checkAlreadyConnected() {
    let gamepads = navigator.getGamepads();

    // If any gamepads are already attached to the page,
    // use the first one that is connected
    for (let idx = 0; idx < gamepads.length; idx++) {
      if (gamepads[idx] !== undefined && gamepads[idx] !== null) {
        if (gamepads[idx].connected === true) {
          this.startGamepad(gamepads[idx]);
        }
      }
    }
  }

  // Event handler for when a gamepad is connected
  eventConnected(event) {
    this.startGamepad(navigator.getGamepads()[event.gamepad.index]);
  }

  // Event handler for when a gamepad is disconnected
  eventDisconnected(event) {
    this.releaseGamepad();
  }

  // Register event connection handlers for gamepads
  init() {
    // gamepad related vars
    this.gp = {
      apiID: undefined,
      timerID: undefined,
      keybinds: undefined,
      axes: { last: undefined, cur: [], changed: [] },
      buttons: { last: undefined, cur: [], changed: [] },
    };

    // Check for previously attached gamepads that might
    // not emit a gamepadconnected() event
    this.checkAlreadyConnected();

    this.boundGamepadConnected = this.eventConnected.bind(this);
    this.boundGamepadDisconnected = this.eventDisconnected.bind(this);

    // When a gamepad connects, start polling it for input
    window.addEventListener("gamepadconnected", this.boundGamepadConnected);

    // When a gamepad disconnects, shut down polling for input
    window.addEventListener(
      "gamepaddisconnected",
      this.boundGamepadDisconnected
    );
  }

  // Release event connection handlers and settings
  shutdown() {
    this.releaseGamepad();
    window.removeEventListener("gamepadconnected", this.boundGamepadConnected);
    window.removeEventListener(
      "gamepaddisconnected",
      this.boundGamepadDisconnected
    );
  }
}

class Audio {
  constructor(module, e) {
    this.started = false;
    this.module = module;
    this.buffer = makeWasmBuffer(
      this.module,
      this.module._get_audio_buffer_ptr(e),
      this.module._get_audio_buffer_capacity(e)
    );
    this.startSec = 0;
    this.resume();

    this.boundStartPlayback = this.startPlayback.bind(this);
    window.addEventListener("keydown", this.boundStartPlayback, true);
    window.addEventListener("click", this.boundStartPlayback, true);
    window.addEventListener("touchend", this.boundStartPlayback, true);
  }

  startPlayback() {
    window.removeEventListener("touchend", this.boundStartPlayback, true);
    window.removeEventListener("keydown", this.boundStartPlayback, true);
    window.removeEventListener("click", this.boundStartPlayback, true);
    this.started = true;
    this.resume();
  }

  get sampleRate() {
    return Audio.ctx.sampleRate;
  }

  pushBuffer() {
    if (!this.started) {
      return;
    }
    const nowSec = Audio.ctx.currentTime;
    const nowPlusLatency = nowSec + AUDIO_LATENCY_SEC;
    const volume = vm.volume;
    this.startSec = this.startSec || nowPlusLatency;
    if (this.startSec >= nowSec) {
      const buffer = Audio.ctx.createBuffer(2, AUDIO_FRAMES, this.sampleRate);
      const channel0 = buffer.getChannelData(0);
      const channel1 = buffer.getChannelData(1);
      for (let i = 0; i < AUDIO_FRAMES; i++) {
        channel0[i] = (this.buffer[2 * i] * volume) / 255;
        channel1[i] = (this.buffer[2 * i + 1] * volume) / 255;
      }
      const bufferSource = Audio.ctx.createBufferSource();
      bufferSource.buffer = buffer;
      bufferSource.connect(Audio.ctx.destination);
      bufferSource.start(this.startSec);
      const bufferSec = AUDIO_FRAMES / this.sampleRate;
      this.startSec += bufferSec;
    } else {
      console.log(
        "Resetting audio (" +
          this.startSec.toFixed(2) +
          " < " +
          nowSec.toFixed(2) +
          ")"
      );
      this.startSec = nowPlusLatency;
    }
  }

  pause() {
    if (!this.started) {
      return;
    }
    Audio.ctx.suspend();
  }

  resume() {
    if (!this.started) {
      return;
    }
    Audio.ctx.resume();
  }
}

Audio.ctx = new AudioContext();

class Video {
  constructor(module, e, el) {
    this.module = module;
    // Both iPhone and Desktop Safari dont't upscale using image-rendering: pixelated
    // on webgl canvases. See https://bugs.webkit.org/show_bug.cgi?id=193895.
    // For now, default to Canvas2D.
    if (window.navigator.userAgent.match(/iPhone|iPad|15.[0-9] Safari/)) {
      this.renderer = new Canvas2DRenderer(el);
    } else {
      try {
        this.renderer = new WebGLRenderer(el);
      } catch (error) {
        console.log(`Error creating WebGLRenderer: ${error}`);
        this.renderer = new Canvas2DRenderer(el);
      }
    }
    this.buffer = makeWasmBuffer(
      this.module,
      this.module._get_frame_buffer_ptr(e),
      this.module._get_frame_buffer_size(e)
    );
    this.sgbBuffer = makeWasmBuffer(
      this.module,
      this.module._get_sgb_frame_buffer_ptr(e),
      this.module._get_sgb_frame_buffer_size(e)
    );
  }

  uploadTexture() {
    this.renderer.uploadTextures(this.buffer, this.sgbBuffer);
  }

  renderTexture() {
    this.renderer.renderTextures();
  }
}

class Canvas2DRenderer {
  constructor(el) {
    this.ctx = el.getContext("2d");
    this.imageData = this.ctx.createImageData(SCREEN_WIDTH, SCREEN_HEIGHT);
    this.sgbImageData = this.ctx.createImageData(
      SGB_SCREEN_WIDTH,
      SGB_SCREEN_HEIGHT
    );

    this.overlayCanvas = document.createElement("canvas");
    this.overlayCanvas.width = SGB_SCREEN_WIDTH;
    this.overlayCanvas.height = SGB_SCREEN_HEIGHT;
    this.overlayCtx = this.overlayCanvas.getContext("2d");
  }

  uploadTextures(buffer, sgbBuffer) {
    this.imageData.data.set(buffer);
    this.sgbImageData.data.set(sgbBuffer);
  }

  renderTextures() {
    if (vm.canvas.useSgbBorder) {
      this.ctx.putImageData(this.imageData, SGB_SCREEN_LEFT, SGB_SCREEN_TOP);
      this.overlayCtx.putImageData(this.sgbImageData, 0, 0);
      this.ctx.drawImage(this.overlayCanvas, 0, 0);
    } else {
      this.ctx.putImageData(this.imageData, 0, 0);
    }
  }
}

class WebGLRenderer {
  constructor(el) {
    const gl = (this.gl = el.getContext("webgl", {
      preserveDrawingBuffer: true,
    }));
    if (gl === null) {
      throw new Error("unable to create webgl context");
    }

    function compileShader(type, source) {
      const shader = gl.createShader(type);
      gl.shaderSource(shader, source);
      gl.compileShader(shader);
      if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
        throw new Error(`compileShader failed: ${gl.getShaderInfoLog(shader)}`);
      }
      return shader;
    }

    const vertexShader = compileShader(
      gl.VERTEX_SHADER,
      `attribute vec2 aPos;
        attribute vec2 aTexCoord;
        varying highp vec2 vTexCoord;
        void main(void) {
          gl_Position = vec4(aPos, 0.0, 1.0);
          vTexCoord = aTexCoord;
        }`
    );
    const fragmentShader = compileShader(
      gl.FRAGMENT_SHADER,
      `varying highp vec2 vTexCoord;
        uniform sampler2D uSampler;
        void main(void) {
          gl_FragColor = texture2D(uSampler, vTexCoord);
        }`
    );

    const program = gl.createProgram();
    gl.attachShader(program, vertexShader);
    gl.attachShader(program, fragmentShader);
    gl.linkProgram(program);
    if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
      throw new Error(`program link failed: ${gl.getProgramInfoLog(program)}`);
    }
    gl.useProgram(program);

    this.aPos = gl.getAttribLocation(program, "aPos");
    this.aTexCoord = gl.getAttribLocation(program, "aTexCoord");
    this.uSampler = gl.getUniformLocation(program, "uSampler");

    this.fbTexture = this.createTexture();
    this.sgbFbTexture = this.createTexture();

    const invLerpClipSpace = (x, max) => 2 * (x / max) - 1;
    const l = invLerpClipSpace(SGB_SCREEN_LEFT, SGB_SCREEN_WIDTH);
    const r = invLerpClipSpace(SGB_SCREEN_RIGHT, SGB_SCREEN_WIDTH);
    const t = -invLerpClipSpace(SGB_SCREEN_TOP, SGB_SCREEN_HEIGHT);
    const b = -invLerpClipSpace(SGB_SCREEN_BOTTOM, SGB_SCREEN_HEIGHT);
    const w = SCREEN_WIDTH / 256,
      sw = SGB_SCREEN_WIDTH / 256;
    const h = SCREEN_HEIGHT / 256,
      sh = SGB_SCREEN_HEIGHT / 256;

    const verts = new Float32Array([
      // fb only
      -1,
      -1,
      0,
      h,
      +1,
      -1,
      w,
      h,
      -1,
      +1,
      0,
      0,
      +1,
      +1,
      w,
      0,

      // sgb fb
      l,
      b,
      0,
      h,
      r,
      b,
      w,
      h,
      l,
      t,
      0,
      0,
      r,
      t,
      w,
      0,

      // sgb border
      -1,
      -1,
      0,
      sh,
      +1,
      -1,
      sw,
      sh,
      -1,
      +1,
      0,
      0,
      +1,
      +1,
      sw,
      0,
    ]);

    const buffer = gl.createBuffer();
    this.gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
    gl.bufferData(gl.ARRAY_BUFFER, verts, gl.STATIC_DRAW);

    gl.enableVertexAttribArray(this.aPos);
    gl.enableVertexAttribArray(this.aTexCoord);
    gl.vertexAttribPointer(this.aPos, 2, gl.FLOAT, gl.FALSE, 16, 0);
    gl.vertexAttribPointer(this.aTexCoord, 2, gl.FLOAT, gl.FALSE, 16, 8);
    gl.uniform1i(this.uSampler, 0);
  }

  createTexture() {
    const gl = this.gl;
    const texture = gl.createTexture();
    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.texImage2D(
      gl.TEXTURE_2D,
      0,
      gl.RGBA,
      256,
      256,
      0,
      gl.RGBA,
      gl.UNSIGNED_BYTE,
      null
    );
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
    return texture;
  }

  uploadTextures(buffer, sgbBuffer) {
    const gl = this.gl;
    gl.bindTexture(gl.TEXTURE_2D, this.fbTexture);
    gl.texSubImage2D(
      gl.TEXTURE_2D,
      0,
      0,
      0,
      SCREEN_WIDTH,
      SCREEN_HEIGHT,
      gl.RGBA,
      gl.UNSIGNED_BYTE,
      buffer
    );

    gl.bindTexture(gl.TEXTURE_2D, this.sgbFbTexture);
    gl.texSubImage2D(
      gl.TEXTURE_2D,
      0,
      0,
      0,
      SGB_SCREEN_WIDTH,
      SGB_SCREEN_HEIGHT,
      gl.RGBA,
      gl.UNSIGNED_BYTE,
      sgbBuffer
    );
  }

  renderTextures() {
    const gl = this.gl;
    gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
    gl.clearColor(0.5, 0.5, 0.5, 1.0);
    gl.clear(gl.COLOR_BUFFER_BIT);

    if (vm.canvas.useSgbBorder) {
      gl.bindTexture(gl.TEXTURE_2D, this.fbTexture);
      gl.drawArrays(gl.TRIANGLE_STRIP, 4, 4);

      gl.enable(gl.BLEND);
      gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
      gl.bindTexture(gl.TEXTURE_2D, this.sgbFbTexture);
      gl.drawArrays(gl.TRIANGLE_STRIP, 8, 4);
      gl.disable(gl.BLEND);
    } else {
      gl.bindTexture(gl.TEXTURE_2D, this.fbTexture);
      gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
    }
  }
}

class Rewind {
  constructor(module, e) {
    this.module = module;
    this.e = e;
    this.joypadBufferPtr = this.module._joypad_new();
    this.statePtr = 0;
    this.bufferPtr = this.module._rewind_new_simple(
      e,
      REWIND_FRAMES_PER_BASE_STATE,
      REWIND_BUFFER_CAPACITY
    );
    this.module._emulator_set_default_joypad_callback(e, this.joypadBufferPtr);
  }

  destroy() {
    this.module._rewind_delete(this.bufferPtr);
    this.module._joypad_delete(this.joypadBufferPtr);
  }

  get oldestTicks() {
    return this.module._rewind_get_oldest_ticks_f64(this.bufferPtr);
  }

  get newestTicks() {
    return this.module._rewind_get_newest_ticks_f64(this.bufferPtr);
  }

  pushBuffer() {
    if (!this.isRewinding) {
      this.module._rewind_append(this.bufferPtr, this.e);
    }
  }

  get isRewinding() {
    return this.statePtr !== 0;
  }

  beginRewind() {
    if (this.isRewinding) return;
    this.statePtr = this.module._rewind_begin(
      this.e,
      this.bufferPtr,
      this.joypadBufferPtr
    );
  }

  rewindToTicks(ticks) {
    if (!this.isRewinding) return;
    return (
      this.module._rewind_to_ticks_wrapper(this.statePtr, ticks) === RESULT_OK
    );
  }

  endRewind() {
    if (!this.isRewinding) return;
    this.module._emulator_set_default_joypad_callback(
      this.e,
      this.joypadBufferPtr
    );
    this.module._rewind_end(this.statePtr);
    this.statePtr = 0;
  }
}


text:
package org.broadinstitute.hellbender.utils;

/**
 * a class we use to determine the merging rules for intervals passed to the GATK
 */
public enum IntervalMergingRule {
    ALL, // we merge both overlapping intervals and abutting intervals
    OVERLAPPING_ONLY // We merge intervals that are overlapping, but NOT ones that only abut each other
}


text:
' Copyright 2015, Google Inc. All Rights Reserved.
'
' 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.

' Author: api.anash@gmail.com (Anash P. Oommen)

Imports Google.Api.Ads.AdWords.Lib
Imports Google.Api.Ads.AdWords.v201502

Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Text

Namespace Google.Api.Ads.AdWords.Examples.VB.v201502
  ''' <summary>
  ''' This code example illustrates how to retrieve the account hierarchy under
  ''' an account. This code example won't work with Test Accounts. See
  ''' https://developers.google.com/adwords/api/docs/test-accounts
  '''
  ''' Tags: ServicedAccountService.get
  ''' </summary>
  Public Class GetAccountHierarchy
    Inherits ExampleBase
    ''' <summary>
    ''' Main method, to run this code example as a standalone application.
    ''' </summary>
    ''' <param name="args">The command line arguments.</param>
    Public Shared Sub Main(ByVal args As String())
      Dim codeExample As New GetAccountHierarchy
      Console.WriteLine(codeExample.Description)
      Try
        codeExample.Run(New AdWordsUser)
      Catch ex As Exception
        Console.WriteLine("An exception occurred while running this code example. {0}", _
            ExampleUtilities.FormatException(ex))
      End Try
    End Sub

    ''' <summary>
    ''' Returns a description about the code example.
    ''' </summary>
    Public Overrides ReadOnly Property Description() As String
      Get
        Return "This code example illustrates how to retrieve the account hierarchy under " & _
            "an account. This code example won't work with Test Accounts. See " & _
            "https://developers.google.com/adwords/api/docs/test-accounts"
      End Get
    End Property

    ''' <summary>
    ''' Runs the code example.
    ''' </summary>
    ''' <param name="user">The AdWords user.</param>
    Public Sub Run(ByVal user As AdWordsUser)
      ' Get the ManagedCustomerService.
      Dim mcService As ManagedCustomerService = CType(user.GetService( _
          AdWordsService.v201502.ManagedCustomerService), ManagedCustomerService)

      ' Create selector.
      Dim selector As New Selector()
      selector.fields = New String() {"CustomerId", "Name"}

      Try
        ' Get results.
        Dim page As ManagedCustomerPage = mcService.get(selector)

        ' Display serviced account graph.
        If Not page.entries Is Nothing Then
          ' Create map from customerId to customer node.
          Dim customerIdToCustomerNode As Dictionary(Of Long, ManagedCustomerTreeNode) = _
              New Dictionary(Of Long, ManagedCustomerTreeNode)()

          ' Create account tree nodes for each customer.
          For Each customer As ManagedCustomer In page.entries
            Dim node As New ManagedCustomerTreeNode()
            node.Account = customer
            customerIdToCustomerNode.Add(customer.customerId, node)
          Next

          ' For each link, connect nodes in tree.
          If (Not page.links Is Nothing) Then
            For Each link As ManagedCustomerLink In page.links
              Dim managerNode As ManagedCustomerTreeNode = _
                  customerIdToCustomerNode(link.managerCustomerId)
              Dim childNode As ManagedCustomerTreeNode = _
                  customerIdToCustomerNode(link.clientCustomerId)
              childNode.ParentNode = managerNode
              If (Not managerNode Is Nothing) Then
                managerNode.ChildAccounts.Add(childNode)
              End If
            Next
          End If

          ' Find the root account node in the tree.
          Dim rootNode As ManagedCustomerTreeNode = Nothing
          For Each account As ManagedCustomer In page.entries
            If (customerIdToCustomerNode(account.customerId).ParentNode Is Nothing) Then
              rootNode = customerIdToCustomerNode(account.customerId)
              Exit For
            End If
          Next

          ' Display account tree.
          Console.WriteLine("CustomerId, Name")
          Console.WriteLine(rootNode.ToTreeString(0, New StringBuilder()))
        Else
          Console.WriteLine("No accounts were found.")
        End If
      Catch ex As Exception
        Throw New System.ApplicationException("Failed to get accounts.", ex)
      End Try
    End Sub
  End Class
End Namespace


text:
package de.hbrs;

import de.hbrs.ToString;

@ToString(deleted = "ToString3")
public class Person {
    private String asd;
    private int age;
    int counter = 1;
    private String name2;
}


text:
<!DOCTYPE html>

    <meta charset='utf-8'>
    <meta content='IE=edge' http-equiv='X-UA-Compatible'>
    <meta content='width=device-width, initial-scale=1' name='viewport'>
    <title>LD48 - Ben Eath The Surf Ace</title>
    <link href='css/style.css' rel='stylesheet'>

      <canvas id='game'></canvas>

    <audio src="sounds/applause.mp3">
    </audio>


text:
package org.jhotdraw.samples.mini;

import org.jhotdraw.draw.tool.DelegationSelectionTool;
import org.jhotdraw.draw.TextAreaFigure;
import org.jhotdraw.draw.LineConnectionFigure;
import org.jhotdraw.draw.liner.ElbowLiner;
import org.jhotdraw.draw.ConnectionFigure;
import java.awt.geom.*;
import javax.swing.*;
import org.jhotdraw.draw.*;
import org.jhotdraw.geom.*;

/**
 * Example showing how to create an editor that can edit multiple
 * drawing views. For simplicity, the editor can create rectangle figures only.
 *
 * @author Werner Randelshofer
 * @version $Id: EditorSample.java 604 2010-01-09 12:00:29Z rawcoder $
 */
public class EditorSample {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {

                // Create a simple drawing consisting of three
                // text areas and an elbow connection.
                TextAreaFigure ta = new TextAreaFigure();
                ta.setBounds(new Point2D.Double(10,10),new Point2D.Double(100,100));
                TextAreaFigure tb = new TextAreaFigure();
                tb.setBounds(new Point2D.Double(220,120),new Point2D.Double(310,210));
                TextAreaFigure tc = new TextAreaFigure();
                tc.setBounds(new Point2D.Double(220,10),new Point2D.Double(310,100));
                ConnectionFigure cf = new LineConnectionFigure();
                cf.setLiner(new ElbowLiner());
                cf.setStartConnector(ta.findConnector(Geom.center(ta.getBounds()), cf));
                cf.setEndConnector(tb.findConnector(Geom.center(tb.getBounds()), cf));
                Drawing drawing = new DefaultDrawing();
                drawing.add(ta);
                drawing.add(tb);
                drawing.add(tc);
                drawing.add(cf);

                // Create a frame with a drawing view and a drawing editor
                JFrame f = new JFrame("My Drawing");
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.setSize(400,300);
                DrawingView view = new DefaultDrawingView();
                view.setDrawing(drawing);
                f.getContentPane().add(view.getComponent());
                DrawingEditor editor = new DefaultDrawingEditor();
                editor.add(view);
                editor.setTool(new DelegationSelectionTool());
                f.setVisible(true);
            }
        });
    }
}


text:
description: Try Swarm at scale
keywords: docker, swarm, scale, voting, application, certificates
redirect_from:
- /swarm/swarm_at_scale/03-create-cluster/
- /swarm/swarm_at_scale/02-deploy-infra/
title: Deploy application infrastructure
---

In this step, you create several Docker hosts to run your application stack on.
Before you continue, make sure you have taken the time to [learn the application
architecture](about.md).

## About these instructions

This example assumes you are running on a Mac or Windows system and enabling
Docker Engine `docker` commands by provisioning local VirtualBox virtual
machines thru Docker Machine. For this evaluation installation, you'll need 6 (six)
VirtualBox VMs.

While this example uses Docker Machine, this is only one example of an
infrastructure you can use. You can create the environment design on whatever
infrastructure you wish. For example, you could place the application on another
public cloud platform such as Azure or DigitalOcean, on premises in your data
center, or even in in a test environment on your laptop.

Finally, these instructions use some common `bash` command substitution techniques to
resolve some values, for example:

```bash
$ eval $(docker-machine env keystore)
```

In a Windows environment, these substitution fail. If you are running in
Windows, replace the substitution `$(docker-machine env keystore)` with the
actual value.

## Task 1. Create the keystore server

To enable a Docker container network and Swarm discovery, you must
deploy (or supply) a key-value store.  As a discovery backend, the key-value store
maintains an up-to-date list of cluster members and shares that list with the
Swarm manager. The Swarm manager uses this list to assign tasks to the nodes.

An overlay network requires a key-value store. The key-value store holds
information about the network state which includes discovery, networks,
endpoints, IP addresses, and more.

[Several different backends are supported](../discovery.md). This example uses Consul container.

1. Create a "machine" named `keystore`.

   ```bash
   $ docker-machine create -d virtualbox --virtualbox-memory "2000" \
   --engine-opt="label=com.function=consul"  keystore
   ```

   You can set options for the Engine daemon with the `--engine-opt` flag. You'll
   use it to label this Engine instance.

2. Set your local shell to the `keystore` Docker host.

   ```bash
   $ eval $(docker-machine env keystore)
   ```

3. Run the
`consul` container.

   ```bash
   $ docker run --restart=unless-stopped -d -p 8500:8500 -h consul progrium/consul -server -bootstrap
   ```

   The `-p` flag publishes port 8500 on the container which is where the Consul
   server listens. The server also has several other ports exposed which you can
   see by running `docker ps`.

   ```bash
   $ docker ps
   CONTAINER ID        IMAGE               ...       PORTS                                                                            NAMES
   372ffcbc96ed        progrium/consul     ...       53/tcp, 53/udp, 8300-8302/tcp, 8400/tcp, 8301-8302/udp, 0.0.0.0:8500->8500/tcp   dreamy_ptolemy
   ```

4. Use a `curl` command test the server by listing the nodes.

   ```bash
   $ curl $(docker-machine ip keystore):8500/v1/catalog/nodes
   [{"Node":"consul","Address":"172.17.0.2"}]
   ```

## Task 2. Create the Swarm manager

In this step, you create the Swarm manager and connect it to the `keystore`
instance. The Swarm manager container is the heart of your Swarm cluster.
It is responsible for receiving all Docker commands sent to the cluster, and for
scheduling resources against the cluster. In a real-world production deployment,
you should configure additional replica Swarm managers as secondaries for high
availability (HA).

You'll use the `--eng-opt` flag to set the `cluster-store` and
`cluster-advertise` options to refer to the `keystore` server. These options
support the container network you'll create later.

1. Create the `manager` host.

   ```bash
   $ docker-machine create -d virtualbox --virtualbox-memory "2000" \
   --engine-opt="label=com.function=manager" \
   --engine-opt="cluster-store=consul://$(docker-machine ip keystore):8500" \
   --engine-opt="cluster-advertise=eth1:2376" manager
   ```

   You also give the daemon a `manager` label.

2. Set your local shell to the `manager` Docker host.

   ```bash
   $ eval $(docker-machine env manager)
   ```

3. Start the Swarm manager process.

   ```bash
   $ docker run --restart=unless-stopped -d -p 3376:2375 \
   -v /var/lib/boot2docker:/certs:ro \
   swarm manage --tlsverify \
   --tlscacert=/certs/ca.pem \
   --tlscert=/certs/server.pem \
   --tlskey=/certs/server-key.pem \
   consul://$(docker-machine ip keystore):8500
   ```

   This command uses the TLS certificates created for the `boot2docker.iso` or
   the manager. This is key for the manager when it connects to other machines
   in the cluster.

4. Test your work by using displaying the Docker daemon logs from the host.

   ```bash
   $ docker-machine ssh manager
   <-- output snipped -->
   docker@manager:~$ tail /var/lib/boot2docker/docker.log
   time="2016-04-06T23:11:56.481947896Z" level=debug msg="Calling GET /v1.15/version"
   time="2016-04-06T23:11:56.481984742Z" level=debug msg="GET /v1.15/version"
   time="2016-04-06T23:12:13.070231761Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   time="2016-04-06T23:12:33.069387215Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   time="2016-04-06T23:12:53.069471308Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   time="2016-04-06T23:13:13.069512320Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   time="2016-04-06T23:13:33.070021418Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   time="2016-04-06T23:13:53.069395005Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   time="2016-04-06T23:14:13.071417551Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   time="2016-04-06T23:14:33.069843647Z" level=debug msg="Watch triggered with 1 nodes" discovery=consul
   ```

   The output indicates that the `consul` and the `manager` are communicating correctly.

5. Exit the Docker host.

   ```bash
   docker@manager:~$ exit
   ```

## Task 3. Add the load balancer

The application uses Interlock and Nginx as a
loadbalancer. Before you build the load balancer host, you'll create the
configuration you'll use for Nginx.

1. On your local host, create a `config` directory.

2. Change directories to the `config` directory.

   ```bash
   $ cd config
   ```

3. Get the IP address of the Swarm manager host.

   For example:

   ```bash
   $ docker-machine ip manager
   192.168.99.101
   ```

5. Use your favorite editor to create a `config.toml` file and add this content
to the file:

   ```json
   ListenAddr = ":8080"
   DockerURL = "tcp://SWARM_MANAGER_IP:3376"
   TLSCACert = "/var/lib/boot2docker/ca.pem"
   TLSCert = "/var/lib/boot2docker/server.pem"
   TLSKey = "/var/lib/boot2docker/server-key.pem"

   [[Extensions]]
   Name = "nginx"
   ConfigPath = "/etc/conf/nginx.conf"
   PidPath = "/etc/conf/nginx.pid"
   MaxConn = 1024
   Port = 80
   ```

6. In the configuration, replace the `SWARM_MANAGER_IP` with the `manager` IP you got
in Step 4.

   You use this value because the load balancer listens on the manager's event
   stream.

7. Save and close the `config.toml` file.

8. Create a machine for the load balancer.

   ```bash
   $ docker-machine create -d virtualbox --virtualbox-memory "2000" \
   --engine-opt="label=com.function=interlock" loadbalancer
   ```

9. Switch the environment to the `loadbalancer`.

   ```bash
   $ eval $(docker-machine env loadbalancer)
   ```

10. Start an `interlock` container running.

    ```bash
    $ docker run \
        -P \
        -d \
        -ti \
        -v nginx:/etc/conf \
        -v /var/lib/boot2docker:/var/lib/boot2docker:ro \
        -v /var/run/docker.sock:/var/run/docker.sock \
        -v $(pwd)/config.toml:/etc/config.toml \
        --name interlock \
        ehazlett/interlock:1.0.1 \
        -D run -c /etc/config.toml
    ```

    This command relies on the `config.toml` file being in the current directory.  After running the command, confirm the image is runing:

    ```bash
    $ docker ps
    CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                     NAMES
    d846b801a978        ehazlett/interlock:1.0.1   "/bin/interlock -D ru"   2 minutes ago       Up 2 minutes        0.0.0.0:32770->8080/tcp   interlock
    ```

    If you don't see the image runing, use `docker ps -a` to list all images to make sure the system attempted to start the image. Then, get the logs to see why the container failed to start.

    ```bash
    $ docker logs interlock
    INFO[0000] interlock 1.0.1 (000291d)
    DEBU[0000] loading config from: /etc/config.toml
    FATA[0000] read /etc/config.toml: is a directory
    ```

    This error usually means you weren't starting the `docker run` from the same
    `config` directory where the `config.toml` file is. If you run the command
    and get a Conflict error such as:

    ```bash
    docker: Error response from daemon: Conflict. The name "/interlock" is already in use by container d846b801a978c76979d46a839bb05c26d2ab949ff9f4f740b06b5e2564bae958. You have to remove (or rename) that container to be able to reuse that name.
    ```

     Remove the interlock container with the `docker rm interlock` and try again.

11. Start an `nginx` container on the load balancer.

    ```bash
    $ docker run -ti -d \
      -p 80:80 \
      --label interlock.ext.name=nginx \
      --link=interlock:interlock \
      -v nginx:/etc/conf \
      --name nginx \
      nginx nginx -g "daemon off;" -c /etc/conf/nginx.conf
    ```

## Task 4. Create the other Swarm nodes

A host in a Swarm cluster is called a *node*. You've already created the manager
node. Here, the task is to create each virtual host for each node. There are
three commands required:

* create the host with Docker Machine
* point the local environment to the new host
* join the host to the Swarm cluster

If you were building this in a non-Mac/Windows environment, you'd only need to
run the `join` command to add a node to the Swarm cluster and register it with
the Consul discovery service. When you create a node, you also give it a label,
for example:

```
--engine-opt="label=com.function=frontend01"
```

You'll use these labels later when starting application containers. In the
commands below, notice the label you are applying to each node.

1. Create the `frontend01` host and add it to the Swarm cluster.

   ```bash
   $ docker-machine create -d virtualbox --virtualbox-memory "2000" \
   --engine-opt="label=com.function=frontend01" \
   --engine-opt="cluster-store=consul://$(docker-machine ip keystore):8500" \
   --engine-opt="cluster-advertise=eth1:2376" frontend01
   $ eval $(docker-machine env frontend01)
   $ docker run -d swarm join --addr=$(docker-machine ip frontend01):2376 consul://$(docker-machine ip keystore):8500
   ```

2. Create the `frontend02` VM.

   ```bash
   $ docker-machine create -d virtualbox --virtualbox-memory "2000" \
   --engine-opt="label=com.function=frontend02" \
   --engine-opt="cluster-store=consul://$(docker-machine ip keystore):8500" \
   --engine-opt="cluster-advertise=eth1:2376" frontend02
   $ eval $(docker-machine env frontend02)
   $ docker run -d swarm join --addr=$(docker-machine ip frontend02):2376 consul://$(docker-machine ip keystore):8500
   ```

3. Create the `worker01` VM.

   ```bash
   $ docker-machine create -d virtualbox --virtualbox-memory "2000" \
   --engine-opt="label=com.function=worker01" \
   --engine-opt="cluster-store=consul://$(docker-machine ip keystore):8500" \
   --engine-opt="cluster-advertise=eth1:2376" worker01
   $ eval $(docker-machine env worker01)
   $ docker run -d swarm join --addr=$(docker-machine ip worker01):2376 consul://$(docker-machine ip keystore):8500
   ```

4.  Create the `dbstore` VM.

    ```bash
    $ docker-machine create -d virtualbox --virtualbox-memory "2000" \
    --engine-opt="label=com.function=dbstore" \
    --engine-opt="cluster-store=consul://$(docker-machine ip keystore):8500" \
    --engine-opt="cluster-advertise=eth1:2376" dbstore
    $ eval $(docker-machine env dbstore)
    $ docker run -d swarm join --addr=$(docker-machine ip dbstore):2376 consul://$(docker-machine ip keystore):8500
    ```

5.  Check your work.

    At this point, you have deployed on the infrastructure you need to run the
    application. Test this now by listing the running machines:

    ```bash
    $ docker-machine ls
    NAME           ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
    dbstore        -        virtualbox   Running   tcp://192.168.99.111:2376           v1.10.3
    frontend01     -        virtualbox   Running   tcp://192.168.99.108:2376           v1.10.3
    frontend02     -        virtualbox   Running   tcp://192.168.99.109:2376           v1.10.3
    keystore       -        virtualbox   Running   tcp://192.168.99.100:2376           v1.10.3
    loadbalancer   -        virtualbox   Running   tcp://192.168.99.107:2376           v1.10.3
    manager        -        virtualbox   Running   tcp://192.168.99.101:2376           v1.10.3
    worker01       *        virtualbox   Running   tcp://192.168.99.110:2376           v1.10.3
    ```

6.  Make sure the Swarm manager sees all your nodes.

    ```
    $ docker -H $(docker-machine ip manager):3376 info
    Containers: 4
     Running: 4
     Paused: 0
     Stopped: 0
    Images: 3
    Server Version: swarm/1.1.3
    Role: primary
    Strategy: spread
    Filters: health, port, dependency, affinity, constraint
    Nodes: 4
     dbstore: 192.168.99.111:2376
      └ Status: Healthy
      └ Containers: 1
      └ Reserved CPUs: 0 / 1
      └ Reserved Memory: 0 B / 2.004 GiB
      └ Labels: com.function=dbstore, executiondriver=native-0.2, kernelversion=4.1.19-boot2docker, operatingsystem=Boot2Docker 1.10.3 (TCL 6.4.1); master : 625117e - Thu Mar 10 22:09:02 UTC 2016, provider=virtualbox, storagedriver=aufs
      └ Error: (none)
      └ UpdatedAt: 2016-04-07T18:25:37Z
     frontend01: 192.168.99.108:2376
      └ Status: Healthy
      └ Containers: 1
      └ Reserved CPUs: 0 / 1
      └ Reserved Memory: 0 B / 2.004 GiB
      └ Labels: com.function=frontend01, executiondriver=native-0.2, kernelversion=4.1.19-boot2docker, operatingsystem=Boot2Docker 1.10.3 (TCL 6.4.1); master : 625117e - Thu Mar 10 22:09:02 UTC 2016, provider=virtualbox, storagedriver=aufs
      └ Error: (none)
      └ UpdatedAt: 2016-04-07T18:26:10Z
     frontend02: 192.168.99.109:2376
      └ Status: Healthy
      └ Containers: 1
      └ Reserved CPUs: 0 / 1
      └ Reserved Memory: 0 B / 2.004 GiB
      └ Labels: com.function=frontend02, executiondriver=native-0.2, kernelversion=4.1.19-boot2docker, operatingsystem=Boot2Docker 1.10.3 (TCL 6.4.1); master : 625117e - Thu Mar 10 22:09:02 UTC 2016, provider=virtualbox, storagedriver=aufs
      └ Error: (none)
      └ UpdatedAt: 2016-04-07T18:25:43Z
     worker01: 192.168.99.110:2376
      └ Status: Healthy
      └ Containers: 1
      └ Reserved CPUs: 0 / 1
      └ Reserved Memory: 0 B / 2.004 GiB
      └ Labels: com.function=worker01, executiondriver=native-0.2, kernelversion=4.1.19-boot2docker, operatingsystem=Boot2Docker 1.10.3 (TCL 6.4.1); master : 625117e - Thu Mar 10 22:09:02 UTC 2016, provider=virtualbox, storagedriver=aufs
      └ Error: (none)
      └ UpdatedAt: 2016-04-07T18:25:56Z
    Plugins:
     Volume:
     Network:
    Kernel Version: 4.1.19-boot2docker
    Operating System: linux
    Architecture: amd64
    CPUs: 4
    Total Memory: 8.017 GiB
    Name: bb13b7cf80e8
    ```

    The command is acting on the Swarm port, so it returns information about the
    entire cluster. You have a manager and no nodes.

## Next Step

Your key-value store, load balancer, and Swarm cluster infrastructure are up. You are
ready to [build and run the voting application](deploy-app.md) on it.


text:
<?php
/*
 * @author Nicolas Clavaud <nicolas@lrqdo.fr>
 */

namespace Ogone\Tests\DirectLink;

use Ogone\Tests;
use Ogone\Tests\ShaComposer\FakeShaComposer;
use Ogone\DirectLink\DirectLinkQueryRequest;
use Ogone\DirectLink\Alias;

class DirectLinkQueryRequestTest extends \TestCase {

    /** @test */
    public function IsValidWhenRequiredFieldsAreFilledIn()
    {
        $directLinkQueryRequest = $this->provideMinimalDirectLinkQueryRequest();
        $directLinkQueryRequest->validate();
    }

    /**
     * @test
     * @expectedException \RuntimeException
     */
    public function IsInvalidWhenFieldsAreMissing()
    {
        $directLinkQueryRequest = new DirectLinkQueryRequest(new FakeShaComposer);
        $directLinkQueryRequest->validate();
    }

    /**
     * @test
     * @expectedException \InvalidArgumentException
     */
    public function isInvalidWithNonOgoneUrl()
    {
        $directLinkQueryRequest = $this->provideMinimalDirectLinkQueryRequest();
        $directLinkQueryRequest->setOgoneUri('http://example.com');
        $directLinkQueryRequest->validate();
    }

    /**
     * @test
     */
    public function isValidWithOgoneUrl()
    {
        $directLinkQueryRequest = $this->provideMinimalDirectLinkQueryRequest();
        $directLinkQueryRequest->setOgoneUri(DirectLinkQueryRequest::PRODUCTION);
        $directLinkQueryRequest->validate();
    }

    /**
     * @test
     * @dataProvider provideBadParameters
     * @expectedException \InvalidArgumentException
     */
    public function BadParametersCauseExceptions($method, $value)
    {
        $directLinkQueryRequest = new DirectLinkQueryRequest(new FakeShaComposer);
        $directLinkQueryRequest->$method($value);
    }

    public function provideBadParameters()
    {
        return array(
            array('setPassword', '12'),
            array('setUserid', '12'),
        );
    }
}


text:
<!doctype html>

    <meta charset="utf-8">
    <title>Simple Autosuggest</title>
    <link rel="canonical" href="/advanced/autosuggest/" />
    <meta name="viewport" content="width=device-width,minimum-scale=1">

      <amp-state id="cities">
        </amp-state>

          Enter city:
          <input [value]="city"
                on="input-debounced: AMP.setState({
                  filteredCities: event.value.length == 0 ?
                    []:
                    cities.filter(city =>
                       city.toLowerCase().indexOf(event.value.toLowerCase()) >= 0
                    )
               })">

        <amp-selector on="select:AMP.setState({
                            city: event.targetOption,
                            filteredCities: []
                         })"
                         keyboard-select-mode="focus">
          <amp-list id="auto-suggest"
                    items="."
                    layout="fixed-height"
                    height="0"
                   [src]="filteredCities"
                   [height]="filteredCities.length * 34">
            <template type="amp-mustache">

{{.}}

            </template>
          </amp-list>
        </amp-selector>


text:
/*
 * Created on Apr 18, 2005
 *
 *
 */
package com.gemstone.gemfire.cache.query.internal.index;

import java.util.List;

import com.gemstone.gemfire.cache.query.IndexType;

/**
 * @author asifs
 *
 * This class contains the information needed to create an index It will
 * contain the callback data between <index></index> invocation
 */
public class IndexCreationData {

  private String name = null;
  private IndexType indexType = null;
  private String fromClause = null;
  private String expression = null;
  private String importStr = null;
  private PartitionedIndex partitionedIndex = null;

  public IndexCreationData(String name) {
    this.name = name;
  }

  public void setIndexType(IndexType indexType) {
    this.indexType = indexType;
  }

  public IndexType getIndexType() {
    return this.indexType;
  }

  public void setIndexData(IndexType type, String fromClause, String expression,
      String importStr) {
    this.indexType = type;
    this.fromClause = fromClause;
    this.expression = expression;
    this.importStr = importStr;
  }

  public void setPartitionedIndex(PartitionedIndex index) {
    this.partitionedIndex = index;
  }

  public PartitionedIndex getPartitionedIndex() {
    return this.partitionedIndex;
  }

  public String getIndexFromClause() {
    return this.fromClause;
  }

  public String getIndexExpression() {
    return this.expression;
  }

  public String getIndexImportString() {
    return this.importStr;
  }

  public String getIndexName() {
    return this.name;
  }

}


text:
#ifndef _AHCI_PEI_STORAGE_SECURITY_H_
#define _AHCI_PEI_STORAGE_SECURITY_H_

/**
  Gets the count of storage security devices that one specific driver detects.

  @param[in]  This               The PPI instance pointer.
  @param[out] NumberofDevices    The number of storage security devices discovered.

  @retval EFI_SUCCESS              The operation performed successfully.
  @retval EFI_INVALID_PARAMETER    The parameters are invalid.

**/
EFI_STATUS
EFIAPI
AhciStorageSecurityGetDeviceNo (
  IN  EDKII_PEI_STORAGE_SECURITY_CMD_PPI    *This,
  OUT UINTN                                 *NumberofDevices
  );

/**
  Gets the device path of a specific storage security device.

  @param[in]  This                 The PPI instance pointer.
  @param[in]  DeviceIndex          Specifies the storage security device to which
                                   the function wants to talk. Because the driver
                                   that implements Storage Security Command PPIs
                                   will manage multiple storage devices, the PPIs
                                   that want to talk to a single device must specify
                                   the device index that was assigned during the
                                   enumeration process. This index is a number from
                                   one to NumberofDevices.
  @param[out] DevicePathLength     The length of the device path in bytes specified
                                   by DevicePath.
  @param[out] DevicePath           The device path of storage security device.
                                   This field re-uses EFI Device Path Protocol as
                                   defined by Section 10.2 EFI Device Path Protocol
                                   of UEFI 2.7 Specification.

  @retval EFI_SUCCESS              The operation succeeds.
  @retval EFI_INVALID_PARAMETER    DevicePathLength or DevicePath is NULL.
  @retval EFI_NOT_FOUND            The specified storage security device not found.
  @retval EFI_OUT_OF_RESOURCES     The operation fails due to lack of resources.

**/
EFI_STATUS
EFIAPI
AhciStorageSecurityGetDevicePath (
  IN  EDKII_PEI_STORAGE_SECURITY_CMD_PPI    *This,
  IN  UINTN                                 DeviceIndex,
  OUT UINTN                                 *DevicePathLength,
  OUT EFI_DEVICE_PATH_PROTOCOL              **DevicePath
  );

/**
  Send a security protocol command to a device that receives data and/or the result
  of one or more commands sent by SendData.

  The ReceiveData function sends a security protocol command to the given DeviceIndex.
  The security protocol command sent is defined by SecurityProtocolId and contains
  the security protocol specific data SecurityProtocolSpecificData. The function
  returns the data from the security protocol command in PayloadBuffer.

  For devices supporting the SCSI command set, the security protocol command is sent
  using the SECURITY PROTOCOL IN command defined in SPC-4.

  For devices supporting the ATA command set, the security protocol command is sent
  using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize
  is non-zero.

  If the PayloadBufferSize is zero, the security protocol command is sent using the
  Trusted Non-Data command defined in ATA8-ACS.

  If PayloadBufferSize is too small to store the available data from the security
  protocol command, the function shall copy PayloadBufferSize bytes into the
  PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.

  If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,
  the function shall return EFI_INVALID_PARAMETER.

  If the given DeviceIndex does not support security protocol commands, the function
  shall return EFI_UNSUPPORTED.

  If the security protocol fails to complete within the Timeout period, the function
  shall return EFI_TIMEOUT.

  If the security protocol command completes without an error, the function shall
  return EFI_SUCCESS. If the security protocol command completes with an error, the
  function shall return EFI_DEVICE_ERROR.

  @param[in]  This             The PPI instance pointer.
  @param[in]  DeviceIndex      Specifies the storage security device to which the
                               function wants to talk. Because the driver that
                               implements Storage Security Command PPIs will manage
                               multiple storage devices, the PPIs that want to talk
                               to a single device must specify the device index
                               that was assigned during the enumeration process.
                               This index is a number from one to NumberofDevices.
  @param[in]  Timeout          The timeout, in 100ns units, to use for the execution
                               of the security protocol command. A Timeout value
                               of 0 means that this function will wait indefinitely
                               for the security protocol command to execute. If
                               Timeout is greater than zero, then this function
                               will return EFI_TIMEOUT if the time required to
                               execute the receive data command is greater than
                               Timeout.
  @param[in]  SecurityProtocolId
                               The value of the "Security Protocol" parameter of
                               the security protocol command to be sent.
  @param[in]  SecurityProtocolSpecificData
                               The value of the "Security Protocol Specific"
                               parameter of the security protocol command to be
                               sent.
  @param[in]  PayloadBufferSize
                               Size in bytes of the payload data buffer.
  @param[out] PayloadBuffer    A pointer to a destination buffer to store the
                               security protocol command specific payload data
                               for the security protocol command. The caller is
                               responsible for having either implicit or explicit
                               ownership of the buffer.
  @param[out] PayloadTransferSize
                               A pointer to a buffer to store the size in bytes
                               of the data written to the payload data buffer.

  @retval EFI_SUCCESS                  The security protocol command completed
                                       successfully.
  @retval EFI_WARN_BUFFER_TOO_SMALL    The PayloadBufferSize was too small to
                                       store the available data from the device.
                                       The PayloadBuffer contains the truncated
                                       data.
  @retval EFI_UNSUPPORTED              The given DeviceIndex does not support
                                       security protocol commands.
  @retval EFI_DEVICE_ERROR             The security protocol command completed
                                       with an error.
  @retval EFI_INVALID_PARAMETER        The PayloadBuffer or PayloadTransferSize
                                       is NULL and PayloadBufferSize is non-zero.
  @retval EFI_TIMEOUT                  A timeout occurred while waiting for the
                                       security protocol command to execute.

**/
EFI_STATUS
EFIAPI
AhciStorageSecurityReceiveData (
  IN  EDKII_PEI_STORAGE_SECURITY_CMD_PPI    *This,
  IN  UINTN                                 DeviceIndex,
  IN  UINT64                                Timeout,
  IN  UINT8                                 SecurityProtocolId,
  IN  UINT16                                SecurityProtocolSpecificData,
  IN  UINTN                                 PayloadBufferSize,
  OUT VOID                                  *PayloadBuffer,
  OUT UINTN                                 *PayloadTransferSize
  );

/**
  Send a security protocol command to a device.

  The SendData function sends a security protocol command containing the payload
  PayloadBuffer to the given DeviceIndex. The security protocol command sent is
  defined by SecurityProtocolId and contains the security protocol specific data
  SecurityProtocolSpecificData. If the underlying protocol command requires a
  specific padding for the command payload, the SendData function shall add padding
  bytes to the command payload to satisfy the padding requirements.

  For devices supporting the SCSI command set, the security protocol command is
  sent using the SECURITY PROTOCOL OUT command defined in SPC-4.

  For devices supporting the ATA command set, the security protocol command is
  sent using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize
  is non-zero. If the PayloadBufferSize is zero, the security protocol command
  is sent using the Trusted Non-Data command defined in ATA8-ACS.

  If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall
  return EFI_INVALID_PARAMETER.

  If the given DeviceIndex does not support security protocol commands, the function
  shall return EFI_UNSUPPORTED.

  If the security protocol fails to complete within the Timeout period, the function
  shall return EFI_TIMEOUT.

  If the security protocol command completes without an error, the function shall
  return EFI_SUCCESS. If the security protocol command completes with an error,
  the functio shall return EFI_DEVICE_ERROR.

  @param[in] This              The PPI instance pointer.
  @param[in] DeviceIndex       The ID of the device.
  @param[in] Timeout           The timeout, in 100ns units, to use for the execution
                               of the security protocol command. A Timeout value
                               of 0 means that this function will wait indefinitely
                               for the security protocol command to execute. If
                               Timeout is greater than zero, then this function
                               will return EFI_TIMEOUT if the time required to
                               execute the receive data command is greater than
                               Timeout.
  @param[in] SecurityProtocolId
                               The value of the "Security Protocol" parameter of
                               the security protocol command to be sent.
  @param[in] SecurityProtocolSpecificData
                               The value of the "Security Protocol Specific"
                               parameter of the security protocol command to be
                               sent.
  @param[in] PayloadBufferSize Size in bytes of the payload data buffer.
  @param[in] PayloadBuffer     A pointer to a destination buffer to store the
                               security protocol command specific payload data
                               for the security protocol command.

  @retval EFI_SUCCESS              The security protocol command completed successfully.
  @retval EFI_UNSUPPORTED          The given DeviceIndex does not support security
                                   protocol commands.
  @retval EFI_DEVICE_ERROR         The security protocol command completed with
                                   an error.
  @retval EFI_INVALID_PARAMETER    The PayloadBuffer is NULL and PayloadBufferSize
                                   is non-zero.
  @retval EFI_TIMEOUT              A timeout occurred while waiting for the security
                                   protocol command to execute.

**/
EFI_STATUS
EFIAPI
AhciStorageSecuritySendData (
  IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI  *This,
  IN UINTN                               DeviceIndex,
  IN UINT64                              Timeout,
  IN UINT8                               SecurityProtocolId,
  IN UINT16                              SecurityProtocolSpecificData,
  IN UINTN                               PayloadBufferSize,
  IN VOID                                *PayloadBuffer
  );

#endif


text:
<!DOCTYPE html>

	<meta charset="UTF-8">
	<title>Setting Background Size for background images</title>

Setting background size for background images

Keywords syntax - cover

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Temporibus perspiciatis vitae, quos mollitia doloribus eos,
					eaque iusto iste tempore rerum quas? Suscipit deleniti ad voluptatum vitae! Quaerat nemo sapiente, iure!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate corporis quaerat aspernatur ut. Tempore maxime autem
					aliquam unde iusto soluta rem eos, quaerat quia deserunt! Numquam qui pariatur, quos commodi!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Temporibus perspiciatis vitae, quos mollitia doloribus eos,
					eaque iusto iste tempore rerum quas? Suscipit deleniti ad voluptatum vitae! Quaerat nemo sapiente, iure!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate corporis quaerat aspernatur ut. Tempore maxime autem
					aliquam unde iusto soluta rem eos, quaerat quia deserunt! Numquam qui pariatur, quos commodi!

Keywords syntax - contain

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

One value syntax - percentage form - 50%

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi est suscipit sed expedita non accusantium velit quidem
					aut nulla aliquid unde at enim praesentium sit excepturi placeat nobis qui, natus.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis excepturi qui possimus, nesciunt, repellat odio repellendus
					blanditiis. Debitis porro ut ab eligendi quisquam eveniet nisi unde assumenda. Autem, tempora, quia?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

One value syntax - em style - 10em

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Similique itaque modi eaque tempore debitis veritatis et consequatur,
					quod autem sed dignissimos perferendis eveniet sequi libero! Id cupiditate consequuntur tempore perspiciatis.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates illo temporibus ipsa itaque accusamus aspernatur
					animi sequi possimus officiis atque mollitia nemo eligendi sed officia omnis, tempore rem, distinctio eius.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

One value syntax - pixel style 25px

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem molestiae voluptatem laborum. Ducimus blanditiis, officiis?
					Odio neque, in officiis asperiores modi exercitationem obcaecati natus consectetur totam amet dolorem? Eos, placeat.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda voluptatum, architecto eaque nihil ratione, aspernatur
					in eos inventore asperiores fugit quae aliquam molestiae, quo nisi odit nemo porro expedita. Iste.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

One value syntax - auto

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente facere odit veniam nobis consectetur eos id aliquam
					quos, soluta iste optio quisquam excepturi consequuntur in, dolor laudantium obcaecati necessitatibus numquam.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nam veritatis, commodi architecto beatae. Voluptas in consequatur
					maiores quis dolorem! Dolore dignissimos, aliquid iusto ex aspernatur magni assumenda at tenetur blanditiis?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

Two value syntax -  width X height - 50% auto

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quod aliquam laborum, harum. Quam vero quas quasi non, eveniet
					dolore consectetur saepe fuga nam quidem labore fugit laboriosam, nobis, quae accusamus!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur culpa numquam officia enim. Repellat molestias
					consectetur excepturi temporibus autem itaque obcaecati fugiat et fuga non consequatur, sapiente ea ipsa possimus!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

Two value syntax -  width X height - 20em 40%

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam alias natus doloribus earum, repellendus culpa dicta
					suscipit sed eaque, cumque architecto. Vero, quam reiciendis amet ex. Delectus ullam, eaque porro!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet possimus suscipit laborum tempora explicabo, qui repellendus
					similique accusantium culpa. Vel accusamus qui rem deleniti commodi, nobis, est rerum iste nisi.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

Two value syntax -  width X height - auto 50px

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit quo, exercitationem? Ex dicta beatae expedita, velit.
					Aperiam ea minus deleniti nisi rem sit praesentium odit, error, esse iure voluptates rerum?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veritatis fuga labore ducimus neque tempore, ad eius blanditiis
					fugit aliquam repudiandae deserunt dolore debitis, maiores libero in nobis minima nihil. Quasi.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!

Two value syntax -  width X height - auto auto

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus minus asperiores provident incidunt corrupti ipsum
					quidem! Ullam facere atque quia nostrum, quasi ducimus rem porro possimus cum. Repellat, minima, et!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quasi non debitis, cupiditate autem fugiat sint labore nam
					sequi repellat perspiciatis illum voluptatem omnis, et eos, placeat nesciunt ducimus quisquam, quo.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores soluta quidem amet adipisci, tempore id suscipit dicta
					voluptas sapiente, aliquid animi nihil eum. Omnis, atque obcaecati necessitatibus, pariatur impedit dolor?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum magnam, ab deleniti animi voluptatem beatae est,
					sequi ratione aliquam earum explicabo soluta reprehenderit, aliquid ullam, nostrum officia harum tempore reiciendis!


text:
/**
 * Converts meters to inches
 *
 * @param {Number} meter
 * @returns {Number}
 */

function convertMetersToInches(meter) {
  return parseFloat((meter / 0.0254).toFixed(2));
}

module.exports = convertMetersToInches;


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
	<title>jQuery async treeview</title>

	<link rel="stylesheet" href="../jquery.treeview.css" />
    <link rel="stylesheet" href="../red-treeview.css" />
	<link rel="stylesheet" href="screen.css" />

jQuery Treeview Plugin Demo

Main Demo

Server component used

Lazy-loading tree

Mixed pre and lazy-loading

Item 1

Item 1.0

Item 1.0.0

Item 1.1

			Item 2

			Item 3


text:
<?php
namespace Codemitte\ForceToolkit\Soql\AST\Functions;

class CalendarMonth extends DateFunction
{
    protected $name = 'CALENDAR_MONTH';
}


text:
/* I do want to see this comment
 *
 */
$(function(b){b.find("all");var a=window;var c=(function(d){return function(e){d.clicko(e)}})(this);if(b.shouting()){b.dont_shout()}else{b.i_cant_hear_you()}a.setTimeout(c,1000)})(Monkey);
// YUI compression via shine.magnetised.info


text:
<?php

class tadminforum implements iadmin {

  public static function i() {
    return getinstance(__class__);
  }

  public function getcontent() {
    $forum = tforum::i();
    $html = tadminhtml::i();
    $args = new targs();

    $html->section = 'editor';
    $lang = tlocal::i('editor');

    $args->comstatus= tadminhtml::array2combo(array(
    'closed' => $lang->closed,
    'reg' => $lang->reg,
    'guest' => $lang->guest,
    'comuser' => $lang->comuser
    ), $forum->comstatus);

    $lang = tlocal::admin('forum');
    $args->rootcat = tposteditor::getcombocategories(array(), $forum->rootcat);
    $args->moderate = $forum->moderate;

    $args->formtitle = $lang->options;
    return $html->adminform('
    [combo=rootcat]
    [combo=comstatus]
    [checkbox=moderate]
    ' .
    tadminviews::getcomboview($forum->idview) .
    tadminperms::getcombo(0)
    , $args);
  }

  public function processform() {
    extract($_POST, EXTR_SKIP);
    $forum = tforum::i();
    $forum->rootcat = (int) $rootcat;
    $forum->idview = (int) $idview;
    $forum->idperm = (int) $idperm;
    $forum->moderate = isset($moderate);
    $forum->save();
  }

}//class


text:
module Fog
  module Parsers
    module AWS
      module Compute
        class MonitorUnmonitorInstances < Fog::Parsers::Base
          def reset
            @response = {}
            @instance_set = []
            @current_instance_set = {}
          end

          def end_element(name)
            case name
            when 'requestId'
              @response['requestId'] = value
            when 'instanceId'
              @current_instance_set['instanceId'] = value
            when 'item'
              @instance_set << @current_instance_set
              @current_instance_set = {}
            when 'state'
              @current_instance_set['monitoring'] = value
            when 'instancesSet'
              @response['instancesSet'] = @instance_set
            end
          end
        end
      end
    end
  end
end


text:
from player import *
from math import pi
from math import fabs

class TestPlayer2(Player):
    def __init__(self):
        super(TestPlayer2, self).__init__()
        self.strategy = GoToBall2()

    def updateStrategy(self):
        pass

    def isInsideConeOfRadiusAndMaxDistance(self, angle_ball_to_player, radius = 30, maxDistance = 0.5):
        pass

    @property
    def TargetConeAngle(self):
        return (self.GoalCenter - self.ball).angle