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.diagram.symbolcontribution;
14 import java.util.Arrays;
16 import org.simantics.diagram.symbollibrary.ISymbolGroup;
17 import org.simantics.diagram.symbollibrary.ISymbolItem;
20 * @author Tuukka Lehtonen
22 public class SymbolGroup extends NamedObject implements ISymbolGroup {
24 public static final ISymbolItem[] NO_ITEMS = {};
26 ISymbolItem[] items = NO_ITEMS;
28 private final String description;
30 public SymbolGroup(Object identification, String name) {
31 this(identification, name, name);
34 public SymbolGroup(Object identification, String name, ISymbolItem[] items) {
35 this(identification, name, name, items);
38 public SymbolGroup(Object identification, String name, String description) {
39 super(identification, name);
40 this.description = description;
43 public SymbolGroup(Object identification, String name, String description, ISymbolItem[] items) {
44 super(identification, name);
45 this.description = description;
50 public String getDescription() {
55 public ISymbolItem[] getItems() {
59 public void setItems(ISymbolItem[] items) {
64 public String toString() {
65 return super.toString() + "[item count=" + items.length + "]";
69 public int hashCode() {
71 int result = super.hashCode();
72 result = prime * result + ((description == null) ? 0 : description.hashCode());
73 result = prime * result + Arrays.hashCode(items);
78 public boolean equals(Object obj) {
81 if (!super.equals(obj))
83 if (getClass() != obj.getClass())
85 SymbolGroup other = (SymbolGroup) obj;
86 if (description == null) {
87 if (other.description != null)
89 } else if (!description.equals(other.description))
91 if (!Arrays.equals(items, other.items))