Example usage for java.lang Long MIN_VALUE

List of usage examples for java.lang Long MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Long MIN_VALUE.

Prototype

long MIN_VALUE

To view the source code for java.lang Long MIN_VALUE.

Click Source Link

Document

A constant holding the minimum value a long can have, -263.

Usage

From source file:org.alfresco.repo.domain.node.NodePropertyHelper.java

public Map<QName, Serializable> convertToPublicProperties(
        Map<NodePropertyKey, NodePropertyValue> propertyValues) {
    Map<QName, Serializable> propertyMap = new HashMap<QName, Serializable>(propertyValues.size(), 1.0F);
    // Shortcut//from ww  w .j  ava  2  s  . c om
    if (propertyValues.size() == 0) {
        return propertyMap;
    }
    // We need to process the properties in order
    SortedMap<NodePropertyKey, NodePropertyValue> sortedPropertyValues = new TreeMap<NodePropertyKey, NodePropertyValue>(
            propertyValues);
    // A working map. Ordering is important.
    SortedMap<NodePropertyKey, NodePropertyValue> scratch = new TreeMap<NodePropertyKey, NodePropertyValue>();
    // Iterate (sorted) over the map entries and extract values with the same qname
    Long currentQNameId = Long.MIN_VALUE;
    Iterator<Map.Entry<NodePropertyKey, NodePropertyValue>> iterator = sortedPropertyValues.entrySet()
            .iterator();
    while (true) {
        Long nextQNameId = null;
        NodePropertyKey nextPropertyKey = null;
        NodePropertyValue nextPropertyValue = null;
        // Record the next entry's values
        if (iterator.hasNext()) {
            Map.Entry<NodePropertyKey, NodePropertyValue> entry = iterator.next();
            nextPropertyKey = entry.getKey();
            nextPropertyValue = entry.getValue();
            nextQNameId = nextPropertyKey.getQnameId();
        }
        // If the QName is going to change, and we have some entries to process, then process them.
        if (scratch.size() > 0 && (nextQNameId == null || !nextQNameId.equals(currentQNameId))) {
            QName currentQName = qnameDAO.getQName(currentQNameId).getSecond();
            PropertyDefinition currentPropertyDef = dictionaryService.getProperty(currentQName);
            // We have added something to the scratch properties but the qname has just changed
            Serializable collapsedValue = null;
            // We can shortcut if there is only one value
            if (scratch.size() == 1) {
                // There is no need to collapse list indexes
                collapsedValue = collapsePropertiesWithSameQNameAndListIndex(currentPropertyDef, scratch);
            } else {
                // There is more than one value so the list indexes need to be collapsed
                collapsedValue = collapsePropertiesWithSameQName(currentPropertyDef, scratch);
            }
            boolean forceCollection = false;
            // If the property is multi-valued then the output property must be a collection
            if (currentPropertyDef != null && currentPropertyDef.isMultiValued()) {
                forceCollection = true;
            } else if (scratch.size() == 1 && scratch.firstKey().getListIndex().intValue() > -1) {
                // This is to handle cases of collections where the property is d:any but not
                // declared as multiple.
                forceCollection = true;
            }
            if (forceCollection && collapsedValue != null && !(collapsedValue instanceof Collection<?>)) {
                // Can't use Collections.singletonList: ETHREEOH-1172
                ArrayList<Serializable> collection = new ArrayList<Serializable>(1);
                collection.add(collapsedValue);
                collapsedValue = collection;
            }

            // Store the value
            propertyMap.put(currentQName, collapsedValue);
            // Reset
            scratch.clear();
        }
        if (nextQNameId != null) {
            // Add to the current entries
            scratch.put(nextPropertyKey, nextPropertyValue);
            currentQNameId = nextQNameId;
        } else {
            // There is no next value to process
            break;
        }
    }
    // Done
    return propertyMap;
}

From source file:com.juick.android.ThreadFragment.java

/**
 * calculate delta times/*from  ww w  .  j a  v  a2  s  .com*/
 * @param messages
 */
private void preprocessMessages(ArrayList<JuickMessage> messages) {
    if (messages == null || messages.size() == 0)
        return;
    Date prevTime = messages.get(0).Timestamp;
    for (int i = 1; i < messages.size(); i++) {
        JuickMessage message = messages.get(i);
        message.deltaTime = message.Timestamp.getTime() - prevTime.getTime();
        if (message.Timestamp.getDate() != prevTime.getDate()) {
            message.deltaTime = Long.MIN_VALUE;
        }
        prevTime = message.Timestamp;
    }
}

From source file:com.social.solution.fragment.MyFragment.java

public List<Tweet> getFilteredRecent() {
    List<Tweet> temp = new ArrayList<Tweet>();
    List<Tweet> filterTemp = new ArrayList<Tweet>();

    firstDisplayTweetId = Long.MIN_VALUE;

    for (Tweet t : tweetlist) {
        if (firstDisplayTweetId < t.id)
            firstDisplayTweetId = t.id;/*from   w  w w .  ja v a2s .  c o m*/
    }
    temp = TweetBank.getNewThan(firstDisplayTweetId);

    for (Tweet t : temp) {
        //if ((!filterTweets || HelperFunctions.genericFilterFunction(t, position)))
        if ((HelperFunctions.genericFilterFunction(t, position)))
            filterTemp.add(t);
    }
    return filterTemp;
}

From source file:de.dreier.mytargets.features.statistics.StatisticsFragment.java

private ILineDataSet generateLinearRegressionLine(List<Pair<Float, DateTime>> values, Evaluator eval) {
    int dataSetSize = values.size();
    double[] x = new double[dataSetSize];
    double[] y = new double[dataSetSize];
    // first pass: read in data, compute x bar and y bar
    int n = 0;//from  ww  w  . j  ava2  s  .co  m
    double sumX = 0.0f;
    double sumY = 0.0f;
    long minX = Long.MAX_VALUE;
    long maxX = Long.MIN_VALUE;
    for (int i = 0; i < dataSetSize; i++) {
        x[n] = eval.getXValue(values, i);
        y[n] = values.get(i).first;
        sumX += x[n];
        sumY += y[n];
        if (x[n] < minX) {
            minX = eval.getXValue(values, i);
        }
        if (x[n] > maxX) {
            maxX = eval.getXValue(values, i);
        }
        n++;
    }
    if (n < 1) {
        return null;
    }
    double xBar = sumX / n;
    double yBar = sumY / n;

    // second pass: compute summary statistics
    double xxBar = 0.0f;
    double xyBar = 0.0f;
    for (int i = 0; i < n; i++) {
        xxBar += (x[i] - xBar) * (x[i] - xBar);
        xyBar += (x[i] - xBar) * (y[i] - yBar);
    }
    double beta1 = xyBar / xxBar;
    double beta0 = yBar - beta1 * xBar;
    float y0 = (float) (beta1 * eval.getXValue(values, 0) + beta0);
    float y1 = (float) (beta1 * eval.getXValue(values, dataSetSize - 1) + beta0);
    Entry first = new Entry(minX, y0);
    Entry last = new Entry(maxX, y1);
    List<Entry> yValues = Arrays.asList(first, last);
    LineDataSet lineDataSet = new LineDataSet(yValues, "");
    lineDataSet.setColors(0xffff9100);
    lineDataSet.setDrawCircles(false);
    lineDataSet.setDrawValues(false);
    lineDataSet.setLineWidth(1);
    lineDataSet.setHighlightEnabled(false);
    return lineDataSet;
}

From source file:uk.ac.leeds.ccg.andyt.projects.moses.process.Comparison.java

public void compareCASUV003WithCAS001() throws Exception {
    File infile;//from   ww  w  . j av a 2 s  .  c o m
    infile = new File("C:/Work/Projects/MoSeS/Workspace/UV003.dat");
    CASUV003DataHandler cASUV003DataHandler = new CASUV003DataHandler(infile);
    infile = new File("C:/Work/Projects/MoSeS/Workspace/CAS001.dat");
    CAS001DataHandler tCAS001DataHandler = new CAS001DataHandler(infile);

    CASUV003DataRecord aCASUV003DataRecord;
    CAS001DataRecord aCAS001DataRecord;
    long difference;
    long maxDifference = Long.MIN_VALUE;
    long sumOfSquaredDifference = 0L;
    long totalDifference = 0L;
    long absoluteDifference = 0L;
    long totalAbsoluteDifference = 0L;
    long RecordID;
    long nRecords = cASUV003DataHandler.getNDataRecords();
    for (RecordID = 0; RecordID < nRecords; RecordID++) {
        aCASUV003DataRecord = cASUV003DataHandler.getCASUV003DataRecord(RecordID);
        aCAS001DataRecord = tCAS001DataHandler.getCAS001DataRecord(RecordID);
        difference = (long) (aCASUV003DataRecord.getAllPeople() - aCAS001DataRecord.getAllPeople());
        if (difference < 0) {
            absoluteDifference = difference * -1L;
        }
        sumOfSquaredDifference += (difference * difference);
        maxDifference = Math.max(maxDifference, difference);
        totalDifference += difference;
        totalAbsoluteDifference += absoluteDifference;
    }
    int scale = 100;
    int roundingMode = BigDecimal.ROUND_HALF_EVEN;
    BigDecimal nRecordsBigDecimal = new BigDecimal(nRecords);
    BigDecimal meanDifferenceBigDecimal = new BigDecimal(maxDifference).divide(nRecordsBigDecimal, scale,
            roundingMode);
    System.out.println("nRecords " + nRecords);
    System.out.println("meanDifferenceBigDecimal " + meanDifferenceBigDecimal.toString());
    System.out.println("sumOfSquaredDifference " + sumOfSquaredDifference);
    System.out.println("maxDifference " + maxDifference);
    System.out.println("totalAbsoluteDifference " + totalAbsoluteDifference);
    System.out.println("totalDifference " + totalDifference);
    BigDecimal standardDeviationOfDifferenceBigDecimal = new BigDecimal("0");
    BigDecimal differenceBigDecimal;
    for (RecordID = 0; RecordID < nRecords; RecordID++) {
        aCASUV003DataRecord = cASUV003DataHandler.getCASUV003DataRecord(RecordID);
        aCAS001DataRecord = tCAS001DataHandler.getCAS001DataRecord(RecordID);
        differenceBigDecimal = new BigDecimal(
                aCASUV003DataRecord.getAllPeople() - aCAS001DataRecord.getAllPeople());
        standardDeviationOfDifferenceBigDecimal = differenceBigDecimal.multiply(differenceBigDecimal);
    }
    standardDeviationOfDifferenceBigDecimal = standardDeviationOfDifferenceBigDecimal
            .divide(nRecordsBigDecimal.subtract(BigDecimal.ONE), scale, roundingMode);
    standardDeviationOfDifferenceBigDecimal = Generic_BigDecimal.sqrt(standardDeviationOfDifferenceBigDecimal,
            scale, RoundingMode.HALF_EVEN);
    System.out.println("standardDeviationOfDifferenceBigDecimal " + standardDeviationOfDifferenceBigDecimal);
}

From source file:org.jenkinsci.plugins.docker.traceability.core.DockerTraceabilityRootAction.java

/**
 * Queries container statuses via API./*from   w w  w . j  a  v  a  2s  . c  o  m*/
 * The output will be retrieved in JSON. Supports filters.
 * @param id ID of the container, for which the info should be retrieved.
 *    Short container IDs are not supported.
 * @param mode {@link QueryMode}. Default value - {@link QueryMode#inspectContainer}
 * @param since Optional starting time. 
 *      If the value equals to 0, the filter will be ignored (default in {@link QueryParameter}).
 * @param until End time. 
 *      If the value equals to 0, the filter will be ignored (default in {@link QueryParameter}).
 * @throws IOException Processing error
 * @throws ServletException Servlet error
 * @return Response containing the output JSON. may be an error if something breaks.
 */
public HttpResponse doQueryContainer(@QueryParameter(required = true) String id,
        @QueryParameter(required = false) String mode, @QueryParameter(required = false) long since,
        @QueryParameter(required = false) long until) throws IOException, ServletException {
    checkPermission(DockerTraceabilityPlugin.READ_DETAILS);

    final QueryMode queryMode = QueryMode.fromString(mode);
    final long maxTime = (until != 0) ? until : Long.MAX_VALUE;
    final long minTime = (since != 0) ? since : Long.MIN_VALUE;

    DockerDeploymentFacet facet = DockerDeploymentFacet.getDeploymentFacet(id);
    if (facet == null) {
        return HttpResponses.error(404, "No info available for the containerId=" + id);
    }

    final SortedSet<DockerContainerRecord> deploymentRecords = facet.getDeploymentRecords();
    List<Object> result = new ArrayList<Object>(deploymentRecords.size());
    for (DockerContainerRecord record : deploymentRecords) {
        // time filters
        final long eventTime = record.getReport().getEvent().getTime();
        if (eventTime < minTime || eventTime > maxTime) {
            continue;
        }

        // Report data
        final DockerTraceabilityReport report = record.getReport();
        switch (queryMode) {
        case all:
            result.add(report);
            break;
        case events:
            result.add(report.getEvent());
            break;
        case inspectContainer:
            InspectContainerResponse containerResponse = report.getContainer();
            if (containerResponse != null) {
                result.add(containerResponse);
            }
            break;
        case inspectImage:
            InspectImageResponse imageResponse = report.getImage();
            if (imageResponse != null) {
                result.add(imageResponse);
            }
            break;
        case hostInfo:
            result.add(report.getHostInfo());
            break;
        default:
            throw new IllegalStateException("Unsupported query mode: " + queryMode);
        }
    }

    // Return raw JSON in the response
    return toJSONResponse(result);
}

From source file:net.ymate.platform.commons.lang.TreeObject.java

/**
 * 
 *
 * @param l
 */
public TreeObject(Long l) {
    _object = l != null ? l.longValue() : Long.MIN_VALUE;
    _type = TYPE_LONG;
}

From source file:net.ymate.platform.commons.lang.TreeObject.java

/**
 * /*from  w  w w  . j  a  va  2s.  com*/
 *
 * @param t
 * @param isTime
 */
public TreeObject(Long t, boolean isTime) {
    _object = t != null ? t.longValue() : Long.MIN_VALUE;
    _type = isTime ? TYPE_TIME : TYPE_LONG;
}

From source file:org.syncope.core.rest.UserTestITCase.java

@Test
public void create() {
    // get task list
    List<PropagationTaskTO> tasks = Arrays
            .asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));

    assertNotNull(tasks);// w ww  . ja v  a2s  .c  o  m
    assertFalse(tasks.isEmpty());

    // get max task id
    long maxId = Long.MIN_VALUE;
    for (PropagationTaskTO task : tasks) {
        if (task.getId() > maxId) {
            maxId = task.getId();
        }
    }
    PropagationTaskTO taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}",
            PropagationTaskTO.class, maxId);
    assertNotNull(taskTO);
    int maxTaskExecutions = taskTO.getExecutions().size();

    UserTO userTO = getSampleTO("a.b@c.com");

    // add a membership
    MembershipTO membershipTO = new MembershipTO();
    membershipTO.setRoleId(8L);
    userTO.addMembership(membershipTO);

    // add an attribute with no values: must be ignored
    AttributeTO nullValueAttrTO = new AttributeTO();
    nullValueAttrTO.setSchema("subscriptionDate");
    nullValueAttrTO.setValues(null);
    membershipTO.addAttribute(nullValueAttrTO);

    // add an attribute with a non-existing schema: must be ignored
    AttributeTO attrWithInvalidSchemaTO = new AttributeTO();
    attrWithInvalidSchemaTO.setSchema("invalid schema");
    attrWithInvalidSchemaTO.addValue("a value");
    userTO.addAttribute(attrWithInvalidSchemaTO);

    // add an attribute with null value: must be ignored
    nullValueAttrTO = new AttributeTO();
    nullValueAttrTO.setSchema("activationDate");
    nullValueAttrTO.addValue(null);
    userTO.addAttribute(nullValueAttrTO);

    // 1. create user
    UserTO newUserTO = restTemplate.postForObject(BASE_URL + "user/create", userTO, UserTO.class);

    assertNotNull(newUserTO);
    assertFalse(newUserTO.getAttributes().contains(attrWithInvalidSchemaTO));

    // check for changePwdDate
    assertNotNull(newUserTO.getCreationDate());

    // 2. check for virtual attribute value
    newUserTO = restTemplate.getForObject(BASE_URL + "user/read/{userId}.json", UserTO.class,
            newUserTO.getId());
    assertNotNull(newUserTO);

    assertNotNull(newUserTO.getVirtualAttributeMap());
    assertNotNull(newUserTO.getVirtualAttributeMap().get("virtualdata").getValues());
    assertFalse(newUserTO.getVirtualAttributeMap().get("virtualdata").getValues().isEmpty());
    assertEquals("virtualvalue", newUserTO.getVirtualAttributeMap().get("virtualdata").getValues().get(0));

    // get the new task list
    tasks = Arrays
            .asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));

    assertNotNull(tasks);
    assertFalse(tasks.isEmpty());

    // get max task id
    long newMaxId = Long.MIN_VALUE;
    for (PropagationTaskTO task : tasks) {
        if (task.getId() > newMaxId) {
            newMaxId = task.getId();
        }
    }

    // default configuration for ws-target-resource2:
    //             only failed executions have to be registered
    // --> no more tasks/executions should be added
    assertEquals(newMaxId, maxId);

    // get last task
    taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", PropagationTaskTO.class, newMaxId);

    assertNotNull(taskTO);
    assertEquals(maxTaskExecutions, taskTO.getExecutions().size());

    // 3. verify password
    Boolean verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{userId}?password=password123",
            Boolean.class, newUserTO.getId());
    assertTrue(verify);
    verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{userId}?password=passwordXX",
            Boolean.class, newUserTO.getId());
    assertFalse(verify);

    // 4. try (and fail) to create another user with same (unique) values
    userTO = getSampleTO("pippo@c.com");
    for (AttributeTO attr : userTO.getAttributes()) {
        if ("userId".equals(attr.getSchema())) {
            attr.getValues().clear();
            attr.addValue("a.b@c.com");
        }
    }

    SyncopeClientException sce = null;
    try {
        restTemplate.postForObject(BASE_URL + "user/create", userTO, UserTO.class);
    } catch (SyncopeClientCompositeErrorException e) {
        sce = e.getException(SyncopeClientExceptionType.DataIntegrityViolation);
    }
    assertNotNull(sce);
}

From source file:annis.visualizers.iframe.CorefVisualizer.java

private List<Node> outputSingleText(EList<SToken> token, VisualizerInput input) throws IOException {
    List<Node> result = new LinkedList<Node>();

    List<Long> prevpositions, listpositions;
    List<Long> finalpositions = null;
    int maxlinkcount = 0;
    String lastId, currentId = null;

    for (SToken tok : token) {

        prevpositions = finalpositions;//from   w w w .  j  a  v  a  2 s  .  c  o  m
        if (prevpositions != null && prevpositions.size() < 1) {
            prevpositions = null;
        }
        lastId = currentId;
        currentId = tok.getId();
        listpositions = componentOfToken.get(currentId);
        List<Boolean> checklist = null;

        if (prevpositions == null && listpositions != null) {
            finalpositions = listpositions;
        } else if (listpositions == null) {
            finalpositions = new LinkedList<Long>();
        } else {
            checklist = new LinkedList<Boolean>();
            for (int i = 0; prevpositions != null && i < prevpositions.size(); i++) {
                if (listpositions.contains(prevpositions.get(i))) {
                    checklist.add(true);
                } else {
                    checklist.add(false);
                }
            }
            List<Long> remains = new LinkedList<Long>();
            for (int i = 0; i < listpositions.size(); i++) {
                if (prevpositions != null && !prevpositions.contains(listpositions.get(i))) {
                    remains.add(listpositions.get(i));
                }
            }

            int minsize = checklist.size() + remains.size();
            int number = 0;
            finalpositions = new LinkedList<Long>();
            for (int i = 0; i < minsize; i++) {
                if (prevpositions != null && checklist.size() > i && checklist.get(i).booleanValue()) {
                    finalpositions.add(prevpositions.get(i));
                } else {
                    if (remains.size() > number) {
                        Long ll = remains.get(number);
                        finalpositions.add(ll);
                        number++;
                        minsize--;
                    } else {
                        finalpositions.add(Long.MIN_VALUE);
                    }
                }
            }
        }

        String onclick = "";
        String style = "";
        if (input.getMarkedAndCovered().containsKey(tok)) {
            MatchedNodeColors[] vals = MatchedNodeColors.values();
            long match = Math.min(input.getMarkedAndCovered().get(tok) - 1, vals.length - 1);

            style += ("color: " + vals[(int) match].getHTMLColor() + ";");
        }

        boolean underline = false;
        if (!finalpositions.isEmpty()) {
            style += "cursor:pointer;";
            underline = true;
            onclick = "togglePRAuto(this);";
        }

        Table tableSingleTok = new Table();
        result.add(tableSingleTok);
        tableSingleTok.setCSSClass("token");

        int currentlinkcount = 0;
        if (underline) {
            boolean firstone = true;
            int index = -1;
            String tooltip;
            if (!finalpositions.isEmpty()) {
                for (Long currentPositionComponent : finalpositions) {
                    index++;
                    String left = "", right = "";

                    TComponent currentWriteComponent = null;// == pir
                    String currentType = "";
                    if (!currentPositionComponent.equals(Long.MIN_VALUE)
                            && komponent.size() > currentPositionComponent) {
                        currentWriteComponent = komponent.get((int) (long) currentPositionComponent);
                        List<String> pi = currentWriteComponent.tokenList;
                        List<String> preparedPi = new LinkedList<String>();
                        for (String s : pi) {
                            preparedPi.add(prepareID(s));
                        }
                        currentType = currentWriteComponent.type;
                        left = StringUtils.join(preparedPi, ",");
                        right = "" + currentPositionComponent + 1;
                    }
                    String annotations = getAnnotations(tok.getId(), currentPositionComponent);
                    if (firstone) {
                        firstone = false;
                        if (currentWriteComponent == null) {
                            String left2 = "", right2 = "";
                            long pr = 0;
                            TComponent currentWriteComponent2;// == pir
                            String currentType2 = "";
                            String annotations2 = "";
                            for (Long currentPositionComponent2 : finalpositions) {
                                if (!currentPositionComponent2.equals(Long.MIN_VALUE)
                                        && komponent.size() > currentPositionComponent2) {
                                    currentWriteComponent2 = komponent
                                            .get((int) (long) currentPositionComponent2);
                                    List<String> pi2 = currentWriteComponent2.tokenList;

                                    // prepare each single ID
                                    List<String> preparedPi2 = new LinkedList<String>();
                                    for (String s : pi2) {
                                        preparedPi2.add(prepareID(s));
                                    }
                                    currentType2 = currentWriteComponent2.type;
                                    left2 = StringUtils.join(preparedPi2, ",");
                                    right2 = "" + currentPositionComponent2 + 1;
                                    annotations2 = getAnnotations(tok.getId(), currentPositionComponent2);
                                    pr = currentPositionComponent2;
                                    break;
                                }
                            }
                            tooltip = "&lt;b&gt;Component&lt;/b&gt;: " + (pr + 1)
                                    + ", &lt;b&gt;Type&lt;/b&gt;: " + currentType2 + annotations2;

                            Tr trTok = new Tr();
                            tableSingleTok.appendChild(trTok);

                            Td tdTok = new Td();
                            trTok.appendChild(tdTok);

                            tdTok.setId("tok_" + prepareID(tok.getSId()));
                            tdTok.setTitle(tooltip);
                            tdTok.setStyle(style);
                            tdTok.setAttribute("onclick", onclick);
                            tdTok.setAttribute("annis:pr_left", left2);
                            tdTok.setAttribute("annis:pr_right", right2);

                            Text textTok = new Text("&nbsp;" + CommonHelper.getSpannedText(tok) + "&nbsp;");
                            tdTok.appendChild(textTok);
                        } else {//easier
                            tooltip = "&lt;b&gt;Component&lt;/b&gt;: " + (currentPositionComponent + 1)
                                    + ", &lt;b&gt;Type&lt;/b&gt; " + currentType + annotations;

                            Tr trTok = new Tr();
                            tableSingleTok.appendChild(trTok);

                            Td tdTok = new Td();
                            trTok.appendChild(tdTok);
                            tdTok.setId("tok_" + prepareID(tok.getSId()));
                            tdTok.setTitle(tooltip);
                            tdTok.setStyle(style);
                            tdTok.setAttribute("onclick", onclick);
                            tdTok.setAttribute("annis:pr_left", left);
                            tdTok.setAttribute("annis:pr_right", right);

                            Text textTok = new Text("&nbsp;" + CommonHelper.getSpannedText(tok) + "&nbsp;");
                            tdTok.appendChild(textTok);

                        }
                    }
                    currentlinkcount++;
                    //while we've got underlines
                    if (currentPositionComponent.equals(Long.MIN_VALUE)) {
                        Tr trBlank = new Tr();
                        tableSingleTok.appendChild(trBlank);

                        Td tdBlank = new Td();
                        trBlank.appendChild(tdBlank);

                        tdBlank.setCSSClass("blank");
                    } else {
                        int color;
                        if (colorlist.containsKey((int) (long) currentPositionComponent)) {
                            color = colorlist.get((int) (long) currentPositionComponent);
                        } else {
                            color = getNewColor((int) (long) currentPositionComponent);
                            colorlist.put((int) (long) currentPositionComponent, color);
                        }
                        if (color > 16777215) {
                            color = 16777215;
                        }

                        String addition = ";border-style: solid; border-width: 0px 0px 0px 2px; border-color: white ";
                        if (lastId != null && currentId != null && checklist != null && checklist.size() > index
                                && checklist.get(index).booleanValue() == true) {
                            if (connectionOf(lastId, currentId, currentPositionComponent)) {
                                addition = "";
                            }
                        }

                        tooltip = "&lt;b&gt;Component&lt;/b&gt;: " + (currentPositionComponent + 1)
                                + ", &lt;b&gt;Type&lt;/b&gt;: " + currentType + annotations;

                        Tr trLineContainer = new Tr();
                        tableSingleTok.appendChild(trLineContainer);

                        Td tdLineContainer = new Td();
                        trLineContainer.appendChild(tdLineContainer);

                        Table tableLineContainer = new Table();
                        tdLineContainer.appendChild(tableLineContainer);

                        tableLineContainer.setCSSClass("linecontainer");

                        Tr trLine = new Tr();
                        tableLineContainer.appendChild(trLine);

                        Td tdLine = new Td();
                        trLine.appendChild(tdLine);

                        tdLine.setCSSClass("line");
                        tdLine.setStyle(
                                "background-color: #" + Integer.toHexString(color) + "; " + style + addition);
                        tdLine.setAttribute("onclick", onclick);
                        tdLine.setAttribute("annis:pr_left", left);
                        tdLine.setAttribute("annis:pr_right", right);
                        tdLine.setTitle(tooltip);

                        Tr trSpace = new Tr();
                        tableLineContainer.appendChild(trSpace);

                        Td tdSpace = new Td();
                        trSpace.appendChild(tdSpace);

                        tdSpace.setCSSClass("space");
                    }
                }
            }
            if (currentlinkcount > maxlinkcount) {
                maxlinkcount = currentlinkcount;
            } else {
                if (currentlinkcount < maxlinkcount) {
                    Tr trSpace = new Tr();
                    tableSingleTok.appendChild(trSpace);

                    Td tdSpace = new Td();
                    trSpace.appendChild(tdSpace);

                    tdSpace.setStyle("height: " + (maxlinkcount - currentlinkcount) * 5 + "px;");
                }
            }
        } else {

            // print a token without lines
            Tr trTok = new Tr();
            tableSingleTok.appendChild(trTok);

            Td tdTok = new Td();
            trTok.appendChild(tdTok);

            tdTok.setId("tok_" + prepareID(tok.getSId()));
            tdTok.setStyle(style);

            Text textTok = new Text("&nbsp;" + CommonHelper.getSpannedText(tok) + "&nbsp;");
            tdTok.appendChild(textTok);

            if (maxlinkcount > 0) {
                Tr trSpace = new Tr();
                tableSingleTok.appendChild(trSpace);

                Td tdSpace = new Td();
                trSpace.appendChild(tdSpace);

                tdSpace.setStyle("height: " + maxlinkcount * 5 + "px;");
            }
        }
    } // end for each token

    return result;
}