Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2014-07-10 14:12:42 -0400
committerRoberto E. Escobar2014-08-28 19:59:21 -0400
commit5d08615ad65ef6b236fc50a55722e9cd09c4492e (patch)
tree9ca714aa48692ed81f94e1f1efef68e6daea2860 /plugins/org.eclipse.osee.framework.jdk.core
parent83ec09fb7705f8e596736d8aab99d8e8143efcf6 (diff)
downloadorg.eclipse.osee-5d08615ad65ef6b236fc50a55722e9cd09c4492e.tar.gz
org.eclipse.osee-5d08615ad65ef6b236fc50a55722e9cd09c4492e.tar.xz
org.eclipse.osee-5d08615ad65ef6b236fc50a55722e9cd09c4492e.zip
feature[ats_ATS64164]: CPA: Create CpaResource
Diffstat (limited to 'plugins/org.eclipse.osee.framework.jdk.core')
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidBaseIdentity.java62
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentifiable.java18
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentity.java23
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidNamedIdentity.java45
4 files changed, 148 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidBaseIdentity.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidBaseIdentity.java
new file mode 100644
index 0000000000..7628a1b341
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidBaseIdentity.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.jdk.core.type;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UuidBaseIdentity<T> implements UuidIdentity<T> {
+ private final T uuid;
+
+ public UuidBaseIdentity(T id) {
+ this.uuid = id;
+ }
+
+ @Override
+ public T getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public int hashCode() {
+ return getUuid().hashCode();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean equals(Object obj) {
+ boolean equal = false;
+ if (obj instanceof UuidIdentity) {
+ UuidIdentity<T> identity = (UuidIdentity<T>) obj;
+ if (getUuid() == identity.getUuid()) {
+ equal = true;
+ } else if (getUuid() != null) {
+ equal = getUuid().equals(identity.getUuid());
+ }
+ }
+ return equal;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(getUuid());
+ }
+
+ @Override
+ public boolean matches(UuidIdentity<?>... identities) {
+ for (UuidIdentity<?> identity : identities) {
+ if (equals(identity)) {
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentifiable.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentifiable.java
new file mode 100644
index 0000000000..7e02c0ef37
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentifiable.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.jdk.core.type;
+
+/**
+ * @author Donald G. dunne
+ */
+public interface UuidIdentifiable<T> extends UuidIdentity<T>, Named {
+ //
+}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentity.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentity.java
new file mode 100644
index 0000000000..d2a1b79c39
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentity.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.jdk.core.type;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface UuidIdentity<T> {
+
+ T getUuid();
+
+ boolean matches(UuidIdentity<?>... identities);
+
+}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidNamedIdentity.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidNamedIdentity.java
new file mode 100644
index 0000000000..e6b8912bc3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidNamedIdentity.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.jdk.core.type;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UuidNamedIdentity<T> extends UuidBaseIdentity<T> implements UuidIdentifiable<T>, Comparable<Named> {
+ private String name;
+
+ public UuidNamedIdentity(T uid, String name) {
+ super(uid);
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int compareTo(Named other) {
+ if (other != null && other.getName() != null && getName() != null) {
+ return getName().compareTo(other.getName());
+ }
+ return -1;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+} \ No newline at end of file

Back to the top