/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
private final String name;
public TypeGroup(String name, Resource type) {
- this(name);
+ this(name, new Resource[] { type });
}
public TypeGroup(String name, Resource... types) {
this.name = name;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + types.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TypeGroup other = (TypeGroup) obj;
+ return types.equals(other.types);
+ }
+
/**
* Initialize TypeGroup from a DIAGRAM.Group instance.
*
}
@Override
- public void trackItems(RequestProcessor processor, final Resource runtimeDiagram, final SetListener<Resource> listener) {
+ public void trackItems(RequestProcessor processor, final Resource runtimeDiagram, final SetListener<Resource> listener) throws DatabaseException {
if (types.isEmpty()) {
System.out.println("TypeGroup has no types!");
return;
}
- processor.asyncRequest(new BinaryRead<Resource, Collection<Resource>, Collection<Resource>>(runtimeDiagram, types) {
+ processor.syncRequest(new BinaryRead<Resource, Collection<Resource>, Collection<Resource>>(runtimeDiagram, types) {
@Override
public Set<Resource> perform(ReadGraph graph) throws DatabaseException {