1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.ui.tests.views.properties.tabbed.dynamic.model;
15 
16 /**
17  * A shape enumeration for the dynamic tests view. (Should use an enum when we
18  * can use Java 5).
19  *
20  * @author Anthony Hunter
21  */
22 public class DynamicTestsShape {
23 
24 	public static final DynamicTestsShape CIRCLE = new DynamicTestsShape(
25 			"circle"); //$NON-NLS-1$
26 
27 	public static final DynamicTestsShape SQUARE = new DynamicTestsShape(
28 			"square"); //$NON-NLS-1$
29 
30 	public static final DynamicTestsShape STAR = new DynamicTestsShape("star"); //$NON-NLS-1$
31 
32 	public static final DynamicTestsShape TRIANGLE = new DynamicTestsShape(
33 			"triangle"); //$NON-NLS-1$
34 
35 	/**
36 	 * @return the shape
37 	 */
getShape(String value)38 	public static DynamicTestsShape getShape(String value) {
39 		if (SQUARE.getShape().equals(value)) {
40 			return SQUARE;
41 		} else if (CIRCLE.getShape().equals(value)) {
42 			return CIRCLE;
43 		} else if (TRIANGLE.getShape().equals(value)) {
44 			return TRIANGLE;
45 		} else if (STAR.getShape().equals(value)) {
46 			return STAR;
47 		}
48 		return null;
49 	}
50 
51 	private String shape;
52 
DynamicTestsShape(String aShape)53 	private DynamicTestsShape(String aShape) {
54 		setShape(aShape);
55 	}
56 
57 	/**
58 	 * @return the shape
59 	 */
getShape()60 	public String getShape() {
61 		return shape;
62 	}
63 
64 	/**
65 	 * @param shape
66 	 *            the shape to set
67 	 */
setShape(String aShape)68 	public void setShape(String aShape) {
69 		this.shape = aShape;
70 	}
71 
72 	@Override
toString()73 	public String toString() {
74 		return getShape();
75 	}
76 
77 }
78