Examples of Offset


Examples of io.druid.segment.data.Offset

    int count = 0;
    while (offset.withinBounds()) {
      Assert.assertEquals(vals[count], offset.getOffset());

      int cloneCount = count;
      Offset clonedOffset = offset.clone();
      while (clonedOffset.withinBounds()) {
        Assert.assertEquals(vals[cloneCount], clonedOffset.getOffset());

        ++cloneCount;
        clonedOffset.increment();
      }

      ++count;
      offset.increment();
    }
View Full Code Here

Examples of lupos.engine.operators.singleinput.modifiers.Offset

    connection.connectAndSetAsNewOperatorConnection(new Limit(node.getLimit()));
  }

  @Override
  public void visit(final ASTOffset node, final OperatorConnection connection) {
    connection.connectAndSetAsNewOperatorConnection(new Offset(node.getOffset()));
  }
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

                TimeFrame currentFrame = myTimeUnitStack.createTimeFrame(
                        currentDate, bottomUnit, defaultUnit);
                Date endDate = currentFrame.getFinishDate();
                offsetEnd += getBottomUnitWidth();
                bottomUnitOffsets.add(
                        new Offset(
                                bottomUnit,
                                myStartDate,
                                endDate,
                                offsetEnd,
                                null));
                currentDate = endDate;
            } while (offsetEnd <= getChartWidth());
        }
        {
            int offsetEnd = 0;
            Date currentDate = myStartDate;
            SkewedFramesWidthFunction widthFunction = new SkewedFramesWidthFunction();
            widthFunction.initialize();
            do {
                final TimeUnit topUnit = getTopUnit(currentDate);
                final TimeUnit defaultUnit = myTimeUnitStack.getDefaultTimeUnit();
                final TimeFrame currentFrame = myTimeUnitStack.createTimeFrame(
                        currentDate, topUnit, defaultUnit);

                Date endDate = currentFrame.getFinishDate();
                offsetEnd += widthFunction.getTimeFrameWidth(currentFrame);
                topUnitOffsets.add(
                        new Offset(
                                topUnit,
                                myStartDate,
                                endDate,
                                offsetEnd,
                                null));
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

    public Offset[] calculateOffsets(TimeFrame timeFrame, TimeUnit frameBottomUnit, Date bottomUnitStartDate, TimeUnit offsetUnit, int frameBottomUnitWidth) {
        Offset[] result;
        //Date bottomUnitEndDate = timeFrame.getUnitFinish(frameBottomUnit, unitIndex);
        if (offsetUnit.equals(frameBottomUnit)) {
            result = new Offset[] {new Offset(offsetUnit, bottomUnitStartDate, bottomUnitStartDate, 0, null)};
        }
        else if (frameBottomUnit.isConstructedFrom(offsetUnit)) {
            //java.util.List buf = new ArrayList();
            int outerFrameUnitCount = timeFrame.getUnitCount(offsetUnit);
            TimeFrame innerFrame = myStack.createTimeFrame(bottomUnitStartDate,
                    frameBottomUnit, offsetUnit);
            int offsetUnitCount = innerFrame.getUnitCount(offsetUnit);
            result = new Offset[offsetUnitCount];
            for (int i=0; i<offsetUnitCount; i++) {
                Date offsetEnd = innerFrame.getUnitFinish(offsetUnit, i);
                int offsetPixels = (i+1)*frameBottomUnitWidth/outerFrameUnitCount;
                result[i] = new Offset(offsetUnit, bottomUnitStartDate, offsetEnd, offsetPixels, null);
            }
        } else {
            throw new RuntimeException("We should not be here");
        }
        return result;
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

        Date curDate = getChartModel().getStartDate();
        final int topUnitHeight = getLineTopPosition();
        boolean firstWeekendDay = true;
        List offsets = getOffsets();
        for (int i=0; i<offsets.size(); i++) {
            Offset nextOffset = (Offset) offsets.get(i);
            if (nextOffset.getDayType() == GPCalendar.DayType.WEEKEND ||
                nextOffset.getDayType() == GPCalendar.DayType.HOLIDAY) {
                GraphicPrimitiveContainer.Rectangle r =
                    getPrimitiveContainer().createRectangle(
                            curX,
                            getLineBottomPosition()+1,
                            nextOffset.getOffsetPixels() - curX,
                            getHeight());
                Color background = nextOffset.getDayType()==GPCalendar.DayType.WEEKEND ?
                    getConfig().getHolidayTimeBackgroundColor() :
                        getConfig().getPublicHolidayTimeBackgroundColor();
                r.setBackgroundColor(background);
                r.setStyle("calendar.holiday");
                getPrimitiveContainer().bind(r, nextOffset.getDayType());
//                if (firstWeekendDay) {
//                    getPrimitiveContainer().createLine(
//                            curX, getLineTopPosition(), curX, getLineTopPosition()+10);
//                    firstWeekendDay = false;
//                }
            }
//            else {
//                TimeUnitText timeUnitText = nextOffset.getOffsetUnit().format(curDate);
//                String unitText = timeUnitText.getText(-1);
//                int posY = getTextBaselinePosition();
//                GraphicPrimitiveContainer.Text text = getPrimitiveContainer().createText(
//                        curX + 2, posY, unitText);
//                getPrimitiveContainer().bind(text, timeUnitText);
//                text.setMaxLength(nextOffset.getOffsetPixels() - curX);
//                text.setFont(getChartModel().getChartUIConfiguration().getSpanningHeaderFont());
//                getPrimitiveContainer().createLine(
//                        curX, getLineTopPosition(), curX, getLineTopPosition()+10);
//                firstWeekendDay = true;
//            }

            if (curDate.equals(myToday) && myRedlineOption.isChecked()) {
                Line redLine = getPrimitiveContainer().createLine(
                        curX+2, getLineBottomPosition()+1, curX+2, getHeight());
                redLine.setForegroundColor(Color.RED);
            }
            if ((curDate.equals(getChartModel().getTaskManager().getProjectStart()) ||
                    curDate.equals(getChartModel().getTaskManager().getProjectEnd())) &&
                isProjectBoundariesOptionOn()) {
                Line blueLine = getPrimitiveContainer().createLine(
                        curX, getLineBottomPosition()+1, curX, getHeight());
                blueLine.setForegroundColor(Color.BLUE);
            }

            curX = nextOffset.getOffsetPixels();
            curDate = nextOffset.getOffsetEnd();
            //System.err.println("curDate="+curDate+" curX="+curX);
        }
    }
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

                Date startDate = currentFrame.getUnitStart(getBottomUnit(), i);
                Date endDate = currentFrame.getUnitFinish(getBottomUnit(), i);
                GPCalendar.DayType dayType = getCalendar().getDayTypeDate(startDate);
                if (dayType == GPCalendar.DayType.WEEKEND) {
                    offsetEnd += offsetStep / myWeekendDecreaseFactor;
                    bottomUnitOffsets.add(new Offset(
                            getBottomUnit(), myStartDate, endDate, initialEnd+(int)(offsetEnd*bottomUnitWidth), dayType));
                    continue;
                }
                addTopUnitOffset = true;
                offsetEnd += offsetStep;
                bottomUnitOffsets.add(new Offset(
                        getBottomUnit(), myStartDate, endDate, initialEnd+(int)(offsetEnd*bottomUnitWidth), dayType));
            }
            currentDate = currentFrame.getFinishDate();
            if (!addTopUnitOffset) {
                continue;
            }
            topUnitOffsets.add(new Offset(
                    getTopUnit(), myStartDate, currentDate, initialEnd+(int)(offsetEnd*bottomUnitWidth), DayType.WORKING));

        } while (offsetEnd*getBottomUnitWidth() <= getChartWidth());
    }
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

    private void renderTopUnits() {
        int curX = 0;
        Date curDate = getChartModel().getStartDate();
        final int topUnitHeight = getChartModel().getChartUIConfiguration().getSpanningHeaderHeight();
        for (int i=0; i<getChartModel().getTopUnitOffsets().size(); i++) {
          Offset nextOffset = (Offset) getChartModel().getTopUnitOffsets().get(i);
            TimeUnitText timeUnitText = nextOffset.getOffsetUnit().format(curDate);
            String unitText = timeUnitText.getText(-1);
            int posY = topUnitHeight - 5;
            GraphicPrimitiveContainer.Text text = myPrimitiveContainer.createText(curX + 2, posY, unitText);
            myPrimitiveContainer.bind(text, timeUnitText);
            text.setMaxLength(nextOffset.getOffsetPixels() - curX);
            text.setFont(getChartModel().getChartUIConfiguration().getSpanningHeaderFont());
            myPrimitiveContainer.createLine(curX, 0, curX, topUnitHeight);
            curX = nextOffset.getOffsetPixels();
            curDate = nextOffset.getOffsetEnd();
        }
    }
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

        int curX = 0;
        Date curDate = getChartModel().getStartDate();
        final int topUnitHeight = getChartModel().getChartUIConfiguration().getSpanningHeaderHeight();
        boolean firstWeekendDay = true;
        for (int i=0; i<getChartModel().getBottomUnitOffsets().size(); i++) {
          Offset nextOffset = (Offset) getChartModel().getBottomUnitOffsets().get(i);
            TimeUnitText timeUnitText = nextOffset.getOffsetUnit().format(curDate);
            String unitText = timeUnitText.getText(-1);
            int posY = 2*topUnitHeight - 5;
            GraphicPrimitiveContainer.Text text = myPrimitiveContainer.createText(curX + 2, posY, unitText);
            myPrimitiveContainer.bind(text, timeUnitText);
            text.setMaxLength(nextOffset.getOffsetPixels() - curX);
            text.setFont(getChartModel().getChartUIConfiguration().getSpanningHeaderFont());
            myPrimitiveContainer.createLine(curX, topUnitHeight, curX, 2*topUnitHeight);
            firstWeekendDay = true;
            curX = nextOffset.getOffsetPixels();
            curDate = nextOffset.getOffsetEnd();
        }
    }
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

        Date lastOffsetEnd = ((Offset)offsets.getLast()).getOffsetEnd();
        if (end.after(lastOffsetEnd)) {
          end = lastOffsetEnd;
        }
        ArrayList copy = new ArrayList(offsets);
        Offset offsetBefore = null;
        Offset offsetAfter = null;

        LinkedList buffer = new LinkedList();
        while (offsets.getFirst()!=null) {
            Offset offset = (Offset) offsets.getFirst();
            if (offset.getOffsetEnd().compareTo(start)<=0) {
                offsetBefore = offset;
                buffer.clear();
            }
            if (offset.getOffsetEnd().compareTo(end)>=0) {
                offsetAfter = offset;
                if (offset.getOffsetEnd().after(end)) {
                  offsets.addAll(0, buffer);
                }
                break;
            }
            buffer.addLast(offset);
View Full Code Here

Examples of net.sourceforge.ganttproject.chart.ChartModelBase.Offset

          offsetDate = lastOffsetEnd;
          length += offsets[offsets.length-1].getOffsetPixels();
          continue;
        }
      for (int i=offsets.length-1; i>=0; i--) {
        Offset offset = offsets[i];
        if (offset.getOffsetEnd().after(anchorDate)) {
          continue;
        }
        length+=offset.getOffsetPixels();
        break;
      }
      break;
      }
      return -length;
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.