<commit_before>/*
 * Copyright 2014 - 2017 Cognizant Technology Solutions
 *
 * 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
 */
package com.cognizant.cognizantits.engine.commands.mobile.nativ;

import com.cognizant.cognizantits.engine.core.CommandControl;
import com.cognizant.cognizantits.engine.support.Status;
import com.cognizant.cognizantits.engine.support.methodInf.Action;
import com.cognizant.cognizantits.engine.support.methodInf.InputType;
import com.cognizant.cognizantits.engine.support.methodInf.ObjectType;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileDriver;
import io.appium.java_client.MultiTouchAction;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
import java.time.Duration;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 *
 */
@SuppressWarnings("rawtypes")
public class Basic extends MobileNativeCommand {

    public Basic(CommandControl cc) {
        super(cc);
    }

    /**
     * method for clearing the element value on the screen
     *
     */
    @Action(object = ObjectType.SELENIUM, desc = "clear  the [<Object>] text if any")

    public void clear() {
        try {
            if (Element != null) {
                (Element).clear();
                Report.updateTestLog(Action, "Cleared'" + ObjectName + "'", Status.PASS);
            } else {
                Report.updateTestLog(Action, "Unable clear '" + ObjectName + "'", Status.FAIL);
            }
        } catch (Exception ex) {
            Report.updateTestLog(Action, ex.getMessage(), Status.DEBUG);
            Logger.getLogger(Basic.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * method for tapping the center of an element on the screen
     *
     * @see AppiumDriver#tap(int, org.openqa.selenium.WebElement, int)
     */
    @Action(object = ObjectType.MOBILE, desc = "Tap on the [<Object>]", input = InputType.OPTIONAL)

    public void tap() {
        try {
            if (Element != null) {
                int nof = this.getInt(Data, 0, 1);
                TouchAction touchAction = new TouchAction(((MobileDriver) Driver));
                do {
                    touchAction.tap(Element);
                    touchAction.release().perform();
                } while (--nof > 0);
                Report.updateTestLog(Action, "Tapped on '" + ObjectName + "'", Status.PASS);
            } else {
                Report.updateTestLog(Action, "Unable tap on'" + ObjectName + "'", Status.FAIL);
            }
        } catch (Exception ex) {
            Report.updateTestLog(Action, ex.getMessage(), Status.DEBUG);
            Logger.getLogger(Basic.class.getName()).log(Level.SEVERE, null, ex);<commit_msg>removed duplicate action `clear`<commit_after>/*
 * Copyright 2014 - 2017 Cognizant Technology Solutions
 *
 * 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
 */
package com.cognizant.cognizantits.engine.commands.mobile.nativ;

import com.cognizant.cognizantits.engine.core.CommandControl;
import com.cognizant.cognizantits.engine.support.Status;
import com.cognizant.cognizantits.engine.support.methodInf.Action;
import com.cognizant.cognizantits.engine.support.methodInf.InputType;
import com.cognizant.cognizantits.engine.support.methodInf.ObjectType;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileDriver;
import io.appium.java_client.MultiTouchAction;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
import java.time.Duration;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 *
 */
@SuppressWarnings("rawtypes")
public class Basic extends MobileNativeCommand {

    public Basic(CommandControl cc) {
        super(cc);
    }
  
    /**
     * method for tapping the center of an element on the screen
     *
     * @see AppiumDriver#tap(int, org.openqa.selenium.WebElement, int)
     */
    @Action(object = ObjectType.MOBILE, desc = "Tap on the [<Object>]", input = InputType.OPTIONAL)

    public void tap() {
        try {
            if (Element != null) {
                int nof = this.getInt(Data, 0, 1);
                TouchAction touchAction = new TouchAction(((MobileDriver) Driver));
                do {
                    touchAction.tap(Element);
                    touchAction.release().perform();
                } while (--nof > 0);
                Report.updateTestLog(Action, "Tapped on '" + ObjectName + "'", Status.PASS);
            } else {
                Report.updateTestLog(Action, "Unable tap on'" + ObjectName + "'", Status.FAIL);
            }
        } catch (Exception ex) {
            Report.updateTestLog(Action, ex.getMessage(), Status.DEBUG);
            Logger.getLogger(Basic.class.getName()).log(Level.SEVERE, null, ex);
{'fraction_non_alphanumeric': 0.11173757047667862, 'fraction_numerical': 0.005125576627370579, 'mean_word_length': 2.8793903247183565, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6724661', 'n_tokens_mistral': 1721, 'n_tokens_neox': 1669, 'n_words': 425}