public int compare(ReadonlyTColor a, ReadonlyTColor b) { float ca, cb; switch (component) { case 0: ca = a.red(); cb = b.red(); break; case 1: ca = a.green(); cb = b.green(); break; case 2: default: ca = a.blue(); cb = b.blue(); } return Float.compare(ca, cb); }
public float getComponentValueFor(ReadonlyTColor col) { float comp; switch (component) { case 0: comp = col.red(); break; case 1: comp = col.green(); break; case 2: default: comp = col.blue(); } return comp; }