Package com.dmissoh.biologic.models

Examples of com.dmissoh.biologic.models.Entry


  private void handleKeyEventForFamily(Event event, Family family) {

    long time = isLive() ? getTime() : getElapsedTime();

    Entry logEntry = new Entry(time);

    char startKey = String.valueOf(family.getStartKey()).toLowerCase()
        .charAt(0);
    char endKey = String.valueOf(family.getEndKey()).toLowerCase()
        .charAt(0);
    char keyPressed = String.valueOf(event.character).toLowerCase().charAt(
        0);

    if (keyPressed == startKey || keyPressed == endKey) {
      String name = family.getName();
      logEntry.setName(name);

      // fillFamily(family);
      Stack<Entry> logEntries = family.getLogEntries();

      if (keyPressed == startKey) {
        if (family.isPunctual()) {
          logEntry.setType(TYPE.PUNCTUAL);
        } else {
          logEntry.setType(TYPE.START);
        }
        if (!family.isPunctual()) {
          if (logEntries.empty()) {
            addLogEntry(logEntry);
          } else {
            if (logEntries.peek().getType() != TYPE.START) {
              addLogEntry(logEntry);
              clearErrorMessage();
            } else {
              showSameEntryTypeError(logEntry);
            }
          }
        } else {
          addLogEntry(logEntry);
        }

      } else if (keyPressed == endKey) {
        if (!family.isPunctual()) {
          logEntry.setType(TYPE.END);
          if (logEntries.empty()) {
            showFirstLogEntryError(logEntry);
          } else {
            if (logEntries.peek().getType() != TYPE.END) {
              addLogEntry(logEntry);
View Full Code Here


    List<Family> families = getFamilies();
    if (families != null) {
      for (Family family : families) {
        Stack<Entry> logEntries = family.getLogEntries();
        if (!logEntries.empty()) {
          Entry top = logEntries.peek();
          if (top.getType() == TYPE.START) {
            running.add(top);
          }
        }
      }
    }
View Full Code Here

    List<Family> families = getFamilies();
    if (families != null) {
      for (Family family : families) {
        Stack<Entry> logEntries = family.getLogEntries();
        if (!logEntries.empty()) {
          Entry top = logEntries.peek();
          if (top.getType() == TYPE.START) {
            RunningEvent runningEvent = new RunningEvent(top,
                family.getStartKey(), family.getEndKey());
            running.add(runningEvent);
          }
        }
View Full Code Here

        for (Entry entry : entries) {
          copy.push(entry);
        }

        while (!copy.empty()) {
          Entry startEntry = copy.pop();
          if (startEntry.getType() != TYPE.PUNCTUAL) {
            if (startEntry.getType() == TYPE.END) {
              long t1 = startEntry.getTimeStamp();
              if (!copy.empty()) {
                Entry endEntry = copy.pop();
                if (endEntry.getType() != TYPE.PUNCTUAL) {
                  if (endEntry.getType() == TYPE.START) {

                    long t2 = endEntry.getTimeStamp();
                    addEvent(events, endEntry.getName(),
                        t1, t2, startTime, color);
                  }
                } else {
                  addPunctualEvent(events, endEntry
                      .getName(),
                      endEntry.getTimeStamp(), startTime,
                      color);
                }
              }
            }
          } else {
View Full Code Here

    return imageRegistry.get(key);
  }

  public String getColumnText(Object element, int columnIndex) {
    String result = "";
    Entry entry = (Entry) element;
    switch (columnIndex) {
    case 0:
      break;
    case 1:
      if (isLive()) {
        result = TimeUtils.formatToTime(entry.getTimeStamp());
      } else {
        result = String.valueOf(entry.getTimeStamp() / 1000);
      }
      break;
    case 2:
      result = entry.getName();
      break;
    case 3:
      result = entry.getType() + "";
      break;
    default:
      break;
    }
    return result;
View Full Code Here

  /*
   * (non-Javadoc) Method declared on ViewerSorter.
   */
  public int compare(Viewer viewer, Object o1, Object o2) {

    Entry task1 = (Entry) o1;
    Entry task2 = (Entry) o2;

    switch (criteria) {
    case DESCRIPTION:
      return compareDescriptions(task1, task2);
    case OWNER:
View Full Code Here

      for (Entry entry : entries) {
        copy.push(entry);
      }

      while (!copy.empty()) {
        Entry entryOne = copy.pop();
        if (entryOne.getType() != Entry.TYPE.PUNCTUAL) {
          long t1 = entryOne.getTimeStamp();
          if (!copy.empty()) {
            Entry entryTwo = copy.pop();
            if (entryTwo.getType() != Entry.TYPE.PUNCTUAL) {
              long t2 = entryTwo.getTimeStamp();
              appendEvent(sb, family.getName(), t1, t2);
            } else {
              appendPunctualEvent(sb, family.getName(), entryTwo
                  .getTimeStamp());
            }
          }
        } else {
          appendPunctualEvent(sb, family.getName(), entryOne
View Full Code Here

TOP

Related Classes of com.dmissoh.biologic.models.Entry

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.