001package components.set; 002 003/** 004 * {@code SetKernel} enhanced with secondary methods. 005 * 006 * @param <T> 007 * type of {@code Set} entries 008 */ 009public interface Set<T> extends SetKernel<T> { 010 011 /** 012 * Adds to {@code this} all elements of {@code s} that are not already in 013 * {@code this}, also removing just those elements from {@code s}. 014 * 015 * @param s 016 * the {@code Set} whose elements are to be added to {@code this} 017 * @updates this, s 018 * @ensures <pre> 019 * this = #this union #s and 020 * s = #this intersection #s 021 * </pre> 022 */ 023 void add(Set<T> s); 024 025 /** 026 * Removes from {@code this} all elements of {@code s} that are also in 027 * {@code this}, leaving {@code s} unchanged, and returns the elements 028 * actually removed. 029 * 030 * @param s 031 * the {@code Set} whose elements are to be removed from 032 * {@code this} 033 * @return the {@code Set} whose elements actually were removed from 034 * {@code this} 035 * @updates this 036 * @ensures <pre> 037 * this = #this \ s and 038 * remove = #this intersection s 039 * </pre> 040 */ 041 Set<T> remove(Set<T> s); 042 043 /** 044 * Reports whether {@code this} is a subset of {@code s}. 045 * 046 * @param s 047 * the second set 048 * @return whether {@code this} is a subset of {@code s} 049 * @ensures isSubset = this is subset of s 050 */ 051 boolean isSubset(Set<T> s); 052 053}