package de.brightbyte.util;

import java.io.UnsupportedEncodingException;

public class UString implements Comparable<UString> {
	protected String string;
	protected int stringOffset;
	protected int stringLength;
	
	protected int[] codepoints;
	protected int codepointsOffset;
	protected int codepointsLength;
	
	protected void initString() {
		// TODO Auto-generated method stub
		
	}

	protected void initCodepoints() {
		// TODO Auto-generated method stub
		
	}

	public int codePointAt(int index) {
		if (codepoints==null) initCodepoints();
		if (index >= codepointsLength) throw new IllegalArgumentException("string index out of bounds: "+index+" >= "+codepointsLength);
		return codepoints[index+codepointsOffset];
	}
	
	public int compareTo(UString anotherString) {
		return ;
	}
	
	public int compareToIgnoreCase(UString str) {
		return ;
	}
	
	public String concat(UString str) {
		return string.concat(str);
	}
	
	public boolean endsWith(UString suffix) {
		return string.endsWith(suffix);
	}
	
	public boolean equals(Object anObject) {
		return ;
	}
	
	public boolean equalsIgnoreCase(UString anotherString) {
		return ;
	}
	
	public byte[] getBytes(String charsetName) throws UnsupportedEncodingException {
		if (string==null) initString();
		return string.getBytes(charsetName);
	}
	
	public int lastIndexOf(int ch, int fromIndex) {
		return ;
	}
	
	public int lastIndexOf(int ch) {
		return ;
	}
	
	public int indexOf(int ch, int fromIndex) {
		return ;
	}
	
	public int indexOf(int ch) {
		return ;
	}
	
	public int lastIndexOf(char ch, int fromIndex) {
		return lastIndexOf(codepointOf(ch), fromIndex);
	}
	
	public int lastIndexOf(char ch) {
		return lastIndexOf(codepointOf(ch));
	}
	
	public int indexOf(char ch, int fromIndex) {
		return indexOf(codepointOf(ch), fromIndex);
	}
	
	public int indexOf(char ch) {
		return indexOf(codepointOf(ch));
	}
	
	public int length() {
		if (codepoints!=null) return codepointsLength;
		else return string.codePointCount(stringOffset, stringOffset+stringLength);
	}
	
	public String replace(char oldChar, char newChar) {
		return string.replace(oldChar, newChar);
	}
	
	public boolean startsWith(String prefix) {
		return string.startsWith(prefix);
	}
	
	public String substring(int beginIndex, int endIndex) {
		return string.substring(beginIndex, endIndex);
	}
	
	public String substring(int beginIndex) {
		return string.substring(beginIndex);
	}
	
	public char[] toCharArray() {
		return string.toCharArray();
	}
	
	public String toLowerCase() {
		return string.toLowerCase();
	}
	
	public String toUpperCase() {
		return string.toUpperCase();
	}
	
	public String trim() {
		return string.trim();
	}
	
	
}
