1 /*******************************************************************************
2 * Copyright (c) 2010, 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
;
15 import java
.util
.ArrayList
;
16 import java
.util
.List
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
21 * Filter node for the '==' operation
24 * @author Patrick Tasse
26 public class TmfFilterEqualsNode
extends TmfFilterAspectNode
{
28 /** equals node name */
29 public static final String NODE_NAME
= "EQUALS"; //$NON-NLS-1$
30 /** not attribute name */
31 public static final String NOT_ATTR
= "not"; //$NON-NLS-1$
32 /** value attribute name */
33 public static final String VALUE_ATTR
= "value"; //$NON-NLS-1$
34 /** ignorecase attribute name */
35 public static final String IGNORECASE_ATTR
= "ignorecase"; //$NON-NLS-1$
37 private boolean fNot
= false;
38 private String fValue
;
39 private boolean fIgnoreCase
= false;
42 * @param parent the parent node
44 public TmfFilterEqualsNode(ITmfFilterTreeNode parent
) {
49 * @return the NOT state
51 public boolean isNot() {
56 * @param not the NOT state
58 public void setNot(boolean not
) {
63 * @return the equals value
65 public String
getValue() {
70 * @param value the equals value
72 public void setValue(String value
) {
77 * @return the ignoreCase state
79 public boolean isIgnoreCase() {
84 * @param ignoreCase the ignoreCase state
86 public void setIgnoreCase(boolean ignoreCase
) {
87 this.fIgnoreCase
= ignoreCase
;
91 public String
getNodeName() {
96 public boolean matches(ITmfEvent event
) {
97 if (event
== null || fEventAspect
== null) {
100 Object value
= fEventAspect
.resolve(event
);
104 String valueString
= value
.toString();
106 return valueString
.equalsIgnoreCase(fValue
) ^ fNot
;
108 return valueString
.equals(fValue
) ^ fNot
;
112 public List
<String
> getValidChildren() {
113 return new ArrayList
<>(0);
117 public String
toString(boolean explicit
) {
118 return getAspectLabel(explicit
) + (fNot ?
" not equals " : " equals ") + (fIgnoreCase ?
"ignorecase \"" : "\"") + fValue
+ '\"'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
122 public ITmfFilterTreeNode
clone() {
123 TmfFilterEqualsNode clone
= (TmfFilterEqualsNode
) super.clone();
124 clone
.setValue(fValue
);