1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.diagram.symbolcontribution;
\r
14 import java.util.Arrays;
\r
16 import org.simantics.diagram.symbollibrary.ISymbolGroup;
\r
17 import org.simantics.diagram.symbollibrary.ISymbolItem;
\r
20 * @author Tuukka Lehtonen
\r
22 public class SymbolGroup extends NamedObject implements ISymbolGroup {
\r
24 public static final ISymbolItem[] NO_ITEMS = {};
\r
26 ISymbolItem[] items = NO_ITEMS;
\r
28 private final String description;
\r
30 public SymbolGroup(Object identification, String name) {
\r
31 this(identification, name, name);
\r
34 public SymbolGroup(Object identification, String name, ISymbolItem[] items) {
\r
35 this(identification, name, name, items);
\r
38 public SymbolGroup(Object identification, String name, String description) {
\r
39 super(identification, name);
\r
40 this.description = description;
\r
43 public SymbolGroup(Object identification, String name, String description, ISymbolItem[] items) {
\r
44 super(identification, name);
\r
45 this.description = description;
\r
50 public String getDescription() {
\r
55 public ISymbolItem[] getItems() {
\r
59 public void setItems(ISymbolItem[] items) {
\r
64 public String toString() {
\r
65 return super.toString() + "[item count=" + items.length + "]";
\r
69 public int hashCode() {
\r
70 final int prime = 31;
\r
71 int result = super.hashCode();
\r
72 result = prime * result + ((description == null) ? 0 : description.hashCode());
\r
73 result = prime * result + Arrays.hashCode(items);
\r
78 public boolean equals(Object obj) {
\r
81 if (!super.equals(obj))
\r
83 if (getClass() != obj.getClass())
\r
85 SymbolGroup other = (SymbolGroup) obj;
\r
86 if (description == null) {
\r
87 if (other.description != null)
\r
89 } else if (!description.equals(other.description))
\r
91 if (!Arrays.equals(items, other.items))
\r