de.tudarmstadt.ukp.csniper.webapp.search.cqp.CqpMacro.java Source code

Java tutorial

Introduction

Here is the source code for de.tudarmstadt.ukp.csniper.webapp.search.cqp.CqpMacro.java

Source

/*******************************************************************************
 * Copyright 2013
 * Ubiquitous Knowledge Processing (UKP) Lab
 * Technische Universitt Darmstadt
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package de.tudarmstadt.ukp.csniper.webapp.search.cqp;

import java.util.List;

import org.apache.commons.lang.StringUtils;

public class CqpMacro {
    private String comment;
    private String name;
    private int paramCount;
    private List<String> body;

    public CqpMacro() {
    }

    public String getBodyAsHtml() {
        StringBuffer html = new StringBuffer();
        for (String line : body) {
            html.append(line + "<br />");
        }
        return html.toString();
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String aComment) {
        comment = aComment;
    }

    public String getName() {
        return name;
    }

    public void setName(String aName) {
        name = aName;
    }

    public int getParamCount() {
        return paramCount;
    }

    public void setParamCount(int aParamCount) {
        paramCount = aParamCount;
    }

    public List<String> getBody() {
        return body;
    }

    public void setBody(List<String> aBody) {
        body = aBody;
    }

    @Override
    public String toString() {
        return "Macro[" + name + ", " + comment + ", " + paramCount + "]\n" + "{{\n" + StringUtils.join(body, "\n")
                + "\n}}\n";
    }
}