Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project settings #14

Merged
merged 21 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
80811fc
remove nullable project setting
jackschonherr Aug 13, 2024
cb9a15e
Created the HazardParameter enum #8
jackschonherr Aug 13, 2024
089d7b1
Implemented the HazardParameter interface #9
jackschonherr Aug 13, 2024
008e88b
changed internal to public for HazardInterface interface and its func…
jackschonherr Aug 13, 2024
ed3307b
Implemented ResultItem generic class #10
jackschonherr Aug 13, 2024
773b62a
Removed lines auto filled by visual studio
jackschonherr Aug 14, 2024
306cfd8
implemented the ConsequencesReceptor interface #12
jackschonherr Aug 14, 2024
763b559
added constructor to ResultItem class #10
jackschonherr Aug 14, 2024
0e3b91c
implemented a fetch method for ResultItem #11
jackschonherr Aug 14, 2024
a8e80d1
added [Flags] attribute b/c this is a bitflag enum #8
jackschonherr Aug 14, 2024
70b943f
changed backing int
jackschonherr Aug 14, 2024
22ee348
added generics
jackschonherr Aug 14, 2024
52ee6d4
Merge branch 'main' into project-settings
Brennan1994 Aug 14, 2024
847d8cc
fixed namespaing
jackschonherr Aug 15, 2024
2084404
renamed interface files
jackschonherr Aug 15, 2024
5e37378
removed generic from ConsequenceReceptor interface
jackschonherr Aug 15, 2024
75023aa
changed ResultItem to struct
jackschonherr Aug 15, 2024
d57ca50
changed Result to a class
jackschonherr Aug 15, 2024
1b681e3
removed generic
jackschonherr Aug 15, 2024
30be506
added constructor and changed return if name not found
jackschonherr Aug 15, 2024
cd4b219
Merge branch 'project-settings' of https://github.com/USACE/consequen…
jackschonherr Aug 15, 2024
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
6 changes: 0 additions & 6 deletions Consequences/Class1.cs

This file was deleted.

10 changes: 10 additions & 0 deletions Consequences/HazardParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Consequences;
[Flags]
public enum HazardParameter // backed by an int by default
{
NoHazard = 0,
Depth = 1,
Velocity = 2,
ArrivalTime = 4,
ArrivalTime2ft = 8
}
5 changes: 5 additions & 0 deletions Consequences/IConsequencesReceptorInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Consequences;
public interface IConsequencesReceptor<T>
Brennan1994 marked this conversation as resolved.
Show resolved Hide resolved
{
public Result<T> Compute(IHazard hi);
}
6 changes: 6 additions & 0 deletions Consequences/IHazardInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Consequences;
public interface IHazard
{
public bool Has(HazardParameter hp);
public T Get<T>(HazardParameter hp);
}
18 changes: 18 additions & 0 deletions Consequences/Result.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Consequences;
public struct Result<T>
Brennan1994 marked this conversation as resolved.
Show resolved Hide resolved
Brennan1994 marked this conversation as resolved.
Show resolved Hide resolved
{
private ResultItem<T>[] results;

Check warning on line 4 in Consequences/Result.cs

View workflow job for this annotation

GitHub Actions / CI

Field 'Result<T>.results' is never assigned to, and will always have its default value null

Check warning on line 4 in Consequences/Result.cs

View workflow job for this annotation

GitHub Actions / CI

Field 'Result<T>.results' is never assigned to, and will always have its default value null
Brennan1994 marked this conversation as resolved.
Show resolved Hide resolved

// retrieve a ResultItem from a Result by name
public ResultItem<T> Fetch(string name)
{
for (int i = 0; i < results.Length; i++)
{
if (results[i].Name() == name)
{
return results[i];
}
}
return null;
}
}
21 changes: 21 additions & 0 deletions Consequences/ResultItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Consequences;
public class ResultItem<T>
Brennan1994 marked this conversation as resolved.
Show resolved Hide resolved
{
private string resultName;
Brennan1994 marked this conversation as resolved.
Show resolved Hide resolved
private T result;

public ResultItem(string name, T res)
{
resultName = name;
result = res;
}

public string Name()
Brennan1994 marked this conversation as resolved.
Show resolved Hide resolved
{
return resultName;
}
public T Value()
{
return result;
}
}
Loading