Пример #1
0
 /** Return a button that invokes javascript when clicked. */
 Input jsButton(String label, String js) {
   Input btn = new Input("button", null);
   btn.attribute("value", label);
   setTabOrder(btn);
   btn.attribute("onClick", js);
   return btn;
 }
Пример #2
0
  public static void main(String[] args) throws IOException {

    String file = "/Users/larissaleite/Documents/integerfile.dat";

    int bufferSize = 1;

    Output output = new Output(file, bufferSize);
    output.create();

    for (int i = 0; i < 500; i++) {
      output.write(i * 10000000);
    }

    output.close();

    Input input = new Input(file, bufferSize);

    try {
      input.open();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    while (!input.end_of_stream()) {
      System.out.println(input.read_next());
    }
  }
 public static void main(String[] args) {
   SortedADT sorted = new SortedArray();
   boolean inserted;
   String value; // type of value
   int option;
   do {
     System.out.println("0: quit");
     System.out.println("1: insert");
     System.out.println("2: remove");
     System.out.println("3: find");
     System.out.println("4: display");
     option = Input.getInteger("input option: ");
     switch (option) {
       case 0:
         break;
       case 1:
         inserted = sorted.insert(Input.getString("input string: ")); // type of input
         if (inserted) System.out.println("inserted");
         break;
       case 2:
         value = (String) sorted.remove(Input.getString("input string: ")); // type of input
         if (value != null) System.out.println("removed");
         else System.out.println("not found");
         break;
       case 3:
         value = (String) sorted.find(Input.getString("input string: ")); // type of input
         if (value != null) System.out.println("found");
         else System.out.println("not found");
         break;
       case 4:
         System.out.println(sorted);
         break;
     }
   } while (option != 0);
 }
  @Subscribe
  public void inputCreated(InputCreated inputCreatedEvent) {
    LOG.debug("Input created/changed: " + inputCreatedEvent.id());
    final Input input;
    try {
      input = inputService.find(inputCreatedEvent.id());
    } catch (NotFoundException e) {
      LOG.warn("Received InputCreated event but could not find Input: ", e);
      return;
    }

    final IOState<MessageInput> inputState = inputRegistry.getInputState(inputCreatedEvent.id());
    if (inputState != null) {
      inputRegistry.remove(inputState);
    }

    if (!input.isGlobal() && !this.nodeId.toString().equals(input.getNodeId())) {
      return;
    }

    final MessageInput messageInput;
    try {
      messageInput = inputService.getMessageInput(input);
      messageInput.initialize();
    } catch (NoSuchInputTypeException e) {
      LOG.warn("Newly created input is of invalid type: " + input.getType(), e);
      return;
    }
    final IOState<MessageInput> newInputState = inputLauncher.launch(messageInput);
    inputRegistry.add(newInputState);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle extras = getIntent().getExtras();

    final Input input = (Input) extras.getSerializable(INPUT);

    try {
      this.expression = Expression.valueOf(input.getExpression());
      this.variable = new Constant(input.getVariableName());

      String title = extras.getString(ChartFactory.TITLE);
      if (title == null) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
      } else if (title.length() > 0) {
        setTitle(title);
      }

      setContentView(R.layout.calc_plot_view);

      final Object lastNonConfigurationInstance = getLastNonConfigurationInstance();
      setGraphicalView(
          lastNonConfigurationInstance instanceof PlotBoundaries
              ? (PlotBoundaries) lastNonConfigurationInstance
              : null);

    } catch (ParseException e) {
      Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
      finish();
    } catch (ArithmeticException e) {
      Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
      finish();
    }
  }
Пример #6
0
  @Override
  public InputLaunchResponse launchInput(
      String title,
      String type,
      Boolean global,
      Map<String, Object> configuration,
      boolean isExclusive,
      String nodeId)
      throws ExclusiveInputException {
    if (isExclusive) {
      for (Input input : getInputs()) {
        if (input.getType().equals(type)) {
          throw new ExclusiveInputException();
        }
      }
    }

    final InputLaunchRequest request =
        InputLaunchRequest.create(title, type, global, configuration, nodeId);

    try {
      return api.path(routes.InputsResource().create(), InputLaunchResponse.class)
          .node(this)
          .body(request)
          .expect(Http.Status.ACCEPTED)
          .execute();
    } catch (Exception e) {
      LOG.error("Could not launch input " + title, e);
      return null;
    }
  }
Пример #7
0
  public void OnUpdate() {
    if (!isAlive()) // Stop when dead
    {
      if (getFlySpeed() > 0) setFlySpeed(getFlySpeed() - 0.0001f * (getFlySpeed() / 2));
    } else {
      timeSinceLastShot +=
          game.getFrame().GetDeltaFrameTime() + getScore() / 45; // TODO: Needs balancing!
      if (Input.IsKeyDown(KeyEvent.VK_A) && pos.x > 0)
        pos.x -= 0.5 * game.getFrame().GetDeltaFrameTime();
      if (Input.IsKeyDown(KeyEvent.VK_D) && pos.x < game.getFrame().getWidth() - size.x)
        pos.x += 0.5 * game.getFrame().GetDeltaFrameTime();
      if (Input.IsKeyDown(KeyEvent.VK_W) && pos.y > 0)
        pos.y -= 0.5 * game.getFrame().GetDeltaFrameTime();
      if (Input.IsKeyDown(KeyEvent.VK_S) && pos.y < game.getFrame().getHeight() - size.y)
        pos.y += 0.5 * game.getFrame().GetDeltaFrameTime();
      if (Input.IsKeyDown(KeyEvent.VK_SPACE) && timeSinceLastShot > shotDelay) {
        fireBullet();
        timeSinceLastShot = 0;
      }

      if (testEnemyCol() >= 0) giveDamage();

      if (getFlySpeed() >= 1.7f
          && game.getAchievements().Unlocked(Achievement.ACHIEVEMENT_DIZZY)) // TODO: Fix this
      game.getAchievements().Unlock(Achievement.ACHIEVEMENT_DIZZY);
      if (getFlySpeed() >= 2.3f && game.getAchievements().Unlocked(Achievement.ACHIEVEMENT_WARP))
        game.getAchievements().Unlock(Achievement.ACHIEVEMENT_WARP);
      if (getFlySpeed() >= 2.7f
          && game.getAchievements().Unlocked(Achievement.ACHIEVEMENT_LIGHTSPEED))
        game.getAchievements().Unlock(Achievement.ACHIEVEMENT_LIGHTSPEED);
    }

    bounding.x = (int) pos.x;
    bounding.y = (int) pos.y;
  }
Пример #8
0
  @Override
  public ExternalIoCommandProvider createCommandProvider(IoContext context) {
    String primary = null;
    Set<String> targets = new TreeSet<String>();
    for (Input input : context.getInputs()) {
      BulkLoadImporterDescription desc = extract(input.getDescription());
      String target = desc.getTargetName();
      if (desc.getMode() == Mode.PRIMARY) {
        assert primary == null || primary.equals(target);
        primary = target;
      }
      targets.add(target);
    }
    for (Output output : context.getOutputs()) {
      BulkLoadExporterDescription desc = extract(output.getDescription());
      String target = desc.getTargetName();
      assert primary == null || primary.equals(target);
      primary = target;
      targets.add(target);
    }
    if (primary != null) {
      targets.remove(primary);
    }

    return new CommandProvider(
        getEnvironment().getBatchId(),
        getEnvironment().getFlowId(),
        primary,
        new ArrayList<String>(targets));
  }
Пример #9
0
  /**
   * Build the UI of the given process according to the given data.
   *
   * @param processExecutionData Process data.
   * @return The UI for the configuration of the process.
   */
  public JComponent buildUIConf(ProcessExecutionData processExecutionData) {
    JPanel panel = new JPanel(new MigLayout("fill"));
    // For each input, display its title, its abstract and gets its UI from the dataUIManager
    for (Input i : processExecutionData.getProcess().getInput()) {
      JPanel inputPanel = new JPanel(new MigLayout("fill"));
      inputPanel.setBorder(BorderFactory.createTitledBorder(i.getTitle()));
      JLabel inputAbstrac = new JLabel(i.getResume());
      inputAbstrac.setFont(inputAbstrac.getFont().deriveFont(Font.ITALIC));
      inputPanel.add(inputAbstrac, "wrap");
      DataUI dataUI = dataUIManager.getDataUI(i.getDataDescription().getClass());
      if (dataUI != null) {
        inputPanel.add(dataUI.createUI(i, processExecutionData.getInputDataMap()), "wrap");
      }
      panel.add(inputPanel, "growx, wrap");
    }

    // For each output, display its title, its abstract and gets its UI from the dataUIManager
    for (Output o : processExecutionData.getProcess().getOutput()) {
      DataUI dataUI = dataUIManager.getDataUI(o.getDataDescription().getClass());
      if (dataUI != null) {
        JComponent component = dataUI.createUI(o, processExecutionData.getOutputDataMap());
        if (component != null) {
          JPanel outputPanel = new JPanel(new MigLayout("fill"));
          outputPanel.setBorder(BorderFactory.createTitledBorder(o.getTitle()));
          JLabel outputAbstrac = new JLabel(o.getResume());
          outputAbstrac.setFont(outputAbstrac.getFont().deriveFont(Font.ITALIC));
          outputPanel.add(outputAbstrac, "wrap");
          outputPanel.add(component, "wrap");
          panel.add(outputPanel, "growx, wrap");
        }
      }
    }
    return panel;
  }
Пример #10
0
  // Asks for one double
  public double inputDouble() {
    Input in = new Input();

    while (true) {
      System.out.print("Please enter a double: ");
      if (in.hasNextDouble()) return in.nextDouble();
    }
  }
Пример #11
0
  public void assemble() {
    Input.addKeyListener(this);

    setFillColor(new Color(0, 0, 20));

    Collider colli = new Collider(this);
    colli.setRotationVelocity(0.01);

    for (int i = 0; i < 50; i++) new HelloWorld(this);

    Container rotorAquarium =
        new Container(this, 3 * getWidth() / 5, 0, 2 * getWidth() / 5, getHeight() / 2);
    rotorAquarium.setFillColor(new Color(0, 10, 40, 240));
    rotorAquarium.setDrawColor(Color.WHITE);
    for (int i = 0; i < 30; i++) new Rotor(rotorAquarium);

    Container colliderAquarium =
        new Container(this, 6 * getWidth() / 7, getHeight() / 2, getWidth() / 7, getHeight() / 5);

    colliderAquarium.setFillColor(new Color(50, 0, 30, 100));
    colliderAquarium.setDrawColor(Color.YELLOW);

    for (int i = 0; i < 10; i++) {
      Collider collider = new Collider(colliderAquarium);
      EntityInfoBox infobox =
          new EntityInfoBox(
              colliderAquarium,
              6 * getWidth() / 7 - EntityInfoBox.WIDTH - 1,
              getHeight() / 2 + i * (EntityInfoBox.HEIGHT + 1),
              collider);
      Link link = new Link(infobox, collider);
    }

    Container playerContainer = new Container(this, 50, 50, getWidth() / 2, 4 * getHeight() / 5);
    playerContainer.setFillColor(new Color(0, 30, 0, 50));
    playerContainer.setDrawColor(new Color(0, 130, 0));

    Player player = new Player(playerContainer);
    Input.addKeyListener(player);

    EntityInfoBox playerInfo = new EntityInfoBox(playerContainer, 1, 1, player);

    new Link(playerInfo, player);

    Container secondRotorContainer =
        new Container(this, getWidth() / 2 + 100, getHeight() / 2 + 50, 300, 400);

    secondRotorContainer.setFillColor(new Color(0, 0, 0, 180));
    secondRotorContainer.setDrawColor(Color.WHITE);

    Rotor rotor1 = new Rotor(secondRotorContainer);
    Rotor rotor2 = new Rotor(secondRotorContainer);
    Rotor rotor3 = new Rotor(secondRotorContainer);
    Link rotorLink1 = new Link(rotor1, rotor2);
    Link rotorLink2 = new Link(rotor2, rotor3);
    Link rotorLink3 = new Link(rotor3, rotor1);
  }
Пример #12
0
  /**
   * Build the UI of the given process according to the given data.
   *
   * @param processExecutionData Process data.
   * @return The UI for the configuration of the process.
   */
  public JComponent buildUIInfo(ProcessExecutionData processExecutionData) {
    JPanel panel = new JPanel(new MigLayout("fill"));
    Process p = processExecutionData.getProcess();
    // Process info
    JLabel titleContentLabel = new JLabel(p.getTitle());
    JLabel abstracContentLabel = new JLabel();
    if (p.getResume() != null) {
      abstracContentLabel.setText(p.getResume());
    } else {
      abstracContentLabel.setText("-");
      abstracContentLabel.setFont(abstracContentLabel.getFont().deriveFont(Font.ITALIC));
    }

    JPanel processPanel = new JPanel(new MigLayout());
    processPanel.setBorder(BorderFactory.createTitledBorder("Process :"));
    processPanel.add(titleContentLabel, "wrap, align left");
    processPanel.add(abstracContentLabel, "wrap, align left");

    // Input info
    JPanel inputPanel = new JPanel(new MigLayout());
    inputPanel.setBorder(BorderFactory.createTitledBorder("Inputs :"));

    for (Input i : p.getInput()) {
      inputPanel.add(new JLabel(dataUIManager.getIconFromData(i)));
      inputPanel.add(new JLabel(i.getTitle()), "align left, wrap");
      if (i.getResume() != null) {
        JLabel abstrac = new JLabel(i.getResume());
        abstrac.setFont(abstrac.getFont().deriveFont(Font.ITALIC));
        inputPanel.add(abstrac, "span 2, wrap");
      } else {
        inputPanel.add(new JLabel("-"), "span 2, wrap");
      }
    }

    // Output info
    JPanel outputPanel = new JPanel(new MigLayout());
    outputPanel.setBorder(BorderFactory.createTitledBorder("Outputs :"));

    for (Output o : p.getOutput()) {
      outputPanel.add(new JLabel(dataUIManager.getIconFromData(o)));
      outputPanel.add(new JLabel(o.getTitle()), "align left, wrap");
      if (o.getResume() != null) {
        JLabel abstrac = new JLabel(o.getResume());
        abstrac.setFont(abstrac.getFont().deriveFont(Font.ITALIC));
        outputPanel.add(abstrac, "span 2, wrap");
      } else {
        outputPanel.add(new JLabel("-"), "align center, span 2, wrap");
      }
    }

    panel.add(processPanel, "growx, wrap");
    panel.add(inputPanel, "growx, wrap");
    panel.add(outputPanel, "growx, wrap");

    return panel;
  }
Пример #13
0
  public Input.IoStats getGlobalInputIo(Input input) {
    final Input.IoStats ioStats = new Input.IoStats();

    final String inputId = input.getId();
    final String type = input.getType();

    try {
      MultiMetricRequest request = new MultiMetricRequest();
      final String read_bytes = qualifiedIOMetricName(type, inputId, "read_bytes", false);
      final String read_bytes_total = qualifiedIOMetricName(type, inputId, "read_bytes", true);
      final String written_bytes = qualifiedIOMetricName(type, inputId, "written_bytes", false);
      final String written_bytes_total =
          qualifiedIOMetricName(type, inputId, "written_bytes", true);
      request.metrics =
          new String[] {read_bytes, read_bytes_total, written_bytes, written_bytes_total};

      final Map<Node, MetricsListResponse> results =
          api.path(routes.MetricsResource().multipleMetrics(), MetricsListResponse.class)
              .body(request)
              .expect(200, 404)
              .executeOnAll();

      for (MetricsListResponse response : results.values()) {
        final Map<String, Metric> metrics = response.getMetrics();

        ioStats.readBytes += asLong(read_bytes, metrics);
        ioStats.readBytesTotal += asLong(read_bytes_total, metrics);
        ioStats.writtenBytes += asLong(written_bytes, metrics);
        ioStats.writtenBytesTotal += asLong(written_bytes_total, metrics);
      }

      for (Radio radio : nodeService.radios().values()) {
        try {
          final MetricsListResponse radioResponse =
              api.path(
                      routes.radio().MetricsResource().multipleMetrics(), MetricsListResponse.class)
                  .body(request)
                  .radio(radio)
                  .expect(200, 404)
                  .execute();
          final Map<String, Metric> metrics = radioResponse.getMetrics();

          ioStats.readBytes += asLong(read_bytes, metrics);
          ioStats.readBytesTotal += asLong(read_bytes_total, metrics);
          ioStats.writtenBytes += asLong(written_bytes, metrics);
          ioStats.writtenBytesTotal += asLong(written_bytes_total, metrics);
        } catch (APIException | IOException e) {
          LOG.error("Unable to load metrics for radio node {}", radio.getId());
        }
      }

    } catch (APIException | IOException e) {
      LOG.error("Unable to load master node", e);
    }
    return ioStats;
  }
Пример #14
0
 /**
  * Return a labelled rasio button
  *
  * @param label appears to right of circle if non null
  * @param value value assigned to key if box checked
  * @param key form key to which value is assigned
  * @param checked if true, is initially checked
  * @return a readio button Element
  */
 protected Element radioButton(String label, String value, String key, boolean checked) {
   Composite c = new Composite();
   Input in = new Input(Input.Radio, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   c.add(in);
   c.add(label);
   return c;
 }
Пример #15
0
  public static void main(String[] args) {
    // 标准指令集的位置,eg:instruction set/MIPS64.txt
    String instructionSetFile = "Input/MIPS64.txt";
    // 测试指令集的位置,eg:instructions/test.txt
    String instructionsFile = "Input/test.txt";
    Input input = new Input(instructionSetFile, instructionsFile);
    ArrayList<ArrayList<String>> instructions = input.getInstrs();

    Tomasulo test = new Tomasulo();
    test.runCPUSimulator(instructions);
  }
Пример #16
0
  public static Gate scan(Scanner sc) {

    // Scanning the gate description.
    Input g = new Input();
    g.scan(sc, inputs);
    if (g.name == null) g = null;

    if (Input.inputList != null) g.inputChange(0, 0, false);

    if (g != null) inputList.add(g);
    return g;
  }
Пример #17
0
 private BulkLoaderScript toScript(List<Input> inputs, List<Output> outputs) {
   List<ImportTable> imports = new ArrayList<ImportTable>();
   List<ExportTable> exports = new ArrayList<ExportTable>();
   for (Input input : inputs) {
     imports.add(convert(input.getDescription()));
   }
   for (Output output : outputs) {
     exports.add(convert(output.getDescription()));
   }
   BulkLoaderScript script = new BulkLoaderScript(imports, exports);
   return script;
 }
Пример #18
0
  /** {@inheritDoc} */
  protected void readItem(Input in, ReadContext readContext) {
    staticFields = new EncodedField[in.readUnsignedLeb128()];
    instanceFields = new EncodedField[in.readUnsignedLeb128()];
    directMethods = new EncodedMethod[in.readUnsignedLeb128()];
    virtualMethods = new EncodedMethod[in.readUnsignedLeb128()];

    EncodedField previousEncodedField = null;
    for (int i = 0, len = staticFields.length; i < len; i++) {
      try {
        staticFields[i] =
            previousEncodedField = new EncodedField(dexFile, in, previousEncodedField);
      } catch (Exception ex) {
        throw ExceptionWithContext.withContext(
            ex, "Error while reading static field at index " + i);
      }
    }

    previousEncodedField = null;
    for (int i = 0, len = instanceFields.length; i < len; i++) {
      try {
        instanceFields[i] =
            previousEncodedField = new EncodedField(dexFile, in, previousEncodedField);
      } catch (Exception ex) {
        throw ExceptionWithContext.withContext(
            ex, "Error while reading instance field at index " + i);
      }
    }

    EncodedMethod previousEncodedMethod = null;
    for (int i = 0, len = directMethods.length; i < len; i++) {
      try {
        directMethods[i] =
            previousEncodedMethod =
                new EncodedMethod(dexFile, readContext, in, previousEncodedMethod);
      } catch (Exception ex) {
        throw ExceptionWithContext.withContext(
            ex, "Error while reading direct method at index " + i);
      }
    }

    previousEncodedMethod = null;
    for (int i = 0, len = virtualMethods.length; i < len; i++) {
      try {
        virtualMethods[i] =
            previousEncodedMethod =
                new EncodedMethod(dexFile, readContext, in, previousEncodedMethod);
      } catch (Exception ex) {
        throw ExceptionWithContext.withContext(
            ex, "Error while reading virtual method at index " + i);
      }
    }
  }
Пример #19
0
  public Receiver(String ip, String name, Input[] inputs, Speaker[] speakers) {
    this.ip = ip;
    this.name = name;
    this.inputs = inputs;
    this.speakers = speakers;

    for (Input input : inputs) {
      input.receiver = this;
    }

    for (Speaker speaker : speakers) {
      speaker.receiver = this;
    }
  }
  public ExternalTaskFactory(Repository repository, TaskInformation information) {
    super(repository);
    this.output = new ValueType(information.output);
    this.pathArguments = information.pathArguments;
    this.prefixes = information.prefixes;
    this.constants = information.constants;
    this.id = information.id;
    if (information.id == null) throw new AssertionError("Task ID is not defined");

    // Add inputs
    for (Map.Entry<String, InputInformation> entry : information.inputs.entrySet()) {
      String name = entry.getKey();
      final InputInformation field = entry.getValue();

      Input input = new JsonInput(getType(field));
      input.setDocumentation(field.help);
      input.setOptional(!field.required);
      input.setCopyTo(field.copyTo);
      input.nestedDependencies(field.dependencies);
      if (field.defaultvalue != null && !field.defaultvalue.isJsonNull()) {
        input.setDefaultValue(Json.toJSON(field.defaultvalue));
      }
      inputs.put(name, input);
    }

    // Add paths
    for (PathArgument pathArgument : information.pathArguments) {
      Input input = new JsonInput(Type.XP_PATH);
      input.setOptional(true); // We are lying -- we will set it!
      inputs.put(pathArgument.jsonName, input);
    }
  }
Пример #21
0
  @Test
  public void testInputs() {
    Service service = connect();

    InputCollection inputs = service.getInputs();

    // Iterate inputs and make sure we can read them.
    for (Input input : inputs.values()) {
      input.getName();
      input.getTitle();
      input.getPath();
      input.getKind();
      touchSpecificInput(input);
    }
  }
Пример #22
0
 /**
  * Return a (possibly labelled) checkbox.
  *
  * @param label appears to right of checkbox if non null
  * @param value value included in result set if box checked
  * @param key form key to which result set is assigned
  * @param checked if true, box is initially checked
  * @return a checkbox Element
  */
 Element checkBox(String label, String value, String key, boolean checked) {
   Input in = new Input(Input.Checkbox, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   if (StringUtil.isNullString(label)) {
     return in;
   } else {
     Composite c = new Composite();
     c.add(in);
     c.add(" ");
     c.add(label);
     return c;
   }
 }
 @Test
 public void null_collection_length_reduced() {
   execute(
       Input.of(HUNT_NULL_LIMB),
       Query.of(Predicates.equal("limbs_[any].fingers_.length", 1), mv),
       Expected.empty());
 }
 @Test
 public void null_collection_length_compared_to_null() {
   execute(
       Input.of(HUNT_NULL_LIMB),
       Query.of(Predicates.equal("limbs_[0].fingers_.length", null), mv),
       Expected.of(HUNT_NULL_LIMB));
 }
 @Test
 public void length_property_atLeaf() {
   execute(
       Input.of(BOND, KRUEGER),
       Query.of(Predicates.equal("limbs_[0].tattoos_.length", 1), mv),
       Expected.of(KRUEGER));
 }
 @Test
 public void length_property() {
   execute(
       Input.of(BOND, KRUEGER),
       Query.of(Predicates.equal("limbs_.length", 2), mv),
       Expected.of(BOND, KRUEGER));
 }
 @Test
 public void null_collection_length_atLeaf_reduced_compared_to_null() {
   execute(
       Input.of(HUNT_NULL_TATTOOS),
       Query.of(Predicates.equal("limbs_[any].tattoos_.length", null), mv),
       Expected.of(HUNT_NULL_TATTOOS));
 }
 @Test
 public void null_collection_length_atLeaf() {
   execute(
       Input.of(HUNT_NULL_TATTOOS),
       Query.of(Predicates.equal("limbs_[0].tattoos_.length", 1), mv),
       Expected.empty());
 }
 private static int computeOutput(Input input, int[] filter, long col) {
   int r = 0;
   for (int p = 0; p < filter.length; p++) {
     r ^= (filter[p] * input.get(col + p));
   }
   return r;
 }
Пример #30
0
  public void onDeactivate() {
    checkNewState(State.DEACTIVATED);
    _sensorManager.unregisterListener(this, _sensor);
    if (DEBUG) Log.d(TAG, "onDeactivate()");

    super.onDeactivate();
  }