QuotaCounts { public QuotaCounts negation() { QuotaCounts ret = new QuotaCounts.Builder().quotaCount(this).build(); ret.nsSsCounts = modify(ret.nsSsCounts, ec -> ec.negation()); ret.tsCounts = modify(ret.tsCounts, ec -> ec.negation()); return ret; } private  QuotaCounts(Builder builder); QuotaCounts add(QuotaCounts that); QuotaCounts subtract(QuotaCounts that); QuotaCounts negation(); long getNameSpace(); void setNameSpace(long nameSpaceCount); void addNameSpace(long nsDelta); long getStorageSpace(); void setStorageSpace(long spaceCount); void addStorageSpace(long dsDelta); EnumCounters<StorageType> getTypeSpaces(); void addTypeSpace(StorageType type, long delta); boolean anyNsSsCountGreaterOrEqual(long val); boolean anyTypeSpaceCountGreaterOrEqual(long val); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void testNegation() throws Exception { QuotaCounts qc = new QuotaCounts.Builder() .nameSpace(HdfsConstants.QUOTA_RESET) .storageSpace(HdfsConstants.QUOTA_RESET) .typeSpaces(HdfsConstants.QUOTA_RESET).build(); qc = qc.negation(); assertEquals(1, qc.getNameSpace()); assertEquals(1, qc.getStorageSpace()); for (StorageType t : StorageType.values()) { assertEquals(1, qc.getTypeSpace(t)); } }