blob: c7a82cfc84897dbf37cc5afcf32b41a96a0a799e [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
2 * Copyright (c) 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
david_williams63219a22005-04-10 01:59:51 +000011package org.eclipse.wst.css.core.internal.metamodelimpl;
nitind958d79a2004-11-23 19:23:00 +000012
david_williams63219a22005-04-10 01:59:51 +000013import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
14import org.eclipse.wst.css.core.internal.metamodel.CSSMMSelector;
nitind958d79a2004-11-23 19:23:00 +000015
16
17abstract class CSSMMSelectorImpl extends CSSMMNodeImpl implements CSSMMSelector {
18
19 /**
20 * Constructor for CSSMMSelectorImpl.
21 */
22 public CSSMMSelectorImpl() {
23 super();
24 }
25
26 /*
27 * @see CSSMMNode#getName()
28 */
29 public String getName() {
30 String name = getAttribute(ATTR_NAME);
31 if (name != null) {
32 return name.toLowerCase();
33 }
34 else {
35 return null;
36 }
37 }
38
39 /*
40 * @see CSSMMNode#getType()
41 */
42 public String getType() {
43 return TYPE_SELECTOR;
44 }
45
46 /*
47 * @see CSSMMNodeImpl#canContain(CSSMMNode)
48 */
49 boolean canContain(CSSMMNode child) {
50 return false;
51 }
52
53 /*
54 * @see CSSMMNodeImpl#getError()
55 */
56 short getError() {
57 if (getName() == null) {
58 return MetaModelErrors.ERROR_NOT_DEFINED;
59 }
60 else {
61 return MetaModelErrors.NO_ERROR;
62 }
63 }
64
65 /*
66 * @see CSSMMSelector#getSelectorString()
67 */
68 public String getSelectorString() {
69 return fValue;
70 }
71
72 /*
73 * @see Object#toString()
74 */
75 public String toString() {
76 return getSelectorString();
77 }
78
79
80 protected String fValue = null;
81}