Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .github/workflows/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@ jobs:
build:
runs-on: windows-2025
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Setup .NetCore
uses: actions/setup-dotnet@v1
with:
dotnet-version: 10.0.101
- name: Build with dotnet
- uses: actions/checkout@v1
with:
repository: TravelModellingGroup/XTMF2
ref: origin/dev
- name: Build XTMF2
run: |
cd "../XTMF2"
dotnet build -c Release
- uses: actions/checkout@v1
- name: Build TMG-Framework
run: |
cd TMG-Framework
dotnet build --configuration Release
dotnet build -c Release
- name: Unit Tests
run: |
cd TMG-Framework
dotnet test
dotnet test -c Release

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ operating XTMF2.

### Requirements

1. DotNet Core 3.1+ SDK
1. DotNet 10.0+ SDK

### Clone the TMG-Framework repository

Expand Down
File renamed without changes.
58 changes: 0 additions & 58 deletions TMG-Framework/src/TMG-Framework/Loading/LoadCategoriesFromCSV.cs

This file was deleted.

5 changes: 0 additions & 5 deletions UpdateReferences.bat

This file was deleted.

1 change: 0 additions & 1 deletion XTMF2
Submodule XTMF2 deleted from 9e3284
87 changes: 87 additions & 0 deletions src/TMG-Framework/Loading/LoadCategoriesFromCSV.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
Copyright 2017-2018 University of Toronto

This file is part of TMG-Framework for XTMF2.

TMG-Framework for XTMF2 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.

TMG-Framework for XTMF2 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 TMG-Framework for XTMF2. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using TMG.Utilities;
using XTMF2;

namespace TMG.Loading;

[Module(Name = "Load Categories From CSV", Description = "Loads categories where each row has a different sparse index.",
DocumentationLink = "http://tmg.utoronto.ca/doc/2.0")]
public sealed class LoadCategoriesFromCSV : BaseFunction<ReadStream, Categories>
{
public override Categories Invoke(ReadStream stream)
{
var record = new List<int>();
using (var reader = new CsvReader(stream, false))
{
while (reader.LoadLine(out var columns))
{
if (columns > 0)
{
reader.Get(out int point, 0);
record.Add(point);
}
}
}
if (record.Count == 0)
{
throw new XTMFRuntimeException(this, "Unable to create Categories object with no contained categories.");
}
string error = null;
var ret = Categories.CreateCategories(record, ref error)
?? throw new XTMFRuntimeException(this, error);
return ret;
}
}

[Module(Name = "Load Categories From CSV", Description = "Loads categories where each row has a different sparse index.",
DocumentationLink = "http://tmg.utoronto.ca/doc/2.0")]
public sealed class LoadCategoriesFromCSVF : BaseFunction<Categories>
{
[SubModule(Name = "Input", Required = true, Description = "The CSV file to read from.", Index = 0)]
public IFunction<ReadStream> Input = null!;

public override Categories Invoke()
{
var record = new List<int>();
using var stream = Input.Invoke();
using var reader = new CsvReader(stream, false);

while (reader.LoadLine(out var columns))
{
if (columns > 0)
{
reader.Get(out int point, 0);
record.Add(point);
}
}

if (record.Count == 0)
{
throw new XTMFRuntimeException(this, "Unable to create Categories object with no contained categories.");
}
string error = null;
var ret = Categories.CreateCategories(record, ref error)
?? throw new XTMFRuntimeException(this, error);
return ret;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<Authors>University of Toronto</Authors>
<Company>University of Toronto</Company>
<Description>A set of modules for XTMF2 to provide assistance in Travel Demand Modelling.</Description>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputPath>..\..\..\XTMF2-Dev\Modules\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -20,11 +23,12 @@
</PropertyGroup>

<ItemGroup>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\XTMF2\src\XTMF2.Interfaces\XTMF2.Interfaces.csproj" />
<ProjectReference Include="..\..\..\XTMF2\src\XTMF2\XTMF2.csproj" />
<Reference Include="XTMF2">
<HintPath>..\..\..\XTMF2-Dev\XTMF2.dll</HintPath>
</Reference>
<Reference Include="XTMF2.Interfaces">
<HintPath>..\..\..\XTMF2-Dev\XTMF2.Interfaces.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@
<ProjectReference Include="..\TMG-Framework.Test\TMG-Framework.Test.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="XTMF2">
<HintPath>..\..\..\XTMF2-Dev\XTMF2.dll</HintPath>
</Reference>
<Reference Include="XTMF2.Interfaces">
<HintPath>..\..\..\XTMF2-Dev\XTMF2.Interfaces.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\XTMF2\src\XTMF2.Interfaces\XTMF2.Interfaces.csproj" />
<ProjectReference Include="..\..\..\XTMF2\src\XTMF2\XTMF2.csproj" />
<ProjectReference Include="..\..\src\TMG-Framework\TMG-Framework.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="XTMF2">
<HintPath>..\..\..\XTMF2-Dev\XTMF2.dll</HintPath>
</Reference>
<Reference Include="XTMF2.Interfaces">
<HintPath>..\..\..\XTMF2-Dev\XTMF2.Interfaces.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Loading