1. A packet transfer controlling apparatus comprising: a code storage unit that stores a plurality of associations of a code and classifications to select information from an input packet when specification of the code is accepted; and a plurality of selecting units that sets, when specification of the code is accepted, the information that belongs to the classifications stored in the code storage unit in association with the code, and selects, when the input of the packet is accepted, the information that belongs to a classification from the information included in the input packet, wherein a plurality of comparing units outputs a comparison result of determining whether the information selected by the selecting unit that performs a preceding process and a comparison value set as a comparison target for the selected information match each other, and further comprising a rule searching unit that searches, when the comparison results are output from all of the comparing units, for a plurality of rules that each set a matching relation through logical AND regarding each classification, the matching relation indicating whether the information that belongs to the classification and the comparison value match each other to find which rule corresponds to the input packet, and outputs identification information that identifies the found rule; and a transfer controlling unit that controls transfer of the packet based on the identification information output by the rule searching unit, wherein when an affirmative matching relation indicating that the information that belongs to the classification and the comparison value match each other is a logical AND relation for the plurality of classifications and a negative logical AND that negates the logical AND relation as a whole is to be set as the rule, the packet transfer controlling apparatus sets, as the rule, one rule with each of the classifications being a bit of 1, and further comprising a plural logical inverting unit that outputs, when an instruction for a plural logical inversion for each the comparison results output from all of the comparing units is accepted, upon output of each of the comparison results, a bit string with all of the classifications each being a bit of 0 only when all of the classifications of the output comparison results are each a bit of 1, and otherwise outputs a bit string with all of the classifications each being a bit of 1, and wherein the rule searching unit searches for the rules based on the bit string output by the plural logic inverting unit and outputs the identification information.