<commit_before>/*******************************************************************************
 * Copyright (c) 2006-2016, <NAME> and Elexis
 * 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
 *
 * Contributors:
 *    <NAME> - initial implementation
 * 	  <EMAIL> - extracted from ch.elexis.base.ch.diagnosecodes_schweiz
 *******************************************************************************/

package ch.elexis.base.ch.ticode;

import java.util.Hashtable;

/**
 * Die Tessinercodes werden nicht in der Datenbank vorgehalten, sondern sind aus Effizientgründen
 * hier in dieser Klasse fest verdrahtet. Die Klasse ist trotzdem im data-Package, um die
 * Programmierkonsistenz zu wahren.
 * 
 * @author Gerry
 * @since 3.2.0
 */
public class TessinerCode {
	public static final String CODESYSTEM_NAME = "TI-Code";
	private static Hashtable<String, TessinerCode> hash = new Hashtable<String, TessinerCode>();
	private String Text;
	private String Code;
	
	private TessinerCode(String Code, String Text){
		this.Code = Code;
		this.Text = Text;
	}
	
	public String getText(){
		return Text;
	}
	
	public String getCode(){
		return getCode();
	}
	
	public String getLabel(){
		return getCode() + " " + Text; //$NON-NLS-1$
	}
	
	public String getCodeSystemName(){
		return CODESYSTEM_NAME; //$NON-NLS-1$
	}
	
	public static TessinerCode load(String code){
		return getFromCode(code);
	}
	
	public static TessinerCode[] getRootNodes(){
		TessinerCode[] ret = new TessinerCode[ticode.length];
		int i;
		for (i = 0; i < ticode.length; i++) {
			String[] line = ticode[i];
			ret[i] = new TessinerCode(line[0], line[1]);
		}
		return ret;
	}
	
	public static TessinerCode getFromCode(String code){<commit_msg>fixed getCode of c.e.b.c.ticode TessinerCode<commit_after>/*******************************************************************************
 * Copyright (c) 2006-2016, <NAME> and Elexis
 * 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
 *
 * Contributors:
 *    <NAME> - initial implementation
 * 	  <EMAIL> - extracted from ch.elexis.base.ch.diagnosecodes_schweiz
 *******************************************************************************/

package ch.elexis.base.ch.ticode;

import java.util.Hashtable;

/**
 * Copy of the ch.elexis.data.TICode class, but without PersistentObject dependencies.
 * 
 * @author Gerry
 * @since 3.2.0
 */
public class TessinerCode {
	public static final String CODESYSTEM_NAME = "TI-Code";
	private static Hashtable<String, TessinerCode> hash = new Hashtable<String, TessinerCode>();
	private String text;
	private String code;
	
	private TessinerCode(String code, String text){
		this.code = code;
		this.text = text;
	}
	
	public String getText(){
		return text;
	}
	
	public String getCode(){
		return code;
	}
	
	public String getLabel(){
		return code + " " + text; //$NON-NLS-1$
	}
	
	public String getCodeSystemName(){
		return CODESYSTEM_NAME; //$NON-NLS-1$
	}
	
	public static TessinerCode load(String code){
		return getFromCode(code);
	}
	
	public static TessinerCode[] getRootNodes(){
		TessinerCode[] ret = new TessinerCode[ticode.length];
		int i;
		for (i = 0; i < ticode.length; i++) {
			String[] line = ticode[i];
			ret[i] = new TessinerCode(line[0], line[1]);
		}
		return ret;
	}
	
	public static TessinerCode getFromCode(String code){
{'fraction_non_alphanumeric': 0.1893939393939394, 'fraction_numerical': 0.010822510822510822, 'mean_word_length': 4.342485549132948, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '1464983', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1127, 'n_words': 331}