Package org.photovault.imginfo

Examples of org.photovault.imginfo.FuzzyDate


  // First, check cases where the midpoint belongs to the fuzziness range
   Calendar cal = Calendar.getInstance();
        cal.clear();
  cal.set( 2002, 11, 24 );
  FuzzyDate fd1 = new FuzzyDate( cal.getTime(), 1.0 );
  // First the case in which there is only lower bound
   q.setFuzzyDateCriteria( PhotoQuery.FIELD_SHOOTING_TIME,
        PhotoQuery.FIELD_SHOOTING_TIME_ACCURACY,
        fd1, QueryFuzzyTimeCriteria.INCLUDE_PROBABLE );
  // Image 2 should not be included since its fuzzy range is
View Full Code Here


  // First, check cases where the midpoint belongs to the fuzziness range
   Calendar cal = Calendar.getInstance();
        cal.clear();
  cal.set( 2002, 11, 24 );
  FuzzyDate fd1 = new FuzzyDate( cal.getTime(), 1.0 );
   q.setFuzzyDateCriteria( PhotoQuery.FIELD_SHOOTING_TIME,
        PhotoQuery.FIELD_SHOOTING_TIME_ACCURACY,
        fd1, QueryFuzzyTimeCriteria.INCLUDE_POSSIBLE );
  // All expected to be included with INCLUDE_POSSIBLE
  boolean[] expected2 = { true, true, true, true };
View Full Code Here

  // First, check cases where the midpoint belongs to the fuzziness range
   Calendar cal = Calendar.getInstance();
        cal.clear();
  cal.set( 2002, 11, 24 );
  FuzzyDate fd1 = new FuzzyDate( cal.getTime(), 1.0 );
  q.setFuzzyDateCriteria( PhotoQuery.FIELD_SHOOTING_TIME,
        PhotoQuery.FIELD_SHOOTING_TIME_ACCURACY,
        fd1, QueryFuzzyTimeCriteria.INCLUDE_CERTAIN );
  // All expected to be included with INCLUDE_POSSIBLE
  boolean[] expected3 = { false, true, false, false };
View Full Code Here

  // Check that all photos were found
  log.debug( "Checking that all are found" );
  for ( int n = 0; n < expected.length; n++ ) {
      if ( expected[n] ) {
                PhotoInfo photo = (PhotoInfo)photos.elementAt( n );
                FuzzyDate d = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() );
    fail( "Photo "+ n + " (id" + photo.getUid() + ", dated " + d.format() + ") not included in result set" );
      }
  }
    }
View Full Code Here

       
        modelFields.put( FUZZY_DATE, new FieldController( photos ) {
            protected void setModelValue( Object model ) {
                log.debug( "FUZZY_DATE - setModeValue ({}) " );
                PhotoInfo obj = (PhotoInfo) model;
                FuzzyDate fd = (FuzzyDate) value;
                if ( fd != null ) {
                    obj.setShootTime( fd.getDate() );
                    obj.setTimeAccuracy( fd.getAccuracy() );
                } else {
                    obj.setShootTime( null );
                    obj.setTimeAccuracy( 0 );
                }
            }
            protected Object getModelValue( Object model ) {
                log.debug( "FUZZY_DATE - getModeValue ({}) " );
                PhotoInfo obj = (PhotoInfo) model;
                Date date = obj.getShootTime();
                double accuracy = obj.getTimeAccuracy();
                return new FuzzyDate( date, accuracy );
            }
            protected void updateView( Object view ) {
                log.debug( "FUZZY_DATE - updateView ({}) " );
                PhotoInfoView obj = (PhotoInfoView) view;
                obj.setFuzzyDate( (FuzzyDate) value );
View Full Code Here

            long timeMsec = Long.parseLong( timeStr );
            String accStr = attrs.getValue( "accuracy" );
            long accMsec = Long.parseLong( accStr );
            Date time = new Date( timeMsec );
            double accDays = ((double) accMsec ) / (24.0 * 3600000.0 );
            FuzzyDate fd = new FuzzyDate( time, accDays );
            return fd;
        }
View Full Code Here

            g2.setBackground( this.getBackground() );
        }
        Font attrFont = new Font( "Arial", Font.PLAIN, 10 );
        FontRenderContext frc = g2.getFontRenderContext();
        if ( showDate && photo.getShootTime() != null ) {
            FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() );
           
            String dateStr = fd.format();
            TextLayout txt = new TextLayout( dateStr, attrFont, frc );
            // Calculate the position for the text
            Rectangle2D bounds = txt.getBounds();
            int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX();
            g2.clearRect( xpos-2, ypos-2,
View Full Code Here

    */
    public Date getStartDate() {
  Date start = null;
  if ( useFuzzyDateField ) {
      log.debug( "Parsing date range" );
      FuzzyDate fd = FuzzyDate.parse( dateRange.getText() );
      if ( fd != null ) {
    log.debug( "Parsed date range: " + fd.format() );
    start = fd.getMinDate();
      }
  } else {
      start = (Date) startDate.getValue();
  }
  log.debug( "Start date " + start );
View Full Code Here

    */
    public Date getEndDate() {
  Date end = null;
  if ( useFuzzyDateField ) {
      log.debug( "Parsing date range" );
       FuzzyDate fd = FuzzyDate.parse( dateRange.getText() );
      if ( fd != null ) {
    log.debug( "Parsed date range: " + fd.format() );
    end = fd.getMaxDate();
      }
  } else {
      end = (Date) endDate.getValue();
  }
  log.debug( "End date " + end );
View Full Code Here

    }
   
    public FuzzyDate getFuzzyDate( ) {
  String str = fuzzyDateField.getText( );
  log.debug( "fuzzyDate = " + str );
  FuzzyDate d = FuzzyDate.parse( str );
  return d;
    }
View Full Code Here

TOP

Related Classes of org.photovault.imginfo.FuzzyDate

Copyright © 2018 www.massapicom. 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.