This method of the PermissionUtils Class compares two sets of flags. Each flag represents access to resources that are independent of other resources of the permissions. The flags to be compared are selected by a bitmask and are compared as a unit.
public static int compareFlags(int flags1, int flags2, int mask, int prevcmp);
Returns a new comparison result, merged with the previous comparison result using mergeComparisonResults.
flags1 & mask | flags2 & mask | Result before merging |
nonzero | nonzero | SetComparison.EQUAL |
nonzero | zero | SetComparison.EMPTY_SUPERSET |
zero | nonzero | SetComparison.EMPTY_SUBSET |
zero | zero | SetComparison.EMPTY |
flags1 | The flags that determine access to resources in the first permission. |
flags2 | The flags that determine access to resources in the second permission. |
mask | A bitmask that is combined with the flags (using the logical AND operator (&)) to determine which resources are to be compared as a unit. |
prevcmp | A previous comparison result for other resources of the permissions. For the first resource of a permission, this is typically SetComparison.EMPTY. |