/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 1 6 . ĠSun gh you k ĠB ae Ġ< sun gh you k . bae @ gmail . com > Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ċ Ġ*/ Ċ Ċ package Ġdeb op 4 k . time period Ċ Ċ import Ġdeb op 4 k . time period . models . Period Relation Ċ import Ġdeb op 4 k . time period . utils . has Inside With Ċ import Ġdeb op 4 k . time period . utils . intersect With Ċ import Ġdeb op 4 k . time period . utils . overlap With Ċ import Ġdeb op 4 k . time period . utils . relation With Ċ import Ġorg . joda . time . DateTime Ċ Ċ /** Ċ Ġ* Ġ@ author Ġsun gh you k . bae @ gmail . com Ċ Ġ*/ Ċ open Ġclass ĠTime Period Collection Ġ: ĠTime Period Container (), ĠI Time Period Collection Ġ{ ĊĊĠ Ġoverride Ġfun Ġhas Inside Periods ( that : ĠI Time Period ): ĠBoolean Ġ{ ĊĠĠĠ Ġreturn Ġperiods . any Ġ{ Ġit . has Inside With ( that ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġhas Overlap Periods ( that : ĠI Time Period ): ĠBoolean Ġ{ ĊĠĠĠ Ġreturn Ġperiods . any Ġ{ Ġit . overlap With ( that ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġhas Intersection Periods ( moment : ĠDateTime ): ĠBoolean Ġ{ ĊĠĠĠ Ġreturn Ġperiods . all Ġ{ Ġit . has Inside With ( moment ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġhas Intersection Periods ( target : ĠI Time Period ): ĠBoolean Ġ{ ĊĠĠĠ Ġreturn Ġperiods . any Ġ{ Ġit . intersect With ( target ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġinside Periods ( target : ĠI Time Period ): ĠList < IT ime Period > Ġ{ ĊĠĠĠ Ġreturn Ġperiods . filter Ġ{ Ġit . has Inside With ( target ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġoverlap Periods ( target : ĠI Time Period ): ĠList < IT ime Period > Ġ{ ĊĠĠĠ Ġreturn Ġperiods . filter Ġ{ Ġit . overlap With ( target ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġintersection Periods ( moment : ĠDateTime ): ĠList < IT ime Period > Ġ{ ĊĠĠĠ Ġreturn Ġperiods . filter Ġ{ Ġit . has Inside With ( moment ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġintersection Periods ( target : ĠI Time Period ): ĠList < IT ime Period > Ġ{ ĊĠĠĠ Ġreturn Ġperiods . filter Ġ{ Ġit . intersect With ( target ) Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġrelation Periods ( target : ĠI Time Period , Ġvar arg Ġrelations : ĠPeriod Relation ): ĠList < IT ime Period > Ġ{ ĊĠĠĠ Ġreturn Ġperiods . filter Ġ{ Ġrelations . contains ( it . relation With ( target )) Ġ} ĊĠ Ġ} ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġof ( c : ĠCollection < IT ime Period >): ĠTime Period Collection Ġ{ ĊĠĠĠĠĠ Ġval Ġcollection Ġ= ĠTime Period Collection () ĊĠĠĠĠĠ Ġcollection . addAll ( c ) ĊĠĠĠĠĠ Ġreturn Ġcollection ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġof ( var arg Ġelements : ĠI Time Period ): ĠTime Period Collection Ġ{ ĊĠĠĠĠĠ Ġval Ġcollection Ġ= ĠTime Period Collection () ĊĠĠĠĠĠ Ġcollection . addAll ( elements . toList ()) ĊĠĠĠĠĠ Ġreturn Ġcollection ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }