001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.io.data.loading.avro;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroEvaluatorRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -7522174834381464354L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroEvaluatorRequest\",\"namespace\":\"org.apache.reef.io.data.loading.avro\",\"fields\":[{\"name\":\"megaBytes\",\"type\":\"int\"},{\"name\":\"number\",\"type\":\"int\"},{\"name\":\"cores\",\"type\":\"int\"},{\"name\":\"nodeNames\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"rackNames\",\"type\":{\"type\":\"array\",\"items\":\"string\"}}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public int megaBytes;
017  @Deprecated public int number;
018  @Deprecated public int cores;
019  @Deprecated public java.util.List<java.lang.CharSequence> nodeNames;
020  @Deprecated public java.util.List<java.lang.CharSequence> rackNames;
021
022  /**
023   * Default constructor.  Note that this does not initialize fields
024   * to their default values from the schema.  If that is desired then
025   * one should use <code>newBuilder()</code>.
026   */
027  public AvroEvaluatorRequest() {}
028
029  /**
030   * All-args constructor.
031   * @param megaBytes The new value for megaBytes
032   * @param number The new value for number
033   * @param cores The new value for cores
034   * @param nodeNames The new value for nodeNames
035   * @param rackNames The new value for rackNames
036   */
037  public AvroEvaluatorRequest(java.lang.Integer megaBytes, java.lang.Integer number, java.lang.Integer cores, java.util.List<java.lang.CharSequence> nodeNames, java.util.List<java.lang.CharSequence> rackNames) {
038    this.megaBytes = megaBytes;
039    this.number = number;
040    this.cores = cores;
041    this.nodeNames = nodeNames;
042    this.rackNames = rackNames;
043  }
044
045  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
046  // Used by DatumWriter.  Applications should not call.
047  public java.lang.Object get(int field$) {
048    switch (field$) {
049    case 0: return megaBytes;
050    case 1: return number;
051    case 2: return cores;
052    case 3: return nodeNames;
053    case 4: return rackNames;
054    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
055    }
056  }
057
058  // Used by DatumReader.  Applications should not call.
059  @SuppressWarnings(value="unchecked")
060  public void put(int field$, java.lang.Object value$) {
061    switch (field$) {
062    case 0: megaBytes = (java.lang.Integer)value$; break;
063    case 1: number = (java.lang.Integer)value$; break;
064    case 2: cores = (java.lang.Integer)value$; break;
065    case 3: nodeNames = (java.util.List<java.lang.CharSequence>)value$; break;
066    case 4: rackNames = (java.util.List<java.lang.CharSequence>)value$; break;
067    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
068    }
069  }
070
071  /**
072   * Gets the value of the 'megaBytes' field.
073   * @return The value of the 'megaBytes' field.
074   */
075  public java.lang.Integer getMegaBytes() {
076    return megaBytes;
077  }
078
079  /**
080   * Sets the value of the 'megaBytes' field.
081   * @param value the value to set.
082   */
083  public void setMegaBytes(java.lang.Integer value) {
084    this.megaBytes = value;
085  }
086
087  /**
088   * Gets the value of the 'number' field.
089   * @return The value of the 'number' field.
090   */
091  public java.lang.Integer getNumber() {
092    return number;
093  }
094
095  /**
096   * Sets the value of the 'number' field.
097   * @param value the value to set.
098   */
099  public void setNumber(java.lang.Integer value) {
100    this.number = value;
101  }
102
103  /**
104   * Gets the value of the 'cores' field.
105   * @return The value of the 'cores' field.
106   */
107  public java.lang.Integer getCores() {
108    return cores;
109  }
110
111  /**
112   * Sets the value of the 'cores' field.
113   * @param value the value to set.
114   */
115  public void setCores(java.lang.Integer value) {
116    this.cores = value;
117  }
118
119  /**
120   * Gets the value of the 'nodeNames' field.
121   * @return The value of the 'nodeNames' field.
122   */
123  public java.util.List<java.lang.CharSequence> getNodeNames() {
124    return nodeNames;
125  }
126
127  /**
128   * Sets the value of the 'nodeNames' field.
129   * @param value the value to set.
130   */
131  public void setNodeNames(java.util.List<java.lang.CharSequence> value) {
132    this.nodeNames = value;
133  }
134
135  /**
136   * Gets the value of the 'rackNames' field.
137   * @return The value of the 'rackNames' field.
138   */
139  public java.util.List<java.lang.CharSequence> getRackNames() {
140    return rackNames;
141  }
142
143  /**
144   * Sets the value of the 'rackNames' field.
145   * @param value the value to set.
146   */
147  public void setRackNames(java.util.List<java.lang.CharSequence> value) {
148    this.rackNames = value;
149  }
150
151  /**
152   * Creates a new AvroEvaluatorRequest RecordBuilder.
153   * @return A new AvroEvaluatorRequest RecordBuilder
154   */
155  public static org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder newBuilder() {
156    return new org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder();
157  }
158
159  /**
160   * Creates a new AvroEvaluatorRequest RecordBuilder by copying an existing Builder.
161   * @param other The existing builder to copy.
162   * @return A new AvroEvaluatorRequest RecordBuilder
163   */
164  public static org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder newBuilder(org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder other) {
165    return new org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder(other);
166  }
167
168  /**
169   * Creates a new AvroEvaluatorRequest RecordBuilder by copying an existing AvroEvaluatorRequest instance.
170   * @param other The existing instance to copy.
171   * @return A new AvroEvaluatorRequest RecordBuilder
172   */
173  public static org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder newBuilder(org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest other) {
174    return new org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder(other);
175  }
176
177  /**
178   * RecordBuilder for AvroEvaluatorRequest instances.
179   */
180  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroEvaluatorRequest>
181    implements org.apache.avro.data.RecordBuilder<AvroEvaluatorRequest> {
182
183    private int megaBytes;
184    private int number;
185    private int cores;
186    private java.util.List<java.lang.CharSequence> nodeNames;
187    private java.util.List<java.lang.CharSequence> rackNames;
188
189    /** Creates a new Builder */
190    private Builder() {
191      super(SCHEMA$);
192    }
193
194    /**
195     * Creates a Builder by copying an existing Builder.
196     * @param other The existing Builder to copy.
197     */
198    private Builder(org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder other) {
199      super(other);
200      if (isValidValue(fields()[0], other.megaBytes)) {
201        this.megaBytes = data().deepCopy(fields()[0].schema(), other.megaBytes);
202        fieldSetFlags()[0] = true;
203      }
204      if (isValidValue(fields()[1], other.number)) {
205        this.number = data().deepCopy(fields()[1].schema(), other.number);
206        fieldSetFlags()[1] = true;
207      }
208      if (isValidValue(fields()[2], other.cores)) {
209        this.cores = data().deepCopy(fields()[2].schema(), other.cores);
210        fieldSetFlags()[2] = true;
211      }
212      if (isValidValue(fields()[3], other.nodeNames)) {
213        this.nodeNames = data().deepCopy(fields()[3].schema(), other.nodeNames);
214        fieldSetFlags()[3] = true;
215      }
216      if (isValidValue(fields()[4], other.rackNames)) {
217        this.rackNames = data().deepCopy(fields()[4].schema(), other.rackNames);
218        fieldSetFlags()[4] = true;
219      }
220    }
221
222    /**
223     * Creates a Builder by copying an existing AvroEvaluatorRequest instance
224     * @param other The existing instance to copy.
225     */
226    private Builder(org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest other) {
227            super(SCHEMA$);
228      if (isValidValue(fields()[0], other.megaBytes)) {
229        this.megaBytes = data().deepCopy(fields()[0].schema(), other.megaBytes);
230        fieldSetFlags()[0] = true;
231      }
232      if (isValidValue(fields()[1], other.number)) {
233        this.number = data().deepCopy(fields()[1].schema(), other.number);
234        fieldSetFlags()[1] = true;
235      }
236      if (isValidValue(fields()[2], other.cores)) {
237        this.cores = data().deepCopy(fields()[2].schema(), other.cores);
238        fieldSetFlags()[2] = true;
239      }
240      if (isValidValue(fields()[3], other.nodeNames)) {
241        this.nodeNames = data().deepCopy(fields()[3].schema(), other.nodeNames);
242        fieldSetFlags()[3] = true;
243      }
244      if (isValidValue(fields()[4], other.rackNames)) {
245        this.rackNames = data().deepCopy(fields()[4].schema(), other.rackNames);
246        fieldSetFlags()[4] = true;
247      }
248    }
249
250    /**
251      * Gets the value of the 'megaBytes' field.
252      * @return The value.
253      */
254    public java.lang.Integer getMegaBytes() {
255      return megaBytes;
256    }
257
258    /**
259      * Sets the value of the 'megaBytes' field.
260      * @param value The value of 'megaBytes'.
261      * @return This builder.
262      */
263    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder setMegaBytes(int value) {
264      validate(fields()[0], value);
265      this.megaBytes = value;
266      fieldSetFlags()[0] = true;
267      return this;
268    }
269
270    /**
271      * Checks whether the 'megaBytes' field has been set.
272      * @return True if the 'megaBytes' field has been set, false otherwise.
273      */
274    public boolean hasMegaBytes() {
275      return fieldSetFlags()[0];
276    }
277
278
279    /**
280      * Clears the value of the 'megaBytes' field.
281      * @return This builder.
282      */
283    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder clearMegaBytes() {
284      fieldSetFlags()[0] = false;
285      return this;
286    }
287
288    /**
289      * Gets the value of the 'number' field.
290      * @return The value.
291      */
292    public java.lang.Integer getNumber() {
293      return number;
294    }
295
296    /**
297      * Sets the value of the 'number' field.
298      * @param value The value of 'number'.
299      * @return This builder.
300      */
301    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder setNumber(int value) {
302      validate(fields()[1], value);
303      this.number = value;
304      fieldSetFlags()[1] = true;
305      return this;
306    }
307
308    /**
309      * Checks whether the 'number' field has been set.
310      * @return True if the 'number' field has been set, false otherwise.
311      */
312    public boolean hasNumber() {
313      return fieldSetFlags()[1];
314    }
315
316
317    /**
318      * Clears the value of the 'number' field.
319      * @return This builder.
320      */
321    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder clearNumber() {
322      fieldSetFlags()[1] = false;
323      return this;
324    }
325
326    /**
327      * Gets the value of the 'cores' field.
328      * @return The value.
329      */
330    public java.lang.Integer getCores() {
331      return cores;
332    }
333
334    /**
335      * Sets the value of the 'cores' field.
336      * @param value The value of 'cores'.
337      * @return This builder.
338      */
339    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder setCores(int value) {
340      validate(fields()[2], value);
341      this.cores = value;
342      fieldSetFlags()[2] = true;
343      return this;
344    }
345
346    /**
347      * Checks whether the 'cores' field has been set.
348      * @return True if the 'cores' field has been set, false otherwise.
349      */
350    public boolean hasCores() {
351      return fieldSetFlags()[2];
352    }
353
354
355    /**
356      * Clears the value of the 'cores' field.
357      * @return This builder.
358      */
359    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder clearCores() {
360      fieldSetFlags()[2] = false;
361      return this;
362    }
363
364    /**
365      * Gets the value of the 'nodeNames' field.
366      * @return The value.
367      */
368    public java.util.List<java.lang.CharSequence> getNodeNames() {
369      return nodeNames;
370    }
371
372    /**
373      * Sets the value of the 'nodeNames' field.
374      * @param value The value of 'nodeNames'.
375      * @return This builder.
376      */
377    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder setNodeNames(java.util.List<java.lang.CharSequence> value) {
378      validate(fields()[3], value);
379      this.nodeNames = value;
380      fieldSetFlags()[3] = true;
381      return this;
382    }
383
384    /**
385      * Checks whether the 'nodeNames' field has been set.
386      * @return True if the 'nodeNames' field has been set, false otherwise.
387      */
388    public boolean hasNodeNames() {
389      return fieldSetFlags()[3];
390    }
391
392
393    /**
394      * Clears the value of the 'nodeNames' field.
395      * @return This builder.
396      */
397    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder clearNodeNames() {
398      nodeNames = null;
399      fieldSetFlags()[3] = false;
400      return this;
401    }
402
403    /**
404      * Gets the value of the 'rackNames' field.
405      * @return The value.
406      */
407    public java.util.List<java.lang.CharSequence> getRackNames() {
408      return rackNames;
409    }
410
411    /**
412      * Sets the value of the 'rackNames' field.
413      * @param value The value of 'rackNames'.
414      * @return This builder.
415      */
416    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder setRackNames(java.util.List<java.lang.CharSequence> value) {
417      validate(fields()[4], value);
418      this.rackNames = value;
419      fieldSetFlags()[4] = true;
420      return this;
421    }
422
423    /**
424      * Checks whether the 'rackNames' field has been set.
425      * @return True if the 'rackNames' field has been set, false otherwise.
426      */
427    public boolean hasRackNames() {
428      return fieldSetFlags()[4];
429    }
430
431
432    /**
433      * Clears the value of the 'rackNames' field.
434      * @return This builder.
435      */
436    public org.apache.reef.io.data.loading.avro.AvroEvaluatorRequest.Builder clearRackNames() {
437      rackNames = null;
438      fieldSetFlags()[4] = false;
439      return this;
440    }
441
442    @Override
443    public AvroEvaluatorRequest build() {
444      try {
445        AvroEvaluatorRequest record = new AvroEvaluatorRequest();
446        record.megaBytes = fieldSetFlags()[0] ? this.megaBytes : (java.lang.Integer) defaultValue(fields()[0]);
447        record.number = fieldSetFlags()[1] ? this.number : (java.lang.Integer) defaultValue(fields()[1]);
448        record.cores = fieldSetFlags()[2] ? this.cores : (java.lang.Integer) defaultValue(fields()[2]);
449        record.nodeNames = fieldSetFlags()[3] ? this.nodeNames : (java.util.List<java.lang.CharSequence>) defaultValue(fields()[3]);
450        record.rackNames = fieldSetFlags()[4] ? this.rackNames : (java.util.List<java.lang.CharSequence>) defaultValue(fields()[4]);
451        return record;
452      } catch (Exception e) {
453        throw new org.apache.avro.AvroRuntimeException(e);
454      }
455    }
456  }
457
458  private static final org.apache.avro.io.DatumWriter
459    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
460
461  @Override public void writeExternal(java.io.ObjectOutput out)
462    throws java.io.IOException {
463    WRITER$.write(this, SpecificData.getEncoder(out));
464  }
465
466  private static final org.apache.avro.io.DatumReader
467    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
468
469  @Override public void readExternal(java.io.ObjectInput in)
470    throws java.io.IOException {
471    READER$.read(this, SpecificData.getDecoder(in));
472  }
473
474}