summaryrefslogtreecommitdiffstats
path: root/org.eclipse.cdt.codan.extension/src/org/eclipse/cdt/codan/extension/ExecutionStateClause.java
blob: adb4e6252baa37bc974ce073119c03f9806395d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*******************************************************************************
 * Copyright (c) 2009 Elliott Baron
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Elliott Baron - initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.codan.extension;

import org.eclipse.cdt.core.dom.ast.IASTNode;

public class ExecutionStateClause {
	
	private IASTNode node;
	private boolean truthValue;

	public ExecutionStateClause(IASTNode node) {
		this(node, true);
	}
	
	public ExecutionStateClause(IASTNode node, boolean truthValue) {
		this.node = node;
		this.truthValue = truthValue;
	}

	public IASTNode getNode() {
		return node;
	}
	
	public boolean isTrue() {
		return truthValue;
	}
	
	@Override
	public String toString() {
		StringBuffer buf = new StringBuffer();
		if (!truthValue) {
			buf.append("NOT ");
		}
		buf.append(node.getRawSignature());
		return buf.toString();
	}
	
}