(conversion, isIn, removeItem)
| 3719 | } |
| 3720 | |
| 3721 | function Set(conversion, isIn, removeItem) { |
| 3722 | this.clear = function() { |
| 3723 | hashMap.clear(); |
| 3724 | }; |
| 3725 | this.contains = function(o) { |
| 3726 | return isIn(o); |
| 3727 | }; |
| 3728 | this.containsAll = function(o) { |
| 3729 | var it = o.iterator(); |
| 3730 | while (it.hasNext()) { |
| 3731 | if (!this.contains(it.next())) { |
| 3732 | return false; |
| 3733 | } |
| 3734 | } |
| 3735 | return true; |
| 3736 | }; |
| 3737 | this.isEmpty = function() { |
| 3738 | return hashMap.isEmpty(); |
| 3739 | }; |
| 3740 | this.iterator = function() { |
| 3741 | return new Iterator(conversion, removeItem); |
| 3742 | }; |
| 3743 | this.remove = function(o) { |
| 3744 | if (this.contains(o)) { |
| 3745 | removeItem(o); |
| 3746 | return true; |
| 3747 | } |
| 3748 | return false; |
| 3749 | }; |
| 3750 | this.removeAll = function(c) { |
| 3751 | var it = c.iterator(); |
| 3752 | var changed = false; |
| 3753 | while (it.hasNext()) { |
| 3754 | var item = it.next(); |
| 3755 | if (this.contains(item)) { |
| 3756 | removeItem(item); |
| 3757 | changed = true; |
| 3758 | } |
| 3759 | } |
| 3760 | return true; |
| 3761 | }; |
| 3762 | this.retainAll = function(c) { |
| 3763 | var it = this.iterator(); |
| 3764 | var toRemove = []; |
| 3765 | while (it.hasNext()) { |
| 3766 | var entry = it.next(); |
| 3767 | if (!c.contains(entry)) { |
| 3768 | toRemove.push(entry); |
| 3769 | } |
| 3770 | } |
| 3771 | for (var i = 0; i < toRemove.length; ++i) { |
| 3772 | removeItem(toRemove[i]); |
| 3773 | } |
| 3774 | return toRemove.length > 0; |
| 3775 | }; |
| 3776 | this.size = function() { |
| 3777 | return hashMap.size(); |
| 3778 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected