private static boolean normal ( int element , int charge , int valence ) { switch ( element ) { case CARBON : if ( charge == - 1 || charge == + 1 ) return valence == 3 ; return charge == 0 && valence == 4 ; case NITROGEN : case PHOSPHORUS : case ARSENIC : if ( charge == - 1 ) return valence == 2 ; if ( charge == + 1 ) return valence == 4 ; return charge == 0 && ( valence == 3 || ( valence == 5 && element == NITROGEN ) ) ; case OXYGEN : if ( charge == + 1 ) return valence == 3 ; return charge == 0 && valence == 2 ; case SULPHUR : case SELENIUM : if ( charge == + 1 ) return valence == 3 ; return charge == 0 && ( valence == 2 || valence == 4 || valence == 6 ) ; } return false ; }
The element has normal valence for the specified charge .