package Ġtask . matrix . io Ċ Ċ enum Ġclass ĠFile Write Algorithm ( ĊĠĠĠ Ġprivate Ġval Ġalgorithm : Ġ( execution Plan : ĠBase Execution Plan ) Ġ-> ĠUnit Ċ ) Ġ{ ĊĠĠĠ ĠSERIAL _ SEQUENTIAL _ WRITE (:: serial Write Se quent ially ), ĊĠĠĠ ĠSA FE _ SERIAL _ CON CURRENT _ WRITE (:: safe Serial Write Concurrent ly ), ĊĠĠĠ ĠSA FE _ PAR ALLEL _ CON CURRENT _ WRITE (:: safe Parallel Write Concurrent ly ), ĊĠĠĠ ĠUNS AFE _ SERIAL _ CON CURRENT _ WRITE (:: unsafe Serial Write Concurrent ly ); ĊĊĠĠĠ Ġoperator Ġfun Ġinvoke ( execution Plan : ĠBase Execution Plan ): ĠUnit Ġ= Ġalgorithm ( execution Plan ) Ċ } Ċ Ċ private Ġfun Ġserial Write Se quent ially ( execution Plan : ĠBase Execution Plan ) Ġ{ ĊĠĠĠ Ġwrite Se quent ially ( execution Plan , Ġ:: iterate Tasks Serial , Ġ:: writeString To ) Ċ } Ċ Ċ private Ġfun Ġsafe Parallel Write Concurrent ly ( execution Plan : ĠBase Execution Plan ) Ġ{ ĊĠĠĠ Ġwrite Concurrent ly ( execution Plan , Ġ:: iterate Tasks Parallel ) Ġ{ Ġfile , Ġcharacters To Write Ġ-> ĊĠĠĠĠĠĠĠ Ġsynchronized ( file ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwrite StringTo ( file , Ġcharacters To Write ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ private Ġfun Ġsafe Serial Write Concurrent ly ( execution Plan : ĠBase Execution Plan ) Ġ{ ĊĠĠĠ Ġwrite Concurrent ly ( execution Plan , Ġ:: iterate Tasks Serial ) Ġ{ Ġfile , Ġcharacters To Write Ġ-> ĊĠĠĠĠĠĠĠ Ġsynchronized ( file ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwrite StringTo ( file , Ġcharacters To Write ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ private Ġfun Ġunsafe Serial Write Concurrent ly ( execution Plan : ĠBase Execution Plan ) Ġ{ ĊĠĠĠ Ġwrite Concurrent ly ( execution Plan , Ġ:: iterate Tasks Serial , Ġ:: writeString To ) Ċ } ĊĊ