Examples of MyDate


Examples of datatype.MyDate

        int vol=ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN).getInt();
  
        raf.read(intBuffer);
        int reserve=ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN).getInt();
       
        Candle c=new Candle(new MyDate(year,month,day),sopen,
            sclose,shigh,slow,vol    );
    //    c.setCode(code);
        list.add(0,c);
       
      }
View Full Code Here

Examples of datatype.MyDate

      try
      {
       
        if(MiscHelper.isNumberString(arr[3]))
        {
          MyDate d=MyDate.parse(arr[0],"-");
          ShareNumberRecord snr=new ShareNumberRecord(d,Long.parseLong(arr[1]),Long.parseLong(arr[3]));
          result.add(snr);
         
        }
       
View Full Code Here

Examples of datatype.MyDate

    String s=r.readLine();
    s=r.readLine();
    while(s!=null)
    {
      String[] arr=StringUtils.split(s," ");
      ShareNumberRecord snr=new ShareNumberRecord(new MyDate(Integer.parseInt(arr[0])),
          Long.parseLong(arr[1]),Long.parseLong(arr[2]));
      result.add(snr);
      s=r.readLine();
    }
   
View Full Code Here

Examples of de.jetwick.util.MyDate

        assertEquals(2, tw.getTextTerms().size());
        assertEquals(2, tw2.getTextTerms().size());
    }

    JTweet createSolrTweet(long id, String twText, String user) {
        return new JTweet(id, twText, new JUser(user)).setCreatedAt(new MyDate(id).toDate());
    }
View Full Code Here

Examples of de.jetwick.util.MyDate

        this.twitter4j = twitter4j;
    }

    public Collection<String> updateFriendsOf(JUser user) {
        Date cacheTime = user.getLastFriendsUpdate();
        if (cacheTime == null || new MyDate().minus(cacheTime.getTime()).getDays() > 3) {
            final Collection<String> friends = new ArrayList<String>();           
            try {
                updateFromTwitter(friends, user.getScreenName(), 1000);
                if (friends.size() > 0) {
                    user.setLastFriendsUpdate(new Date());
View Full Code Here

Examples of de.jetwick.util.MyDate

    public void setRemoveOlderThanHours(int removeHours) {
        removeOlderThanMinutes = removeHours * 60;
    }

    public MyDate createRemoveOlderThan() {
        return new MyDate().minusMinutes(removeOlderThanMinutes).castToHour();
    }
View Full Code Here

Examples of de.jetwick.util.MyDate

        assertEquals("peter3", iter.next().getScreenName());
    }

    @Test
    public void testSorting() {
        MyDate day = new MyDate();
        MyDate day2 = day.clone().plusDays(1);
        twSearch.store(createSolrTweet(day, "java is a test!", "peter"), false);
        twSearch.store(createSolrTweet(day2, "java is cool and stable!", "peter2"), true);
        JetwickQuery q = new TweetQuery("java").setSort("dt", "desc");
        List<JUser> res = new ArrayList<JUser>();
        twSearch.query(res, q);
        assertEquals(2, res.size());
        assertEquals(day2.getTime(), (long) res.get(0).getOwnTweets().iterator().next().getTwitterId());

        q = new TweetQuery("java").setSort("dt", "asc");
        res.clear();
        twSearch.query(res, q);
        assertEquals(day.getTime(), (long) res.get(0).getOwnTweets().iterator().next().getTwitterId());
View Full Code Here

Examples of de.jetwick.util.MyDate

    public void testFindDuplicates() {
        twSearch.store(new JTweet(1L, "wikileaks is not a wtf", new JUser("userA")), false);
        twSearch.store(new JTweet(2L, "news about wikileaks", new JUser("userB")), false);

        // find dup is restricted to the last hour so use a current date
        MyDate dt = new MyDate();
        JTweet tw3 = new JTweet(3L, "wtf means wikileaks task force", new JUser("userC")).setCreatedAt(dt.toDate());
        JTweet tw4 = new JTweet(4L, "wtf wikileaks task force", new JUser("userD")).setCreatedAt(dt.plusMinutes(1).toDate());
        JTweet tw5 = new JTweet(5L, "RT @userC: wtf means wikileaks task force", new JUser("userE")).setCreatedAt(dt.plusMinutes(1).toDate());       
        twSearch.queueObjects(Arrays.asList(tw3, tw4, tw5));
        twSearch.forceEmptyQueueAndRefresh();
        assertEquals("should be empty. should NOT find tweet 4 because it is younger", 0, tw3.getDuplicates().size());
        assertEquals("should find tweet 3", 1, tw4.getDuplicates().size());

        Map<Long, JTweet> map = new LinkedHashMap<Long, JTweet>();
        JTweet tw = new JTweet(10L, "wtf wikileaks task force", new JUser("peter")).setCreatedAt(dt.plusMinutes(1).toDate());
        map.put(10L, tw);
        twSearch.findDuplicates(map);
        assertEquals("should find tweets 3 and 4", 2, tw.getDuplicates().size());
    }
View Full Code Here

Examples of de.jetwick.util.MyDate

        assertEquals("should find tweets 3 and 4", 2, tw.getDuplicates().size());
    }
   
    @Test
    public void testSpamDuplicates() {
        MyDate dt = new MyDate();
        JTweet tw1 = new JTweet(1L, "2488334. Increase your twitter followers now! Buy Twitter Followers", new JUser("userA")).setCreatedAt(dt.plusMinutes(1).toDate());
        JTweet tw2 = new JTweet(2L, "349366. Increase your twitter followers now! Buy Twitter Followers", new JUser("userB")).setCreatedAt(dt.plusMinutes(1).toDate());
        JTweet tw3 = new JTweet(31L, "2040312. Increase your twitter followers now! Buy Twitter Followers", new JUser("userC")).setCreatedAt(dt.plusMinutes(1).toDate());       
        twSearch.queueObjects(Arrays.asList(tw1, tw2, tw3));
        twSearch.forceEmptyQueueAndRefresh();

        assertEquals(0, tw1.getDuplicates().size());
        assertEquals(1, tw2.getDuplicates().size());
View Full Code Here

Examples of de.jetwick.util.MyDate

    }

    @Test
    public void testUpdateAndRemove() throws Exception {
        JTweet tw1 = createTweet(1L, "@karsten hajo", "peter");
        tw1.setCreatedAt(new MyDate().minusDays(2).toDate());

        twSearch.testUpdate(tw1);
        assertEquals(1, twSearch.countAll());
        assertEquals("@karsten hajo", twSearch.search("hajo").iterator().next().getOwnTweets().iterator().next().getText());
        assertEquals(1, twSearch.findByUserName("peter").getOwnTweets().size());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.