List of usage examples for java.util Calendar JUNE
int JUNE
To view the source code for java.util Calendar JUNE.
Click Source Link
From source file:com.boozallen.cognition.ingest.storm.bolt.logging.LogRecordDateBoltTest.java
@Test public void testLogDate(@Injectable LogRecord record, @Injectable Logger logger) throws Exception { bolt.logger = logger;/*from www . j av a 2s.co m*/ bolt.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; bolt.level = Level.DEBUG; Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.setTimeZone(TimeZone.getTimeZone("UTC")); calendar.set(2014, Calendar.JUNE, 10, 20, 22, 4); new Expectations(bolt) { { record.getDate(); result = calendar.getTime(); bolt.log(logger, "2014-06-10T20:22:04.000Z"); } }; bolt.logDate(record); }
From source file:nl.utwente.bigdata.MapReduce5.java
private static int translateMonthCalendar(String month) { int monthOut = 0; if (month.equals("Jul")) { monthOut = Calendar.JULY; }// w w w. j a v a2 s.c o m if (month.equals("Jun")) { monthOut = Calendar.JUNE; } return monthOut; }
From source file:Negocio.Produccion.Planificacion.GanttDemo.java
/** * Creates a sample dataset for a Gantt chart. * * @return The dataset.//w ww. j ava 2s. c o m */ public static IntervalCategoryDataset createDataset() { final TaskSeries s1 = new TaskSeries("Scheduled"); s1.add(new Task("Write Proposal", new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001)))); s1.add(new Task("Obtain Approval", new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001)))); s1.add(new Task("Requirements Analysis", new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(5, Calendar.MAY, 2001)))); s1.add(new Task("Design Phase", new SimpleTimePeriod(date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001)))); s1.add(new Task("Design Signoff", new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001)))); s1.add(new Task("Alpha Implementation", new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), date(31, Calendar.JULY, 2001)))); s1.add(new Task("Design Review", new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001)))); s1.add(new Task("Revised Design Signoff", new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), date(10, Calendar.AUGUST, 2001)))); s1.add(new Task("Beta Implementation", new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), date(12, Calendar.SEPTEMBER, 2001)))); s1.add(new Task("Testing", new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001)))); s1.add(new Task("Final Implementation", new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), date(15, Calendar.NOVEMBER, 2001)))); s1.add(new Task("Signoff", new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001)))); final TaskSeries s2 = new TaskSeries("Actual"); s2.add(new Task("Write Proposal", new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001)))); s2.add(new Task("Obtain Approval", new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001)))); s2.add(new Task("Requirements Analysis", new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001)))); s2.add(new Task("Design Phase", new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001)))); s2.add(new Task("Design Signoff", new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001)))); s2.add(new Task("Alpha Implementation", new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Design Review", new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Revised Design Signoff", new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Beta Implementation", new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001)))); s2.add(new Task("Testing", new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001)))); s2.add(new Task("Final Implementation", new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001)))); s2.add(new Task("Signoff", new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001)))); final TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); collection.add(s2); return collection; }
From source file:org.projectforge.business.gantt.GanttTest.java
private GanttTask createTestChart() { // final GanttObjectImpl root = createGanttObject(null, "--", "rootNode", "0"); final GanttTaskImpl phase1 = createGanttObject(null, "P1", "Phase 1", "5"); final GanttTaskImpl task1 = createGanttObject(phase1, "001", "Task 1", "10"); final DayHolder day = new DayHolder(); day.setDate(2010, Calendar.JUNE, 1); task1.setStartDate(day.getDate());// www. j a va 2 s . co m createGanttObject(phase1, "002", "Task 2 (finish-start)", "10", task1, GanttRelationType.FINISH_START, 10); final GanttTaskImpl task3 = createGanttObject(phase1, "003", "Task 3 (finish-start II)", "5", task1, null, 0); createGanttObject(phase1, "004", "Task 4 (finish-start, depth = 2)", "5", task3, null, -3); final GanttTaskImpl task5 = createGanttObject(phase1, "005", "Task 5", "5"); day.add(Calendar.MONTH, 1); task5.setStartDate(day.getDate()); createGanttObject(phase1, "006", "Task 6 (finish-finish)", "3", task5, GanttRelationType.FINISH_FINISH, 0); createGanttObject(phase1, "007", "Task 7 (finish_finish)", "3", task5, GanttRelationType.FINISH_FINISH, -8); final GanttTaskImpl task8 = createGanttObject(phase1, "008", "Task 8 (finish_finish)", "3", task5, GanttRelationType.FINISH_FINISH, 3); createGanttObject(phase1, "009", "Task 9 (start-start)", "3", task8, GanttRelationType.START_START, 0); createGanttObject(phase1, "010", "Task 10 (start-start)", "3", task8, GanttRelationType.START_START, 5); createGanttObject(phase1, "011", "Task 11 (start-start)", "3", task8, GanttRelationType.START_START, -5); final GanttTaskImpl task12 = createGanttObject(phase1, "012", "Task 12", "5"); day.add(Calendar.WEEK_OF_YEAR, 3); task12.setStartDate(day.getDate()); createGanttObject(phase1, "013", "Task 13 (start-finish)", "3", task12, GanttRelationType.START_FINISH, -5); createGanttObject(phase1, "014", "Task 14 (start-finish)", "3", task12, GanttRelationType.START_FINISH, 5); createGanttObject(phase1, "015", "Task 15 (start-finish)", "3", task12, GanttRelationType.START_FINISH, 0); final GanttTaskImpl task16 = createGanttObject(phase1, "016", "Task 16", "6"); day.add(Calendar.WEEK_OF_YEAR, 1); task16.setStartDate(day.getDate()); return phase1; }
From source file:org.pivotal.gemfire.cache.CacheRegionQueryUsingToDateTest.java
@Before public void setupPeople() { Region<Long, Person> localPeople = gemfireCache.getRegion("/People"); put(localPeople, createPerson("Jon", "Doe", createDate(1979, Calendar.MAY, 15))); put(localPeople, createPerson("Jane", "Doe", createDate(1981, Calendar.APRIL, 21))); put(localPeople, createPerson("Pie", "Doe", createDate(1997, Calendar.NOVEMBER, 22))); put(localPeople, createPerson("Cookie", "Doe", createDate(2008, Calendar.AUGUST, 16))); put(localPeople, createPerson("Sour", "Doe", createDate(2012, Calendar.DECEMBER, 1))); put(localPeople, createPerson("Jack", "Handy", createDate(1977, Calendar.MAY, 10))); put(localPeople, createPerson("Sandy", "Handy", createDate(1977, Calendar.MARCH, 3))); put(localPeople, createPerson("Jack", "Black", createDate(1972, Calendar.JUNE, 26))); put(localPeople, createPerson("Ben", "Dover", createDate(1969, Calendar.MAY, 5))); put(localPeople, createPerson("Ima", "Pigg", createDate(1975, Calendar.JULY, 17))); assertThat(localPeople.size(), is(equalTo(10))); }
From source file:info.magnolia.test.mock.jcr.MockValueTest.java
@Test public void testGetDateFromString() throws Exception { MockValue jcrValue = new MockValue("2012-06-15T10:39:23.901+01:00"); Calendar cal = jcrValue.getDate(); assertEquals(cal.get(Calendar.YEAR), 2012); assertEquals(cal.get(Calendar.MONTH), Calendar.JUNE); assertEquals(cal.get(Calendar.DAY_OF_MONTH), 15); }
From source file:com.mycompany.CRMFly.serviceLayer.ClientsServiceImpl.java
@Transactional public Map<Date, Double> getSumsFotDates(Clients client) { Long id = client.getId();/*from ww w .j a va 2s .c o m*/ Calendar calendar = new GregorianCalendar(); Integer monthDifference = 0; if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL || calendar.get(Calendar.MONTH) == Calendar.JULY || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) { monthDifference = 0; } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY || calendar.get(Calendar.MONTH) == Calendar.AUGUST || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) { monthDifference = -1; } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER || calendar.get(Calendar.MONTH) == Calendar.DECEMBER) monthDifference = -2; // Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH); calendar.add(Calendar.MONTH, monthDifference); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); // calendar.add(Calendar.DAY_OF_MONTH, dayDifference-1); Date beginningOfQuarter = calendar.getTime(); Double thisQuarterSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackOne = calendar.getTime(); Double QuarterBackOneSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackTwo = calendar.getTime(); Double QuarterBackTwoSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackThree = calendar.getTime(); Double QuarterBackThreeSum = 0.0; List<Contracts> contracts = clientsDAO.getContractsForClient(id); HashMap<Date, Double> sums = new HashMap<Date, Double>(); for (Contracts contract : contracts) { Date date = contract.getBegin_date(); if (date.after(beginningOfQuarter)) thisQuarterSum += contract.getTotalSum(); else if (date.after(QuarterBackOne)) QuarterBackOneSum += contract.getTotalSum(); else if (date.after(QuarterBackTwo)) QuarterBackTwoSum += contract.getTotalSum(); else if (date.after(QuarterBackThree)) QuarterBackThreeSum += contract.getTotalSum(); } sums.put(beginningOfQuarter, thisQuarterSum); sums.put(QuarterBackOne, QuarterBackOneSum); sums.put(QuarterBackTwo, QuarterBackTwoSum); sums.put(QuarterBackThree, QuarterBackThreeSum); return sums; }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting short description of month by the number * of month//from w w w. j a v a 2 s . co m * * @param mthNum * @return */ public static String getMonthShortDesc(int mthNum) { String mthShortDesc; switch (mthNum) { case Calendar.JANUARY: { mthShortDesc = DateTimeConstants.SHORT_JANUARY; break; } case Calendar.FEBRUARY: { mthShortDesc = DateTimeConstants.SHORT_FEBRUARY; break; } case Calendar.MARCH: { mthShortDesc = DateTimeConstants.SHORT_MARCH; break; } case Calendar.APRIL: { mthShortDesc = DateTimeConstants.SHORT_APRIL; break; } case Calendar.MAY: { mthShortDesc = DateTimeConstants.SHORT_MAY; break; } case Calendar.JUNE: { mthShortDesc = DateTimeConstants.SHORT_JUNE; break; } case Calendar.JULY: { mthShortDesc = DateTimeConstants.SHORT_JULY; break; } case Calendar.AUGUST: { mthShortDesc = DateTimeConstants.SHORT_AUGUST; break; } case Calendar.SEPTEMBER: { mthShortDesc = DateTimeConstants.SHORT_SEPTEMBER; break; } case Calendar.OCTOBER: { mthShortDesc = DateTimeConstants.SHORT_OCTOBER; break; } case Calendar.NOVEMBER: { mthShortDesc = DateTimeConstants.SHORT_NOVEMBER; break; } case Calendar.DECEMBER: { mthShortDesc = DateTimeConstants.SHORT_DECEMBER; break; } default: { mthShortDesc = ""; break; } } return mthShortDesc; }
From source file:com.mycompany.CRMFly.serviceLayer.ProductsServiceImpl.java
@Transactional public Map<Date, Double> getSumsFotDates(Products product) { Long id = product.getId();//from w w w. j av a2s . c o m Calendar calendar = new GregorianCalendar(); Integer monthDifference = 0; if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL || calendar.get(Calendar.MONTH) == Calendar.JULY || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) { monthDifference = 0; } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY || calendar.get(Calendar.MONTH) == Calendar.AUGUST || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) { monthDifference = -1; } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER || calendar.get(Calendar.MONTH) == Calendar.DECEMBER) monthDifference = -2; Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH); calendar.add(Calendar.MONTH, monthDifference); calendar.add(Calendar.DAY_OF_MONTH, dayDifference - 1); Date beginningOfQuarter = calendar.getTime(); Double thisQuarterSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackOne = calendar.getTime(); Double QuarterBackOneSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackTwo = calendar.getTime(); Double QuarterBackTwoSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackThree = calendar.getTime(); Double QuarterBackThreeSum = 0.0; List<PositionsInContract> positions = productsDAO.getContractPositionsForProduct(id); HashMap<Date, Double> sums = new HashMap<Date, Double>(); for (PositionsInContract position : positions) { Long posID = position.getId(); Contracts contract = productsDAO.getContractForPosition(posID); Date date = contract.getBegin_date(); if (date.after(beginningOfQuarter)) thisQuarterSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackOne)) QuarterBackOneSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackTwo)) QuarterBackTwoSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackThree)) QuarterBackThreeSum += position.getPrice() * position.getQuantity(); } sums.put(beginningOfQuarter, thisQuarterSum); sums.put(QuarterBackOne, QuarterBackOneSum); sums.put(QuarterBackTwo, QuarterBackTwoSum); sums.put(QuarterBackThree, QuarterBackThreeSum); return sums; }
From source file:org.metawidget.swing.widgetprocessor.binding.beanutils.BeanUtilsBindingProcessorTest.java
public void testScalaBinding() throws Exception { // Model/*from w ww . j av a2s .c om*/ Date dateFirst = new GregorianCalendar(1975, Calendar.APRIL, 9).getTime(); ScalaFoo scalaFoo = new ScalaFoo(); scalaFoo.bar_$eq(dateFirst); ScalaFoo scalaFoo2 = new ScalaFoo(); scalaFoo.nestedFoo = scalaFoo2; ScalaFoo scalaFoo3 = new ScalaFoo(); scalaFoo2.nestedFoo = scalaFoo3; scalaFoo3.bar_$eq(new GregorianCalendar(1976, Calendar.MAY, 16).getTime()); // BeanUtilsBinding ConvertUtils.register(new DateConverter(DATE_FORMAT), Date.class); // Inspect SwingMetawidget metawidget = new SwingMetawidget(); metawidget.addWidgetProcessor(new BeanUtilsBindingProcessor( new BeanUtilsBindingProcessorConfig().setPropertyStyle(new ScalaPropertyStyle()))); BaseObjectInspectorConfig config = new BaseObjectInspectorConfig() .setPropertyStyle(new ScalaPropertyStyle()); metawidget.setInspector(new PropertyTypeInspector(config)); metawidget.setToInspect(scalaFoo); // Loading JTextField textField = (JTextField) metawidget.getComponent(1); DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); assertEquals(dateFormat.format(dateFirst), textField.getText()); JLabel label = (JLabel) metawidget.getComponent(5); assertEquals("Not settable", label.getText()); JTextField nestedTextField = (JTextField) ((SwingMetawidget) metawidget.getComponent(3)).getComponent(1); assertEquals("", nestedTextField.getText()); JTextField nestedNestedTextField = (JTextField) ((SwingMetawidget) ((SwingMetawidget) metawidget .getComponent(3)).getComponent(3)).getComponent(1); assertEquals(dateFormat.format(scalaFoo3.bar()), nestedNestedTextField.getText()); // Saving Date dateSecond = new GregorianCalendar(1976, Calendar.MAY, 10).getTime(); textField.setText(dateFormat.format(dateSecond)); nestedNestedTextField.setText(dateFormat.format(new GregorianCalendar(1977, Calendar.JUNE, 17).getTime())); metawidget.getWidgetProcessor(BeanUtilsBindingProcessor.class).save(metawidget); GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(scalaFoo.bar()); assertEquals(1976, calendar.get(Calendar.YEAR)); assertEquals(null, scalaFoo2.bar()); calendar.setTime(scalaFoo3.bar()); assertEquals(1977, calendar.get(Calendar.YEAR)); // Rebinding textField = (JTextField) metawidget.getComponent(1); assertEquals(dateFormat.format(dateSecond), textField.getText()); scalaFoo.bar_$eq(dateFirst); metawidget.getWidgetProcessor(BeanUtilsBindingProcessor.class).rebind(scalaFoo, metawidget); textField = (JTextField) metawidget.getComponent(1); assertEquals(dateFormat.format(dateFirst), textField.getText()); }