- 浏览: 74220 次
- 性别:
- 来自: 北京
-
文章分类
最新评论
import junit.framework.TestCase;
import junit.framework.Assert;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.Constructor;
public class TestReflectionGetFields extends TestCase {
public void testGetFieldsWillReturnOnlyPublicField
()
{
Field[] fields = TestSubClass.class.getFields();
for (Field field : fields)
{
Assert.assertTrue(Modifier.isPublic(field.getModifiers()));
}
}
public void testGetFieldsWillContainPublicFieldsInheriedFromSuper
()
{
Field[] fields = TestSubClass.class.getFields();
for (Field field : fields)
{
if(!TestSubClass.class.getName().equals(field.getDeclaringClass()))
{
Assert.assertTrue(true);
return;
}
}
Assert.fail("public field inherited from super class/interface should return ,but not");
}
public void testGetDeclaredFieldsWillReturnFieldsDefinedInThisClassWithoutThoseInheritedFromSuper
()
{
Field[] fields = TestSubClass.class.getDeclaredFields();
for (Field field : fields)
{
Assert.assertEquals(TestSubClass.class.getName(), field.getDeclaringClass().getName());
}
}
public void testGetDeclaredFieldsWillContainPrivateField
()
{
Field[] fields = TestSubClass.class.getDeclaredFields();
for (Field field : fields)
{
if (Modifier.isPrivate(field.getModifiers()))
{
Assert.assertTrue("getDeclaredFields() will return private field of "+ field.getName(),true);
return;
}
}
Assert.fail("private method should return,but not");
}
private static interface TestSubInterface extends TestParentInterface
{
String NAME = "NameOfTestSubInterface";
void methodOfTestSubInterface();
}
private static interface TestParentInterface
{
String NAME = "NameOfTestParentInterface";
void methodOfTestParentInterface();
}
private abstract static class TestParentClass implements TestParentInterface,TestSubInterface
{
private String privateFieldOfTestParentClass;
public String publicFieldOfTestParentClass;
protected String protectedFieldOfTestParentClass;
String fieldOfDefaultModifierOfTestParentClass;
public void publicMethodOfTestParentClass(){}
protected void protectedMethodOfTestParentClass(){}
private void privateMethodOfTestParentClass(){}
void defaultModifierMethodOfTestParentClass(){}
}
private static class TestSubClass extends TestParentClass
{
private String privateFieldOfTestSubClass;
public String publicFieldOfTestSubClass;
protected String protectedFieldOfTestSubClass;
String fieldOfDefaultModifierOfTestParentClass;
public TestSubClass(){};
public TestSubClass(boolean dummy){};
private TestSubClass(String dummy){};
TestSubClass(int dummy){};
protected TestSubClass(long dummy){};
public void publicMethodOfTestParentClass(){}
protected void protectedMethodOfTestParentClass(){}
private void privateMethodOfTestParentClass(){}
void defaultModifierMethodOfTestParentClass(){}
public void methodOfTestSubInterface(){};
public void methodOfTestParentInterface(){};
}
}
The following table summarizes the classes that compose the reflection API. The Class and Object classes are in the java.lang (in the API reference documentation)package. The other classes are contained in the java.lang.reflect (in the API reference documentation)package.
Modifier |
information about the access modifiers of a class and its members. |
Object |
Provides the getClass
method.
|
发表评论
-
How to be a Programmer: A Short,Comprehensive,and Personal Summary
2013-10-28 10:38 619well written. http://samizdat ... -
js module pattern
2013-10-12 16:21 438http://www.adequatelygood.com/ ... -
GZip compressing HTML, JavaScript, CSS etc. makes the data sent to the browser s
2013-07-31 15:48 686this is fun. http://tutorials ... -
java collection matrix
2012-08-07 11:24 783http://www.janeve.me/articles/w ... -
ghost text (aka in-field text)
2012-04-01 11:18 740http://archive.plugins.jquery.c ... -
What is Optimistic Locking vs. Pessimistic Locking
2011-09-09 16:50 865What is Optimistic Locking vs. ... -
what is DAO
2011-04-15 13:42 809http://java.sun.com/blueprints/ ... -
indenting xml in vim with xmllint
2011-01-10 09:48 730I added to my “.vimrc” file: ... -
css sprite
2010-12-15 16:57 712http://css-tricks.com/css-sprit ... -
最牛B 的 Linux Shell 命令
2010-10-30 00:08 745http://hi.baidu.com/hy0kl/blog/ ... -
GPS Bearing VS Heading
2010-10-21 15:40 1695http://gps.about.com/od/glossar ... -
Document Type Declaration
2010-07-19 22:01 861Document Type Declaration h ... -
XML Declaration must be the first line in the document.
2010-06-12 17:54 931The XML declaration typically a ... -
UCM
2010-05-08 11:41 795Two links about UCM The power ... -
What is an MXBean?
2010-01-28 11:10 815refer to http://weblogs.java. ... -
why wait() always in a loop
2010-01-19 00:17 858As we know ,jdk API doc suggest ... -
Locks in Java
2010-01-18 22:48 958copied from http://tutorials.je ... -
use jps instead of ps to find jvm process
2010-01-11 14:21 842copied from http://java.sun.com ... -
My first error of Hello Wolrd Struts
2010-01-04 09:10 887It's my first time to touch Str ... -
Unit Testing Equals and HashCode of Java Beans
2009-12-29 10:07 1334copy from http://blog.cornetdes ...
相关推荐
这个数据集提供了2010年至2021年间加拿大各省的家庭支出与收入数据,这些数据根据人口统计和地理指标进行了分类。每行代表了年份(REF_DATE)、省份(GEO)以及编码后的支出或收入类型的唯一组合(COORDINATE)。以下是该数据集的关键特点及包含的列信息: 关键特点: 支出数据:家庭支出按照收入五分位数和支出类别进行分类。 收入数据:家庭收入值根据家庭类型、较年长成年人的年龄组别和收入水平细分。 地理位置匿名化:为了保护隐私,原始的地理位置标识符被替换为如“Province 1”这样的标签。 时间序列:涵盖了超过十年的财务数据(2010–2021),适合用于纵向经济和社会趋势分析。 包含的列: REF_DATE:记录年份(2010–2021) GEO:省份标签(例如,“Province 1”) Statistic:度量类型(例如,平均家庭支出) Before-tax household income quintile:税前家庭收入水平分组 Household expenditures, summary-level categories:支出类别 UOM:计量单位 COORD
1.【锂电池剩余寿命预测】GRU门控循环单元锂电池剩余寿命预测(Matlab完整源码和数据) 2.数据集:NASA数据集,已经处理好,B0005电池训练、测试; 3.环境准备:Matlab2023b,可读性强; 4.模型描述:GRU门控循环单元在各种各样的问题上表现非常出色,现在被广泛使用。 5.领域描述:近年来,随着锂离子电池的能量密度、功率密度逐渐提升,其安全性能与剩余使用寿命预测变得愈发重要。本代码实现了GRU门控循环单元在该领域的应用。 6.作者介绍:机器学习之心,博客专家认证,机器学习领域创作者,2023博客之星TOP50,主做机器学习和深度学习时序、回归、分类、聚类和降维等程序设计和案例分析,文章底部有博主联系方式。从事Matlab、Python算法仿真工作8年,更多仿真源码、数据集定制私信。
2000-2024年各省专利侵权案件结案数数据 1、时间:2000-2024年 2、来源:国家知识产权J 3、指标:专利侵权案件结案数 4、范围:31省 5、用途:可用于衡量知识产权保护水平
- 使用`<div>` 容器组织游戏界面,包含得分显示、游戏画布和操作按钮 - 支持三种游戏模式选择(一般模式、困难模式、无敌模式) - 移动端和桌面端兼容,提供触摸和键盘两种控制方式 2. CSS样式 : - 采用Flex布局实现页面居中显示 - 使用Grid布局实现方向按钮的排列 - 定义了游戏容器的阴影、圆角等视觉效果 - 为按钮添加了hover效果和过渡动画 3. JavaScript逻辑 : - 使用Canvas API实现游戏渲染 - 实现了蛇的移动、食物生成、碰撞检测等核心游戏逻辑 - 支持三种游戏模式,不同模式对应不同的游戏速度和规则 - 使用localStorage保存最高分记录 - 实现随机颜色生成,使游戏更具趣味性 代码整体结构清晰,功能完整,具有良好的可扩展性和可维护性。
台区终端电科院送检文档
内容概要:本文详细介绍了一个基于强化学习(RL)的飞机升阻力特性预测模型的实现过程。首先,定义了飞机空气动力学环境,包括状态空间、动作空间以及目标——预测升力系数(Cl)和阻力系数(Cd)。接着,通过生成模拟数据并进行预处理,创建了用于训练的数据集。然后,构建了一个神经网络代理模型,用于联合编码状态和动作,并预测升阻力系数。最后,实现了PPO算法来训练强化学习代理,使其能够根据当前状态选择最优动作,并通过不断迭代提高预测精度。文中还提供了完整的代码实现和详细的注释。 适合人群:航空航天领域的研究人员、机器学习工程师、对强化学习感兴趣的开发者。 使用场景及目标:适用于需要预测飞机升阻力特性的应用场景,如飞行器设计优化、性能评估等。目标是通过强化学习方法提升预测模型的准确性,从而为实际工程提供可靠的理论支持和技术手段。 其他说明:本文不仅涵盖了模型的设计与实现,还包括了数据生成、预处理等多个环节,有助于读者全面理解整个建模过程。同时,提供的代码可以作为研究和开发的基础,方便进一步扩展和改进。
cmock ut aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
lsm6d datasheet
风力发电机传动机构的设计(增速器)
genesys-zu(5ev)配置petalinux(从安装到嵌入)
django自建博客app
Android项目原生java语言课程设计,包含LW+ppt
幼儿园预防肺结核教育培训课件资料
STM32F103RCT6单片机控制气泵和电磁阀的开关 1、气泵和电磁阀的开和关均为开关量,实现控制方法有多种,比如继电器,但是继电器动作有噪声且体积较大,更好的方法为使用mos管。 2、mos管的选型:mos管选择主要注意两个参数即可,一是导通的电流,二是耐压值,并且常用NMOS管,根据要求,气泵和电磁阀供电电压为12V,所以选择的mos管耐压值要大于12V,这里选用耐压值为30V的MOS管,并且导通电流为5.8A。
因文件较多,数据存放网盘,txt文件内包含下载链接及提取码,永久有效。失效会第一时间进行补充。样例数据及详细介绍参见文章:https://blog.csdn.net/T0620514/article/details/146916073
将 Windows 系统中 “C:\windows\fonts” 目录下的所有字体文件
智能量测终端最新标准
滑道式提升机及其控制电路的设计.zip
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
三拐曲轴模锻工艺及模具设计说明书参考.zip