⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 leapyearbean.java

📁 EJB最新技术开发指南源代码
💻 JAVA
字号:
package com.ibm.ivj.wte.samples.leapyear;

// Licensed Material - Property of IBM 
// (C) Copyright IBM Corp. 2000 - All Rights Reserved 
// 
// DISCLAIMER: 
// The following [enclosed] code is sample code created by IBM 
// Corporation.  This sample code is not part of any standard IBM product 
// and is provided to you solely for the purpose of assisting you in the 
// development of your applications.  The code is provided 'AS IS', 
// without warranty or condition of any kind.  IBM shall not be liable for any damages 
// arising out of your use of the sample code, even if IBM has been 
// advised of the possibility of such damages.

/**
 * Insert the type's description here.
 * Creation date: (05/22/2000 9:47:20 AM)
 * @author: Administrator
 */
public class LeapYearBean {
private static final String copyright = 
	"(c) Copyright IBM Corporation 2000.";

	private int[] fieldLeapYears = null;
	private int fieldStartYear = 0;
/**
 * LeapYearBean constructor comment.
 */
public LeapYearBean() {
	super();
}
/**
 * Perform the findLeapYears method.
 */
public void findLeapYears() {
	// Find next 10 leap years
	final int limit = 10;
	int year=getStartYear();
	setLeapYears(new int[limit]);
	// Find the first leap year
	while (!isLeapYear(year))
		year++;
	
	int i=0;
	while (i<limit) {
		if (isLeapYear(year)) {
			setLeapYears(i, year);
			i++;
		}
		year=year+4;
	}
	return;
}
/**
 * Gets the leapYears property (int[]) value.
 * @return The leapYears property value.
 * @see #setLeapYears
 */
public int[] getLeapYears() {
	return fieldLeapYears;
}
/**
 * Gets the leapYears index property (int) value.
 * @return The leapYears property value.
 * @param index The index value into the property array.
 * @see #setLeapYears
 */
public int getLeapYears(int index) {
	return getLeapYears()[index];
}
/**
 * Gets the startYear property (int) value.
 * @return The startYear property value.
 * @see #setStartYear
 */
public int getStartYear() {
	return fieldStartYear;
}
/**
 * Perform the isLeapYear method.
 * @return boolean
 * @param argYear int
 */
public boolean isLeapYear(int argYear) {
	return (((argYear%4==0) && !(argYear%100==0)) || (argYear%400==0));
}
/**
 * Sets the leapYears property (int[]) value.
 * @param leapYears The new value for the property.
 * @see #getLeapYears
 */
public void setLeapYears(int[] leapYears) {
	fieldLeapYears = leapYears;
}
/**
 * Sets the leapYears index property (int[]) value.
 * @param index The index value into the property array.
 * @param leapYears The new value for the property.
 * @see #getLeapYears
 */
public void setLeapYears(int index, int leapYears) {
	fieldLeapYears[index] = leapYears;
}
/**
 * Sets the startYear property (int) value.
 * @param startYear The new value for the property.
 * @see #getStartYear
 */
public void setStartYear(int startYear) {
	fieldStartYear = startYear;
}
}

⌨️ 快捷键说明

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