This project has retired. For details please refer to its Attic page.
Source code
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 AvroAllocatedEvaluator extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -4031059340839902026L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroAllocatedEvaluator\",\"namespace\":\"org.apache.reef.io.watcher.driver.evaluator\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"evaluatorDescriptor\",\"type\":{\"type\":\"record\",\"name\":\"AvroEvaluatorDescriptor\",\"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 java.lang.CharSequence id;
017  @Deprecated public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor evaluatorDescriptor;
018
019  /**
020   * Default constructor.  Note that this does not initialize fields
021   * to their default values from the schema.  If that is desired then
022   * one should use <code>newBuilder()</code>.
023   */
024  public AvroAllocatedEvaluator() {}
025
026  /**
027   * All-args constructor.
028   * @param id The new value for id
029   * @param evaluatorDescriptor The new value for evaluatorDescriptor
030   */
031  public AvroAllocatedEvaluator(java.lang.CharSequence id, org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor evaluatorDescriptor) {
032    this.id = id;
033    this.evaluatorDescriptor = evaluatorDescriptor;
034  }
035
036  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
037  // Used by DatumWriter.  Applications should not call.
038  public java.lang.Object get(int field$) {
039    switch (field$) {
040    case 0: return id;
041    case 1: return evaluatorDescriptor;
042    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
043    }
044  }
045
046  // Used by DatumReader.  Applications should not call.
047  @SuppressWarnings(value="unchecked")
048  public void put(int field$, java.lang.Object value$) {
049    switch (field$) {
050    case 0: id = (java.lang.CharSequence)value$; break;
051    case 1: evaluatorDescriptor = (org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor)value$; break;
052    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
053    }
054  }
055
056  /**
057   * Gets the value of the 'id' field.
058   * @return The value of the 'id' field.
059   */
060  public java.lang.CharSequence getId() {
061    return id;
062  }
063
064  /**
065   * Sets the value of the 'id' field.
066   * @param value the value to set.
067   */
068  public void setId(java.lang.CharSequence value) {
069    this.id = value;
070  }
071
072  /**
073   * Gets the value of the 'evaluatorDescriptor' field.
074   * @return The value of the 'evaluatorDescriptor' field.
075   */
076  public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor getEvaluatorDescriptor() {
077    return evaluatorDescriptor;
078  }
079
080  /**
081   * Sets the value of the 'evaluatorDescriptor' field.
082   * @param value the value to set.
083   */
084  public void setEvaluatorDescriptor(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor value) {
085    this.evaluatorDescriptor = value;
086  }
087
088  /**
089   * Creates a new AvroAllocatedEvaluator RecordBuilder.
090   * @return A new AvroAllocatedEvaluator RecordBuilder
091   */
092  public static org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder newBuilder() {
093    return new org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder();
094  }
095
096  /**
097   * Creates a new AvroAllocatedEvaluator RecordBuilder by copying an existing Builder.
098   * @param other The existing builder to copy.
099   * @return A new AvroAllocatedEvaluator RecordBuilder
100   */
101  public static org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder newBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder other) {
102    return new org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder(other);
103  }
104
105  /**
106   * Creates a new AvroAllocatedEvaluator RecordBuilder by copying an existing AvroAllocatedEvaluator instance.
107   * @param other The existing instance to copy.
108   * @return A new AvroAllocatedEvaluator RecordBuilder
109   */
110  public static org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder newBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator other) {
111    return new org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder(other);
112  }
113
114  /**
115   * RecordBuilder for AvroAllocatedEvaluator instances.
116   */
117  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroAllocatedEvaluator>
118    implements org.apache.avro.data.RecordBuilder<AvroAllocatedEvaluator> {
119
120    private java.lang.CharSequence id;
121    private org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor evaluatorDescriptor;
122    private org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.Builder evaluatorDescriptorBuilder;
123
124    /** Creates a new Builder */
125    private Builder() {
126      super(SCHEMA$);
127    }
128
129    /**
130     * Creates a Builder by copying an existing Builder.
131     * @param other The existing Builder to copy.
132     */
133    private Builder(org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder other) {
134      super(other);
135      if (isValidValue(fields()[0], other.id)) {
136        this.id = data().deepCopy(fields()[0].schema(), other.id);
137        fieldSetFlags()[0] = true;
138      }
139      if (isValidValue(fields()[1], other.evaluatorDescriptor)) {
140        this.evaluatorDescriptor = data().deepCopy(fields()[1].schema(), other.evaluatorDescriptor);
141        fieldSetFlags()[1] = true;
142      }
143      if (other.hasEvaluatorDescriptorBuilder()) {
144        this.evaluatorDescriptorBuilder = org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.newBuilder(other.getEvaluatorDescriptorBuilder());
145      }
146    }
147
148    /**
149     * Creates a Builder by copying an existing AvroAllocatedEvaluator instance
150     * @param other The existing instance to copy.
151     */
152    private Builder(org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator other) {
153            super(SCHEMA$);
154      if (isValidValue(fields()[0], other.id)) {
155        this.id = data().deepCopy(fields()[0].schema(), other.id);
156        fieldSetFlags()[0] = true;
157      }
158      if (isValidValue(fields()[1], other.evaluatorDescriptor)) {
159        this.evaluatorDescriptor = data().deepCopy(fields()[1].schema(), other.evaluatorDescriptor);
160        fieldSetFlags()[1] = true;
161      }
162      this.evaluatorDescriptorBuilder = null;
163    }
164
165    /**
166      * Gets the value of the 'id' field.
167      * @return The value.
168      */
169    public java.lang.CharSequence getId() {
170      return id;
171    }
172
173    /**
174      * Sets the value of the 'id' field.
175      * @param value The value of 'id'.
176      * @return This builder.
177      */
178    public org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder setId(java.lang.CharSequence value) {
179      validate(fields()[0], value);
180      this.id = value;
181      fieldSetFlags()[0] = true;
182      return this;
183    }
184
185    /**
186      * Checks whether the 'id' field has been set.
187      * @return True if the 'id' field has been set, false otherwise.
188      */
189    public boolean hasId() {
190      return fieldSetFlags()[0];
191    }
192
193
194    /**
195      * Clears the value of the 'id' field.
196      * @return This builder.
197      */
198    public org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder clearId() {
199      id = null;
200      fieldSetFlags()[0] = false;
201      return this;
202    }
203
204    /**
205      * Gets the value of the 'evaluatorDescriptor' field.
206      * @return The value.
207      */
208    public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor getEvaluatorDescriptor() {
209      return evaluatorDescriptor;
210    }
211
212    /**
213      * Sets the value of the 'evaluatorDescriptor' field.
214      * @param value The value of 'evaluatorDescriptor'.
215      * @return This builder.
216      */
217    public org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder setEvaluatorDescriptor(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor value) {
218      validate(fields()[1], value);
219      this.evaluatorDescriptorBuilder = null;
220      this.evaluatorDescriptor = value;
221      fieldSetFlags()[1] = true;
222      return this;
223    }
224
225    /**
226      * Checks whether the 'evaluatorDescriptor' field has been set.
227      * @return True if the 'evaluatorDescriptor' field has been set, false otherwise.
228      */
229    public boolean hasEvaluatorDescriptor() {
230      return fieldSetFlags()[1];
231    }
232
233    /**
234     * Gets the Builder instance for the 'evaluatorDescriptor' field and creates one if it doesn't exist yet.
235     * @return This builder.
236     */
237    public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.Builder getEvaluatorDescriptorBuilder() {
238      if (evaluatorDescriptorBuilder == null) {
239        if (hasEvaluatorDescriptor()) {
240          setEvaluatorDescriptorBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.newBuilder(evaluatorDescriptor));
241        } else {
242          setEvaluatorDescriptorBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.newBuilder());
243        }
244      }
245      return evaluatorDescriptorBuilder;
246    }
247
248    /**
249     * Sets the Builder instance for the 'evaluatorDescriptor' field
250     * @param value The builder instance that must be set.
251     * @return This builder.
252     */
253    public org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder setEvaluatorDescriptorBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.Builder value) {
254      clearEvaluatorDescriptor();
255      evaluatorDescriptorBuilder = value;
256      return this;
257    }
258
259    /**
260     * Checks whether the 'evaluatorDescriptor' field has an active Builder instance
261     * @return True if the 'evaluatorDescriptor' field has an active Builder instance
262     */
263    public boolean hasEvaluatorDescriptorBuilder() {
264      return evaluatorDescriptorBuilder != null;
265    }
266
267    /**
268      * Clears the value of the 'evaluatorDescriptor' field.
269      * @return This builder.
270      */
271    public org.apache.reef.io.watcher.driver.evaluator.AvroAllocatedEvaluator.Builder clearEvaluatorDescriptor() {
272      evaluatorDescriptor = null;
273      evaluatorDescriptorBuilder = null;
274      fieldSetFlags()[1] = false;
275      return this;
276    }
277
278    @Override
279    public AvroAllocatedEvaluator build() {
280      try {
281        AvroAllocatedEvaluator record = new AvroAllocatedEvaluator();
282        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
283        if (evaluatorDescriptorBuilder != null) {
284          record.evaluatorDescriptor = this.evaluatorDescriptorBuilder.build();
285        } else {
286          record.evaluatorDescriptor = fieldSetFlags()[1] ? this.evaluatorDescriptor : (org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor) defaultValue(fields()[1]);
287        }
288        return record;
289      } catch (Exception e) {
290        throw new org.apache.avro.AvroRuntimeException(e);
291      }
292    }
293  }
294
295  private static final org.apache.avro.io.DatumWriter
296    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
297
298  @Override public void writeExternal(java.io.ObjectOutput out)
299    throws java.io.IOException {
300    WRITER$.write(this, SpecificData.getEncoder(out));
301  }
302
303  private static final org.apache.avro.io.DatumReader
304    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
305
306  @Override public void readExternal(java.io.ObjectInput in)
307    throws java.io.IOException {
308    READER$.read(this, SpecificData.getDecoder(in));
309  }
310
311}