The Dutch Flag Problem

Provided values

The colors are represented through the following constants: BLUE, WHITE and RED. You can use them directly in your code.

Provided functions

This world is very simple, with only 5 provided functions.

[!java]void [/!]swap([!java]int [/!]x[!scala]:Int[/!], [!java]int [/!]y[!scala]:Int[/!])
Swap the lines number x and y.
[!java]int [/!]getSize() [!scala]:Int[/!]
Returns the amount of lines on this flag.
[!java]int [/!]getColor([!java]int [/!]line[!scala]:Int[/!])  [!scala]:Int[/!]
Returns the color of the given line.
[!java]boolean [/!]isSorted()  [!scala]:Boolean[/!]
Returns whether the flag is sorted.
[!java]boolean [/!]isSelected()  [!scala]:Boolean[/!]
Returns whether the current world is selected in the interface.