/** * return a Wildcards object that has the given flags set * <p> * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> */ public Wildcards wildcard(final Wildcards.Flag flag) { final int flags = flag.wildcard(this.flags); if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }
/** * return a Wildcards object that matches on exactly the given flag * <p> * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> */ public Wildcards matchOn(final Wildcards.Flag flag) { final int flags = flag.matchOn(this.flags); if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }
/** * return a Wildcard object that has the given nwSrcCidrMask set. * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> * * @param srcCidrMask * source mask to set in <b>normal CIDR notation</b>, i.e., 8 * means x.x.x.x/8 * @return a modified object */ public Wildcards withNwSrcMask(final int srcCidrMask) { final int flags = Flag.NW_SRC.setInt(this.flags, Math.max(0, 32 - srcCidrMask)); if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }
/** * return a Wildcards object that has the given flags wildcarded * <p> * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> */ public Wildcards wildcard(final Wildcards.Flag... setFlags) { int flags = this.flags; for (final Wildcards.Flag flag : setFlags) { flags = flag.wildcard(flags); } if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }
/** * return a Wildcards object that matches on exactly the given flags * <p> * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> */ public Wildcards matchOn(final Wildcards.Flag... setFlags) { int flags = this.flags; for (final Wildcards.Flag flag : setFlags) { flags = flag.matchOn(flags); } if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }
/** * return a Wildcard object that has the given nwDstCidrMask set. * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> * * @param dstCidrMask * dest mask to set in <b>normal CIDR notation</b>, i.e., 8 means * x.x.x.x/8 * @return a modified object */ public Wildcards withNwDstMask(final int dstCidrMask) { final int flags = Flag.NW_DST.setInt(this.flags, Math.max(0, 32 - dstCidrMask)); if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }
/** * return a wildcard object matching the given int flags. May reuse / cache * frequently used wildcard instances. Don't rely on it though (use equals * not ==). * * @param flags * @return */ public static Wildcards of(final int paramFlags) { final int flags = Wildcards.sanitizeInt(paramFlags); switch (flags) { case 0x0000: return Wildcards.EXACT; case OFMatch.OFPFW_ALL_SANITIZED: return Wildcards.FULL; case INT_INPORT_L2_MATCH: return Wildcards.INPORT_L2_MATCH; default: return new Wildcards(flags); } }
/** * return a Wildcards object that has the given flags set * <p> * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> */ public Wildcards wildcard(final Wildcards.Flag flag, final Wildcards.Flag flag2) { final int flags = flag.wildcard(flag2.wildcard(this.flags)); if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }
/** * return a Wildcards object that matches on exactly the given flags * <p> * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays * unmodified. </b> */ public Wildcards matchOn(final Wildcards.Flag flag, final Wildcards.Flag flag2) { final int flags = flag.matchOn(flag2.matchOn(this.flags)); if (flags == this.flags) { return this; } else { return new Wildcards(flags); } }