Skip to content

Commit

Permalink
Add GetName, GetNameWithNumber for xxValue DataModel (Issue #24).
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Sep 6, 2021
1 parent 035ed55 commit 91e9ea5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/ISADotnet/DataModel/Factor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Factor =
|> Option.defaultValue ""

/// Returns the name of the factor with the number as string (e.g. "temperature #2")
member this.GetNameWithNumber =
member this.GetNameWithNumber =
this.FactorType
|> Option.map (fun oa -> oa.GetName)
|> Option.defaultValue ""
Expand Down Expand Up @@ -160,6 +160,18 @@ type FactorValue =
| Some u -> $"{v} {u}"
| None -> v

/// Returns the name of the category as string
member this.GetName =
this.Category
|> Option.map (fun factor -> factor.GetName)
|> Option.defaultValue ""

/// Returns the name of the category with the number as string (e.g. "temperature #2")
member this.GetNameWithNumber =
this.Category
|> Option.map (fun oa -> oa.GetNameWithNumber)
|> Option.defaultValue ""

interface IISAPrintable with
member this.Print() =
this.ToString()
Expand Down
13 changes: 12 additions & 1 deletion src/ISADotnet/DataModel/Material.fs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ type MaterialAttribute =
|> Option.map (fun oa -> oa.GetNameWithNumber)
|> Option.defaultValue ""


interface IISAPrintable with
member this.Print() =
this.ToString()
Expand Down Expand Up @@ -91,6 +90,18 @@ type MaterialAttributeValue =
static member empty =
MaterialAttributeValue.create()

/// Returns the name of the category as string
member this.GetName =
this.Category
|> Option.map (fun oa -> oa.GetName)
|> Option.defaultValue ""

/// Returns the name of the category with the number as string (e.g. "temperature #2")
member this.GetNameWithNumber =
this.Category
|> Option.map (fun oa -> oa.GetNameWithNumber)
|> Option.defaultValue ""

member this.GetValue =
this.Value
|> Option.map (fun oa ->
Expand Down
12 changes: 12 additions & 0 deletions src/ISADotnet/DataModel/Process.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ type ProcessParameterValue =
static member empty =
ProcessParameterValue.create()

/// Returns the name of the category as string
member this.GetName =
this.Category
|> Option.map (fun oa -> oa.GetName)
|> Option.defaultValue ""

/// Returns the name of the category with the number as string (e.g. "temperature #2")
member this.GetNameWithNumber =
this.Category
|> Option.map (fun oa -> oa.GetNameWithNumber)
|> Option.defaultValue ""

member this.GetValue =
this.Value
|> Option.map (fun oa ->
Expand Down

0 comments on commit 91e9ea5

Please sign in to comment.