Skip to content

Commit

Permalink
Remove unnecessary type arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Mendez committed Dec 29, 2016
1 parent 1078c7d commit d376d35
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions gel/src/main/java/de/tudresden/inf/lat/gel/GelProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private IntegerSubsumerGraph copy(IntegerSubsumerGraph graph) {
* relations to each role
*/
private Map<Integer, IntegerBinaryRelation> getRelationX() {
Map<Integer, IntegerBinaryRelation> m = new TreeMap<Integer, IntegerBinaryRelation>();
Map<Integer, IntegerBinaryRelation> m = new TreeMap<>();
for (Integer relation : super.getRelationIdSet()) {
if (super.getEntityManager().isAuxiliary(relation) || relation < IntegerEntityManager.firstUsableIdentifier)
continue;
Expand All @@ -121,8 +121,8 @@ public static GelProcessor newGelProcessor(
Set<ComplexIntegerAxiom> ontology,
IntegerOntologyObjectFactory factory) {

Set<Integer> originalClassSet = new HashSet<Integer>();
Set<Integer> originalObjectPropertySet = new HashSet<Integer>();
Set<Integer> originalClassSet = new HashSet<>();
Set<Integer> originalObjectPropertySet = new HashSet<>();

for (ComplexIntegerAxiom axiom : ontology) {
originalClassSet.addAll(axiom.getClassesInSignature());
Expand Down
4 changes: 2 additions & 2 deletions gel/src/main/java/de/tudresden/inf/lat/gel/GelReasoner.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public OWLClassExpression leastCommonSubsumer(OWLClassExpression[] concepts, int
Set<ComplexIntegerAxiom> axiomSet = translator.translateSA(ontology.getAxioms());

// get IDs of the newly introduced concept names
List<Integer> ids = new ArrayList<Integer>(concepts.length);
List<Integer> ids = new ArrayList<>(concepts.length);
for (OWLClass c : newNames) {
ids.add(translator.getTranslationRepository().getId(c));
}
Expand Down Expand Up @@ -187,7 +187,7 @@ private OWLClassExpression translateBack(OWLDataFactory owlFactory, TranslationR
if (exp instanceof IntegerClass) {
return rep.getOWLClass(((IntegerClass) exp).getId());
} else if (exp instanceof IntegerObjectIntersectionOf) {
Set<OWLClassExpression> classExpressions = new HashSet<OWLClassExpression>();
Set<OWLClassExpression> classExpressions = new HashSet<>();
for (IntegerClassExpression e : ((IntegerObjectIntersectionOf) exp).getOperands()) {
classExpressions.add(translateBack(owlFactory, rep, e));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void loadDataStructures(GelProcessor processor) {
*/
protected List<Successor> getSuccessors(Integer concept) {
// compute all successors of the given concept
List<Successor> successors = new ArrayList<Successor>();
List<Successor> successors = new ArrayList<>();
for (Integer relation : relationGraph.keySet()) {
// check that the relation is not auxiliary or the top or bottom relation
if (entityManager.isAuxiliary(relation) || relation < IntegerEntityManager.firstUsableIdentifier) {
Expand All @@ -61,7 +61,7 @@ protected List<Successor> getSuccessors(Integer concept) {
}

// find the minimal successors in this set
List<Successor> minimalSuccessors = new ArrayList<Successor>(successors);
List<Successor> minimalSuccessors = new ArrayList<>(successors);
for (Successor s1 : successors) {
if (!minimalSuccessors.contains(s1)) continue;
for (Successor s2 : successors) {
Expand Down
14 changes: 7 additions & 7 deletions gel/src/main/java/de/tudresden/inf/lat/gel/LcsAlgorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public IntegerClassExpression leastCommonSubsumer(List<Integer> concepts, int k)
// traverse all roles, if k is larger than 0
if (k > 0) {
// construct a set of all successors for each concept
List<List<Successor>> successors = new ArrayList<List<Successor>>(concepts.size());
List<List<Successor>> successors = new ArrayList<>(concepts.size());
for (int concept : concepts) {
successors.add(getSuccessors(concept));
}
Expand All @@ -54,7 +54,7 @@ public IntegerClassExpression leastCommonSubsumer(List<Integer> concepts, int k)

// recursively compute the lcs and add the resulting
// existential restriction to the conjunction set
List<Integer> newConcepts = new ArrayList<Integer>();
List<Integer> newConcepts = new ArrayList<>();
for (Successor s : successorTuple) {
newConcepts.add(s.getConcept());
}
Expand Down Expand Up @@ -88,14 +88,14 @@ public IntegerClassExpression leastCommonSubsumer(List<Integer> concepts, int k)
*/
private Set<Integer> findMinimalCommonRelations(List<Successor> successorTuple) {
// Find common subsumers of all relations
Set<Integer> commonRelations = new HashSet<Integer>(objectPropertyGraph.getSubsumers(successorTuple.get(0).getRole()));
Set<Integer> commonRelations = new HashSet<>(objectPropertyGraph.getSubsumers(successorTuple.get(0).getRole()));
for (int i = 1; i < successorTuple.size(); i++) {
commonRelations.retainAll(objectPropertyGraph.getSubsumers(successorTuple.get(i).getRole()));
}
commonRelations.remove(IntegerEntityManager.topObjectPropertyId);

// Extract minimal ones
Set<Integer> mininmalCommonRelations = new HashSet<Integer>(commonRelations);
Set<Integer> mininmalCommonRelations = new HashSet<>(commonRelations);
for (Integer r1 : commonRelations) {
if (!mininmalCommonRelations.contains(r1))
continue;
Expand Down Expand Up @@ -136,13 +136,13 @@ private boolean subsumesAll(Integer concept, List<Integer> otherConcepts) {
*/
private Set<IntegerClassExpression> getCommonNames(List<Integer> concepts) {
// compute concept names that subsume all input concepts
Set<Integer> commonSubsumers = new HashSet<Integer>(classGraph.getSubsumers(concepts.get(0)));
Set<Integer> commonSubsumers = new HashSet<>(classGraph.getSubsumers(concepts.get(0)));
for (int i = 1; i < concepts.size(); i++) {
commonSubsumers.retainAll(classGraph.getSubsumers(concepts.get(i)));
}

// wrap all common names as owl classes
Set<IntegerClassExpression> commonNames = new HashSet<IntegerClassExpression>();
Set<IntegerClassExpression> commonNames = new HashSet<>();
for (Integer i : commonSubsumers) {
if (!entityManager.isAuxiliary(i)) {
commonNames.add(dataTypeFactory.createClass(i));
Expand All @@ -168,7 +168,7 @@ public SuccessorProduct(List<List<Successor>> successors) {
this.successors = successors;
indices = new int[successors.size()];
lengths = new int[successors.size()];
result = new ArrayList<Successor>(successors.size());
result = new ArrayList<>(successors.size());
unmodifiableView = Collections.unmodifiableList(result);
for (int i = 0; i < successors.size(); i++) {
indices[i] = 0;
Expand Down
8 changes: 4 additions & 4 deletions gel/src/main/java/de/tudresden/inf/lat/gel/LcsView.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public class LcsView extends AbstractActiveOntologyViewComponent implements Acti
private Box inputBox;

// the interface can have an arbitrary number of concepts - these list store the concepts and the text/check boxes
List<JCheckBox> inputCheckBoxes = new ArrayList<JCheckBox>();
List<JTextField> inputTextFields = new ArrayList<JTextField>();
List<OWLClassExpression> inputConcepts = new ArrayList<OWLClassExpression>();
List<JCheckBox> inputCheckBoxes = new ArrayList<>();
List<JTextField> inputTextFields = new ArrayList<>();
List<OWLClassExpression> inputConcepts = new ArrayList<>();

/**
* Creates a new text/check box for an additional input concept.
Expand Down Expand Up @@ -128,7 +128,7 @@ public void actionPerformed(ActionEvent e) {
if ("lcs".equals(e.getActionCommand())) {
// button click - compute lsc
GelReasoner r = new GelReasoner(super.getOWLModelManager().getActiveOntology());
ArrayList<OWLClassExpression> concepts = new ArrayList<OWLClassExpression>();
ArrayList<OWLClassExpression> concepts = new ArrayList<>();
for (int i=0; i<inputConcepts.size(); i++) {
if (inputCheckBoxes.get(i).isSelected()) {
concepts.add(inputConcepts.get(i));
Expand Down
6 changes: 3 additions & 3 deletions gel/src/main/java/de/tudresden/inf/lat/gel/Minimizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public IntegerClassExpression minimize(IntegerClassExpression expression) {
// class expression is a conjunction - get all conjuncts (that
// should be either concept names or existential restrictions)
Set<IntegerClassExpression> exprs = ((IntegerObjectIntersectionOf) expression).getOperands();
Set<IntegerClassExpression> newExprs = new HashSet<IntegerClassExpression>(exprs);
Set<IntegerClassExpression> newExprs = new HashSet<>(exprs);

// remove all expressions that subsume other expressions
for (IntegerClassExpression e1 : exprs) {
Expand All @@ -72,7 +72,7 @@ public IntegerClassExpression minimize(IntegerClassExpression expression) {
}

// minimize all remaining expressions individually
Set<IntegerClassExpression> newExprs2 = new HashSet<IntegerClassExpression>();
Set<IntegerClassExpression> newExprs2 = new HashSet<>();
for (IntegerClassExpression e : newExprs) {
newExprs2.add(minimize(e));
}
Expand Down Expand Up @@ -165,7 +165,7 @@ private boolean subConcept(IntegerClassExpression e1, IntegerClassExpression e2)
}

private Collection<IntegerObjectSomeValuesFrom> findExistentialRestrictions(Integer property, IntegerClassExpression expression) {
Collection<IntegerObjectSomeValuesFrom> set = new ArrayList<IntegerObjectSomeValuesFrom>();
Collection<IntegerObjectSomeValuesFrom> set = new ArrayList<>();
if (expression instanceof IntegerObjectIntersectionOf) {
for (IntegerClassExpression sub : ((IntegerObjectIntersectionOf) expression).getOperands()) {
set.addAll(findExistentialRestrictions(property, sub));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MscAlgorithm extends Generalization {
*/
public IntegerClassExpression mostSpecificConcept(int element, int k) {
// get all concept names that the individual is part of
Set<IntegerClassExpression> conjunctionSet = new HashSet<IntegerClassExpression>();
Set<IntegerClassExpression> conjunctionSet = new HashSet<>();
for (Integer concept : classGraph.getSubsumers(element)) {
if (!entityManager.isAuxiliary(concept)) {
conjunctionSet.add(dataTypeFactory.createClass(concept));
Expand Down

0 comments on commit d376d35

Please sign in to comment.