diff --git a/docs/api/odfdom/org/odftoolkit/odfdom/dom/OdfSchemaConstraint.html b/docs/api/odfdom/org/odftoolkit/odfdom/dom/OdfSchemaConstraint.html
index 554063df98..0cc9a55060 100644
--- a/docs/api/odfdom/org/odftoolkit/odfdom/dom/OdfSchemaConstraint.html
+++ b/docs/api/odfdom/org/odftoolkit/odfdom/dom/OdfSchemaConstraint.html
@@ -299,8 +299,8 @@
getMessage
Specified by:
getMessage in interface ValidationConstraint
Returns:
-the detail message string of this Constraint instance (which may be
- null).
+the detail message string of this Constraint instance (which may be
+ null).
diff --git a/docs/api/odfdom/org/odftoolkit/odfdom/pkg/OdfPackageConstraint.html b/docs/api/odfdom/org/odftoolkit/odfdom/pkg/OdfPackageConstraint.html
index 7959b80dc9..a503c01fd8 100644
--- a/docs/api/odfdom/org/odftoolkit/odfdom/pkg/OdfPackageConstraint.html
+++ b/docs/api/odfdom/org/odftoolkit/odfdom/pkg/OdfPackageConstraint.html
@@ -427,8 +427,8 @@ getMessage
Specified by:
getMessage in interface ValidationConstraint
Returns:
-the detail message string of this Constraint instance (which may be
- null).
+the detail message string of this Constraint instance (which may be
+ null).
diff --git a/docs/api/odfdom/org/odftoolkit/odfdom/pkg/ValidationConstraint.html b/docs/api/odfdom/org/odftoolkit/odfdom/pkg/ValidationConstraint.html
index 6a6f028b76..a969ba3162 100644
--- a/docs/api/odfdom/org/odftoolkit/odfdom/pkg/ValidationConstraint.html
+++ b/docs/api/odfdom/org/odftoolkit/odfdom/pkg/ValidationConstraint.html
@@ -153,8 +153,8 @@ getMessage
Returns the detail message string of this Constraint.
- Returns:
-- the detail message string of this Constraint instance (which may be
- null).
+- the detail message string of this
Constraint instance (which may be
+ null).
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionInformation.java b/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionInformation.java
index 8eccf3ed6d..f5b20c9f54 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionInformation.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionInformation.java
@@ -69,15 +69,15 @@ public class MSVExpressionInformation {
private Map>> mContainedInPaths;
private boolean mCanHaveText = false;
// map child to its isSingleton property
- private Set mSingletonChildren = new HashSet();
- private Set mMultipleChildren = new HashSet();
+ private Set mSingletonChildren = new HashSet<>();
+ private Set mMultipleChildren = new HashSet<>();
public MSVExpressionInformation(Expression exp, String schemaFileName) {
- mContainedInPaths = new HashMap>>();
+ mContainedInPaths = new HashMap<>();
// Builds paths to child elements and child attributes
- List> paths = new ArrayList>();
- List start = new ArrayList(1);
+ List> paths = new ArrayList<>();
+ List start = new ArrayList<>(1);
start.add(exp);
paths.add(start);
buildPaths(paths);
@@ -111,7 +111,7 @@ public MSVExpressionInformation(Expression exp, String schemaFileName) {
for (Expression step : path) {
List> pathsToStep = mContainedInPaths.get(step);
if (pathsToStep == null) {
- pathsToStep = new ArrayList>(1);
+ pathsToStep = new ArrayList<>(1);
pathsToStep.add(path);
mContainedInPaths.put(step, pathsToStep);
} else {
@@ -132,9 +132,8 @@ public MSVExpressionInformation(Expression exp, String schemaFileName) {
*/
private void registerChildrenMaxCardinalities(List> waysToChildren) {
Map multiples =
- new HashMap<
- Expression, Boolean>(); // Cardinality (the opposite of isSingleton): true=N, false=1
- Map> paths = new HashMap>();
+ new HashMap<>(); // Cardinality (the opposite of isSingleton): true=N, false=1
+ Map> paths = new HashMap<>();
for (List way : waysToChildren) {
Expression childexp = way.get(way.size() - 1);
@@ -169,7 +168,7 @@ private void registerChildrenMaxCardinalities(List> waysToChild
// MSV detects that this is two times the same choice and creates just one ChoiceExpression.
// But this is not what we understand as a common CHOICE -> It's a common element definition
// X == empty, X
- Set choices = new HashSet();
+ Set choices = new HashSet<>();
for (Expression oldStep : paths.get(childexp)) {
if (oldStep instanceof ChoiceExp) {
choices.add((ChoiceExp) oldStep);
@@ -290,7 +289,7 @@ private static void buildPaths(List> paths) {
} else if (children.size() > 1) {
paths.remove(paths.size() - 1);
for (Expression child : children) {
- List newway = new ArrayList();
+ List newway = new ArrayList<>();
newway.addAll(waytoresearch);
newway.add(child);
paths.add(newway);
@@ -301,8 +300,8 @@ private static void buildPaths(List> paths) {
}
}
- private static List> getPathsToClass(List> paths, Class clazz) {
- List> remainingPaths = new ArrayList>();
+ private static List> getPathsToClass(List> paths, Class> clazz) {
+ List> remainingPaths = new ArrayList<>();
for (List path : paths) {
if (clazz.isInstance(path.get(path.size() - 1))) {
remainingPaths.add(path);
@@ -350,7 +349,7 @@ public boolean isMandatory(Collection equallyNamedChildren) {
"ExpressionInformation: Cannot determine isMandatory for a null or empty children list.");
}
- Set> twins = new HashSet>();
+ Set> twins = new HashSet<>();
for (Expression exp : equallyNamedChildren) {
if (!(exp instanceof NameClassAndExpression)) {
@@ -378,7 +377,7 @@ public boolean isMandatory(Collection equallyNamedChildren) {
* So both twins do not really share such a CHOICE. You have to look for another path which _really_ shares this choice or - if you find none -
* set CHILD to optional.
*/
- HashSet visitedChoices = new HashSet();
+ HashSet visitedChoices = new HashSet<>();
for (List path : twins) {
for (int s = 0; s < path.size(); s++) {
@@ -388,7 +387,7 @@ public boolean isMandatory(Collection equallyNamedChildren) {
// If other twin paths share the same choice...
List> choiceInPaths =
- new ArrayList>(mContainedInPaths.get(step));
+ new ArrayList<>(mContainedInPaths.get(step));
choiceInPaths.retainAll(twins);
// small Performance gain: A CHOICE contained only in one path makes CHILD always optional
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionIterator.java b/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionIterator.java
index b05078b643..2baf3c6b58 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionIterator.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionIterator.java
@@ -75,7 +75,7 @@ public UniqueAncestor(Expression exp, int siblingIndex) {
private int mSiblingIndex;
}
// limit browsing to subclasses of Expression
- private Class mDesiredExpression;
+ private Class> mDesiredExpression;
// if false, only return direct children of root. Don't return root as first element or grand
// children
private boolean mOnlyChildren;
@@ -102,7 +102,7 @@ public MSVExpressionIterator(Expression root) {
* @param root Expression root
* @param desiredExpression Limit returned expressions to subclasses of desiredExpression
*/
- public MSVExpressionIterator(Expression root, Class desiredExpression) {
+ public MSVExpressionIterator(Expression root, Class> desiredExpression) {
this(root, desiredExpression, false);
}
@@ -118,7 +118,7 @@ public MSVExpressionIterator(Expression root, Class desiredExpression) {
* @param desiredExpression Limit returned expressions to subclasses of desiredExpression
* @param onlyChildren if only children should be returned
*/
- public MSVExpressionIterator(Expression root, Class desiredExpression, boolean onlyChildren) {
+ public MSVExpressionIterator(Expression root, Class> desiredExpression, boolean onlyChildren) {
// initialize members
mCurrentExpression = root;
mDesiredExpression = desiredExpression;
@@ -126,10 +126,10 @@ public MSVExpressionIterator(Expression root, Class desiredExpression, boolean o
// create helpers
mVisitor = new MSVExpressionVisitorChildren();
- mKnownElementExpressions = new HashSet();
+ mKnownElementExpressions = new HashSet<>();
// Initialize status
- mAncestorsAndCurrent = new Stack();
+ mAncestorsAndCurrent = new Stack<>();
mAncestorsAndCurrent.push(new UniqueAncestor(root, 0));
// make sure that there is at least one desired expression - for hasNext()
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionVisitorChildren.java b/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionVisitorChildren.java
index 93c796695c..f46f7d7efc 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionVisitorChildren.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/MSVExpressionVisitorChildren.java
@@ -123,7 +123,7 @@ public List onValue(ValueExp exp) {
}
private List children(Iterator i) {
- ArrayList list = new ArrayList();
+ ArrayList list = new ArrayList<>();
while (i.hasNext()) {
list.add(i.next());
}
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/MSVNameClassVisitorList.java b/generator/schema2template/src/main/java/schema2template/grammar/MSVNameClassVisitorList.java
index dae10b266a..7d7c71b670 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/MSVNameClassVisitorList.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/MSVNameClassVisitorList.java
@@ -61,7 +61,7 @@ public List onAnyName(AnyNameClass arg0) {
}
public List onChoice(ChoiceNameClass arg0) {
- List retval = new ArrayList();
+ List retval = new ArrayList<>();
retval.addAll((List) arg0.nc1.visit(this));
retval.addAll((List) arg0.nc2.visit(this));
return retval;
@@ -71,7 +71,7 @@ public List onChoice(ChoiceNameClass arg0) {
// W3C Schema restriction on name have to be given out as more adequate for us!
public List onDifference(DifferenceNameClass arg0) {
if (arg0 != null) {
- List l = new ArrayList(2);
+ List l = new ArrayList<>(2);
l.add(arg0.nc1.toString());
l.add(arg0.nc2.toString());
return l;
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/NamespaceDictionary.java b/generator/schema2template/src/main/java/schema2template/grammar/NamespaceDictionary.java
index 969eeab435..fd11c87128 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/NamespaceDictionary.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/NamespaceDictionary.java
@@ -34,8 +34,8 @@ public class NamespaceDictionary {
/** Construct a new empty dictionary */
public NamespaceDictionary() {
- uri2local = new HashMap();
- local2uri = new HashMap();
+ uri2local = new HashMap<>();
+ local2uri = new HashMap<>();
}
/**
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/OdfFamilyPropertiesPatternMatcher.java b/generator/schema2template/src/main/java/schema2template/grammar/OdfFamilyPropertiesPatternMatcher.java
index 3d5b67debf..5810517390 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/OdfFamilyPropertiesPatternMatcher.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/OdfFamilyPropertiesPatternMatcher.java
@@ -91,7 +91,7 @@ private void initialize() {
// Whenever visiting elements and RefExps, they are memorized
// to identify head of islands.
int depth = 1;
- List resultList = null;
+ List resultList = null;
@Override
public void onElement(ElementExp exp) {
@@ -116,7 +116,7 @@ public void onAttribute(AttributeExp exp) {
// System.out.println("NEW FAMILY" + asString(propertiesByFamily));
collectingState = Boolean.TRUE;
depthCollecting = depth;
- resultList = new ArrayList();
+ resultList = new ArrayList<>();
if (exp.exp instanceof ValueExp) {
// System.out.println("style:family-1" + ((ValueExp) exp.exp).value.toString());
propertiesByFamily.put(((ValueExp) exp.exp).value.toString(), resultList);
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/OdfModel.java b/generator/schema2template/src/main/java/schema2template/grammar/OdfModel.java
index 5ac81269bf..1e6225bc4b 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/OdfModel.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/OdfModel.java
@@ -121,7 +121,7 @@ public boolean isStylable(SourceCodeBaseClass base) {
* @return list of style family names
*/
public List getStyleFamilies(PuzzleComponent element) {
- List retval = new ArrayList();
+ List retval = new ArrayList<>();
if (mNameToFamiliesMap.containsKey(element.getQName())) {
retval.addAll(mNameToFamiliesMap.get(element.getQName()));
}
@@ -135,11 +135,11 @@ public List getStyleFamilies(PuzzleComponent element) {
*/
public SortedSet getStyleFamilies() {
Iterator> iter = mNameToFamiliesMap.values().iterator();
- List families = new ArrayList();
+ List families = new ArrayList<>();
while (iter.hasNext()) {
families.addAll(iter.next());
}
- return new TreeSet(families);
+ return new TreeSet<>(families);
}
/**
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePiece.java b/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePiece.java
index d04c8a69ab..632fb01eb5 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePiece.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePiece.java
@@ -36,7 +36,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -77,9 +76,9 @@ public class PuzzlePiece implements Comparable, PuzzleComponent {
/* Properties for PuzzlePiece of Type.ELEMENT */
private PuzzlePieceSet mChildElements = new PuzzlePieceSet();
- private HashSet mMandatoryChildElementNames = new HashSet();
+ private HashSet mMandatoryChildElementNames = new HashSet<>();
private PuzzlePieceSet mAttributes = new PuzzlePieceSet();
- private HashSet mMandatoryChildAttributeNames = new HashSet();
+ private HashSet mMandatoryChildAttributeNames = new HashSet<>();
private boolean mCanHaveText = false;
private Set mSingletonChildExpressions;
private Set mMultipleChildExpressions;
@@ -335,9 +334,8 @@ public PuzzlePieceSet withMultiples() {
*/
public int getMultipleNumber() {
int retval = 0;
- Iterator iter = mMultiples.iterator();
- while (iter.hasNext()) {
- if (iter.next().equals(this)) {
+ for (PuzzlePiece mMultiple : mMultiples) {
+ if (mMultiple.equals(this)) {
return retval;
}
retval++;
@@ -522,7 +520,7 @@ private static void extractTypedPuzzlePieces(
Grammar grammar, PuzzlePieceSet setToBeFilled, Class superclass) {
Expression root = grammar.getTopLevel();
MSVExpressionIterator iter = new MSVExpressionIterator(root, superclass);
- HashMap> multipleMap = new HashMap>();
+ HashMap> multipleMap = new HashMap<>();
while (iter.hasNext()) {
Expression exp = iter.next();
@@ -544,7 +542,7 @@ private static void extractTypedPuzzlePieces(
if (multiples != null) {
multiples.add(newDefinition);
} else {
- multiples = new ArrayList(1);
+ multiples = new ArrayList<>(1);
multiples.add(newDefinition);
multipleMap.put(name, multiples);
}
@@ -552,20 +550,16 @@ private static void extractTypedPuzzlePieces(
}
// Fills multiple information
- Iterator defIter = setToBeFilled.iterator();
- while (defIter.hasNext()) {
- PuzzlePiece def = defIter.next();
+ for (PuzzlePiece def : setToBeFilled) {
def.mMultiples = new PuzzlePieceSet(multipleMap.get(def.getQName()));
}
}
// Builds Map Expression->List
private static Map> buildReverseMap(PuzzlePieceSet defs) {
- Map> retval = new HashMap>();
- Iterator iter = defs.iterator();
- while (iter.hasNext()) {
- PuzzlePiece def = iter.next();
- List list = retval.computeIfAbsent(def.getExpression(), k -> new ArrayList());
+ Map> retval = new HashMap<>();
+ for (PuzzlePiece def : defs) {
+ List list = retval.computeIfAbsent(def.getExpression(), k -> new ArrayList<>());
list.add(def);
}
return retval;
@@ -573,12 +567,10 @@ private static Map> buildReverseMap(PuzzlePieceSet
// Builds Map Name->List
private static Map> buildNameExpressionsMap(PuzzlePieceSet defs) {
- Map> retval = new HashMap>();
- Iterator iter = defs.iterator();
- while (iter.hasNext()) {
- PuzzlePiece def = iter.next();
- List list = retval.computeIfAbsent(def.getQName(), k -> new ArrayList());
- list.add(def.getExpression());
+ Map> retval = new HashMap<>();
+ for (PuzzlePiece def : defs) {
+ List list = retval.computeIfAbsent(def.getQName(), k -> new ArrayList<>());
+ list.add(def.getExpression());
}
return retval;
}
@@ -654,14 +646,12 @@ private static void addChildExpression(
Map> reverseAttributeMap = buildReverseMap(attributes);
// Handle Element Definitions
- Iterator iter = elements.iterator();
- while (iter.hasNext()) {
- PuzzlePiece puzzlePiece = iter.next();
+ for (PuzzlePiece puzzlePiece : elements) {
MSVExpressionIterator childFinder =
- new MSVExpressionIterator(
- puzzlePiece.getExpression(),
- NameClassAndExpression.class,
- MSVExpressionIterator.DIRECT_CHILDREN_ONLY);
+ new MSVExpressionIterator(
+ puzzlePiece.getExpression(),
+ NameClassAndExpression.class,
+ MSVExpressionIterator.DIRECT_CHILDREN_ONLY);
while (childFinder.hasNext()) {
Expression child_exp = childFinder.next();
List child_defs = null;
@@ -683,13 +673,13 @@ private static void addChildExpression(
if (graphMLTargetDir != null) {
TinkerPopGraph tinkerPopGraph =
- new TinkerPopGraph(puzzlePiece.getExpression(), schemaFileName);
+ new TinkerPopGraph(puzzlePiece.getExpression(), schemaFileName);
File f = new File(graphMLTargetDir);
f.mkdirs();
tinkerPopGraph.exportAsGraphML(f.getAbsolutePath());
}
MSVExpressionInformation elementInfo =
- new MSVExpressionInformation(puzzlePiece.getExpression(), schemaFileName);
+ new MSVExpressionInformation(puzzlePiece.getExpression(), schemaFileName);
puzzlePiece.mCanHaveText = elementInfo.canHaveText();
Map> atnameToDefs = buildNameExpressionsMap(puzzlePiece.mAttributes);
@@ -700,7 +690,7 @@ private static void addChildExpression(
}
Map> elnameToDefs =
- buildNameExpressionsMap(puzzlePiece.mChildElements);
+ buildNameExpressionsMap(puzzlePiece.mChildElements);
for (Map.Entry> entry : elnameToDefs.entrySet()) {
if (elementInfo.isMandatory(entry.getValue())) {
puzzlePiece.mMandatoryChildElementNames.add(entry.getKey());
@@ -712,21 +702,18 @@ private static void addChildExpression(
}
// Handle Attribute Definitions
- Iterator aiter = attributes.iterator();
- while (aiter.hasNext()) {
- PuzzlePiece def = aiter.next();
-
+ for (PuzzlePiece def : attributes) {
MSVExpressionIterator datatypeFinder =
- new MSVExpressionIterator(
- def.getExpression(), DataExp.class, MSVExpressionIterator.DIRECT_CHILDREN_ONLY);
+ new MSVExpressionIterator(
+ def.getExpression(), DataExp.class, MSVExpressionIterator.DIRECT_CHILDREN_ONLY);
while (datatypeFinder.hasNext()) {
DataExp data_exp = (DataExp) datatypeFinder.next();
def.mDatatypes.add(new PuzzlePiece(data_exp));
}
MSVExpressionIterator valueFinder =
- new MSVExpressionIterator(
- def.getExpression(), ValueExp.class, MSVExpressionIterator.DIRECT_CHILDREN_ONLY);
+ new MSVExpressionIterator(
+ def.getExpression(), ValueExp.class, MSVExpressionIterator.DIRECT_CHILDREN_ONLY);
while (valueFinder.hasNext()) {
ValueExp value_exp = (ValueExp) valueFinder.next();
if (value_exp.getName().localName.equals("token")) {
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePieceSet.java b/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePieceSet.java
index a8ab77faff..40f9cfb529 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePieceSet.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/PuzzlePieceSet.java
@@ -50,11 +50,11 @@ public class PuzzlePieceSet implements PuzzleComponent, Collection
private SortedSet mDefinitions;
public PuzzlePieceSet() {
- mDefinitions = new TreeSet();
+ mDefinitions = new TreeSet<>();
}
public PuzzlePieceSet(Collection c) {
- mDefinitions = new TreeSet(c);
+ mDefinitions = new TreeSet<>(c);
}
private void assertNotImmutable() {
@@ -109,8 +109,8 @@ private PuzzlePiece first() {
*/
Map uniteDefinitionsWithEqualContent() {
// System.out.println("this.mDefinitions: " + this.mDefinitions.size());
- Map retval = new HashMap();
- SortedSet immutableSet = new TreeSet(this.mDefinitions);
+ Map retval = new HashMap<>();
+ SortedSet immutableSet = new TreeSet<>(this.mDefinitions);
for (PuzzlePiece def1 : immutableSet) {
if (!this.mDefinitions.contains(def1)) {
// if def1 is already removed, we shouldn't process it
@@ -174,7 +174,7 @@ public void makeImmutable() {
* @return new PuzzlePieceSet
*/
public PuzzlePieceSet withoutMultiples() {
- Map uniqueMap = new HashMap();
+ Map uniqueMap = new HashMap<>();
for (PuzzlePiece def : this) {
uniqueMap.put(def.getQName(), def);
}
diff --git a/generator/schema2template/src/main/java/schema2template/grammar/XMLModel.java b/generator/schema2template/src/main/java/schema2template/grammar/XMLModel.java
index 4d8cfbfa45..fac9748d13 100644
--- a/generator/schema2template/src/main/java/schema2template/grammar/XMLModel.java
+++ b/generator/schema2template/src/main/java/schema2template/grammar/XMLModel.java
@@ -108,7 +108,7 @@ public SortedSet getElements(String qName) {
// create a map from the qName to the PuzzlePiece(s) - multiple if there are multiple
// definitions for the qName in the grammar
this.elementNameToPuzzlePieces =
- createMapQNameToPuzzlePiece(new TreeSet(this.getElements()));
+ createMapQNameToPuzzlePiece(new TreeSet<>(this.getElements()));
}
return this.elementNameToPuzzlePieces.get(qName);
}
@@ -119,7 +119,7 @@ public SortedSet getAttributes(String qName) {
// create a map from the qName to the PuzzlePiece(s) - multiple if there are multiple
// definitions for the qName in the grammar
this.attributeNameToPuzzlePieces =
- createMapQNameToPuzzlePiece(new TreeSet(this.getElements()));
+ createMapQNameToPuzzlePiece(new TreeSet<>(this.getElements()));
}
return this.attributeNameToPuzzlePieces.get(qName);
}
@@ -133,9 +133,9 @@ public SortedSet getAttributes(String qName) {
*/
private static Map> createMapQNameToPuzzlePiece(
Set definitions) {
- Map> retval = new HashMap>();
+ Map> retval = new HashMap<>();
for (PuzzlePiece def : definitions) {
- SortedSet multiples = retval.computeIfAbsent(def.getQName(), k -> new TreeSet());
+ SortedSet multiples = retval.computeIfAbsent(def.getQName(), k -> new TreeSet<>());
multiples.add(def);
}
return retval;
diff --git a/generator/schema2template/src/main/java/schema2template/template/FileCreationListEntry.java b/generator/schema2template/src/main/java/schema2template/template/FileCreationListEntry.java
index 77a00c7e93..2592d08daa 100644
--- a/generator/schema2template/src/main/java/schema2template/template/FileCreationListEntry.java
+++ b/generator/schema2template/src/main/java/schema2template/template/FileCreationListEntry.java
@@ -55,7 +55,7 @@ public FileCreationListEntry(EntryType type) {
*/
public FileCreationListEntry(EntryType type, int lineNumber) {
mType = type;
- mAttributes = new HashMap();
+ mAttributes = new HashMap<>();
mLineNumber = lineNumber;
}
diff --git a/generator/schema2template/src/main/java/schema2template/template/GrammarAdditionsFileHandler.java b/generator/schema2template/src/main/java/schema2template/template/GrammarAdditionsFileHandler.java
index fdd0788241..f0046519cd 100644
--- a/generator/schema2template/src/main/java/schema2template/template/GrammarAdditionsFileHandler.java
+++ b/generator/schema2template/src/main/java/schema2template/template/GrammarAdditionsFileHandler.java
@@ -92,8 +92,8 @@ public GrammarAdditionsFileHandler(
mAttributeDefaults = attributeDefaultMap;
mDatatypeValueConversion = datatypeValueConversion;
mElementStyleFamilies = elementNameToFamilyMap;
- mProcessedElements = new HashSet();
- mProcessedDatatypes = new HashSet();
+ mProcessedElements = new HashSet<>();
+ mProcessedDatatypes = new HashSet<>();
}
private void readElementSettings(Attributes attrs) throws SAXException {
@@ -116,7 +116,7 @@ private void readElementSettings(Attributes attrs) throws SAXException {
String commaSeparatedStyleFamilies = attrs.getValue("family");
if (commaSeparatedStyleFamilies != null) {
StringTokenizer tok = new StringTokenizer(commaSeparatedStyleFamilies, ",");
- List families = new ArrayList();
+ List families = new ArrayList<>();
while (tok.hasMoreElements()) {
String family = tok.nextToken();
if (family.length() > 0) {
@@ -156,7 +156,7 @@ private void readAttributeSettings(Attributes attrs) throws SAXException {
String elementName = attrs.getValue("element");
String defaultValue = attrs.getValue("defaultValue");
- Map defaultValueByParentElement = mAttributeDefaults.computeIfAbsent(attrName, k -> new HashMap());
+ Map defaultValueByParentElement = mAttributeDefaults.computeIfAbsent(attrName, k -> new HashMap<>());
if (elementName == null) {
elementName = ALL_ELEMENTS;
}
diff --git a/generator/schema2template/src/main/java/schema2template/template/SourceCodeBaseClass.java b/generator/schema2template/src/main/java/schema2template/template/SourceCodeBaseClass.java
index 06bfcc5de7..f293aeda49 100644
--- a/generator/schema2template/src/main/java/schema2template/template/SourceCodeBaseClass.java
+++ b/generator/schema2template/src/main/java/schema2template/template/SourceCodeBaseClass.java
@@ -101,7 +101,7 @@ public PuzzlePieceSet getChildElementsOfBaseClass() {
*/
public PuzzlePieceSet getBaseAttributes() {
SortedSet attributes =
- new TreeSet(mChildElementsOfBaseClass.last().getAttributes());
+ new TreeSet<>(mChildElementsOfBaseClass.last().getAttributes());
for (PuzzlePiece childElement :
mChildElementsOfBaseClass.headSet(mChildElementsOfBaseClass.last())) {
attributes.retainAll(childElement.getAttributes());
@@ -116,7 +116,7 @@ public PuzzlePieceSet getBaseAttributes() {
*/
public PuzzlePieceSet getBaseElements() {
SortedSet elements =
- new TreeSet(mChildElementsOfBaseClass.last().getChildElements());
+ new TreeSet<>(mChildElementsOfBaseClass.last().getChildElements());
for (PuzzlePiece childElement :
mChildElementsOfBaseClass.headSet(mChildElementsOfBaseClass.last())) {
elements.retainAll(childElement.getChildElements());
diff --git a/generator/schema2template/src/main/java/schema2template/template/SourceCodeModel.java b/generator/schema2template/src/main/java/schema2template/template/SourceCodeModel.java
index 417aa80b9b..786147b861 100644
--- a/generator/schema2template/src/main/java/schema2template/template/SourceCodeModel.java
+++ b/generator/schema2template/src/main/java/schema2template/template/SourceCodeModel.java
@@ -23,13 +23,13 @@
*/
package schema2template.template;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import schema2template.grammar.PuzzleComponent;
import schema2template.grammar.PuzzlePiece;
+import schema2template.grammar.PuzzlePieceSet;
import schema2template.grammar.XMLModel;
/**
@@ -65,19 +65,19 @@ public SourceCodeModel(
mElementNameBaseNameMap = elementNameBaseNameMap;
mBaseNameElementNameMap = invertMap(elementNameBaseNameMap);
// Intermediate Step -> get all baseNames
- SortedSet baseNames = new TreeSet(elementNameBaseNameMap.values());
+ SortedSet baseNames = new TreeSet<>(elementNameBaseNameMap.values());
// Intermediate Step -> get all childOfBaseElement Definitions for each baseName
Map> baseNameElementsMap =
- new HashMap>(baseNames.size());
+ new HashMap<>(baseNames.size());
for (Map.Entry entry : elementNameBaseNameMap.entrySet()) {
String elementName = entry.getKey();
String baseName = entry.getValue();
- SortedSet elements = baseNameElementsMap.computeIfAbsent(baseName, k -> new TreeSet());
+ SortedSet elements = baseNameElementsMap.computeIfAbsent(baseName, k -> new TreeSet<>());
PuzzleComponent childElement = schemaModel.getElement(elementName);
if (childElement != null) {
- if (childElement instanceof Collection) {
- elements.addAll((Collection) childElement);
+ if (childElement instanceof PuzzlePieceSet) {
+ elements.addAll((PuzzlePieceSet) childElement);
} else {
elements.add((PuzzlePiece) childElement);
}
@@ -87,8 +87,8 @@ public SourceCodeModel(
}
// Generate all base classes (additional intermediate step: register them)
- mBaseNameToBaseClass = new HashMap(baseNames.size());
- mBaseClasses = new TreeSet();
+ mBaseNameToBaseClass = new HashMap<>(baseNames.size());
+ mBaseClasses = new TreeSet<>();
for (String baseName : baseNames) {
SourceCodeBaseClass javabaseclass =
new SourceCodeBaseClass(baseName, baseNameElementsMap.get(baseName));
@@ -97,7 +97,7 @@ public SourceCodeModel(
}
// Generate a map from element tag name to base classes
- mElementBaseMap = new HashMap(elementNameBaseNameMap.size());
+ mElementBaseMap = new HashMap<>(elementNameBaseNameMap.size());
for (Map.Entry entry : elementNameBaseNameMap.entrySet()) {
String baseName = entry.getValue();
SourceCodeBaseClass baseclass = mBaseNameToBaseClass.get(baseName);
@@ -137,7 +137,7 @@ public String getBaseChild(String childName) {
private static Map invertMap(Map map) {
Map inversedMap = null;
if (map != null && !map.isEmpty()) {
- inversedMap = new HashMap();
+ inversedMap = new HashMap<>();
for (Map.Entry entry : map.entrySet()) {
if (!inversedMap.containsKey(entry.getKey())) {
inversedMap.put(entry.getValue(), entry.getKey());
@@ -281,7 +281,7 @@ public String getSuperClassPackageName(String childName) {
public SortedSet getValuetypes(PuzzleComponent datatypes) {
SortedSet retval = null;
if (datatypes != null) {
- retval = new TreeSet();
+ retval = new TreeSet<>();
for (PuzzlePiece datatype : datatypes.getCollection()) {
String datatypename = datatype.getQName();
String[] tuple = mDataTypeValueAndConversionMap.get(datatypename);
diff --git a/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedInnerTableOperation.java b/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedInnerTableOperation.java
index ffb58d5844..6abec9c0aa 100644
--- a/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedInnerTableOperation.java
+++ b/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedInnerTableOperation.java
@@ -44,7 +44,7 @@ public CachedInnerTableOperation(
public CachedOperation clone() {
return new CachedInnerTableOperation(
mComponentType,
- new ArrayList(mStart),
+ new ArrayList<>(mStart),
mAbsolutePosition,
mHardFormattingProperties,
mComponentProperties);
diff --git a/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedOperation.java b/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedOperation.java
index bf25c98604..c69a3a735a 100644
--- a/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedOperation.java
+++ b/odfdom/src/main/java/org/odftoolkit/odfdom/changes/CachedOperation.java
@@ -47,7 +47,7 @@ public CachedOperation(
public CachedOperation clone() {
return new CachedOperation(
mComponentType,
- new ArrayList(mStart),
+ new ArrayList<>(mStart),
mAbsolutePosition,
mHardFormattingProperties,
mComponentProperties);
diff --git a/odfdom/src/main/java/org/odftoolkit/odfdom/changes/ChangesFileSaxHandler.java b/odfdom/src/main/java/org/odftoolkit/odfdom/changes/ChangesFileSaxHandler.java
index ec4647c559..0e1f460879 100644
--- a/odfdom/src/main/java/org/odftoolkit/odfdom/changes/ChangesFileSaxHandler.java
+++ b/odfdom/src/main/java/org/odftoolkit/odfdom/changes/ChangesFileSaxHandler.java
@@ -38,7 +38,6 @@
import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
@@ -98,7 +97,6 @@
import org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles;
import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle;
import org.odftoolkit.odfdom.incubator.doc.style.OdfStylePageLayout;
-import org.odftoolkit.odfdom.incubator.doc.text.OdfTextListStyle;
import org.odftoolkit.odfdom.pkg.OdfAttribute;
import org.odftoolkit.odfdom.pkg.OdfElement;
import org.odftoolkit.odfdom.pkg.OdfFileDom;
@@ -155,7 +153,7 @@ public class ChangesFileSaxHandler extends org.odftoolkit.odfdom.pkg.OdfFileSaxH
// the actual component. Linking each other building the tree view of the document
private Component mCurrentComponent;
// the position of the component, being updated for the operations being generated
- private final List mLastComponentPositions = new ArrayList();
+ private final List mLastComponentPositions = new ArrayList<>();
/** DOM is created by default, but is in general not needed */
private final boolean domCreationEnabled = true;
// private final ArrayDeque mShapePropertiesStack;
@@ -184,7 +182,7 @@ public class ChangesFileSaxHandler extends org.odftoolkit.odfdom.pkg.OdfFileSaxH
* Quick cache to get the correct linked list. Key is the xml:id of the first list. The sequence
* of all continued lists and usability functions are provided by ContinuedList
*/
- private final Map mLinkedLists = new HashMap();
+ private final Map mLinkedLists = new HashMap<>();
// *** FOR BLOCKING OPERATIONS
// the number of elements above the current element during parsing.
// Required to find out if the correct blocking element for the UI was found
@@ -421,15 +419,15 @@ public ChangesFileSaxHandler(Node rootNode) throws SAXException {
mSchemaDoc.setJsonOperationQueue(mJsonOperationProducer);
}
- mAutoListStyles = new HashMap();
- mUserFieldDecls = new HashMap();
+ mAutoListStyles = new HashMap<>();
+ mUserFieldDecls = new HashMap<>();
// Stack to remember/track the nested delimiters not being components (spans) open-up by SAX
// events
- mTextSelectionStack = new ArrayDeque();
- mListStyleStack = new ArrayDeque();
+ mTextSelectionStack = new ArrayDeque<>();
+ mListStyleStack = new ArrayDeque<>();
// mShapePropertiesStack = new ArrayDeque();
- mWhitespaceStatusStack = new ArrayDeque();
+ mWhitespaceStatusStack = new ArrayDeque<>();
}
@Override
@@ -570,9 +568,7 @@ public void startElement(String uri, String localName, String qName, Attributes
&& (localName.equals("p") || localName.equals("h") || localName.equals("table"))) {
// move nodes
Node bodyNode = mCurrentNode.getParentNode();
- Iterator it = m_cachedPageShapes.iterator();
- while (it.hasNext()) {
- ShapeProperties component = it.next();
+ for (ShapeProperties component : m_cachedPageShapes) {
bodyNode.insertBefore(component.mOwnNode, bodyNode.getFirstChild());
}
mLastComponentPositions.clear();
@@ -622,7 +618,7 @@ public void startElement(String uri, String localName, String qName, Attributes
TextParagraphElementBase p = (TextParagraphElementBase) element;
Map hardFormatting = mJsonOperationProducer.getHardStyles(p);
if (hardFormatting == null) {
- hardFormatting = new HashMap();
+ hardFormatting = new HashMap<>();
}
if (element instanceof TextHElement || !mListStyleStack.isEmpty()) {
if (!hardFormatting.containsKey("paragraph")) {
@@ -716,9 +712,7 @@ public void startElement(String uri, String localName, String qName, Attributes
hardFormatting,
mContextName);
paragraphOpCreated = true;
- Iterator it = m_cachedPageShapes.iterator();
- while (it.hasNext()) {
- ShapeProperties component = it.next();
+ for (ShapeProperties component : m_cachedPageShapes) {
Component frameComponent = component.getDrawFrameElement().getComponent();
Component frameComponentParent = frameComponent.getParent();
int framePosition = frameComponentParent.indexOf(frameComponent);
@@ -726,16 +720,14 @@ public void startElement(String uri, String localName, String qName, Attributes
element.appendChild(component.mOwnNode);
component.mShapePosition.addAll(0, position);
component.createShapeOperation(
- this,
- mComponentStack,
- component.mDescription,
- component.hasImageSibling()
- ? ShapeType.ImageShape
- : component.isGroupShape() ? ShapeType.GroupShape : ShapeType.NormalShape,
- component.mContext);
- Iterator opIter = component.iterator();
- while (opIter.hasNext()) {
- CachedOperation op = opIter.next();
+ this,
+ mComponentStack,
+ component.mDescription,
+ component.hasImageSibling()
+ ? ShapeType.ImageShape
+ : component.isGroupShape() ? ShapeType.GroupShape : ShapeType.NormalShape,
+ component.mContext);
+ for (CachedOperation op : component) {
List start = op.mStart;
if (!op.mAbsolutePosition) {
if (op.mComponentType.equals(OperationConstants.ATTRIBUTES)) {
@@ -749,12 +741,12 @@ public void startElement(String uri, String localName, String qName, Attributes
start.addAll(0, position);
}
cacheOperation(
- false,
- op.mComponentType,
- start,
- false,
- op.mHardFormattingProperties,
- op.mComponentProperties);
+ false,
+ op.mComponentType,
+ start,
+ false,
+ op.mHardFormattingProperties,
+ op.mComponentProperties);
}
}
m_cachedPageShapes.clear();
@@ -797,7 +789,7 @@ public void startElement(String uri, String localName, String qName, Attributes
// if there are absolute styles, but not the main property set, where the
// templateStyleId should be placed in
if (hardFormatting == null) {
- hardFormatting = new HashMap();
+ hardFormatting = new HashMap<>();
}
hardFormatting.put("drawing", new JSONObject());
}
@@ -806,7 +798,7 @@ public void startElement(String uri, String localName, String qName, Attributes
// if there are absolute styles, but not the main property set, where the
// templateStyleId should be placed in
if (hardFormatting == null) {
- hardFormatting = new HashMap();
+ hardFormatting = new HashMap<>();
}
hardFormatting.put("image", new JSONObject());
}
@@ -1065,7 +1057,7 @@ public void startElement(String uri, String localName, String qName, Attributes
}
// The grid is known after columns had been parsed, updating later to row positino
- List tablePosition = new ArrayList(mLastComponentPositions);
+ List tablePosition = new ArrayList<>(mLastComponentPositions);
cacheTableOperation(
OperationConstants.TABLE,
tablePosition,
@@ -1111,7 +1103,7 @@ public void startElement(String uri, String localName, String qName, Attributes
// if there are absolute styles, but not the main property set, where the
// templateStyleId should be placed in
if (hardFormatting == null) {
- hardFormatting = new HashMap();
+ hardFormatting = new HashMap<>();
}
}
if (!hardFormatting.containsKey("row")) {
@@ -1173,7 +1165,7 @@ public void startElement(String uri, String localName, String qName, Attributes
// templateStyleId should be placed in
if (hardFormatting == null || !hardFormatting.containsKey("cell")) {
if (hardFormatting == null) {
- hardFormatting = new HashMap();
+ hardFormatting = new HashMap<>();
}
}
JSONObject cellProps = (JSONObject) hardFormatting.get("cell");
@@ -1345,7 +1337,7 @@ public void startElement(String uri, String localName, String qName, Attributes
}
}
if (mColumns == null) {
- mColumns = new ArrayList();
+ mColumns = new ArrayList<>();
}
mColumns.add(column);
} else if (element instanceof TextListElement) {
@@ -1501,7 +1493,7 @@ public void startElement(String uri, String localName, String qName, Attributes
int childNo = frameProps.incrementChildNumber();
if (childNo == 1) {
- Map hardFormatting = new HashMap();
+ Map hardFormatting = new HashMap<>();
hardFormatting.putAll(frameProps.getShapeHardFormatting());
JSONObject drawingProps = (JSONObject) hardFormatting.get("drawing");
JSONObject imageProps = (JSONObject) hardFormatting.get("image");
@@ -1645,17 +1637,13 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
defaultTabStopWidth = _defaultTabStopWidth;
}
}
- final Iterator textStyleIter =
- officeStyles.getStylesForFamily(OdfStyleFamily.Text).iterator();
- while (textStyleIter.hasNext()) {
+ for (OdfStyle odfStyle : officeStyles.getStylesForFamily(OdfStyleFamily.Text)) {
mJsonOperationProducer.triggerStyleHierarchyOps(
- officeStyles, OdfStyleFamily.Text, textStyleIter.next());
+ officeStyles, OdfStyleFamily.Text, odfStyle);
}
- final Iterator graphicStyleIter =
- officeStyles.getStylesForFamily(OdfStyleFamily.Graphic).iterator();
- while (graphicStyleIter.hasNext()) {
+ for (OdfStyle odfStyle : officeStyles.getStylesForFamily(OdfStyleFamily.Graphic)) {
mJsonOperationProducer.triggerStyleHierarchyOps(
- officeStyles, OdfStyleFamily.Graphic, graphicStyleIter.next());
+ officeStyles, OdfStyleFamily.Graphic, odfStyle);
}
// always generate graphic default style
mJsonOperationProducer.triggerDefaultStyleOp(
@@ -1689,11 +1677,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
// mJsonOperationProducer.triggerStyleHierarchyOps(officeStyles,
// OdfStyleFamily.List, style);
// }
- final Iterator textListStyleIter =
- officeStyles.getListStyles().iterator();
- while (textListStyleIter.hasNext()) {
- mJsonOperationProducer.addListStyle(textListStyleIter.next());
- }
+ officeStyles.getListStyles().forEach(mJsonOperationProducer::addListStyle);
// maps page properties, but returns the default page properties
defaultPageStyles = mJsonOperationProducer.addPageProperties(stylesDom);
@@ -1755,16 +1739,14 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
null);
}
// flush the inner operations of the shape
- Iterator opIter = shapeProps.iterator();
- while (opIter.hasNext()) {
- CachedOperation op = opIter.next();
+ for (CachedOperation op : shapeProps) {
cacheOperation(
- true,
- op.mComponentType,
- op.mStart,
- false,
- op.mHardFormattingProperties,
- op.mComponentProperties);
+ true,
+ op.mComponentType,
+ op.mStart,
+ false,
+ op.mHardFormattingProperties,
+ op.mComponentProperties);
}
mCurrentComponent = mCurrentComponent.getParent();
}
@@ -1816,7 +1798,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
// if there are absolute styles, but not the main property set, where the
// templateStyleId should be placed in
if (hardFormatting == null) {
- hardFormatting = new HashMap();
+ hardFormatting = new HashMap<>();
}
}
if (s.hasUrl()) {
@@ -1904,7 +1886,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
newOp.mStart.remove(0);
}
- ArrayList