当前位置: 首页>>代码示例>>Java>>正文


Java Strings类代码示例

本文整理汇总了Java中happy.coding.io.Strings的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Strings类属于happy.coding.io包,在下文中一共展示了Strings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: crawl_web_pages

import happy.coding.io.Strings; //导入依赖的package包/类
public void crawl_web_pages() throws Exception
{
	String filePath = "./src/main/resources/mtime.txt";
	List<String> urls = FileIO.readAsList(filePath);

	for (String url : urls)
	{
		String html = URLReader.read(url);
		Document doc = Jsoup.parse(html);
		String name = doc.select("span[property=v:itemreviewed]").text();
		name = Strings.filterWebString(name, '_');

		String dirPath = dir + name + "/";
		FileIO.makeDirectory(dirPath);
		FileIO.writeString(dirPath + name + ".html", html);
	}
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:18,代码来源:MTimeCrawler.java

示例2: toString

import happy.coding.io.Strings; //导入依赖的package包/类
@Override
public String toString() {
	return Strings
			.toString(new Object[] { "initLRate", "maxLRate", "regU", "regT", "regV", "numSharedFactors",
					"numIters", "isBoldDriver", "isUndoEnabled", "initByNorm" }, ",")
			+ "\n" + Strings.toString(new Object[] { initLRate, maxLRate, regU, regT, regV, numSharedFactors,
					numIters, isBoldDriver, isUndoEnabled, initByNorm }, ",");
}
 
开发者ID:kite1988,项目名称:famf,代码行数:9,代码来源:Recommender.java

示例3: toString

import happy.coding.io.Strings; //导入依赖的package包/类
@Override
public String toString() {
	return super.toString()
			+ ","
			+ Strings.toString(
					new Object[] { rho, alpha, regBeta, regGamma }, ",");
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:8,代码来源:FUSTauc.java

示例4: toString

import happy.coding.io.Strings; //导入依赖的package包/类
@Override
public String toString() {
	return super.toString()
			+ ","
			+ Strings.toString(new Object[] { (float) tau, rho, (float) alpha, (float) regBeta, (float) regGamma },
					",");
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:8,代码来源:FUSTauc_backup.java

示例5: toString

import happy.coding.io.Strings; //导入依赖的package包/类
@Override
public String toString() {
	return super.toString()
			+ ","
			+ Strings.toString(new Object[] { tau, rho, alpha, regLambda,
					regBeta, regGamma }, ",");
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:8,代码来源:FUSTrmse.java

示例6: toString

import happy.coding.io.Strings; //导入依赖的package包/类
@Override
public String toString() {
	return super.toString()
			+ ","
			+ Strings.toString(new Object[] { rho, alpha, regLambda,
					regBeta, regGamma }, ",");
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:8,代码来源:FUSMrmse.java

示例7: toString

import happy.coding.io.Strings; //导入依赖的package包/类
@Override
public String toString()
{
	StringBuilder sb = new StringBuilder();
	Strings.setSeparator(new Separator(" / "));

	sb.append("Name: " + name + "\n");
	sb.append("id: " + id + "\n");
	sb.append("Year: " + year + "\n");
	sb.append("Url: " + douban_url + "\n\n");

	sb.append("Average Rating: " + avg_rating + "\n");
	sb.append("Num of Ratings: " + num_ratings + "\n");
	sb.append("Distr. Ratings: " + Strings.toString(ratio_rates) + "\n\n");

	sb.append("Director: " + director + "\n");
	sb.append("Scenarist: " + Strings.toString(scenarist) + "\n");
	sb.append("Actors: " + Strings.toString(actors) + "\n");
	sb.append("Types: " + Strings.toString(types) + "\n");
	sb.append("Official Url: " + official_url + "\n");
	sb.append("Countries: " + Strings.toString(countries) + "\n");
	sb.append("Language: " + Strings.toString(language) + "\n");
	sb.append("Release Date: " + releseDates + "\n");
	sb.append("Length: " + length + "\n");
	sb.append("Alias: " + Strings.toString(alias) + "\n");
	sb.append("IMDB Url: " + imdb_url + "\n\n");

	sb.append("Description:\n" + description);

	return sb.toString();
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:32,代码来源:DoubanMovie.java

示例8: toString

import happy.coding.io.Strings; //导入依赖的package包/类
@Override
public String toString()
{
	StringBuilder sb = new StringBuilder();
	Strings.setSeparator(new Separator(" / "));

	sb.append("Name: " + name + "\n");
	sb.append("Sub Name: " + sub_name + "\n");
	sb.append("id: " + id + "\n");
	sb.append("Main Point: " + main_point + "\n");
	sb.append("Url: " + gm_url + "\n\n");

	sb.append("Average Rating: " + avg_rating + "\n");
	sb.append("Num of Ratings: " + num_ratings + "\n\n");
	//sb.append("Distr. Ratings: " + Strings.toString(ratio_rates) + "\n\n");

	sb.append("Director: " + director + "\n");
	//sb.append("Scenarist: " + Strings.toString(scenarist) + "\n");
	sb.append("Actors: " + Strings.toString(actors) + "\n");
	sb.append("Types: " + Strings.toString(types) + "\n");
	//sb.append("Official Url: " + official_url + "\n");
	sb.append("Countries: " + Strings.toString(countries) + "\n");
	sb.append("Language: " + Strings.toString(language) + "\n");
	sb.append("Release Date: " + releseDates + "\n");
	sb.append("Length: " + length + "\n");
	//sb.append("Alias: " + Strings.toString(alias) + "\n");
	//sb.append("IMDB Url: " + imdb_url + "\n\n");

	sb.append("Description:\n" + description);

	return sb.toString();
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:33,代码来源:GewaraMovie.java

示例9: crawl_web_pages

import happy.coding.io.Strings; //导入依赖的package包/类
public void crawl_web_pages(String url) throws Exception
{
	String html = read_url(url);
	Document doc = Jsoup.parse(html);
	String name = doc.select("div.detail_head_name h1").first().text();
	name = Strings.filterWebString(name, '_');

	String dirPath = dir + name + "/";
	FileIO.makeDirectory(dirPath);
	FileIO.writeString(dirPath + name + ".html", html);
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:12,代码来源:GewaraCrawler.java

示例10: run_web_pages

import happy.coding.io.Strings; //导入依赖的package包/类
public void run_web_pages(String url) throws Exception
{
	String html = read_url(url);
	Document doc = Jsoup.parse(html);
	String name = doc.select("span[property=v:itemreviewed]").text();
	name = Strings.filterWebString(name, '_');

	String dirPath = dir + name + "/";
	FileIO.makeDirectory(dirPath);
	FileIO.writeString(dirPath + name + ".html", html);
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:12,代码来源:DoubanCrawler.java

示例11: run_ratings

import happy.coding.io.Strings; //导入依赖的package包/类
public void run_ratings(String url) throws Exception
{
	String html = read_url(url);
	Document doc = Jsoup.parse(html);
	String name = doc.select("span[property=v:itemreviewed]").text();
	name = Strings.filterWebString(name, '_');

	String dirPath = dir + name + "/ratings/";
	FileIO.makeDirectory(dirPath);

	// save rating pages
	int k = 0;
	while (true)
	{
		String link = url + "collections?start=" + (k * 20);
		String page = read_url(link);

		k++;
		FileIO.writeString(dirPath + "page_" + k + ".html", page);
		Logs.debug("Current processing page: " + k);

		// if finished;
		Document doc2 = Jsoup.parse(page);
		Elements es = doc2.select("div#collections_tab span.next");
		if (es == null || es.size() == 0)
		{
			break;
		}
	}

}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:32,代码来源:DoubanCrawler.java

示例12: printSpecs

import happy.coding.io.Strings; //导入依赖的package包/类
public void printSpecs() {
	Logs.info("Starts at {}", Dates.now());
	Logs.info(null);

	String suffix = Strings.repeat('-', 22);
	Logs.info(suffix + " Global Setting " + suffix);
	Logs.info("Currently data set   = {} ({})", Dataset.LABEL, Dataset.DIRECTORY);
	Logs.info("Validation approach  = {}", VALIDATE_METHOD.name());
	Logs.info("Prediction method    = {}", PREDICT_METHOD.name());
	Logs.info("Calculate similarity = {}", params.SIMILARITY_METHOD);

	Logs.info(null);
	Logs.info(suffix + " Method Results " + suffix);
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:15,代码来源:ConfigParams.java

示例13: load_tags

import happy.coding.io.Strings; //导入依赖的package包/类
private void load_tags() throws Exception
{
	String file = "movie-tags.csv";
	if (itemTags == null)
	{
		itemTags = new HashMap<>();
		String path = FileIO.makeDirPath(Dataset.DIRECTORY, file);

		Logs.debug("Load item's tags from {}", Strings.shortStr(path));

		tags = new ArrayList<>();

		BufferedReader br = new BufferedReader(new FileReader(new File(path)));
		String line = null;
		while ((line = br.readLine()) != null)
		{
			String[] data = line.split(",");
			String item = data[0];
			String tag = data[1]; //.toLowerCase().replace(" ", "");

			if (!tags.contains(tag)) tags.add(tag);

			Map<String, Integer> innerMap = null;
			if (itemTags.containsKey(item)) innerMap = itemTags.get(item);
			else innerMap = new HashMap<>();

			int count = 0;
			if (innerMap.containsKey(tag)) count = innerMap.get(tag);
			count++;

			innerMap.put(tag, count);
			itemTags.put(item, innerMap);
		}
		br.close();
	}
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:37,代码来源:CBF_mt.java

示例14: bubble

import happy.coding.io.Strings; //导入依赖的package包/类
/**
 * a.k.a <em>sinking sort</em>, refers to:
 * http://en.wikipedia.org/wiki/Bubble_sort
 * 
 */
@SuppressWarnings("unchecked")
public static <T> void bubble(List<? extends Comparable<T>> data) {
	int N = data.size();

	int count = 0;

	while (true) {
		int i = 0;
		boolean swap = false;
		Comparable<T> t0 = data.get(i);

		for (int j = 1; j < N - count; j++) {
			Comparable<T> t1 = data.get(j);
			if (t0.compareTo((T) t1) > 0) {
				swap((List<Comparable<T>>) data, i, j);
				swap = true;
			}

			i = j;
			t0 = data.get(i);
		}

		count++;

		if (Debug.OFF)
			Logs.debug("Step " + count + ": " + Strings.toString(data));

		// if swap = false, means no swapping is occurred in last iteration, i.e. already sorted
		if (!swap)
			break;

	}

}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:40,代码来源:Sortor.java

示例15: example

import happy.coding.io.Strings; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void example() {
	List<Sortee> data = new ArrayList<>();

	int N = 10;

	for (int i = 0; i < N; i++)
		data.add(new Sortee(Randoms.random()));

	Strings.setSeparator(Separator.comma);
	Logs.debug("Before   : " + Strings.toString(data));

	List<Sortee> raw = prepareData(data);
	Sortor.insertion(raw);
	Logs.debug("Insertion: " + Strings.toString(raw));

	raw = prepareData(data);
	Sortor.selection(raw);
	Logs.debug("Selection: " + Strings.toString(raw));

	raw = prepareData(data);
	Sortor.bubble(raw);
	Logs.debug("Bubble   : " + Strings.toString(raw));

	raw = prepareData(data);
	Sortor.shell(raw);
	Logs.debug("Shell    : " + Strings.toString(raw));

	raw = prepareData(data);
	Sortor.comb(raw);
	Logs.debug("Comb     : " + Strings.toString(raw));

	raw = prepareData(data);
	raw = (List<Sortee>) Sortor.merge(raw);
	Logs.debug("Merge    : " + Strings.toString(raw));
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:38,代码来源:Sortor.java


注:本文中的happy.coding.io.Strings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。