/*******************************************************************************
- * Copyright (c) 2010, 2014 Ericsson
+ * Copyright (c) 2010, 2015 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* @version 1.0
* @author Patrick Tasse
*/
-@SuppressWarnings("javadoc")
-public class TmfFilterContainsNode extends TmfFilterTreeNode {
+public class TmfFilterContainsNode extends TmfFilterAspectNode {
+ /** contains node name */
public static final String NODE_NAME = "CONTAINS"; //$NON-NLS-1$
+ /** not attribute name */
public static final String NOT_ATTR = "not"; //$NON-NLS-1$
- public static final String FIELD_ATTR = "field"; //$NON-NLS-1$
+ /** value attribute name */
public static final String VALUE_ATTR = "value"; //$NON-NLS-1$
+ /** ignorecase attribute name */
public static final String IGNORECASE_ATTR = "ignorecase"; //$NON-NLS-1$
private boolean fNot = false;
- private String fField;
private String fValue;
private transient String fValueUpperCase;
private boolean fIgnoreCase = false;
this.fNot = not;
}
- /**
- * @return the field name
- */
- public String getField() {
- return fField;
- }
-
- /**
- * @param field the field name
- */
- public void setField(String field) {
- this.fField = field;
- }
-
/**
* @return the contains value
*/
* @param value the contains value
*/
public void setValue(String value) {
- this.fValue = value;
+ fValue = value;
+ fValueUpperCase = null;
if (value != null) {
fValueUpperCase = value.toUpperCase();
}
@Override
public boolean matches(ITmfEvent event) {
- Object value = getFieldValue(event, fField);
+ if (event == null || fEventAspect == null) {
+ return false ^ fNot;
+ }
+ Object value = fEventAspect.resolve(event);
if (value == null) {
return false ^ fNot;
}
@Override
public String toString() {
- return fField + (fNot ? " not" : "") + " contains \"" + fValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ String aspectName = fEventAspect != null ? fEventAspect.getName() : ""; //$NON-NLS-1$
+ return aspectName + (fNot ? " not" : "") + " contains \"" + fValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
@Override
public ITmfFilterTreeNode clone() {
TmfFilterContainsNode clone = (TmfFilterContainsNode) super.clone();
- clone.fField = fField;
clone.setValue(fValue);
return clone;
}
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((fField == null) ? 0 : fField.hashCode());
result = prime * result + (fIgnoreCase ? 1231 : 1237);
result = prime * result + (fNot ? 1231 : 1237);
result = prime * result + ((fValue == null) ? 0 : fValue.hashCode());
return false;
}
TmfFilterContainsNode other = (TmfFilterContainsNode) obj;
- if (fField == null) {
- if (other.fField != null) {
- return false;
- }
- } else if (!fField.equals(other.fField)) {
- return false;
- }
if (fIgnoreCase != other.fIgnoreCase) {
return false;
}