From 1d62c97e1dada43ee9a58bbc48f540ee34e8a51d Mon Sep 17 00:00:00 2001
From: Brian Vosburgh
Date: Wed, 23 Sep 2015 18:29:57 -0400
Subject: major rework of collections, stacks, queues, and deques
---
.../jpt/jaxb/core/internal/AbstractJaxbNode.java | 4 ++--
.../jpt/jaxb/core/internal/SchemaLibraryImpl.java | 4 ++--
.../internal/context/AbstractJaxbContextRoot.java | 22 +++++++++++-----------
.../internal/context/ContextContainerTools.java | 11 ++++++++++-
.../java/GenericJavaAttributesContainer.java | 22 +++++++++++-----------
.../context/java/GenericJavaClassMapping.java | 10 +++++-----
.../internal/context/java/GenericJavaXmlNs.java | 4 ++--
.../internal/context/ELJaxbContextRootImpl.java | 4 ++--
.../internal/context/java/ELJavaXmlJoinNode.java | 4 ++--
.../properties/JaxbSchemasPropertiesPage.java | 4 ++--
10 files changed, 49 insertions(+), 40 deletions(-)
(limited to 'jaxb')
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java
index 313eff6c4c..05ff36c0c7 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -309,7 +309,7 @@ public abstract class AbstractJaxbNode
* updated (false
).
*/
protected void sync(boolean sync) {
- HashSet contextElements = CollectionTools.set(this.getContextElements());
+ HashSet contextElements = CollectionTools.hashSet(this.getContextElements());
int resourceIndex = 0;
for (R resourceElement : this.getResourceElements()) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java
index c5c5bcbc74..3989aff4bb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -54,7 +54,7 @@ public class SchemaLibraryImpl
public List getSchemaLocations() {
return Collections.unmodifiableList(
- ListTools.list(
+ ListTools.arrayList(
IterableTools.transform(this.schemaEntries, SchemaEntry.LOCATION_TRANSFORMER)));
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java
index c5fcbcd9de..d8a1490d82 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -93,7 +93,7 @@ public abstract class AbstractJaxbContextRoot
Set totalTypeNames = new HashSet();
// process types with annotations and in jaxb.index files
- for (String typeName: CollectionTools.set(calculateInitialTypeNames())) { // ensure iterable is unique
+ for (String typeName: CollectionTools.hashSet(calculateInitialTypeNames())) { // ensure iterable is unique
totalTypeNames.add(typeName);
addType_(buildType(typeName));
}
@@ -122,18 +122,18 @@ public abstract class AbstractJaxbContextRoot
super.update();
// keep a master list of these so that objects are updated only once
- final Set packagesToUpdate = CollectionTools.set();
- final Set typesToUpdate = CollectionTools.set();
+ final Set packagesToUpdate = CollectionTools.hashSet();
+ final Set typesToUpdate = CollectionTools.hashSet();
// keep a (shrinking) running list of these so that we know which ones we do eventually need to remove
- final Set packagesToRemove = CollectionTools.set(this.packages.keySet());
- final Set typesToRemove = CollectionTools.set(this.types.keySet());
+ final Set packagesToRemove = CollectionTools.hashSet(this.packages.keySet());
+ final Set typesToRemove = CollectionTools.hashSet(this.types.keySet());
// keep a master list of all types that we've processed so we don't process them again
- final Set totalTypes = CollectionTools.set();
+ final Set totalTypes = CollectionTools.hashSet();
// keep a running list of types that we need to scan for further referenced types
- final Set typesToScan = CollectionTools.set();
+ final Set typesToScan = CollectionTools.hashSet();
// process packages with annotations first
for (String pkg : calculateInitialPackageNames()) {
@@ -148,7 +148,7 @@ public abstract class AbstractJaxbContextRoot
// calculate initial types (annotated or listed in jaxb.index files)
final Set resourceTypesToProcess
- = CollectionTools.set(calculateInitialTypeNames());
+ = CollectionTools.hashSet(calculateInitialTypeNames());
// store set of types that are referenced (and should therefore be default mapped)
final Set referencedTypes = new HashSet();
@@ -215,7 +215,7 @@ public abstract class AbstractJaxbContextRoot
* calculate set of packages that can be determined purely by presence of package annotations
*/
protected Set calculateInitialPackageNames() {
- return CollectionTools.set(
+ return CollectionTools.hashSet(
IterableTools.transform(getJaxbProject().getAnnotatedJavaResourcePackages(), JavaResourcePackage.NAME_TRANSFORMER));
}
@@ -223,7 +223,7 @@ public abstract class AbstractJaxbContextRoot
* calculate set of packages that can be determined from type names
*/
protected Set calculatePackageNames(Set typeNames) {
- Set packageNames = CollectionTools.set();
+ Set packageNames = CollectionTools.hashSet();
for (String typeName : typeNames) {
JavaType jaxbType = this.types.get(typeName);
if (jaxbType != null) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/ContextContainerTools.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/ContextContainerTools.java
index 1cfff80b7b..fda2038721 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/ContextContainerTools.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/ContextContainerTools.java
@@ -1,3 +1,12 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2015 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jaxb.core.internal.context;
import java.util.ArrayList;
@@ -86,7 +95,7 @@ public class ContextContainerTools {
* updated (false
).
*/
protected static void sync(Adapter adapter, boolean sync) {
- HashSet contextElements = CollectionTools.set(adapter.getContextElements());
+ HashSet contextElements = CollectionTools.hashSet(adapter.getContextElements());
ArrayList contextElementsToSync = new ArrayList(contextElements.size());
int resourceIndex = 0;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributesContainer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributesContainer.java
index 1da4952d28..7becc89143 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributesContainer.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributesContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -137,7 +137,7 @@ public class GenericJavaAttributesContainer
*/
private void initializePublicMemberAccessAttributes() {
this.initializeFieldAttributes(JavaResourceField.IS_RELEVANT_FOR_PUBLIC_MEMBER_ACCESS);
- Collection resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ Collection resourceMethods = CollectionTools.hashBag(this.getResourceMethods());
//iterate through all persistable resource method getters
for (JavaResourceMethod getterMethod : this.getResourcePropertyGetters()) {
JavaResourceMethod setterMethod = JavaResourceMethod.SET_METHOD_TRANSFORMER.transform(getterMethod);
@@ -169,7 +169,7 @@ public class GenericJavaAttributesContainer
private void intializePropertyAccessAttributes() {
this.initializeFieldAttributes(JavaResourceAnnotatedElement.IS_ANNOTATED);
- Collection resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ Collection resourceMethods = CollectionTools.hashBag(this.getResourceMethods());
//iterate through all resource methods searching for persistable getters
for (JavaResourceMethod getterMethod : this.getResourcePropertyGetters()) {
JavaResourceMethod setterMethod = JavaResourceMethod.SET_METHOD_TRANSFORMER.transform(getterMethod);
@@ -245,7 +245,7 @@ public class GenericJavaAttributesContainer
}
private void initializeAnnotatedPropertyAttributes() {
- Collection resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ Collection resourceMethods = CollectionTools.hashBag(this.getResourceMethods());
//iterate through all resource methods searching for persistable getters
for (JavaResourceMethod getterMethod : this.getResourcePropertyGetters()) {
JavaResourceMethod setterMethod = JavaResourceMethod.SET_METHOD_TRANSFORMER.transform(getterMethod);
@@ -312,11 +312,11 @@ public class GenericJavaAttributesContainer
* 4. all annotated methods (some will have a matching getter/setter, some will be standalone)
*/
private void syncPublicMemberAccessAttributes() {
- HashSet contextAttributes = CollectionTools.set(this.getAttributes());
+ HashSet contextAttributes = CollectionTools.hashSet(this.getAttributes());
this.syncFieldAttributes(contextAttributes, JavaResourceField.IS_RELEVANT_FOR_PUBLIC_MEMBER_ACCESS);
- Collection resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ Collection resourceMethods = CollectionTools.hashBag(this.getResourceMethods());
//iterate through all persistable resource method getters
for (JavaResourceMethod getterMethod : this.getResourcePropertyGetters()) {
JavaResourceMethod setterMethod = JavaResourceMethod.SET_METHOD_TRANSFORMER.transform(getterMethod);
@@ -347,7 +347,7 @@ public class GenericJavaAttributesContainer
* 2. all annotated methods getters/setters
*/
private void syncFieldAccessAttributes() {
- HashSet contextAttributes = CollectionTools.set(this.getAttributes());
+ HashSet contextAttributes = CollectionTools.hashSet(this.getAttributes());
this.syncFieldAttributes(contextAttributes, JavaResourceField.IS_RELEVANT_FOR_FIELD_ACCESS);
this.syncAnnotatedPropertyAttributes(contextAttributes);
@@ -360,11 +360,11 @@ public class GenericJavaAttributesContainer
* 3. all annotated methods getters/setters that don't have a matching pair
*/
private void syncPropertyAccessAttributes() {
- HashSet contextAttributes = CollectionTools.set(this.getAttributes());
+ HashSet contextAttributes = CollectionTools.hashSet(this.getAttributes());
this.syncFieldAttributes(contextAttributes, JavaResourceAnnotatedElement.IS_ANNOTATED);
- Collection resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ Collection resourceMethods = CollectionTools.hashBag(this.getResourceMethods());
//iterate through all resource methods searching for persistable getters
for (JavaResourceMethod getterMethod : this.getResourcePropertyGetters()) {
JavaResourceMethod setterMethod = JavaResourceMethod.SET_METHOD_TRANSFORMER.transform(getterMethod);
@@ -395,14 +395,14 @@ public class GenericJavaAttributesContainer
* 2. all annotated methods getters/setters (some will have a matching getter/setter, some will be standalone)
*/
private void syncNoneAccessAttributes() {
- HashSet contextAttributes = CollectionTools.set(this.getAttributes());
+ HashSet contextAttributes = CollectionTools.hashSet(this.getAttributes());
this.syncFieldAttributes(contextAttributes, JavaResourceAnnotatedElement.IS_ANNOTATED);
this.syncAnnotatedPropertyAttributes(contextAttributes);
}
private void syncAnnotatedPropertyAttributes(HashSet contextAttributes) {
- Collection resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ Collection resourceMethods = CollectionTools.hashBag(this.getResourceMethods());
//iterate through all resource methods searching for persistable getters
for (JavaResourceMethod getterMethod : this.getResourcePropertyGetters()) {
JavaResourceMethod setterMethod = JavaResourceMethod.SET_METHOD_TRANSFORMER.transform(getterMethod);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaClassMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaClassMapping.java
index ac5290d5dd..9e52c22e3f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaClassMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaClassMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -532,8 +532,8 @@ public class GenericJavaClassMapping
protected void updateIncludedAttributes() {
HashSet oldSuperclasses
- = CollectionTools.set(this.includedAttributesContainers.keySet());
- Set oldAttributes = CollectionTools.set(getIncludedAttributes());
+ = CollectionTools.hashSet(this.includedAttributesContainers.keySet());
+ Set oldAttributes = CollectionTools.hashSet(getIncludedAttributes());
if (! isXmlTransient()) {
JaxbClassMapping superclass = this.superclass;
@@ -554,7 +554,7 @@ public class GenericJavaClassMapping
this.includedAttributesContainers.remove(oldSuperclass);
}
- Set newAttributes = CollectionTools.set(getIncludedAttributes());
+ Set newAttributes = CollectionTools.hashSet(getIncludedAttributes());
if (IterableTools.elementsAreDifferent(oldAttributes, newAttributes)) {
fireCollectionChanged(INCLUDED_ATTRIBUTES_COLLECTION, newAttributes);
}
@@ -773,7 +773,7 @@ public class GenericJavaClassMapping
// no nonexistent attributes (attributes mapped otherwise allowed) ...
// *except* no transient attributes allowed
- Bag props = CollectionTools.bag(getPropOrder());
+ Bag props = CollectionTools.hashBag(getPropOrder());
Set allAttributes = new HashSet();
Set requiredAttributes = new HashSet();
Set transientAttributes = new HashSet();
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java
index aa3b73291f..bfac5bb2c9 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -133,7 +133,7 @@ public class GenericJavaXmlNs
if (schema != null) {
result = IterableTools.concatenate(result, schema.getNamespaceProposals());
}
- return CollectionTools.set(result);
+ return CollectionTools.hashSet(result);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/ELJaxbContextRootImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/ELJaxbContextRootImpl.java
index fb28815eab..7b48deec37 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/ELJaxbContextRootImpl.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/ELJaxbContextRootImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -204,7 +204,7 @@ public class ELJaxbContextRootImpl
protected void updateOxmFiles() {
Collection
- unmatchedOxmResources = CollectionTools.collection(getJaxbProject().getOxmResources());
+ unmatchedOxmResources = CollectionTools.hashBag(getJaxbProject().getOxmResources());
for (OxmFile oxmFile : getOxmFiles()) {
JptXmlResource oxmResource = oxmFile.getOxmResource();
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlJoinNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlJoinNode.java
index d78f11b5c2..13b36a84ee 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlJoinNode.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlJoinNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -159,7 +159,7 @@ public class ELJavaXmlJoinNode
StringTools.JAVA_STRING_LITERAL_CONTENT_TRANSFORMER));
}
- return CollectionTools.sortedSet(result);
+ return CollectionTools.treeSet(result);
}
return EmptyIterable.instance();
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
index e9c98045c6..8992ee6aef 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -574,7 +574,7 @@ public class JaxbSchemasPropertiesPage
@Override
protected Collection getAspectValue() {
- return CollectionTools.collection(iterator());
+ return CollectionTools.hashBag(iterator());
}
--
cgit v1.2.3