Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Feb 5, 2024
1 parent c13a09e commit fdf3223
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/FileFormats/MPS/MPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ struct Card
f3::String
f4::String
f5::String
num_fields::Int

function Card(;
f1::String = "",
Expand All @@ -164,12 +163,7 @@ struct Card
f4::String = "",
f5::String = "",
)
num_fields = isempty(f1) ? 0 : 1
num_fields = isempty(f2) ? num_fields : 2
num_fields = isempty(f3) ? num_fields : 3
num_fields = isempty(f4) ? num_fields : 4
num_fields = isempty(f5) ? num_fields : 5
return new(f1, f2, f3, f4, f5, num_fields)
return new(f1, f2, f3, f4, f5)
end
end

Expand All @@ -183,23 +177,17 @@ function print_offset(io, offset, field, min_start)
end

function Base.show(io::IO, card::Card)
offset = print_offset(io, 0, card.f1, 2)
if card.num_fields == 1
return
offset = print_offset(io, 0, card.f1, 2)
offset = print_offset(io, offset, card.f2, 5)
if !isempty(card.f3)
offset = print_offset(io, offset, card.f3, 15)
end
offset = print_offset(io, offset, card.f2, 5)
if card.num_fields == 2
return
if !isempty(card.f4)
offset = print_offset(io, offset, card.f4, 25)
end
offset = print_offset(io, offset, card.f3, 15)
if card.num_fields == 3
return
end
offset = print_offset(io, offset, card.f4, 25)
if card.num_fields == 4
return
if !isempty(card.f5)
offset = print_offset(io, offset, card.f5, 40)
end
offset = print_offset(io, offset, card.f5, 40)
return
end

Expand Down

0 comments on commit fdf3223

Please sign in to comment.