--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.diagram.symbolcontribution;\r
+\r
+import java.util.Arrays;\r
+\r
+import org.simantics.diagram.symbollibrary.ISymbolGroup;\r
+import org.simantics.diagram.symbollibrary.ISymbolItem;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class SymbolGroup extends NamedObject implements ISymbolGroup {\r
+\r
+ public static final ISymbolItem[] NO_ITEMS = {};\r
+\r
+ ISymbolItem[] items = NO_ITEMS;\r
+\r
+ private final String description;\r
+\r
+ public SymbolGroup(Object identification, String name) {\r
+ this(identification, name, name);\r
+ }\r
+\r
+ public SymbolGroup(Object identification, String name, ISymbolItem[] items) {\r
+ this(identification, name, name, items);\r
+ }\r
+\r
+ public SymbolGroup(Object identification, String name, String description) {\r
+ super(identification, name);\r
+ this.description = description;\r
+ }\r
+\r
+ public SymbolGroup(Object identification, String name, String description, ISymbolItem[] items) {\r
+ super(identification, name);\r
+ this.description = description;\r
+ this.items = items;\r
+ }\r
+\r
+ @Override\r
+ public String getDescription() {\r
+ return description;\r
+ }\r
+\r
+ @Override\r
+ public ISymbolItem[] getItems() {\r
+ return items;\r
+ }\r
+\r
+ public void setItems(ISymbolItem[] items) {\r
+ this.items = items;\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ return super.toString() + "[item count=" + items.length + "]";\r
+ }\r
+\r
+ @Override\r
+ public int hashCode() {\r
+ final int prime = 31;\r
+ int result = super.hashCode();\r
+ result = prime * result + ((description == null) ? 0 : description.hashCode());\r
+ result = prime * result + Arrays.hashCode(items);\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+ if (!super.equals(obj))\r
+ return false;\r
+ if (getClass() != obj.getClass())\r
+ return false;\r
+ SymbolGroup other = (SymbolGroup) obj;\r
+ if (description == null) {\r
+ if (other.description != null)\r
+ return false;\r
+ } else if (!description.equals(other.description))\r
+ return false;\r
+ if (!Arrays.equals(items, other.items))\r
+ return false;\r
+ return true;\r
+ }\r
+\r
+}
\ No newline at end of file