001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.io.watcher.driver.task;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroSuspendedTask extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -3338900733222850217L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroSuspendedTask\",\"namespace\":\"org.apache.reef.io.watcher.driver.task\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"activeContext\",\"type\":{\"type\":\"record\",\"name\":\"AvroActiveContext\",\"namespace\":\"org.apache.reef.io.watcher.driver.context\",\"fields\":[{\"name\":\"base\",\"type\":{\"type\":\"record\",\"name\":\"AvroContextBase\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"evaluatorId\",\"type\":\"string\"},{\"name\":\"parentId\",\"type\":[\"string\",\"null\"]},{\"name\":\"evaluatorDescriptor\",\"type\":[{\"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\"}]},\"null\"]}]}}]}},{\"name\":\"get\",\"type\":[\"bytes\",\"null\"]}]}");
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.context.AvroActiveContext activeContext;
018  @Deprecated public java.nio.ByteBuffer get;
019
020  /**
021   * Default constructor.  Note that this does not initialize fields
022   * to their default values from the schema.  If that is desired then
023   * one should use <code>newBuilder()</code>.
024   */
025  public AvroSuspendedTask() {}
026
027  /**
028   * All-args constructor.
029   * @param id The new value for id
030   * @param activeContext The new value for activeContext
031   * @param get The new value for get
032   */
033  public AvroSuspendedTask(java.lang.CharSequence id, org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext, java.nio.ByteBuffer get) {
034    this.id = id;
035    this.activeContext = activeContext;
036    this.get = get;
037  }
038
039  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
040  // Used by DatumWriter.  Applications should not call.
041  public java.lang.Object get(int field$) {
042    switch (field$) {
043    case 0: return id;
044    case 1: return activeContext;
045    case 2: return get;
046    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
047    }
048  }
049
050  // Used by DatumReader.  Applications should not call.
051  @SuppressWarnings(value="unchecked")
052  public void put(int field$, java.lang.Object value$) {
053    switch (field$) {
054    case 0: id = (java.lang.CharSequence)value$; break;
055    case 1: activeContext = (org.apache.reef.io.watcher.driver.context.AvroActiveContext)value$; break;
056    case 2: get = (java.nio.ByteBuffer)value$; break;
057    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
058    }
059  }
060
061  /**
062   * Gets the value of the 'id' field.
063   * @return The value of the 'id' field.
064   */
065  public java.lang.CharSequence getId() {
066    return id;
067  }
068
069  /**
070   * Sets the value of the 'id' field.
071   * @param value the value to set.
072   */
073  public void setId(java.lang.CharSequence value) {
074    this.id = value;
075  }
076
077  /**
078   * Gets the value of the 'activeContext' field.
079   * @return The value of the 'activeContext' field.
080   */
081  public org.apache.reef.io.watcher.driver.context.AvroActiveContext getActiveContext() {
082    return activeContext;
083  }
084
085  /**
086   * Sets the value of the 'activeContext' field.
087   * @param value the value to set.
088   */
089  public void setActiveContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) {
090    this.activeContext = value;
091  }
092
093  /**
094   * Gets the value of the 'get' field.
095   * @return The value of the 'get' field.
096   */
097  public java.nio.ByteBuffer getGet() {
098    return get;
099  }
100
101  /**
102   * Sets the value of the 'get' field.
103   * @param value the value to set.
104   */
105  public void setGet(java.nio.ByteBuffer value) {
106    this.get = value;
107  }
108
109  /**
110   * Creates a new AvroSuspendedTask RecordBuilder.
111   * @return A new AvroSuspendedTask RecordBuilder
112   */
113  public static org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder newBuilder() {
114    return new org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder();
115  }
116
117  /**
118   * Creates a new AvroSuspendedTask RecordBuilder by copying an existing Builder.
119   * @param other The existing builder to copy.
120   * @return A new AvroSuspendedTask RecordBuilder
121   */
122  public static org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder other) {
123    return new org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder(other);
124  }
125
126  /**
127   * Creates a new AvroSuspendedTask RecordBuilder by copying an existing AvroSuspendedTask instance.
128   * @param other The existing instance to copy.
129   * @return A new AvroSuspendedTask RecordBuilder
130   */
131  public static org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroSuspendedTask other) {
132    return new org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder(other);
133  }
134
135  /**
136   * RecordBuilder for AvroSuspendedTask instances.
137   */
138  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroSuspendedTask>
139    implements org.apache.avro.data.RecordBuilder<AvroSuspendedTask> {
140
141    private java.lang.CharSequence id;
142    private org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext;
143    private org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder activeContextBuilder;
144    private java.nio.ByteBuffer get;
145
146    /** Creates a new Builder */
147    private Builder() {
148      super(SCHEMA$);
149    }
150
151    /**
152     * Creates a Builder by copying an existing Builder.
153     * @param other The existing Builder to copy.
154     */
155    private Builder(org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder other) {
156      super(other);
157      if (isValidValue(fields()[0], other.id)) {
158        this.id = data().deepCopy(fields()[0].schema(), other.id);
159        fieldSetFlags()[0] = true;
160      }
161      if (isValidValue(fields()[1], other.activeContext)) {
162        this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext);
163        fieldSetFlags()[1] = true;
164      }
165      if (other.hasActiveContextBuilder()) {
166        this.activeContextBuilder = org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(other.getActiveContextBuilder());
167      }
168      if (isValidValue(fields()[2], other.get)) {
169        this.get = data().deepCopy(fields()[2].schema(), other.get);
170        fieldSetFlags()[2] = true;
171      }
172    }
173
174    /**
175     * Creates a Builder by copying an existing AvroSuspendedTask instance
176     * @param other The existing instance to copy.
177     */
178    private Builder(org.apache.reef.io.watcher.driver.task.AvroSuspendedTask other) {
179            super(SCHEMA$);
180      if (isValidValue(fields()[0], other.id)) {
181        this.id = data().deepCopy(fields()[0].schema(), other.id);
182        fieldSetFlags()[0] = true;
183      }
184      if (isValidValue(fields()[1], other.activeContext)) {
185        this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext);
186        fieldSetFlags()[1] = true;
187      }
188      this.activeContextBuilder = null;
189      if (isValidValue(fields()[2], other.get)) {
190        this.get = data().deepCopy(fields()[2].schema(), other.get);
191        fieldSetFlags()[2] = true;
192      }
193    }
194
195    /**
196      * Gets the value of the 'id' field.
197      * @return The value.
198      */
199    public java.lang.CharSequence getId() {
200      return id;
201    }
202
203    /**
204      * Sets the value of the 'id' field.
205      * @param value The value of 'id'.
206      * @return This builder.
207      */
208    public org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder setId(java.lang.CharSequence value) {
209      validate(fields()[0], value);
210      this.id = value;
211      fieldSetFlags()[0] = true;
212      return this;
213    }
214
215    /**
216      * Checks whether the 'id' field has been set.
217      * @return True if the 'id' field has been set, false otherwise.
218      */
219    public boolean hasId() {
220      return fieldSetFlags()[0];
221    }
222
223
224    /**
225      * Clears the value of the 'id' field.
226      * @return This builder.
227      */
228    public org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder clearId() {
229      id = null;
230      fieldSetFlags()[0] = false;
231      return this;
232    }
233
234    /**
235      * Gets the value of the 'activeContext' field.
236      * @return The value.
237      */
238    public org.apache.reef.io.watcher.driver.context.AvroActiveContext getActiveContext() {
239      return activeContext;
240    }
241
242    /**
243      * Sets the value of the 'activeContext' field.
244      * @param value The value of 'activeContext'.
245      * @return This builder.
246      */
247    public org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder setActiveContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) {
248      validate(fields()[1], value);
249      this.activeContextBuilder = null;
250      this.activeContext = value;
251      fieldSetFlags()[1] = true;
252      return this;
253    }
254
255    /**
256      * Checks whether the 'activeContext' field has been set.
257      * @return True if the 'activeContext' field has been set, false otherwise.
258      */
259    public boolean hasActiveContext() {
260      return fieldSetFlags()[1];
261    }
262
263    /**
264     * Gets the Builder instance for the 'activeContext' field and creates one if it doesn't exist yet.
265     * @return This builder.
266     */
267    public org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder getActiveContextBuilder() {
268      if (activeContextBuilder == null) {
269        if (hasActiveContext()) {
270          setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(activeContext));
271        } else {
272          setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder());
273        }
274      }
275      return activeContextBuilder;
276    }
277
278    /**
279     * Sets the Builder instance for the 'activeContext' field
280     * @param value The builder instance that must be set.
281     * @return This builder.
282     */
283    public org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder value) {
284      clearActiveContext();
285      activeContextBuilder = value;
286      return this;
287    }
288
289    /**
290     * Checks whether the 'activeContext' field has an active Builder instance
291     * @return True if the 'activeContext' field has an active Builder instance
292     */
293    public boolean hasActiveContextBuilder() {
294      return activeContextBuilder != null;
295    }
296
297    /**
298      * Clears the value of the 'activeContext' field.
299      * @return This builder.
300      */
301    public org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder clearActiveContext() {
302      activeContext = null;
303      activeContextBuilder = null;
304      fieldSetFlags()[1] = false;
305      return this;
306    }
307
308    /**
309      * Gets the value of the 'get' field.
310      * @return The value.
311      */
312    public java.nio.ByteBuffer getGet() {
313      return get;
314    }
315
316    /**
317      * Sets the value of the 'get' field.
318      * @param value The value of 'get'.
319      * @return This builder.
320      */
321    public org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder setGet(java.nio.ByteBuffer value) {
322      validate(fields()[2], value);
323      this.get = value;
324      fieldSetFlags()[2] = true;
325      return this;
326    }
327
328    /**
329      * Checks whether the 'get' field has been set.
330      * @return True if the 'get' field has been set, false otherwise.
331      */
332    public boolean hasGet() {
333      return fieldSetFlags()[2];
334    }
335
336
337    /**
338      * Clears the value of the 'get' field.
339      * @return This builder.
340      */
341    public org.apache.reef.io.watcher.driver.task.AvroSuspendedTask.Builder clearGet() {
342      get = null;
343      fieldSetFlags()[2] = false;
344      return this;
345    }
346
347    @Override
348    public AvroSuspendedTask build() {
349      try {
350        AvroSuspendedTask record = new AvroSuspendedTask();
351        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
352        if (activeContextBuilder != null) {
353          record.activeContext = this.activeContextBuilder.build();
354        } else {
355          record.activeContext = fieldSetFlags()[1] ? this.activeContext : (org.apache.reef.io.watcher.driver.context.AvroActiveContext) defaultValue(fields()[1]);
356        }
357        record.get = fieldSetFlags()[2] ? this.get : (java.nio.ByteBuffer) defaultValue(fields()[2]);
358        return record;
359      } catch (Exception e) {
360        throw new org.apache.avro.AvroRuntimeException(e);
361      }
362    }
363  }
364
365  private static final org.apache.avro.io.DatumWriter
366    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
367
368  @Override public void writeExternal(java.io.ObjectOutput out)
369    throws java.io.IOException {
370    WRITER$.write(this, SpecificData.getEncoder(out));
371  }
372
373  private static final org.apache.avro.io.DatumReader
374    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
375
376  @Override public void readExternal(java.io.ObjectInput in)
377    throws java.io.IOException {
378    READER$.read(this, SpecificData.getDecoder(in));
379  }
380
381}