<commit_before>/**
    Copyright 2017 Andrea "Stock" Stocchero

    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,
    WITHOUString 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 org.pepstock.charba.client.commons;

import org.pepstock.charba.client.commons.Key;
import org.pepstock.charba.client.items.UndefinedValues;

/**
 * Enums the property ID used by CHARBA to identify the chart.
 * 
 * @author Andrea "Stock" Stocchero
 */
public enum Id implements Key
{

	/**
	 * Name of java script property
	 */
	charbaId;

	/**
	 * Returns the property value from java script object.
	 * 
	 * @param nativeObjectContainer java script object container
	 * @return the property value or {@link org.pepstock.charba.client.items.UndefinedValues#STRING} if not exist
	 */
	public static String get(NativeObjectContainer nativeObjectContainer) {
		return get(nativeObjectContainer.getNativeObject());
	}

	/**
	 * Returns the property value from java script object.
	 * 
	 * @param nativeObject java script object
	 * @return the property value or {@link org.pepstock.charba.client.items.UndefinedValues#STRING} if not exist
	 */
	public static String get(NativeObject nativeObject) {
		// checks if property exists
		if (nativeObject.hasProperty(charbaId.name())) {
			// gets descriptor
			NativeStringDescriptor descriptor = nativeObject.getStringProperty(charbaId.name());
			// if descriptor is consistent, return value
			return descriptor != null ? descriptor.getValue() : UndefinedValues.STRING;
		}
		// property doesn't exist
		return UndefinedValues.STRING;
	}

}<commit_msg>added ID inspector by int and key<commit_after>/**
    Copyright 2017 <NAME>" Stocchero

    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,
    WITHOUString 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 org.pepstock.charba.client.commons;

import org.pepstock.charba.client.items.UndefinedValues;

/**
 * Enums the property ID used by CHARBA to identify the chart.
 * 
 * @author <NAME>" Stocchero
 */
public enum Id implements Key
{

	/**
	 * Name of java script property
	 */
	charbaId;

	/**
	 * Returns the property value from java script object.
	 * 
	 * @param nativeObjectContainer java script object container
	 * @return the property value or {@link org.pepstock.charba.client.items.UndefinedValues#STRING} if not exist
	 */
	public static String get(NativeObjectContainer nativeObjectContainer) {
		return get(nativeObjectContainer.getNativeObject());
	}

	/**
	 * Returns the property value from java script object.
	 * 
	 * @param nativeObject java script object
	 * @return the property value or {@link org.pepstock.charba.client.items.UndefinedValues#STRING} if not exist
	 */
	public static String get(NativeObject nativeObject) {
		// checks if property exists
		if (nativeObject.hasProperty(charbaId.name())) {
			// gets descriptor
			NativeStringDescriptor descriptor = nativeObject.getStringProperty(charbaId.name());
			// if descriptor is consistent, return value
			return descriptor != null ? descriptor.getValue() : UndefinedValues.STRING;
		}
		// property doesn't exist
		return UndefinedValues.STRING;
	}

	/**
	 * Returns the property value from java script object, when the ID is stored as integer
	 * 
	 * @param key the key to search inside the object
	 * @param nativeObject java script object
	 * @return the property value or {@link org.pepstock.charba.client.items.UndefinedValues#INTEGER} if not exist
	 */
	public static int get(Key key, NativeObject nativeObject) {
		// checks if property exists
		if (nativeObject.hasProperty(key.name())) {
			// gets descriptor
			NativeIntegerDescriptor descriptor = nativeObject.getIntProperty(key.name());
			// if descriptor is consistent, return value
			return descriptor != null ? descriptor.getValue() : UndefinedValues.INTEGER;
		}
		// property doesn't exist
		return UndefinedValues.INTEGER;
	}
}
{'fraction_non_alphanumeric': 0.0831065522294327, 'fraction_numerical': 0.0033493824576093785, 'mean_word_length': 3.865580448065173, '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': '817182', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1235, 'n_words': 479}