jeudi 23 juillet 2015

most efficient way to check three object for not beeing null OR only two of them can be null

i am struggling with problem of validation of three objects (A, B, C)

there are my conditions

  • none of then can be null
  • maximally one of then can be not null

i want to resolve it without many if expression and creating monstrous code.

so

  A  B  C
A 1  0  0
B 0  1  0
C 0  0  1

as it show i need to achieve something like this pseudo table before only one of them can be true and all the other are false

final

what expression can provide such validation ?

Aucun commentaire:

Enregistrer un commentaire