Package org.fluxtream.core.mvc.models

Examples of org.fluxtream.core.mvc.models.TimespanModel


    //note: assumption made: list will be sorted such that the last element in it will have the highest end time and newModel is the closest new model to that one
    public void simpleMergeAddTimespan(List<TimespanModel> list, TimespanModel newModel, long startMillis, long endMillis){
        final int largeWidth = 1920;
        final double millisPerPixel = (endMillis - startMillis) / (double) largeWidth;
        if (!list.isEmpty()){
            TimespanModel lastModel = list.get(list.size() - 1);
            if (lastModel.getObjectType().equals(newModel.getObjectType()) && lastModel.getValue().equals(newModel.getValue())){
                double millisFromEndToEnd = (newModel.getEnd() - lastModel.getEnd()) * 1000;
                double pixelDifference =    millisFromEndToEnd / millisPerPixel;
                if (pixelDifference < 5){
                    lastModel.setEnd(newModel.getEnd());
                    return;
                }
            }
        }
        list.add(newModel);
View Full Code Here


            List<AbstractFacet> facets = getFacetsInTimespanOrderedByEnd(timeInterval,apiKey,objectType);


            for (AbstractFacet facet : facets){
                simpleMergeAddTimespan(items,new TimespanModel(facet.start,facet.end,"on",objectTypeName),startMillis,endMillis);
            }

        }
        return items;
    }
View Full Code Here

                for (AbstractFacet facet : facets){
                    MovesMoveFacet moveFacet = (MovesMoveFacet) facet;
                    for (MovesActivity activity : moveFacet.getActivities()){
                        BodyTrackHelper.TimespanStyle style = new BodyTrackHelper.TimespanStyle();
                        style.iconURL = String.format(env.get("homeBaseUrl")+"%s/images/moves/" + activity.activity + ".png", env.get("release"));
                        final TimespanModel moveTimespanModel = new TimespanModel(activity.start, activity.end, activity.activity, objectTypeName, style);
                        items.add(moveTimespanModel);
                    }
                }

            }
            else if (objectType.getName().equals("place")){
                List<AbstractFacet> facets = getFacetsInTimespan(timeInterval,apiKey,objectType);
                for (AbstractFacet facet : facets){
                    MovesPlaceFacet place = (MovesPlaceFacet) facet;
                    BodyTrackHelper.TimespanStyle style = new BodyTrackHelper.TimespanStyle();
                    style.iconURL = getMovesPlaceIcon(place.apiKeyId, place.getId());
                    final TimespanModel placeTimespanModel = new TimespanModel(place.start, place.end, "place", objectTypeName,style);
                    items.add(placeTimespanModel);
                }
            }
        }
        return items;
View Full Code Here

                long end = start + 30;
                if (i<sleepPhases.size()-1) {
                    JSONArray nextSleepPhase = sleepPhases.getJSONArray(i+1);
                    end = nextSleepPhase.getLong(0);
                }
                final TimespanModel moveTimespanModel = new TimespanModel(start*1000, end*1000-1, toPhaseString(phase), "up-sleep");
                simpleMergeAddTimespan(items,moveTimespanModel,startMillis,endMillis);
            }
        }
        return items;
    }
View Full Code Here

        // 1/256 of the tile width, whichever is larger.
        long duration = Math.max((endMillis-startMillis)/256L, 180000L);

        for (AbstractFacet facet : facets){
            LastFmRecentTrackFacet trackFacet = (LastFmRecentTrackFacet) facet;
            simpleMergeAddTimespan(items,new TimespanModel(trackFacet.start,trackFacet.start+duration,"on",objectTypeName),startMillis,endMillis);
        }

        return items;
    }
View Full Code Here

        for (AbstractFacet facet : facets){
            EvernoteNoteFacet note = (EvernoteNoteFacet) facet;
            if (connectorSettings!=null) {
                final NotebookConfig notebookConfig = connectorSettings.getNotebook(note.notebookGuid);
                if (notebookConfig!=null&&!notebookConfig.hidden)
                    simpleMergeAddTimespan(items,new TimespanModel(note.start, note.start + duration, ((EvernoteNoteFacet)facet).notebookGuid, objectTypeName),startMillis,endMillis);
            } else
                simpleMergeAddTimespan(items,new TimespanModel(note.start, note.start + duration, ((EvernoteNoteFacet)facet).notebookGuid, objectTypeName),startMillis,endMillis);
        }
        return items;
    }
View Full Code Here

        for (AbstractFacet facet : facets){
            GoogleCalendarEventFacet event = (GoogleCalendarEventFacet) facet;
            if (connectorSettings!=null) {
                final CalendarConfig calendarConfig = connectorSettings.getCalendar(event.calendarId);
                if (calendarConfig!=null&&!calendarConfig.hidden)
                    simpleMergeAddTimespan(items,new TimespanModel(event.start, event.end, ((GoogleCalendarEventFacet)facet).calendarId, objectTypeName),startMillis,endMillis);
            } else
                simpleMergeAddTimespan(items,new TimespanModel(event.start, event.end, ((GoogleCalendarEventFacet)facet).calendarId, objectTypeName),startMillis,endMillis);
        }
        return items;
    }
View Full Code Here

        String objectTypeName = apiKey.getConnector().getName() + "-" + sleep.getName();
        List<AbstractFacet> facets = getFacetsInTimespanOrderedByEnd(timeInterval,apiKey, sleep);

        for (AbstractFacet facet : facets){
            FitbitSleepFacet sleepFacet = (FitbitSleepFacet)facet;
            simpleMergeAddTimespan(items,new TimespanModel(sleepFacet.start,sleepFacet.end, "on",objectTypeName),startMillis,endMillis);
        }

        return items;
    }
View Full Code Here

        for (ObjectType objectType : connector.objectTypes()) {
            String objectTypeName = apiKey.getConnector().getName() + "-" + objectType.getName();
            List<AbstractFacet> objectTypeFacets = getFacetsInTimespan(timeInterval,apiKey, objectType);

            for (AbstractFacet facet : objectTypeFacets){
                items.add(new TimespanModel(facet.start, facet.start+duration, channelName, objectTypeName));
            }
        }

        return items;
    }
View Full Code Here

TOP

Related Classes of org.fluxtream.core.mvc.models.TimespanModel

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.