| package org.projectfloodlight.openflow.types; |
| |
| import javax.annotation.concurrent.Immutable; |
| |
| /** a hash value that supports bit-wise combinations, mainly to calculate hash values for |
| * reconciliation operations. |
| * |
| * @author Andreas Wundsam <andreas.wundsam@bigswitch.com> |
| * |
| * @param <H> - this type, for return type safety. |
| */ |
| @Immutable |
| public interface HashValue<H extends HashValue<H>> { |
| /** return the "numBits" highest-order bits of the hash. |
| * @param numBits number of higest-order bits to return [0-32]. |
| * @return a numberic value of the 0-32 highest-order bits. |
| */ |
| int prefixBits(int numBits); |
| |
| /** perform an arithmetic addition of this value and other. Wraps around on |
| * overflow of the defined word size. |
| * |
| * @param other |
| * @return this + other |
| */ |
| H add(H other); |
| |
| /** |
| * arithmetically substract the given 'other' value from this value. |
| * around on overflow. |
| * |
| * @param other |
| * @return this - other |
| */ |
| H subtract(H other); |
| |
| /** @return the bitwise inverse of this value */ |
| H inverse(); |
| |
| /** or this value with another value value of the same type */ |
| H or(H other); |
| |
| /** and this value with another value value of the same type */ |
| H and(H other); |
| |
| /** xor this value with another value value of the same type */ |
| H xor(H other); |
| } |