CSMSL.Proteomics.FragmentTypesExtension.GetTerminus C# (CSharp) Method

GetTerminus() public static method

public static GetTerminus ( this fragmentType ) : Terminus
fragmentType this
return Terminus
        public static Terminus GetTerminus(this FragmentTypes fragmentType)
        {
            // Super handy: http://stackoverflow.com/questions/4624248/c-logical-riddle-with-bit-operations-only-one-bit-is-set
            if (fragmentType == FragmentTypes.None || (fragmentType & (fragmentType - 1)) != FragmentTypes.None)
            {
                throw new ArgumentException("Fragment Type must be a single value to determine the terminus", "fragmentType");
            }
            return fragmentType >= FragmentTypes.x ? Terminus.C : Terminus.N;
        }