1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.common;
14 import org.simantics.db.Resource;
19 final public class NamedTypedResource implements Comparable<NamedTypedResource> {
22 final Resource resource;
25 public NamedTypedResource(String name, Resource resource, Resource type) {
27 assert(resource != null);
30 this.resource = resource;
34 public String getName() {
38 public Resource getResource() {
42 public Resource getType() {
47 public int compareTo(NamedTypedResource o) {
48 return name.compareToIgnoreCase(o.name);
52 public String toString() {
57 public int hashCode() {
58 return resource.hashCode();
62 public boolean equals(Object obj) {
67 if (getClass() != obj.getClass())
69 NamedTypedResource other = (NamedTypedResource) obj;
70 return resource.equals(other.resource) && type.equals(other.type) && name.equals(other.name);