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