package edu.rit.csh;

/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
@SuppressWarnings("all")
/** The record data for an article's view for a given hour */
@org.apache.avro.specific.AvroGenerated
public class LogRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"LogRecord\",\"doc\":\"The record data for an article's view for a given hour\",\"fields\":[{\"name\":\"pageTitle\",\"type\":\"string\",\"doc\":\"The title of the article\"},{\"name\":\"timestamp\",\"type\":\"long\",\"doc\":\"The hour in which the log data occured\"},{\"name\":\"count\",\"type\":\"int\",\"doc\":\"the number of views the article got\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** The title of the article */
  @Deprecated public java.lang.CharSequence pageTitle;
  /** The hour in which the log data occured */
  @Deprecated public long timestamp;
  /** the number of views the article got */
  @Deprecated public int count;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use <code>newBuilder()</code>. 
   */
  public LogRecord() {}

  /**
   * All-args constructor.
   */
  public LogRecord(java.lang.CharSequence pageTitle, java.lang.Long timestamp, java.lang.Integer count) {
    this.pageTitle = pageTitle;
    this.timestamp = timestamp;
    this.count = count;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call. 
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return pageTitle;
    case 1: return timestamp;
    case 2: return count;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call. 
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: pageTitle = (java.lang.CharSequence)value$; break;
    case 1: timestamp = (java.lang.Long)value$; break;
    case 2: count = (java.lang.Integer)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'pageTitle' field.
   * The title of the article   */
  public java.lang.CharSequence getPageTitle() {
    return pageTitle;
  }

  /**
   * Sets the value of the 'pageTitle' field.
   * The title of the article   * @param value the value to set.
   */
  public void setPageTitle(java.lang.CharSequence value) {
    this.pageTitle = value;
  }

  /**
   * Gets the value of the 'timestamp' field.
   * The hour in which the log data occured   */
  public java.lang.Long getTimestamp() {
    return timestamp;
  }

  /**
   * Sets the value of the 'timestamp' field.
   * The hour in which the log data occured   * @param value the value to set.
   */
  public void setTimestamp(java.lang.Long value) {
    this.timestamp = value;
  }

  /**
   * Gets the value of the 'count' field.
   * the number of views the article got   */
  public java.lang.Integer getCount() {
    return count;
  }

  /**
   * Sets the value of the 'count' field.
   * the number of views the article got   * @param value the value to set.
   */
  public void setCount(java.lang.Integer value) {
    this.count = value;
  }

  /** Creates a new LogRecord RecordBuilder */
  public static LogRecord.Builder newBuilder() {
    return new LogRecord.Builder();
  }
  
  /** Creates a new LogRecord RecordBuilder by copying an existing Builder */
  public static LogRecord.Builder newBuilder(LogRecord.Builder other) {
    return new LogRecord.Builder(other);
  }
  
  /** Creates a new LogRecord RecordBuilder by copying an existing LogRecord instance */
  public static LogRecord.Builder newBuilder(LogRecord other) {
    return new LogRecord.Builder(other);
  }
  
  /**
   * RecordBuilder for LogRecord instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<LogRecord>
    implements org.apache.avro.data.RecordBuilder<LogRecord> {

    private java.lang.CharSequence pageTitle;
    private long timestamp;
    private int count;

    /** Creates a new Builder */
    private Builder() {
      super(LogRecord.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(LogRecord.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.pageTitle)) {
        this.pageTitle = data().deepCopy(fields()[0].schema(), other.pageTitle);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.timestamp)) {
        this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.count)) {
        this.count = data().deepCopy(fields()[2].schema(), other.count);
        fieldSetFlags()[2] = true;
      }
    }
    
    /** Creates a Builder by copying an existing LogRecord instance */
    private Builder(LogRecord other) {
            super(LogRecord.SCHEMA$);
      if (isValidValue(fields()[0], other.pageTitle)) {
        this.pageTitle = data().deepCopy(fields()[0].schema(), other.pageTitle);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.timestamp)) {
        this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.count)) {
        this.count = data().deepCopy(fields()[2].schema(), other.count);
        fieldSetFlags()[2] = true;
      }
    }

    /** Gets the value of the 'pageTitle' field */
    public java.lang.CharSequence getPageTitle() {
      return pageTitle;
    }
    
    /** Sets the value of the 'pageTitle' field */
    public LogRecord.Builder setPageTitle(java.lang.CharSequence value) {
      validate(fields()[0], value);
      this.pageTitle = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'pageTitle' field has been set */
    public boolean hasPageTitle() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'pageTitle' field */
    public LogRecord.Builder clearPageTitle() {
      pageTitle = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'timestamp' field */
    public java.lang.Long getTimestamp() {
      return timestamp;
    }
    
    /** Sets the value of the 'timestamp' field */
    public LogRecord.Builder setTimestamp(long value) {
      validate(fields()[1], value);
      this.timestamp = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'timestamp' field has been set */
    public boolean hasTimestamp() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'timestamp' field */
    public LogRecord.Builder clearTimestamp() {
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'count' field */
    public java.lang.Integer getCount() {
      return count;
    }
    
    /** Sets the value of the 'count' field */
    public LogRecord.Builder setCount(int value) {
      validate(fields()[2], value);
      this.count = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'count' field has been set */
    public boolean hasCount() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'count' field */
    public LogRecord.Builder clearCount() {
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public LogRecord build() {
      try {
        LogRecord record = new LogRecord();
        record.pageTitle = fieldSetFlags()[0] ? this.pageTitle : (java.lang.CharSequence) defaultValue(fields()[0]);
        record.timestamp = fieldSetFlags()[1] ? this.timestamp : (java.lang.Long) defaultValue(fields()[1]);
        record.count = fieldSetFlags()[2] ? this.count : (java.lang.Integer) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}
