OK, this is a very subtle thing if you are not familiar with how Object Oriented programming languages work and the relationships between SwitchItem, DimmerItem, and ColorItem. I made a detailed posting on the topic of OO in the context of the Rules language here:
The key point you should take away from that posting is that there is a hierarchy of types. In this case ColorItem inherits from DimmerItem and DimmerItem inherits from SwitchItem. What this means is you can cast to, use, and treat both a ColorItem and a DimmerItem as a SwitchItem. Further, you can treat a ColorItem as if it were a DimmerItem.
The class hierarchy looks something like:
Object
Item
GenericItem
SwitchItem
DimmerItem
ColorItem
Any class in this hierarchy actually is any type which is above it in the hierarchy. So a SwitchItem is a GenericItem, an Item, and an Object. A ColorItem is a DimmerItem, a SwitchItem, a GenericItem, an Item, and an Object.
Thus:
myColorItem instanceof SwitchItem == True
myColorItem instanceof DimmerItem == True
myDimmerItem instanceof SwitchItem == True
myDimmerItem instanceof ColorItem == False
mySwitchItem instanceof ColorItem == False
mySwitchItem instanceof DimmerItem == False
What what this means is that by testing for SwitchItem first it always evaluates to true because a ColorItem and a DimmerItem are also a SwitchItem.
To make this work the way you want you need to test for ColorItem first, DimmerItem second, and SwitchItem last.