Package com.github.javaparser.utils
Class VisitorSet<N extends Node>
- java.lang.Object
-
- com.github.javaparser.utils.VisitorSet<N>
-
- All Implemented Interfaces:
java.lang.Iterable<N>
,java.util.Collection<N>
,java.util.Set<N>
public class VisitorSet<N extends Node> extends java.lang.Object implements java.util.Set<N>
A set that overrides the equals and hashcode calculation of the added nodes by using another equals and hashcode visitor for those methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
VisitorSet.EqualsHashcodeOverridingFacade
-
Field Summary
Fields Modifier and Type Field Description private GenericVisitor<java.lang.Boolean,Visitable>
equalsVisitor
private GenericVisitor<java.lang.Integer,java.lang.Void>
hashcodeVisitor
private java.util.Set<VisitorSet.EqualsHashcodeOverridingFacade>
innerSet
-
Constructor Summary
Constructors Constructor Description VisitorSet(GenericVisitor<java.lang.Integer,java.lang.Void> hashcodeVisitor, GenericVisitor<java.lang.Boolean,Visitable> equalsVisitor)
Pass the visitors to use for equals and hashcode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(N elem)
boolean
addAll(java.util.Collection<? extends N> col)
void
clear()
boolean
contains(java.lang.Object elem)
boolean
containsAll(java.util.Collection<?> col)
boolean
isEmpty()
java.util.Iterator<N>
iterator()
boolean
remove(java.lang.Object elem)
boolean
removeAll(java.util.Collection<?> col)
boolean
retainAll(java.util.Collection<?> col)
int
size()
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] arr)
java.lang.String
toString()
-
-
-
Field Detail
-
innerSet
private final java.util.Set<VisitorSet.EqualsHashcodeOverridingFacade> innerSet
-
hashcodeVisitor
private final GenericVisitor<java.lang.Integer,java.lang.Void> hashcodeVisitor
-
equalsVisitor
private final GenericVisitor<java.lang.Boolean,Visitable> equalsVisitor
-
-
Constructor Detail
-
VisitorSet
public VisitorSet(GenericVisitor<java.lang.Integer,java.lang.Void> hashcodeVisitor, GenericVisitor<java.lang.Boolean,Visitable> equalsVisitor)
Pass the visitors to use for equals and hashcode.
-
-
Method Detail
-
add
public boolean add(N elem)
-
addAll
public boolean addAll(java.util.Collection<? extends N> col)
-
clear
public void clear()
-
contains
public boolean contains(java.lang.Object elem)
-
containsAll
public boolean containsAll(java.util.Collection<?> col)
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<N> iterator()
-
remove
public boolean remove(java.lang.Object elem)
-
removeAll
public boolean removeAll(java.util.Collection<?> col)
-
retainAll
public boolean retainAll(java.util.Collection<?> col)
-
size
public int size()
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <T> T[] toArray(T[] arr)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-