You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
311 lines
11 KiB
311 lines
11 KiB
#Region "Microsoft.VisualBasic::a569a13cc7b75b8c8e7719f420966908, Google.Protobuf\WellKnownTypes\Duration.vb"
|
|
|
|
' Author:
|
|
'
|
|
' asuka (amethyst.asuka@gcmodeller.org)
|
|
' xie (genetics@smrucc.org)
|
|
' xieguigang (xie.guigang@live.com)
|
|
'
|
|
' Copyright (c) 2018 GPL3 Licensed
|
|
'
|
|
'
|
|
' GNU GENERAL PUBLIC LICENSE (GPL3)
|
|
'
|
|
'
|
|
' This program is free software: you can redistribute it and/or modify
|
|
' it under the terms of the GNU General Public License as published by
|
|
' the Free Software Foundation, either version 3 of the License, or
|
|
' (at your option) any later version.
|
|
'
|
|
' This program is distributed in the hope that it will be useful,
|
|
' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
' GNU General Public License for more details.
|
|
'
|
|
' You should have received a copy of the GNU General Public License
|
|
' along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
' /********************************************************************************/
|
|
|
|
' Summaries:
|
|
|
|
' Module DurationReflection
|
|
'
|
|
' Properties: Descriptor
|
|
'
|
|
' Constructor: (+1 Overloads) Sub New
|
|
'
|
|
' Class Duration
|
|
'
|
|
' Properties: Descriptor, DescriptorProp, Nanos, Parser, Seconds
|
|
'
|
|
' Constructor: (+2 Overloads) Sub New
|
|
'
|
|
' Function: CalculateSize, Clone, (+2 Overloads) Equals, GetHashCode, ToString
|
|
'
|
|
' Sub: (+2 Overloads) MergeFrom, OnConstruction, WriteTo
|
|
'
|
|
'
|
|
' /********************************************************************************/
|
|
|
|
#End Region
|
|
|
|
' Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
' source: google/protobuf/duration.proto
|
|
#Region "Designer generated code"
|
|
|
|
Imports Microsoft.VisualBasic.Language
|
|
Imports pbr = Google.Protobuf.Reflection
|
|
|
|
Namespace Google.Protobuf.WellKnownTypes
|
|
|
|
''' <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary>
|
|
Public Partial Module DurationReflection
|
|
|
|
#Region "Descriptor"
|
|
''' <summary>File descriptor for google/protobuf/duration.proto</summary>
|
|
Public ReadOnly Property Descriptor As pbr.FileDescriptor
|
|
Get
|
|
Return descriptorField
|
|
End Get
|
|
End Property
|
|
|
|
Private descriptorField As pbr.FileDescriptor
|
|
|
|
Sub New()
|
|
Dim descriptorData As Byte() = Global.System.Convert.FromBase64String(String.Concat("Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq", "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9uoAEB", "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", "bzM="))
|
|
descriptorField = pbr.FileDescriptor.FromGeneratedCode(descriptorData, New pbr.FileDescriptor() {}, New pbr.GeneratedClrTypeInfo(Nothing, New pbr.GeneratedClrTypeInfo() {New pbr.GeneratedClrTypeInfo(GetType(Global.Google.Protobuf.WellKnownTypes.Duration), Global.Google.Protobuf.WellKnownTypes.Duration.Parser, {"Seconds", "Nanos"}, Nothing, Nothing, Nothing)}))
|
|
End Sub
|
|
#End Region
|
|
|
|
End Module
|
|
#Region "Messages"
|
|
''' <summary>
|
|
''' A Duration represents a signed, fixed-length span of time represented
|
|
''' as a count of seconds and fractions of seconds at nanosecond
|
|
''' resolution. It is independent of any calendar and concepts like "day"
|
|
''' or "month". It is related to Timestamp in that the difference between
|
|
''' two Timestamp values is a Duration and it can be added or subtracted
|
|
''' from a Timestamp. Range is approximately +-10,000 years.
|
|
'''
|
|
''' Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
'''
|
|
''' Timestamp start = ...;
|
|
''' Timestamp end = ...;
|
|
''' Duration duration = ...;
|
|
'''
|
|
''' duration.seconds = end.seconds - start.seconds;
|
|
''' duration.nanos = end.nanos - start.nanos;
|
|
'''
|
|
''' if (duration.seconds < 0 && duration.nanos > 0) {
|
|
''' duration.seconds += 1;
|
|
''' duration.nanos -= 1000000000;
|
|
''' } else if (durations.seconds > 0 && duration.nanos < 0) {
|
|
''' duration.seconds -= 1;
|
|
''' duration.nanos += 1000000000;
|
|
''' }
|
|
'''
|
|
''' Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
'''
|
|
''' Timestamp start = ...;
|
|
''' Duration duration = ...;
|
|
''' Timestamp end = ...;
|
|
'''
|
|
''' end.seconds = start.seconds + duration.seconds;
|
|
''' end.nanos = start.nanos + duration.nanos;
|
|
'''
|
|
''' if (end.nanos < 0) {
|
|
''' end.seconds -= 1;
|
|
''' end.nanos += 1000000000;
|
|
''' } else if (end.nanos >= 1000000000) {
|
|
''' end.seconds += 1;
|
|
''' end.nanos -= 1000000000;
|
|
''' }
|
|
''' </summary>
|
|
Public NotInheritable Partial Class Duration
|
|
Implements IMessageType(Of Duration)
|
|
|
|
Private Shared ReadOnly _parser As MessageParserType(Of Duration) = New MessageParserType(Of Duration)(Function() New Duration())
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Shared ReadOnly Property Parser As MessageParserType(Of Duration)
|
|
Get
|
|
Return _parser
|
|
End Get
|
|
End Property
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Shared ReadOnly Property DescriptorProp As pbr.MessageDescriptor
|
|
Get
|
|
Return Global.Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes(0)
|
|
End Get
|
|
End Property
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Private ReadOnly Property Descriptor As pbr.MessageDescriptor Implements IMessage.Descriptor
|
|
Get
|
|
Return DescriptorProp
|
|
End Get
|
|
End Property
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Sub New()
|
|
OnConstruction()
|
|
End Sub
|
|
|
|
Partial Private Sub OnConstruction()
|
|
End Sub
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Sub New(other As Duration)
|
|
Me.New()
|
|
seconds_ = other.seconds_
|
|
nanos_ = other.nanos_
|
|
End Sub
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Function Clone() As Duration Implements IDeepCloneable(Of Duration).Clone
|
|
Return New Duration(Me)
|
|
End Function
|
|
|
|
''' <summary>Field number for the "seconds" field.</summary>
|
|
Public Const SecondsFieldNumber As Integer = 1
|
|
Private seconds_ As Long
|
|
''' <summary>
|
|
''' Signed seconds of the span of time. Must be from -315,576,000,000
|
|
''' to +315,576,000,000 inclusive.
|
|
''' </summary>
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Property Seconds As Long
|
|
Get
|
|
Return seconds_
|
|
End Get
|
|
Set(value As Long)
|
|
seconds_ = value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>Field number for the "nanos" field.</summary>
|
|
Public Const NanosFieldNumber As Integer = 2
|
|
Private nanos_ As Integer
|
|
''' <summary>
|
|
''' Signed fractions of a second at nanosecond resolution of the span
|
|
''' of time. Durations less than one second are represented with a 0
|
|
''' `seconds` field and a positive or negative `nanos` field. For durations
|
|
''' of one second or more, a non-zero value for the `nanos` field must be
|
|
''' of the same sign as the `seconds` field. Must be from -999,999,999
|
|
''' to +999,999,999 inclusive.
|
|
''' </summary>
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Property Nanos As Integer
|
|
Get
|
|
Return nanos_
|
|
End Get
|
|
Set(value As Integer)
|
|
nanos_ = value
|
|
End Set
|
|
End Property
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Overrides Function Equals(other As Object) As Boolean
|
|
Return Equals(TryCast(other, Duration))
|
|
End Function
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Overloads Function Equals(other As Duration) As Boolean Implements IEquatable(Of Duration).Equals
|
|
If ReferenceEquals(other, Nothing) Then
|
|
Return False
|
|
End If
|
|
|
|
If ReferenceEquals(other, Me) Then
|
|
Return True
|
|
End If
|
|
|
|
If Seconds <> other.Seconds Then Return False
|
|
If Nanos <> other.Nanos Then Return False
|
|
Return True
|
|
End Function
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Overrides Function GetHashCode() As Integer
|
|
Dim hash = 1
|
|
If Seconds <> 0L Then hash = hash Xor Seconds.GetHashCode()
|
|
If Nanos <> 0 Then hash = hash Xor Nanos.GetHashCode()
|
|
Return hash
|
|
End Function
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Overrides Function ToString() As String
|
|
Return JsonFormatter.ToDiagnosticString(Me)
|
|
End Function
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Sub WriteTo(output As CodedOutputStream) Implements IMessage.WriteTo
|
|
If Seconds <> 0L Then
|
|
output.WriteRawTag(8)
|
|
output.WriteInt64(Seconds)
|
|
End If
|
|
|
|
If Nanos <> 0 Then
|
|
output.WriteRawTag(16)
|
|
output.WriteInt32(Nanos)
|
|
End If
|
|
End Sub
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Function CalculateSize() As Integer Implements IMessage.CalculateSize
|
|
Dim size = 0
|
|
|
|
If Seconds <> 0L Then
|
|
size += 1 + CodedOutputStream.ComputeInt64Size(Seconds)
|
|
End If
|
|
|
|
If Nanos <> 0 Then
|
|
size += 1 + CodedOutputStream.ComputeInt32Size(Nanos)
|
|
End If
|
|
|
|
Return size
|
|
End Function
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Sub MergeFrom(other As Duration) Implements IMessageType(Of Duration).MergeFrom
|
|
If other Is Nothing Then
|
|
Return
|
|
End If
|
|
|
|
If other.Seconds <> 0L Then
|
|
Seconds = other.Seconds
|
|
End If
|
|
|
|
If other.Nanos <> 0 Then
|
|
Nanos = other.Nanos
|
|
End If
|
|
End Sub
|
|
|
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
|
|
Public Sub MergeFrom(input As CodedInputStream) Implements IMessage.MergeFrom
|
|
Dim tag As New Value(Of UInteger)
|
|
|
|
While ((tag = input.ReadTag())) <> 0
|
|
|
|
Select Case tag.Value
|
|
Case 8
|
|
Seconds = input.ReadInt64()
|
|
|
|
Case 16
|
|
Nanos = input.ReadInt32()
|
|
|
|
Case Else
|
|
input.SkipLastField()
|
|
End Select
|
|
End While
|
|
End Sub
|
|
End Class
|
|
|
|
#End Region
|
|
|
|
End Namespace
|
|
#End Region
|