userutil.java

来自「AJAX的一个好东西哦,国人的一个AJAX的实现不错的东西」· Java 代码 · 共 50 行

JAVA
50
字号
/*
 * Created on 2005-2-27
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package net.buffalo.demo.simple;

import java.util.Random;

/**
 * @author michael
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class UserUtil {
	private static User[] users = {
		new User(1,"张三丰", 90, true, "武当派开派祖师"),
		new User(2,"令狐冲", 30, true, "华山派弟子"),
		new User(3,"乔峰", 36, true, "身份复杂,曾为丐帮帮主,后自杀"),
		new User(4,"赵灵儿", 16, false, "女娲后人"),
		new User(5,"苏蓉蓉", 24, false, "楚留香红颜知己之一,熟知天文地理各种知识"),
	};
	
	private static ComplexUser[] complexUsers = {
		new ComplexUser(new Name("John","M","Smith")),
		new ComplexUser(new Name("Friend","H","Johnson")),
		new ComplexUser(new Name("Michael","J","Jordon")),
	};
	
	static {
		complexUsers[0].setFriends( new ComplexUser[]{complexUsers[1],complexUsers[2]} );
		complexUsers[1].setFriends( new ComplexUser[]{complexUsers[0],complexUsers[2]} );
		complexUsers[2].setFriends( new ComplexUser[]{complexUsers[1],complexUsers[0]} );
	}
	
	public static User randomUser() {
		int r = new Random().nextInt(5);
		return users[r];
	}
	
	public static ComplexUser randomComplexUser() {
		int r = new Random().nextInt(3);
		return complexUsers[r];
		
	}
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?