| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | 3 | | // |
| | 4 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 5 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 6 | | // regenerated. |
| | 7 | |
|
| | 8 | | // |
| | 9 | | // This file was autogenerated by a tool. |
| | 10 | | // Do not modify it. |
| | 11 | | // |
| | 12 | |
|
| | 13 | | namespace Microsoft.Azure.Batch |
| | 14 | | { |
| | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| | 16 | | using System; |
| | 17 | | using System.Collections.Generic; |
| | 18 | | using System.Linq; |
| | 19 | |
|
| | 20 | | /// <summary> |
| 114 | 21 | | /// A range of task ids that a <see cref="CloudTask"/> depends on. All tasks with ids in the range must complete suc |
| | 22 | | /// before the dependent task can be scheduled. |
| 114 | 23 | | /// </summary> |
| | 24 | | public partial class TaskIdRange : ITransportObjectProvider<Models.TaskIdRange>, IPropertyMetadata |
| 1 | 25 | | { |
| | 26 | | #region Constructors |
| | 27 | |
|
| 1592 | 28 | | internal TaskIdRange(Models.TaskIdRange protocolObject) |
| | 29 | | { |
| 1480 | 30 | | this.End = protocolObject.End; |
| 1479 | 31 | | this.Start = protocolObject.Start; |
| 1479 | 32 | | } |
| 112 | 33 | |
|
| | 34 | | #endregion Constructors |
| 1 | 35 | |
|
| | 36 | | #region TaskIdRange |
| | 37 | |
|
| 111 | 38 | | /// <summary> |
| 111 | 39 | | /// Gets the last task id in the range. |
| 111 | 40 | | /// </summary> |
| | 41 | | /// <remarks> |
| | 42 | | /// Ranges are inclusive. For example, if a task depends on a range with End 12, then task "12" must complete be |
| | 43 | | /// the task can be scheduled. |
| | 44 | | /// </remarks> |
| 2031 | 45 | | public int End { get; } |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// Gets the first task id in the range. |
| | 49 | | /// </summary> |
| | 50 | | /// <remarks> |
| | 51 | | /// Ranges are inclusive. For example, if a task depends on a range with Start 8, then task "8" must complete be |
| | 52 | | /// the task can be scheduled. |
| | 53 | | /// </remarks> |
| 2031 | 54 | | public int Start { get; } |
| | 55 | |
|
| | 56 | | #endregion // TaskIdRange |
| | 57 | |
|
| | 58 | | #region IPropertyMetadata |
| | 59 | |
|
| | 60 | | bool IModifiable.HasBeenModified |
| | 61 | | { |
| | 62 | | //This class is compile time readonly so it cannot have been modified |
| 0 | 63 | | get { return false; } |
| | 64 | | } |
| | 65 | |
|
| | 66 | | bool IReadOnly.IsReadOnly |
| | 67 | | { |
| 0 | 68 | | get { return true; } |
| | 69 | | set |
| | 70 | | { |
| | 71 | | // This class is compile time readonly already |
| 1480 | 72 | | } |
| | 73 | | } |
| | 74 | |
|
| | 75 | | #endregion // IPropertyMetadata |
| | 76 | |
|
| | 77 | | #region Internal/private methods |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Return a protocol object of the requested type. |
| | 81 | | /// </summary> |
| | 82 | | /// <returns>The protocol object of the requested type.</returns> |
| | 83 | | Models.TaskIdRange ITransportObjectProvider<Models.TaskIdRange>.GetTransportObject() |
| | 84 | | { |
| 450 | 85 | | Models.TaskIdRange result = new Models.TaskIdRange() |
| 450 | 86 | | { |
| 450 | 87 | | End = this.End, |
| 450 | 88 | | Start = this.Start, |
| 450 | 89 | | }; |
| | 90 | |
|
| 450 | 91 | | return result; |
| | 92 | | } |
| | 93 | |
|
| | 94 | | /// <summary> |
| | 95 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | 96 | | /// </summary> |
| | 97 | | internal static IList<TaskIdRange> ConvertFromProtocolCollection(IEnumerable<Models.TaskIdRange> protoCollection |
| | 98 | | { |
| 0 | 99 | | ConcurrentChangeTrackedModifiableList<TaskIdRange> converted = UtilitiesInternal.CollectionToThreadSafeColle |
| 0 | 100 | | items: protoCollection, |
| 0 | 101 | | objectCreationFunc: o => new TaskIdRange(o)); |
| | 102 | |
|
| 0 | 103 | | return converted; |
| | 104 | | } |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | 108 | | /// </summary> |
| | 109 | | internal static IList<TaskIdRange> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.TaskIdRange> protoC |
| | 110 | | { |
| 0 | 111 | | ConcurrentChangeTrackedModifiableList<TaskIdRange> converted = UtilitiesInternal.CollectionToThreadSafeColle |
| 0 | 112 | | items: protoCollection, |
| 0 | 113 | | objectCreationFunc: o => new TaskIdRange(o).Freeze()); |
| | 114 | |
|
| 0 | 115 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | 116 | |
|
| 0 | 117 | | return converted; |
| | 118 | | } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | 122 | | /// and returned as a readonly collection. |
| | 123 | | /// </summary> |
| | 124 | | internal static IReadOnlyList<TaskIdRange> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.TaskIdRange> |
| | 125 | | { |
| 656 | 126 | | IReadOnlyList<TaskIdRange> converted = |
| 656 | 127 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| 656 | 128 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| 656 | 129 | | items: protoCollection, |
| 2475 | 130 | | objectCreationFunc: o => new TaskIdRange(o).Freeze()), o => o.AsReadOnly()); |
| | 131 | |
|
| 656 | 132 | | return converted; |
| | 133 | | } |
| | 134 | |
|
| | 135 | | #endregion // Internal/private methods |
| | 136 | | } |
| | 137 | | } |