<commit_before>package me.prettyprint.cassandra.service;

import java.util.Collections;
import java.util.Map;

import me.prettyprint.cassandra.model.ExecutionResult;
import me.prettyprint.cassandra.service.CassandraClientMonitor.Counter;
import me.prettyprint.hector.api.ConsistencyLevelPolicy;
import me.prettyprint.hector.api.exceptions.HectorException;

import org.apache.cassandra.thrift.Cassandra;

/**
 * Defines an operation performed on cassandra
 *
 * @param <T>
 *          The result type of the operation (if it has a result), such as the
 *          result of get_count or get_column
 *
 *          Oh closures, how I wish you were here...
 */
public abstract class Operation<T> {
  private static final Map<String, String> EMPTY_CREDENTIALS = Collections.emptyMap();

  /** Counts failed attempts */
  public final Counter failCounter;

  /** The stopwatch used to measure operation performance */
  public final String stopWatchTagName;

  public FailoverPolicy failoverPolicy;
  public ConsistencyLevelPolicy consistencyLevelPolicy;
  
  public String keyspaceName;

  public Map<String, String> credentials;
  
  protected T result;
  private HectorException exception;
  private CassandraHost cassandraHost;
  private long execTime;
  public final OperationType operationType;
  
  public Operation(OperationType operationType) {
    this.failCounter = operationType.equals(OperationType.READ) ? Counter.READ_FAIL :
      Counter.WRITE_FAIL;
    this.operationType = operationType;
    this.stopWatchTagName = operationType.name();
  }

  public Operation(OperationType operationType, Map<String, String> credentials) {
    this(operationType, FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE, null, credentials);
  }
  
  public Operation(OperationType operationType, FailoverPolicy failoverPolicy, String keyspaceName, Map<String, String> credentials) {
    this.failCounter = operationType.equals(OperationType.READ) ? Counter.READ_FAIL :<commit_msg>class-level default as suggested by moores on the mail list<commit_after>package me.prettyprint.cassandra.service;

import java.util.Collections;
import java.util.Map;

import me.prettyprint.cassandra.model.ExecutionResult;
import me.prettyprint.cassandra.service.CassandraClientMonitor.Counter;
import me.prettyprint.hector.api.ConsistencyLevelPolicy;
import me.prettyprint.hector.api.exceptions.HectorException;

import org.apache.cassandra.thrift.Cassandra;

/**
 * Defines an operation performed on cassandra
 *
 * @param <T>
 *          The result type of the operation (if it has a result), such as the
 *          result of get_count or get_column
 *
 *          Oh closures, how I wish you were here...
 */
public abstract class Operation<T> {
  private static final Map<String, String> EMPTY_CREDENTIALS = Collections.emptyMap();

  /** Counts failed attempts */
  public final Counter failCounter;

  /** The stopwatch used to measure operation performance */
  public final String stopWatchTagName;

  public FailoverPolicy failoverPolicy = FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE;
  public ConsistencyLevelPolicy consistencyLevelPolicy;
  
  public String keyspaceName;

  public Map<String, String> credentials;
  
  protected T result;
  private HectorException exception;
  private CassandraHost cassandraHost;
  private long execTime;
  public final OperationType operationType;
  
  public Operation(OperationType operationType) {
    this.failCounter = operationType.equals(OperationType.READ) ? Counter.READ_FAIL :
      Counter.WRITE_FAIL;
    this.operationType = operationType;
    this.stopWatchTagName = operationType.name();
  }

  public Operation(OperationType operationType, Map<String, String> credentials) {
    this(operationType, FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE, null, credentials);
  }
  
  public Operation(OperationType operationType, FailoverPolicy failoverPolicy, String keyspaceName, Map<String, String> credentials) {
    this.failCounter = operationType.equals(OperationType.READ) ? Counter.READ_FAIL :
{'fraction_non_alphanumeric': 0.07745952677459526, 'fraction_numerical': 0.0, 'mean_word_length': 4.7535816618911175, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2404421', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1099, 'n_words': 296}