All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.daxie.xops.openxops.CharacterDataCodeParser Maven / Gradle / Ivy

Go to download

XOPSManipulator is a Java library that offers several functions to manipulate matters relating to X operations.

The newest version!
package com.daxie.xops.openxops;

import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Pattern;

import com.daxie.log.LogFile;
import com.daxie.tool.FileFunctions;
import com.daxie.tool.StringFunctions;
import com.daxie.xops.character.CharacterAILevel;
import com.daxie.xops.character.CharacterData;
import com.daxie.xops.character.CharacterModelType;
import com.daxie.xops.character.CharacterTextureType;
import com.daxie.xops.character.CharacterType;

/**
 * Parses the source code of OpenXOPS and obtains character data.
 * @author Daba
 *
 */
public class CharacterDataCodeParser {
	private Map character_data_map;
	
	/**
	 * In case you already have lines of the code.
	 * @param lines Lines of the code
	 */
	public CharacterDataCodeParser(List lines) {
		character_data_map=new HashMap<>();
		
		if(lines==null) {
			LogFile.WriteWarn("[CharacterDataCodeParser-] Null argument.",true);
			return;
		}
		
		this.ParseLines(lines);
	}
	/**
	 * Parses the code after loading it from a file.
	 * @param code_filename Filename of the code
	 * @param encoding Encoding
	 * @throws FileNotFoundException Specified file not found
	 * @throws UnsupportedEncodingException Specified encoding not supported
	 */
	public CharacterDataCodeParser(String code_filename,String encoding) 
			throws FileNotFoundException,UnsupportedEncodingException{
		character_data_map=new HashMap<>();
		
		List lines=FileFunctions.GetFileAllLines(code_filename, encoding);
		this.ParseLines(lines);
	}
	
	private void ParseLines(List lines) {
		for(int i=0;i GetCharacterDataMap(){
		return new HashMap<>(character_data_map);
	}
	public TreeMap GetCharacterDataOrderedMap(){
		return new TreeMap<>(character_data_map);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy