2012-06-17 20:34:50 +02:00
|
|
|
/*******************************************************************************
|
2015-10-22 00:25:12 +02:00
|
|
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
2012-06-17 20:34:50 +02:00
|
|
|
* 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:
|
2015-01-21 21:58:35 +01:00
|
|
|
* MINRES Technologies GmbH - initial API and implementation
|
2012-06-17 20:34:50 +02:00
|
|
|
*******************************************************************************/
|
2015-01-03 16:34:32 +01:00
|
|
|
package com.minres.scviewer.database;
|
2012-06-17 19:53:05 +02:00
|
|
|
|
2015-11-15 22:15:37 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
|
2015-01-01 23:17:32 +01:00
|
|
|
public class RelationType {
|
|
|
|
|
2015-11-15 22:15:37 +01:00
|
|
|
private static HashMap<String, RelationType> registry = new HashMap<>();
|
|
|
|
|
2015-01-01 23:17:32 +01:00
|
|
|
private String name;
|
|
|
|
|
2015-11-15 22:15:37 +01:00
|
|
|
public static RelationType create(String name){
|
|
|
|
if(registry.containsKey(name)){
|
|
|
|
return registry.get(name);
|
|
|
|
}else{
|
|
|
|
RelationType relType = new RelationType(name);
|
|
|
|
registry.put(name, relType);
|
|
|
|
return relType;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private RelationType(String name) {
|
2015-01-01 23:17:32 +01:00
|
|
|
super();
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
2015-10-27 23:39:33 +01:00
|
|
|
public String toString(){
|
|
|
|
return name;
|
|
|
|
}
|
2015-11-15 22:15:37 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
return name.hashCode();
|
|
|
|
}
|
2012-06-17 19:53:05 +02:00
|
|
|
}
|