All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cfml.parsing.cfscript.script.CFThreadStatement Maven / Gradle / Ivy

There is a newer version: 2.11.0
Show newest version
package cfml.parsing.cfscript.script;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import org.antlr.v4.runtime.Token;

import cfml.parsing.cfscript.CFExpression;
import cfml.parsing.cfscript.CFIdentifier;
import cfml.parsing.util.ArrayBuilder;

public class CFThreadStatement extends CFParsedAttributeStatement implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private CFScriptStatement body;
	
	public CFScriptStatement getBody() {
		return body;
	}
	
	public static HashSet getSupportedAttributes() {
		return supportedAttributes;
	}
	
	private static HashSet supportedAttributes;
	
	static {
		supportedAttributes = new HashSet();
		supportedAttributes.add("NAME");
		supportedAttributes.add("ATTRIBUTECOLLECTION");
		supportedAttributes.add("OUTPUT");
		supportedAttributes.add("ACTION");
		supportedAttributes.add("PRIORITY");
		supportedAttributes.add("DURATION");
		supportedAttributes.add("TIMEOUT");
	}
	
	public CFThreadStatement(Token _t, Map _attr, CFScriptStatement _body) {
		super(_t, _attr);
		
		body = _body;
	}
	
	@Override
	public String Decompile(int indent) {
		StringBuilder sb = new StringBuilder();
		sb.append("thread ");
		DecompileAttributes(sb);
		if (body == null) {
			sb.append(";");
		} else {
			sb.append(body.Decompile(0));
		}
		
		return sb.toString();
	}
	
	@Override
	public List decomposeScript() {
		return ArrayBuilder.createCFScriptStatement(body);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy