split modules

master
xieguigang 7 years ago
parent a3e8cfea1f
commit 88017a05df

@ -208,6 +208,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Environment.vb" />
<Compile Include="Linq\NamespaceDoc.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
@ -224,9 +225,9 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Taskhost.d\Invoke\TaskInvoke.vb" />
<Compile Include="Taskhost.d\Linq\LinqPool.vb" />
<Compile Include="Taskhost.d\Linq\ILinq%28Of T%29.vb" />
<Compile Include="Taskhost.d\Linq\LinqProvider.vb" />
<Compile Include="Linq\LinqPool.vb" />
<Compile Include="Linq\ILinq%28Of T%29.vb" />
<Compile Include="Linq\LinqProvider.vb" />
<Compile Include="Taskhost.d\Invoke\Return.vb" />
<Compile Include="Taskhost.d\Invoke\InvokeInfo.vb" />
<Compile Include="Taskhost.d\Extensions.vb" />

@ -1,167 +1,167 @@
#Region "Microsoft.VisualBasic::069775a9dca65fb20879e79072bf05f8, ComputingServices\Taskhost.d\Linq\LinqPool.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:
' Class LinqPool
'
' Function: GetLinq, OpenQuery
'
' Sub: (+2 Overloads) Dispose, Free
' Class __openTask
'
' Constructor: (+1 Overloads) Sub New
' Function: OpenQuery
'
'
'
'
' /********************************************************************************/
#End Region
Imports System.Threading
Imports Microsoft.VisualBasic.Net
Imports Microsoft.VisualBasic.Parallel.Tasks
Namespace TaskHost
Public Class LinqPool : Implements IDisposable
''' <summary>
''' linq
''' </summary>
ReadOnly __linq As New Dictionary(Of String, LinqProvider)
ReadOnly __openQuerys As New TaskQueue(Of IPEndPoint)
Public Function GetLinq(uid As String) As LinqProvider
Return __linq(uid)
End Function
''' <summary>
''' uidLinq PortalTostring
''' </summary>
''' <param name="uid"></param>
Public Sub Free(uid As String)
If Not __linq.ContainsKey(uid) Then Return
Dim x As LinqProvider = __linq(uid)
Call x.Free ' Linq
SyncLock __linq
Call __linq.Remove(uid) '
End SyncLock
End Sub
''' <summary>
'''
''' </summary>
''' <param name="source"></param>
''' <param name="type">
'''
''' 使
''' </param>
''' <returns></returns>
Public Function OpenQuery(source As IEnumerable, type As Type) As IPEndPoint
Dim elType As Type = type.GetTypeElement(True)
If elType Is Nothing Then
elType = type
End If
Dim task As New __openTask(__linq) With {
.elType = elType,
.source = source
}
Return __openQuerys.Join(AddressOf task.OpenQuery)
End Function
Private Class __openTask
ReadOnly __linq As Dictionary(Of String, LinqProvider)
Public source As IEnumerable
Public elType As Type
Sub New(ByRef linq As Dictionary(Of String, LinqProvider))
__linq = linq
End Sub
Public Function OpenQuery() As IPEndPoint
Dim linq As New LinqProvider(source, elType) ' Linq
Dim portal As IPEndPoint = linq.Portal
Dim uid As String = portal.ToString
Call __linq.Add(portal.ToString, linq) '
Return portal
End Function
End Class
#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls
' IDisposable
Protected Overridable Sub Dispose(disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
For Each x In __linq
Call Free(x.Key)
Next
Call __linq.Free
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub
' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
'End Sub
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
Dispose(True)
' TODO: uncomment the following line if Finalize() is overridden above.
' GC.SuppressFinalize(Me)
End Sub
#End Region
End Class
End Namespace
#Region "Microsoft.VisualBasic::069775a9dca65fb20879e79072bf05f8, ComputingServices\Taskhost.d\Linq\LinqPool.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:
' Class LinqPool
'
' Function: GetLinq, OpenQuery
'
' Sub: (+2 Overloads) Dispose, Free
' Class __openTask
'
' Constructor: (+1 Overloads) Sub New
' Function: OpenQuery
'
'
'
'
' /********************************************************************************/
#End Region
Imports System.Threading
Imports Microsoft.VisualBasic.Net
Imports Microsoft.VisualBasic.Parallel.Tasks
Namespace TaskHost
Public Class LinqPool : Implements IDisposable
''' <summary>
''' linq
''' </summary>
ReadOnly __linq As New Dictionary(Of String, LinqProvider)
ReadOnly __openQuerys As New TaskQueue(Of IPEndPoint)
Public Function GetLinq(uid As String) As LinqProvider
Return __linq(uid)
End Function
''' <summary>
''' uidLinq PortalTostring
''' </summary>
''' <param name="uid"></param>
Public Sub Free(uid As String)
If Not __linq.ContainsKey(uid) Then Return
Dim x As LinqProvider = __linq(uid)
Call x.Free ' Linq
SyncLock __linq
Call __linq.Remove(uid) '
End SyncLock
End Sub
''' <summary>
'''
''' </summary>
''' <param name="source"></param>
''' <param name="type">
'''
''' 使
''' </param>
''' <returns></returns>
Public Function OpenQuery(source As IEnumerable, type As Type) As IPEndPoint
Dim elType As Type = type.GetTypeElement(True)
If elType Is Nothing Then
elType = type
End If
Dim task As New __openTask(__linq) With {
.elType = elType,
.source = source
}
Return __openQuerys.Join(AddressOf task.OpenQuery)
End Function
Private Class __openTask
ReadOnly __linq As Dictionary(Of String, LinqProvider)
Public source As IEnumerable
Public elType As Type
Sub New(ByRef linq As Dictionary(Of String, LinqProvider))
__linq = linq
End Sub
Public Function OpenQuery() As IPEndPoint
Dim linq As New LinqProvider(source, elType) ' Linq
Dim portal As IPEndPoint = linq.Portal
Dim uid As String = portal.ToString
Call __linq.Add(portal.ToString, linq) '
Return portal
End Function
End Class
#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls
' IDisposable
Protected Overridable Sub Dispose(disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
For Each x In __linq
Call Free(x.Key)
Next
Call __linq.Free
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub
' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
'End Sub
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
Dispose(True)
' TODO: uncomment the following line if Finalize() is overridden above.
' GC.SuppressFinalize(Me)
End Sub
#End Region
End Class
End Namespace

@ -0,0 +1,8 @@
Namespace Linq
''' <summary>
''' Linq: Linq
''' </summary>
Module NamespaceDoc
End Module
End Namespace
Loading…
Cancel
Save