-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proof Slicing: make dependency tracking optional (#3309)
Fixes #3301 by adding an option to disable the dependency tracker and adding a way to create the dependency graph after the proof is done. cc @unp1
- Loading branch information
Showing
11 changed files
with
415 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
key.util/src/main/java/org/key_project/util/collection/IdentityHashSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* This file is part of KeY - https://key-project.org | ||
* KeY is licensed under the GNU General Public License Version 2 | ||
* SPDX-License-Identifier: GPL-2.0-only */ | ||
package org.key_project.util.collection; | ||
|
||
import java.util.Collection; | ||
import java.util.IdentityHashMap; | ||
import java.util.Iterator; | ||
import java.util.Set; | ||
|
||
/** | ||
* Hash set using the object's identity instead of their hashcode to determine uniqueness. | ||
* | ||
* @param <T> elmeent type | ||
* @author Arne Keller | ||
*/ | ||
public class IdentityHashSet<T> implements Set<T> { | ||
/** | ||
* Backing store. | ||
*/ | ||
private final IdentityHashMap<T, Object> innerMap = new IdentityHashMap<>(); | ||
|
||
/** | ||
* Construct an empty set. | ||
*/ | ||
public IdentityHashSet() { | ||
|
||
} | ||
|
||
/** | ||
* Copy provided elements into a new set. | ||
* | ||
* @param list elements to add | ||
*/ | ||
public IdentityHashSet(ImmutableList<T> list) { | ||
list.forEach(this::add); | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return innerMap.size(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return innerMap.isEmpty(); | ||
} | ||
|
||
@Override | ||
public boolean contains(Object o) { | ||
return innerMap.containsKey(o); | ||
} | ||
|
||
@Override | ||
public Iterator<T> iterator() { | ||
return innerMap.keySet().iterator(); | ||
} | ||
|
||
@Override | ||
public Object[] toArray() { | ||
return innerMap.keySet().toArray(); | ||
} | ||
|
||
@Override | ||
public <T1> T1[] toArray(T1[] a) { | ||
return innerMap.keySet().toArray(a); | ||
} | ||
|
||
@Override | ||
public boolean add(T o) { | ||
return innerMap.put(o, o) == null; | ||
} | ||
|
||
@Override | ||
public boolean remove(Object o) { | ||
var contained = innerMap.containsKey(o); | ||
innerMap.remove(o); | ||
return contained; | ||
} | ||
|
||
@Override | ||
public boolean addAll(Collection<? extends T> c) { | ||
var changed = false; | ||
for (T o : c) { | ||
changed |= add(o); | ||
} | ||
return changed; | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
innerMap.clear(); | ||
} | ||
|
||
@Override | ||
public boolean removeAll(Collection<?> c) { | ||
var changed = false; | ||
for (Object o : c) { | ||
changed |= remove(o); | ||
} | ||
return changed; | ||
} | ||
|
||
@Override | ||
public boolean retainAll(Collection<?> c) { | ||
return innerMap.keySet().retainAll(c); | ||
} | ||
|
||
@Override | ||
public boolean containsAll(Collection<?> c) { | ||
return innerMap.keySet().containsAll(c); | ||
} | ||
} |
Oops, something went wrong.