<commit_before>/**
 * Copyright (c) 2010-2014, openHAB.org and others.
 *
 * 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
 */
package org.openhab.binding.zibase.internal;

import java.lang.annotation.Inherited;

import org.openhab.core.types.Command;
import org.openhab.core.types.State;

import fr.zapi.Zibase;

/**
 * This class handle scenarios stored in Zibase memory
 * @author <NAME>
 *
 */
public class ZibaseBindingConfigScenario extends ZibaseBindingConfig {

	private int scenarionNumber;
	
	public ZibaseBindingConfigScenario(String[] configParameters) {
		super(configParameters);
		
		scenarionNumber = Integer.parseInt(configParameters[ZibaseBindingConfig.POS_VALUES]);
	}

	/**
	 * command and dim ignored for scenario execution
	 * {@link Inherited}
	 */
	@Override
	public void sendCommand(Zibase zibase, Command command, int dim) {
		zibase.launchScenario(scenarionNumber);
	}

	/**
	 * {@link Inherited}
	 */
	protected boolean isItemConfigValid() {
		logger.info("Checking config for scenario item " + this.getId());
		
		try {
			Integer.parseInt(this.values[ZibaseBindingConfig.POS_VALUES]);
			return true;
		} catch (NumberFormatException ex) {
			logger.error("bad scenario id : " + this.getId());
		}
		
		return false;
	}

	/**
	 * TODO : check whether info about executed scenario can be used
	 * {@link Inherited}
	 */
	@Override
	public State getOpenhabStateFromZibaseValue(Zibase zibase, String zbResponseStr) {
		// TODO Auto-generated method stub
		return null;
	}

}<commit_msg>now return a timestamps as state when a scenario has been executed on the zibase<commit_after>/**
 * Copyright (c) 2010-2014, openHAB.org and others.
 *
 * 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
 */
package org.openhab.binding.zibase.internal;

import java.lang.annotation.Inherited;

import org.openhab.core.library.types.DecimalType;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;

import fr.zapi.Zibase;

/**
 * This class handle scenarios stored in Zibase memory
 * @author <NAME>
 *
 */
public class ZibaseBindingConfigScenario extends ZibaseBindingConfig {

	private int scenarionNumber;
	
	public ZibaseBindingConfigScenario(String[] configParameters) {
		super(configParameters);
		
		scenarionNumber = Integer.parseInt(configParameters[ZibaseBindingConfig.POS_ID]);
	}

	/**
	 * command and dim ignored for scenario execution
	 * {@link Inherited}
	 */
	@Override
	public void sendCommand(Zibase zibase, Command command, int dim) {
		zibase.launchScenario(scenarionNumber);
	}

	/**
	 * {@link Inherited}
	 */
	protected boolean isItemConfigValid() {
		logger.info("Checking config for scenario item " + this.getId());
		
		try {
			Integer.parseInt(this.values[ZibaseBindingConfig.POS_ID]);
			return true;
		} catch (NumberFormatException ex) {
			logger.error("bad scenario id : " + this.getId());
		}
		
		return false;
	}

	/**
	 * {@link Inherited}
	 */
	@Override
	public State getOpenhabStateFromZibaseValue(Zibase zibase, String zbResponseStr) {
		return new DecimalType(System.currentTimeMillis());
	}

}
{'fraction_non_alphanumeric': 0.10386612810155799, 'fraction_numerical': 0.006924408540103866, 'mean_word_length': 4.317484662576687, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4236550', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1028, 'n_words': 281}