public bool Equals(RevFlagSet other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.Mask == Mask); }
public bool ContainsAll(IEnumerable <RevFlag> c) // [henon] was Collection<?> in java { RevFlagSet oFlag = (c as RevFlagSet); if (oFlag != null) { int cMask = oFlag.Mask; return((Mask & cMask) == cMask); } return(c.All(flag => Contains(flag))); }
/// <summary> /// Remove a set of flags from this object. /// </summary> /// <param name="set"> /// The flag to remove from this object. /// </param> public void remove(RevFlagSet set) { Flags &= ~set.Mask; }
/// <summary> /// Add a set of flags to this object. /// </summary> /// <param name="set"> /// The set of flags to mark on this object, for later testing. /// </param> public void add(RevFlagSet set) { Flags |= set.Mask; }
/// <summary> /// Test to see if all flags in the set have been set on this object. /// </summary> /// <param name="set">the flags to test.</param> /// <returns>true if all flags of the set have been added to this object; /// false if some or none have been added. /// </returns> public bool hasAll(RevFlagSet set) { return((Flags & set.Mask) == set.Mask); }
/// <summary> /// Test to see if any flag in the set has been set on this object. /// </summary> /// <param name="set">the flags to test.</param> /// <returns> /// true if any flag in the set has been added to this object; false /// if not. /// </returns> public bool hasAny(RevFlagSet set) { return((Flags & set.Mask) != 0); }
/// <summary> /// Create a set of flags. /// </summary> /// <param name="flags">the set to copy flags from.</param> public RevFlagSet(RevFlagSet flags) { Mask = flags.Mask; }