Examples of MapUpdate


Examples of BasicDataType.MapUpdate

  /** Gets the packet as a MapUpdate
   * @return Returns the packet as a MapUpdate
   */
  public MapUpdate toMapUpdate() {
    return new MapUpdate(data[0], data[1], data[2]);
  }
View Full Code Here

Examples of BasicDataType.MapUpdate

     * Iterate through entire map and add visited squares to the ArrayList
     */
    for(int x=0; x < mapSize; x++)
      for(int y=0; y < mapSize; y++)
        if(grid[x][y].getVisits() != 0)
          visitedSquares.add(new MapUpdate(grid[x][y].getDiff(), (byte)x, (byte)y));

    return visitedSquares;
  }
View Full Code Here

Examples of BasicDataType.MapUpdate

     * Iterate through entire map and add visited squares to the ArrayList
     */
    for(int x=0; x < mapSize; x++)
      for(int y=0; y < mapSize; y++)
        if(grid[x][y].getVisits() != 0)
          visitedSquares.add(new MapUpdate(grid[x][y].getDiff(), (byte)x, (byte)y));

    return visitedSquares;
  }
View Full Code Here

Examples of BasicDataType.MapUpdate

  public byte getExpValue(){
    return this.data[0];
  }
 
  public MapUpdate toMapUpdate() {
    return new MapUpdate(data[0], data[1], data[2]);
  }
View Full Code Here

Examples of BasicDataType.MapUpdate

      //System.out.println("Trying to send");
      for (int i=0; i<127;i++){
        byte x = (byte)((3 * id + i) % 20);
        byte y = (byte)((125 * id + i) %20);
       
        MapUpdate mapup = new MapUpdate((byte)(id+1), x, y);
        com.sendMapUpdate(mapup);
        try{
          Thread.sleep(1000);
        }catch(Exception e){
          System.out.println("Thread sleep exception");
        }
      }
        try{
          Thread.sleep((int)rand.nextInt(n+1));
        }catch(Exception e){
          System.out.println("Thread sleep exception");
        }
     
      Button.waitForPress();
      com.removeListener(this);
    }
    else{
      System.out.println("Slave");
      com.addListener(this);
     
      for (int i=0; i<127;i++){
        byte x = (byte)((3 * id + i) % 20);
        byte y = (byte)((125 * id + i) % 20);
        if(id==3){
          MapUpdate mapup = new MapUpdate((byte)-1, x, y);
        }
        MapUpdate mapup = new MapUpdate((byte)(id+1), x, y);
        com.sendMapUpdate(mapup);
        try{
          Thread.sleep(1000);
        }catch(Exception e){
          System.out.println("Thread sleep exception");
View Full Code Here

Examples of BasicDataType.MapUpdate

     * Iterate through entire map and add visited squares to the ArrayList
     */
    for(int x=0; x < mapSize; x++)
      for(int y=0; y < mapSize; y++)
        if(grid[x][y].getVisits() != 0)
          visitedSquares.add(new MapUpdate(grid[x][y].getDiff(), (byte)x, (byte)y));

    return visitedSquares;
  }
View Full Code Here

Examples of com.basho.riak.client.api.commands.datatypes.MapUpdate

      favorites.add(BinaryValue.create(buffer.array()));
      buffer.rewind();
    }

    // Create an update for the user's values
    MapUpdate userMapUpdate = new MapUpdate()
      .update(numLogins, new CounterUpdate(1))                // counter
      .update(lastLoginTime, new RegisterUpdate(now))     // register
      .update(loggedIn, new FlagUpdate(true))                   // flag
      .update(shoppingCart, favorites);              // asSet

    // Now create an update for the user's entry
    MapUpdate userEntryUpdate = new MapUpdate()
      .update(username, userMapUpdate);

    UpdateMap update = new UpdateMap.Builder(carts, userEntryUpdate)
      .withOption(Option.RETURN_BODY, true)
      .build();
View Full Code Here

Examples of com.basho.riak.client.api.commands.datatypes.MapUpdate

  public void testConflict() throws ExecutionException, InterruptedException
  {

    resetAndEmptyBucket(carts);

        MapUpdate innerMapUpdate = new MapUpdate().update("flag", new FlagUpdate(true));
        CounterUpdate innerCounterUpdate = new CounterUpdate(1);
       
    // Insert a Map and Counter into logins and observe both counter and map returned
    UpdateMap conflictedUpdateCmd =
      new UpdateMap.Builder(carts, new MapUpdate().update(numLogins, innerMapUpdate).update(numLogins, innerCounterUpdate))
        .withOption(Option.RETURN_BODY, true)
        .build();

    UpdateMap.Response conflictedResponse =
      client.execute(conflictedUpdateCmd);
View Full Code Here

Examples of com.basho.riak.client.api.commands.datatypes.MapUpdate

    @Test
    public void testStore() throws ExecutionException, InterruptedException
    {

        MapUpdate update = new MapUpdate();

        UpdateMap store = new UpdateMap.Builder(key, update)
          .withContext(context)
            .withOption(Option.DW, new Quorum(1))
            .withOption(Option.PW, new Quorum(1))
View Full Code Here

Examples of com.basho.riak.client.api.commands.datatypes.MapUpdate

            favorites.add(BinaryValue.create(buffer.array()));
            buffer.rewind();
        }

        // Create an update for the user's values
        MapUpdate userMapUpdate = new MapUpdate()
            .update(numLogins, new CounterUpdate(1))                // counter
            .update(lastLoginTime, new RegisterUpdate(now))     // register
            .update(loggedIn, new FlagUpdate(true))                   // flag
            .update(shoppingCart, favorites);              // asSet

        // Now create an update for the user's entry
        MapUpdate userEntryUpdate = new MapUpdate()
            .update(username, userMapUpdate);

        Location location = new Location(new Namespace(mapBucketType, bucketName), key);
        DtUpdateOperation update =
            new DtUpdateOperation.Builder(location)
                .withOp(userEntryUpdate.getOp())
                .build();

        cluster.execute(update);
        update.get();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.