nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 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_williams | 63219a2 | 2005-04-10 01:59:51 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.css.core.internal.metamodelimpl; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 12 | |
david_williams | 63219a2 | 2005-04-10 01:59:51 +0000 | [diff] [blame] | 13 | import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; |
| 14 | import org.eclipse.wst.css.core.internal.metamodel.CSSMMSelector; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 15 | |
| 16 | |
| 17 | abstract 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 | } |