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


Java Field类代码示例

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


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

示例1: test_ConstructorLjava_lang_StringLjava_lang_String

import java.text.DateFormat.Field; //导入依赖的package包/类
public void test_ConstructorLjava_lang_StringLjava_lang_String() {
	// Regression for HARMONY-178
	MyField field = new MyField("day of month", Calendar.ERA);

	assertEquals("field has wrong name", "day of month", field.getName());
	assertEquals("field has wrong Calendar field number", Calendar.ERA,
			field.getCalendarField());

	DateFormat.Field realField = DateFormat.Field
			.ofCalendarField(Calendar.ERA);
	assertSame("Modified calendar field with the same field number",
			DateFormat.Field.ERA, realField);

	DateFormat.Field realField2 = DateFormat.Field
			.ofCalendarField(Calendar.DAY_OF_MONTH);
	assertSame("Modified calendar field with the same field number",
			DateFormat.Field.DAY_OF_MONTH, realField2);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:DataFormatFieldTest.java

示例2: test_Constructor2

import java.text.DateFormat.Field; //导入依赖的package包/类
/**
 * @tests java.text.DateFormat$Field#Field(java.lang.String, int)
 */
public void test_Constructor2() {
    MyField field = new MyField("day of month", Calendar.ERA);

    assertEquals("field has wrong name", "day of month", field.getName());
    assertEquals("field has wrong Calendar field number", Calendar.ERA,
            field.getCalendarField());

    DateFormat.Field realField = DateFormat.Field
            .ofCalendarField(Calendar.ERA);
    assertSame("Modified calendar field with the same field number",
            DateFormat.Field.ERA, realField);

    DateFormat.Field realField2 = DateFormat.Field
            .ofCalendarField(Calendar.DAY_OF_MONTH);
    assertSame("Modified calendar field with the same field number",
            DateFormat.Field.DAY_OF_MONTH, realField2);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:DataFormatFieldTest.java

示例3: test_getCalendarField

import java.text.DateFormat.Field; //导入依赖的package包/类
/**
 * @tests java.text.DateFormat$Field#getCalendarField()
 */
public void test_getCalendarField() {
    // Test for method int getCalendarField()
    assertEquals("Field.AM_PM.getCalendarField() returned the wrong value",
            Calendar.AM_PM, Field.AM_PM.getCalendarField());

    // test special cases
    assertEquals(
            "Field.TIME_ZONE.getCalendarField() returned the wrong value",
            -1, Field.TIME_ZONE.getCalendarField());
    assertEquals("Field.HOUR0.getCalendarField() returned the wrong value",
            Calendar.HOUR, Field.HOUR0.getCalendarField());
    assertEquals("Field.HOUR1.getCalendarField() returned the wrong value",
            -1, Field.HOUR1.getCalendarField());
    assertEquals(
            "Field.HOUR_OF_DAY0.getCalendarField() returned the wrong value",
            Calendar.HOUR_OF_DAY, Field.HOUR_OF_DAY0.getCalendarField());
    assertEquals(
            "Field.HOUR_OF_DAY1.getCalendarField() returned the wrong value",
            -1, Field.HOUR_OF_DAY1.getCalendarField());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:DataFormatFieldTest.java

示例4: getDateVector1

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector1() {
    // "19990913171901"
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(0, 4, Field.YEAR));
    v.add(new FieldContainer(4, 6, Field.MONTH));
    v.add(new FieldContainer(6, 8, Field.DAY_OF_MONTH));
    v.add(new FieldContainer(8, 10, Field.HOUR_OF_DAY0));
    v.add(new FieldContainer(10, 12, Field.MINUTE));
    v.add(new FieldContainer(12, 14, Field.SECOND));
    return v;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:Support_SimpleDateFormat.java

示例5: getDateVector2

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector2() {
    // "12 3 5 March 2002 Monday"
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(0, 2, Field.WEEK_OF_YEAR));
    v.add(new FieldContainer(3, 4, Field.WEEK_OF_MONTH));
    v.add(new FieldContainer(5, 7, Field.DAY_OF_MONTH));
    v.add(new FieldContainer(8, 17, Field.MONTH));
    v.add(new FieldContainer(18, 22, Field.YEAR));
    v.add(new FieldContainer(23, 29, Field.DAY_OF_WEEK));
    return v;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:Support_SimpleDateFormat.java

示例6: getDateVector3

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector3() {
    // "5:19 GMT-05:00"
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(0, 1, Field.HOUR1));
    v.add(new FieldContainer(2, 4, Field.MINUTE));
    v.add(new FieldContainer(5, 14, Field.TIME_ZONE));
    return v;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:9,代码来源:Support_SimpleDateFormat.java

示例7: getDateVector5

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector5() {
    // "5:19 -0400"
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(0, 1, Field.HOUR1));
    v.add(new FieldContainer(2, 4, Field.MINUTE));
    v.add(new FieldContainer(5, 10, Field.TIME_ZONE));
    return v;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:9,代码来源:Support_SimpleDateFormat.java

示例8: getDateVector1

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector1() {
	// "19990913171901"
	Vector<FieldContainer> v = new Vector<FieldContainer>();
	v.add(new FieldContainer(0, 4, Field.YEAR));
	v.add(new FieldContainer(4, 6, Field.MONTH));
	v.add(new FieldContainer(6, 8, Field.DAY_OF_MONTH));
	v.add(new FieldContainer(8, 10, Field.HOUR_OF_DAY0));
	v.add(new FieldContainer(10, 12, Field.MINUTE));
	v.add(new FieldContainer(12, 14, Field.SECOND));
	return v;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:Support_SimpleDateFormat.java

示例9: getDateVector2

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector2() {
	// "12 3 5 March 2002 Monday"
	Vector<FieldContainer> v = new Vector<FieldContainer>();
	v.add(new FieldContainer(0, 2, Field.WEEK_OF_YEAR));
	v.add(new FieldContainer(3, 4, Field.WEEK_OF_MONTH));
	v.add(new FieldContainer(5, 7, Field.DAY_OF_MONTH));
	v.add(new FieldContainer(8, 17, Field.MONTH));
	v.add(new FieldContainer(18, 22, Field.YEAR));
	v.add(new FieldContainer(23, 29, Field.DAY_OF_WEEK));
	return v;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:Support_SimpleDateFormat.java

示例10: getDateVector3

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector3() {
	// "5:19 EDT"
	Vector<FieldContainer> v = new Vector<FieldContainer>();
	v.add(new FieldContainer(0, 1, Field.HOUR1));
	v.add(new FieldContainer(2, 4, Field.MINUTE));
	v.add(new FieldContainer(5, 14, Field.TIME_ZONE));
	return v;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:Support_SimpleDateFormat.java

示例11: getDateVector5

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector5() {
	// "5:19 -0400"
	Vector<FieldContainer> v = new Vector<FieldContainer>();
	v.add(new FieldContainer(0, 1, Field.HOUR1));
	v.add(new FieldContainer(2, 4, Field.MINUTE));
	v.add(new FieldContainer(5, 10, Field.TIME_ZONE));
	return v;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:Support_SimpleDateFormat.java

示例12: test_ConstructorLjava_lang_StringI

import java.text.DateFormat.Field; //导入依赖的package包/类
/**
 * @tests java.text.DateFormat$Field#Field(java.lang.String, int)
 */
public void test_ConstructorLjava_lang_StringI() {
    MyField field = new MyField("a field", Calendar.DAY_OF_WEEK);

    assertEquals("field has wrong name", "a field", field.getName());
    assertEquals("field has wrong Calendar field number",
            Calendar.DAY_OF_WEEK, field.getCalendarField());

    DateFormat.Field realField = DateFormat.Field
            .ofCalendarField(Calendar.DAY_OF_WEEK);
    assertSame("Modified calendar field with the same field number",
            DateFormat.Field.DAY_OF_WEEK, realField);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:DataFormatFieldTest.java

示例13: getDateVector3

import java.text.DateFormat.Field; //导入依赖的package包/类
private Vector<FieldContainer> getDateVector3() {
	// "5:19 EDT"
	Vector<FieldContainer> v = new Vector<FieldContainer>();
	v.add(new FieldContainer(0, 1, Field.HOUR1));
	v.add(new FieldContainer(2, 4, Field.MINUTE));
	v.add(new FieldContainer(5, 8, Field.TIME_ZONE));
	return v;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:9,代码来源:Support_SimpleDateFormat.java

示例14: testExecuteJobsForSingleEngine

import java.text.DateFormat.Field; //导入依赖的package包/类
@Test
public void testExecuteJobsForSingleEngine() {
  // configure and build a process engine
  StandaloneProcessEngineConfiguration standaloneProcessEngineConfiguration = new StandaloneInMemProcessEngineConfiguration();
  standaloneProcessEngineConfiguration.setProcessEngineName(getClass().getName() + "-engine1");
  standaloneProcessEngineConfiguration.setJdbcUrl("jdbc:h2:mem:jobexecutor-test-engine");
  standaloneProcessEngineConfiguration.setJobExecutorActivate(false);
  standaloneProcessEngineConfiguration.setJobExecutor(jobExecutor);
  standaloneProcessEngineConfiguration.setDbMetricsReporterActivate(false);
  ProcessEngine engine = standaloneProcessEngineConfiguration.buildProcessEngine();

  createdProcessEngines.add(engine);

  engine.getRepositoryService().createDeployment()
    .addClasspathResource(PROCESS_RESOURCE)
    .deploy();

  jobExecutor.shutdown();

  engine.getRuntimeService()
    .startProcessInstanceByKey("intermediateTimerEventExample");

  Assert.assertEquals(1, engine.getManagementService().createJobQuery().count());

  Calendar calendar = Calendar.getInstance();
  calendar.add(Field.DAY_OF_YEAR.getCalendarField(), 6);
  ClockUtil.setCurrentTime(calendar.getTime());
  jobExecutor.start();
  waitForJobExecutorToProcessAllJobs(10000, 100, jobExecutor, engine.getManagementService(), true);

  Assert.assertEquals(0, engine.getManagementService().createJobQuery().count());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:33,代码来源:SequentialJobAcquisitionTest.java

示例15: CopyTestModelToStorage

import java.text.DateFormat.Field; //导入依赖的package包/类
private void CopyTestModelToStorage() {
    try {
        //get working folder of the app on the mobile
        String fileDirPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/"+
                             getApplicationContext().getString(R.string.app_name) ;
        //create the folder if it does not exist
        File allfiles  = new File(fileDirPath);
        if (!allfiles.exists()) {
            //if the folder does not exist
            if (allfiles.mkdirs()) {
                //create the folder
            } else {
                //failed
                Toast.makeText(
                    getApplicationContext(),
                    "Cannot Create Folder to Store Test Model!",
                    Toast.LENGTH_LONG).show();
                return;
            }
        }

        //copy the files (test models) in res/raw one by one to the storage of the mobile
        Resources res = getResources();
        java.lang.reflect.Field[] fields=R.raw.class.getFields();
        for (int count=0; count < fields.length; count++) {
            int resourceId=res.getIdentifier(fields[count].getName(),
                                             "raw",
                                             getPackageName());
            //get full file name
            TypedValue value = new TypedValue();
            getResources().getValue(resourceId, value, true);
            String filename = value.string.toString();
            filename = filename.split("res/raw/")[1];
            String eachFilePathInStorage = fileDirPath + "/" + filename;
            File eachfile = new File(eachFilePathInStorage);
            //read out the file stream and copy it to the storage
            InputStream ins = res.openRawResource(resourceId);
            FileOutputStream fos = new FileOutputStream(eachfile);
            byte[] buffer = new byte[8192];
            int count1 = 0;
            while ((count1 = ins.read(buffer)) > 0) {
                fos.write(buffer, 0, count1);
            }
            fos.close();
            ins.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
        Toast.makeText(
            getApplicationContext(),
            "Some Errors When Copying Test Models to Storage. Contact the Author!",
            Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:Autodesk-Forge,项目名称:viewer-android-sample,代码行数:55,代码来源:MainActivity.java


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