<p>adapt.</p>

@param mutation a {@link org.apache.hadoop.hbase.client.Mutation} object.
@return a {@link RowMutation} object.
501179
public RowMutation adapt(org.apache.hadoop.hbase.client.Mutation mutation) {
    RowMutation rowMutation = newRowMutationModel(mutation.getRow());
    adapt(mutation, rowMutation);
    return rowMutation;
  }
289745
@Override
    public void merge(Collection<Bean> beans) throws AbortRuntimeException {
        init();
        Map<HBeanRow, HBeanRow> providedRows = new HashMap<>();
        for (Bean bean : beans) {
            HBeanRow row = new HBeanRow(bean, uids);
            providedRows.put(row, row);
            for (BeanId id : bean.getReferences()) {
                HBeanRow refRow = new HBeanRow(id, uids);
                providedRows.put(refRow, refRow);
            }
        }
        HBeanRowCollector storedCollector = null;
        try {
            storedCollector = table.getEager(providedRows);
        } catch (HBeanNotFoundException e) {
            // only throw exception if the bean was not provided
            if (!idsFoundIn(beans, e)) {
                throw Events.CFG301_MISSING_RUNTIME_REF(e.getNotFound().iterator().next());
            }
        }

        Map<HBeanRow, HBeanRow> storedRows = storedCollector.getRowMap();
        Set<RowMutations> mutations = new HashSet<>();

        for (HBeanRow provided : providedRows.keySet()) {
            HBeanRow stored = storedRows.get(provided);
            RowMutations rowMutations = new RowMutations(provided.getRowKey());
            Set<HBeanRow> deleteReferences = stored.merge(provided, rowMutations);
            try {
                deleteReferences = table.getLazy(deleteReferences);
                for (HBeanRow row : deleteReferences) {
                    RowMutations mutation = row.removePredecessor(provided);
                    mutations.add(mutation);
                }
            } catch (HBeanNotFoundException e) {
                throw new IllegalStateException("Broken predecessors");
            }
            mutations.add(rowMutations);
        }
        table.mutate(mutations);
    }
1155365
@Nullable
  public InputRow transform(@Nullable final InputRow row)
  {
    if (row == null) {
      return null;
    }

    final InputRow transformedRow;

    if (transforms.isEmpty()) {
      transformedRow = row;
    } else {
      transformedRow = new TransformedInputRow(row, transforms);
    }

    if (valueMatcher != null) {
      rowSupplierForValueMatcher.set(transformedRow);
      if (!valueMatcher.matches()) {
        return null;
      }
    }

    return transformedRow;
  }
61847
private <T> Observable<DocumentFragment<T>> subdocObserveMutation(Observable<DocumentFragment<T>> mutation, final long timeout, final TimeUnit timeUnit) {
        if (persistTo == PersistTo.NONE && replicateTo == ReplicateTo.NONE) {
            return mutation;
        }

        return mutation.flatMap(new Func1<DocumentFragment<T>, Observable<DocumentFragment<T>>>() {
            @Override
            public Observable<DocumentFragment<T>> call(final DocumentFragment<T> frag) {
                Observable<DocumentFragment<T>> result = Observe
                    .call(core, bucketName, frag.id(), frag.cas(), false, frag.mutationToken(), persistTo.value(), replicateTo.value(),
                        environment.observeIntervalDelay(), environment.retryStrategy())
                    .map(new Func1<Boolean, DocumentFragment<T>>() {
                        @Override
                        public DocumentFragment<T> call(Boolean aBoolean) {
                            return frag;
                        }
                    })
                    .onErrorResumeNext(new Func1<Throwable, Observable<DocumentFragment<T>>>() {
                        @Override
                        public Observable<DocumentFragment<T>> call(Throwable throwable) {
                            return Observable.error(new DurabilityException(
                                "Durability requirement failed: " + throwable.getMessage(),
                                throwable));
                        }
                    });
                if (timeout > 0) {
                    result = result.timeout(timeout, timeUnit, environment.scheduler());
                }
                return result;
            }
        });
    }
583308
public void fillColumnMutation(ColumnListMutation<ByteBuffer> clm, Object entity) {
        try {
            ByteBuffer columnName = toColumnName(entity);
            ByteBuffer value      = valueMapper.toByteBuffer(entity);
            
            clm.putColumn(columnName, value);
        } catch(Exception e) {
            throw new PersistenceException("failed to fill mutation batch", e);
        }
    }
723795
public <T> void adapt(@NonNull final Observable<T> subscriber, @Nullable final Callback<T> callback) {
        subscriber.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<T>() {

                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        if (callback != null) {
                            callback.error(e);
                        }
                    }

                    @Override
                    public void onNext(T result) {
                        if (callback != null) {
                            callback.success(result);
                        }
                    }
                });
    }
634312
@SuppressWarnings("unchecked")
	public <Input,Output> Output adapt(Input input, Class<Output> outputType) throws Exception {
		Class<?> inputType = input.getClass();
		Adapter a = findAdapter(input, inputType, outputType);
		if (a == null) return null;
		return (Output)a.adapt(input);
	}
376423
private List<Mutation> executeInternal(ByteBuffer key, ColumnFamily columnFamily)
    {
        Map<String, TriggerDefinition> triggers = columnFamily.metadata().getTriggers();
        if (triggers.isEmpty())
            return null;
        List<Mutation> tmutations = Lists.newLinkedList();
        Thread.currentThread().setContextClassLoader(customClassLoader);
        try
        {
            for (TriggerDefinition td : triggers.values())
            {
                ITrigger trigger = cachedTriggers.get(td.classOption);
                if (trigger == null)
                {
                    trigger = loadTriggerInstance(td.classOption);
                    cachedTriggers.put(td.classOption, trigger);
                }
                Collection<Mutation> temp = trigger.augment(key, columnFamily);
                if (temp != null)
                    tmutations.addAll(temp);
            }
            return tmutations;
        }
        catch (Exception ex)
        {
            throw new RuntimeException(String.format("Exception while creating trigger on CF with ID: %s", columnFamily.id()), ex);
        }
        finally
        {
            Thread.currentThread().setContextClassLoader(parent);
        }
    }
1232506
private static Mutation createMutation(byte[] colName, byte[] colValue, long timestamp) {
        if (colValue == null) {
            colValue = EMPTY_BYTES;
        }
        Column col = new Column();
        col.setName(colName);
        col.setValue(colValue);
        col.setTimestamp(timestamp);
        
        ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
        cosc.setColumn(col);
        
        Mutation mutation = new Mutation();
        mutation.setColumn_or_supercolumn(cosc);
        return mutation;
    }
386467
public FlatRow adaptToRow(Result result) {
    // Result.getRow() is derived from its cells.  If the cells are empty, the row will be null.
    if (result.getRow() == null) {
      return null;
    }

    FlatRow.Builder rowBuilder =
        FlatRow.newBuilder().withRowKey(ByteStringer.wrap(result.getRow()));

    final Cell[] rawCells = result.rawCells();
    if (rawCells != null && rawCells.length > 0) {
      for (Cell rawCell : rawCells) {
        rowBuilder.addCell(
          Bytes.toString(rawCell.getFamilyArray(),
              rawCell.getFamilyOffset(), rawCell.getFamilyLength()
          ),
          ByteStringer.wrap(rawCell.getQualifierArray(),
              rawCell.getQualifierOffset(), rawCell.getQualifierLength()
          ),
          TimestampConverter.hbase2bigtable(rawCell.getTimestamp()),
          ByteStringer.wrap(rawCell.getValueArray(),
              rawCell.getValueOffset(), rawCell.getValueLength()
          )
        );
      }
    }

    return rowBuilder.build();
  }
117845
public static Node evolveProgram(Map<double[], Double> data)
    {
        TreeFactory factory = new TreeFactory(2, // Number of parameters passed into each program.
                                              4, // Maximum depth of generated trees.
                                              Probability.EVENS, // Probability that a node is a function node.
                                              new Probability(0.6d)); // Probability that other nodes are params rather than constants.
        List<EvolutionaryOperator<Node>> operators = new ArrayList<EvolutionaryOperator<Node>>(3);
        operators.add(new TreeMutation(factory, new Probability(0.4d)));
        operators.add(new TreeCrossover());
        operators.add(new Simplification());
        TreeEvaluator evaluator = new TreeEvaluator(data);
        EvolutionEngine<Node> engine = new GenerationalEvolutionEngine<Node>(factory,
                                                                             new EvolutionPipeline<Node>(operators),
                                                                             evaluator,
                                                                             new RouletteWheelSelection(),
                                                                             new MersenneTwisterRNG());
        engine.addEvolutionObserver(new EvolutionLogger<Node>());
        return engine.evolve(1000, 5, new TargetFitness(0d, evaluator.isNatural()));
    }
184420
function mutate(Component, title, api = {}) {
  class Mutated extends React.Component {
    constructor(props, context) {
      super(props);

      this.ToRender = Component;
      const mutations = context.mutations;

      if (!mutations || !mutations[title]) {
        return;
      }

      // Convert old style mutations to new style mutations
      if (!Array.isArray(mutations[title])) {
        mutations[title] = [mutations[title]];
      }

      // Apply all mutations to the component
      for (let mut of mutations[title]) {
        this.ToRender = mut(this.ToRender, api);
      }
    }

    render() {
      const ToRender = this.ToRender;
      return <ToRender {...this.props} />;
    }
  }

  Mutated.contextTypes = {
    mutations: PropTypes.object
  };

  return Mutated;
}
193871
@Override
  public void mutate(Mutation mutation) throws IOException {
    handleExceptions();
    addCallback(helper.mutate(mutation), mutation);
  }
981265
protected Map<ByteBuffer, Map<String, List<Mutation>>> prepareMutation(EntityMetadata entityMetadata, Object entity,
        Object id, List<RelationHolder> relationHolders, Map<ByteBuffer, Map<String, List<Mutation>>> mutationMap) {

        if (!isOpen()) {
            throw new PersistenceException("ThriftClient is closed.");
        }

        // check for counter column
        if (isUpdate && entityMetadata.isCounterColumnType()) {
            log.warn("Invalid operation! {} is not possible over counter column of entity {}.", "Merge",
                entityMetadata.getEntityClazz());
            throw new UnsupportedOperationException("Invalid operation! Merge is not possible over counter column.");
        }

        Collection<ThriftRow> tfRows = null;
        try {
            String columnFamily = entityMetadata.getTableName();
            tfRows = getDataHandler().toThriftRow(entity, id, entityMetadata, columnFamily,
                getTtlValues().get(columnFamily));
        } catch (Exception e) {
            log.error("Error during persisting record for entity {}, Caused by: .", entityMetadata.getEntityClazz(),
                entityMetadata.getTableName(), e);
            throw new KunderaException(e);
        }

        Map<String, List<Mutation>> columnFamilyValues = new HashMap<String, List<Mutation>>();

        for (ThriftRow tf : tfRows) {
            if (tf.getColumnFamilyName().equals(entityMetadata.getTableName())) {
                addRelationsToThriftRow(entityMetadata, tf, relationHolders);
            }

            String columnFamily = tf.getColumnFamilyName();
            // Create Insertion List
            List<Mutation> mutationList = new ArrayList<Mutation>();

            /*********** Handling for counter column family ************/

            if (entityMetadata.isCounterColumnType()) {
                List<CounterColumn> thriftCounterColumns = tf.getCounterColumns();
                List<CounterSuperColumn> thriftCounterSuperColumns = tf.getCounterSuperColumns();

                if (thriftCounterColumns != null && !thriftCounterColumns.isEmpty()) {
                    for (CounterColumn column : thriftCounterColumns) {
                        Mutation mut = new Mutation();
                        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_column(column));
                        mutationList.add(mut);
                    }
                }

                if (thriftCounterSuperColumns != null && !thriftCounterSuperColumns.isEmpty()) {
                    for (CounterSuperColumn sc : thriftCounterSuperColumns) {
                        Mutation mut = new Mutation();
                        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_super_column(sc));
                        mutationList.add(mut);
                    }
                }
            } else
            /********* Handling for column family and super column family *********/
            {
                List<Column> thriftColumns = tf.getColumns();
                List<SuperColumn> thriftSuperColumns = tf.getSuperColumns();

                // Populate Insertion list for columns
                if (thriftColumns != null && !thriftColumns.isEmpty()) {
                    for (Column column : thriftColumns) {
                        Mutation mut = new Mutation();
                        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(column));
                        mutationList.add(mut);
                    }
                }

                // Populate Insertion list for super columns
                if (thriftSuperColumns != null && !thriftSuperColumns.isEmpty()) {
                    for (SuperColumn superColumn : thriftSuperColumns) {
                        Mutation mut = new Mutation();
                        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setSuper_column(superColumn));
                        mutationList.add(mut);
                    }
                }
            }
            columnFamilyValues.put(columnFamily, mutationList);
        }
        // Create Mutation Map

        ByteBuffer b = CassandraUtilities.toBytes(id, entityMetadata.getIdAttribute().getBindableJavaType());
        mutationMap.put(b, columnFamilyValues);

        return mutationMap;
    }
654839
private Mutation mutationFromTuple(Tuple t) throws IOException
    {
        Mutation mutation = new Mutation();
        if (t.get(1) == null)
        {
            if (allow_deletes)
            {
                mutation.deletion = new Deletion();
                mutation.deletion.predicate = new org.apache.cassandra.thrift.SlicePredicate();
                mutation.deletion.predicate.column_names = Arrays.asList(objToBB(t.get(0)));
                mutation.deletion.setTimestamp(FBUtilities.timestampMicros());
            }
            else
                throw new IOException("null found but deletes are disabled, set " + PIG_ALLOW_DELETES +
                    "=true in environment or allow_deletes=true in URL to enable");
        }
        else
        {
            org.apache.cassandra.thrift.Column column = new org.apache.cassandra.thrift.Column();
            column.setName(objToBB(t.get(0)));
            column.setValue(objToBB(t.get(1)));
            column.setTimestamp(FBUtilities.timestampMicros());
            mutation.column_or_supercolumn = new ColumnOrSuperColumn();
            mutation.column_or_supercolumn.column = column;
        }
        return mutation;
    }
1041829
def mutate(self, config):
        

        if config.single_structural_mutation:
            div = max(1,(config.node_add_prob + config.node_delete_prob +
                         config.conn_add_prob + config.conn_delete_prob))
            r = random()
            if r < (config.node_add_prob/div):
                self.mutate_add_node(config)
            elif r < ((config.node_add_prob + config.node_delete_prob)/div):
                self.mutate_delete_node(config)
            elif r < ((config.node_add_prob + config.node_delete_prob +
                       config.conn_add_prob)/div):
                self.mutate_add_connection(config)
            elif r < ((config.node_add_prob + config.node_delete_prob +
                       config.conn_add_prob + config.conn_delete_prob)/div):
                self.mutate_delete_connection()
        else:
            if random() < config.node_add_prob:
                self.mutate_add_node(config)

            if random() < config.node_delete_prob:
                self.mutate_delete_node(config)

            if random() < config.conn_add_prob:
                self.mutate_add_connection(config)

            if random() < config.conn_delete_prob:
                self.mutate_delete_connection()

        # Mutate connection genes.
        for cg in self.connections.values():
            cg.mutate(config)

        # Mutate node genes (bias, response, etc.).
        for ng in self.nodes.values():
            ng.mutate(config)
1307731
@InternalApi
  private void adapt(org.apache.hadoop.hbase.client.Mutation mutation, MutationApi<?> mutationApi) {
    mutationAdapters.hbaseMutationAdapter.adapt(mutation, mutationApi);
  }