@Override public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException { if (!supports(field)) throw new UnsupportedOperationException( "OFMatchV3Ver14 does not support matching on field " + field.getName()); OFOxm<F> oxm = this.oxmList.get(field); if (oxm == null || !field.arePrerequisitesOK(this)) return null; return oxm.getValue(); }
@Override public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException { if (!supportsMasked(field)) throw new UnsupportedOperationException( "OFMatchV3Ver14 does not support masked matching on field " + field.getName()); OFOxm<F> oxm = this.oxmList.get(field); if (oxm == null || !field.arePrerequisitesOK(this)) return null; if (oxm.getMask() == null) return null; // TODO: Make OfOxm extend Masked and just return the OXM? return Masked.of(oxm.getValue(), oxm.getMask()); }
@Override public String toString() { StringBuilder b = new StringBuilder("OFMatchV3Ver14("); boolean first = true; for (MatchField<?> field : getMatchFields()) { if (first) first = false; else b.append(", "); String name = field.getName(); b.append(name).append('=').append(this.get(field)); if (isPartiallyMasked(field)) { b.append('/').append(this.getMasked(field).getMask()); } } b.append(")"); return b.toString(); }
@Override public boolean isPartiallyMasked(MatchField<?> field) { if (!supports(field)) throw new UnsupportedOperationException( "OFMatchV3Ver14 does not support matching on field " + field.getName()); OFOxm<?> oxm = this.oxmList.get(field); return oxm != null && oxm.isMasked(); }
@Override public boolean isFullyWildcarded(MatchField<?> field) { if (!supports(field)) throw new UnsupportedOperationException( "OFMatchV3Ver14 does not support matching on field " + field.getName()); OFOxm<?> oxm = this.oxmList.get(field); return oxm == null; }