1. class Collation {
  2. has int $.collation-level = 15;
  3. has $!Country = 'International';
  4. method gist {
  5. "collation-level => $!collation-level, Country => $!Country, " ~
  6. "Language => None, primary => {self.primary}, secondary => {self.secondary}, " ~
  7. "tertiary => {self.tertiary}, quaternary => {self.quaternary}"
  8. }
  9. #proto method set (|) { * }
  10. #multi method set (Int :$collation-level!) {
  11. # $!collation-level = $collation-level;
  12. #}
  13. method set (Bool :$primary = self.primary,
  14. Bool :$secondary = self.secondary, Bool :$tertiary = self.tertiary,
  15. Bool :$quaternary = self.quaternary)
  16. {
  17. my int $i = 0;
  18. $i += 1 if $primary;
  19. $i += 2 if $secondary;
  20. $i += 4 if $tertiary;
  21. $i += 8 if $quaternary;
  22. $!collation-level = $i;
  23. }
  24. method primary { so $!collation-level +& 1 }
  25. method secondary { so $!collation-level +& 2 }
  26. method tertiary { so $!collation-level +& 4 }
  27. method quaternary { so $!collation-level +& 8 }
  28. }
  29. PROCESS::<$COLLATION> = Collation.new;