7from .strategy_entryinformation
import EntryInformation
8from .strategy_isortentries
import SortOptions
9from .strategy_sortentries_class
import Strategy_SortEntries_ClassFactory
43 def __init__(self, sortOption : SortOptions, reversedSort : bool) ->
None:
45 self.
_sortEntries = Strategy_SortEntries_ClassFactory.Create(sortOption, reversedSort)
63 def ShowEntries(self, entries : list[EntryInformation]) ->
None:
65 localEntries = entries.copy()
69 print(
" Sort strategy: {0} (order = {1})".format(self.
_sortEntries.ToString(),
"Descending" if self.
_reversedSort else "Ascending"))
70 print(
" {0:6} {1:3} {2:3}".format(
"Name",
"Age",
"Height"))
71 print(
" {0:6} {1:3} {2:3}".format(
"------",
"---",
"------"))
72 for entry
in localEntries:
73 print(
" {0}".format(entry.ToString()))
Represents a way of displaying a list of EntryInformation objects in a particular order.
_sortEntries
The sorting strategy to use as represented by the ISortEntries interface.
None __init__(self, SortOptions sortOption, bool reversedSort)
Constructor.
_reversedSort
Whether to reverse the normal order of the sort.
None ShowEntries(self, list[EntryInformation] entries)
Display the specified entries in sorted order.