/*******************************************************************************
 * (c) Copyright 2016 Hewlett-Packard Development Company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *
 * The Apache License is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *******************************************************************************/
package io.cloudslang.lang.compiler.parser.utils;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @author Bonczidai Levente
 * @since 3/21/2017
 */
public enum StepDescriptionTag {
    INPUT("@input"),
    OUTPUT("@output");

    private static final List<StepDescriptionTag> DESCRIPTION_TAGS_LIST =
            Collections.unmodifiableList(Arrays.asList(StepDescriptionTag.values()));
    private final String value;

    StepDescriptionTag(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public static List<StepDescriptionTag> asList() {
        return DESCRIPTION_TAGS_LIST;
    }

    public static boolean isStepDescriptionTag(String str) {
        for (StepDescriptionTag stepDescriptionTag : StepDescriptionTag.asList()) {
            if (str.contains(stepDescriptionTag.getValue())) {
                return true;
            }
        }
        return false;
    }

    public static StepDescriptionTag fromString(String str) {
        for (StepDescriptionTag stepDescriptionTag : StepDescriptionTag.asList()) {
            if (str.contains(stepDescriptionTag.getValue())) {
                return stepDescriptionTag;
            }
        }
        return null;
    }

}

@@ -1230,37 +1230,32 @@
  str) %7B%0A        
-for (
 StepDescriptionT
@@ -1280,177 +1280,68 @@
 Tag 
-: StepDescriptionTag.asList()) %7B%0A            if (str.contains(stepDescriptionTag.getValue())) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false
+= fromString(str);%0A        return stepDescriptionTag != null
 ;%0A  

remove code duplication