If jail time > 12 months, sentence = prison else sentence = jail
elseif (sentences == consecutive){
serve(time,chargeCount,jail)
}
There are other variables, such as Jurisdiction, also impact how a person will be sentenced. Laws might differ a bit in Sweden though.That code isn't very good. A person can serve >12months if the sentences are ran consecutively. Depending on the criminal, crime, and place, the person charged may want to be in prison instead of jail.
This brochure from the Swedish government [0] differentiates between remand prisons and correctional facilities (of varying security levels), no mention of anything else at all.
[0] http://www.regeringen.se/content/1/c4/33/41/0feab306.pdf (PDF)
remand prison: Where people who are suspected of offenses and who have been detained by a court while waiting for trial are held.[from the link above]
[0] http://legal-dictionary.thefreedictionary.com/Remand+prison