Example usage for com.google.common.base StandardSystemProperty FILE_SEPARATOR

List of usage examples for com.google.common.base StandardSystemProperty FILE_SEPARATOR

Introduction

In this page you can find the example usage for com.google.common.base StandardSystemProperty FILE_SEPARATOR.

Prototype

StandardSystemProperty FILE_SEPARATOR

To view the source code for com.google.common.base StandardSystemProperty FILE_SEPARATOR.

Click Source Link

Document

File separator ("/" on UNIX).

Usage

From source file:ec.nbdemetra.ui.properties.AutoCompletedComponentDemo.java

private static Component create() {
    AutoCompletedComponent result = new AutoCompletedComponent();
    result.setValue(StandardSystemProperty.FILE_SEPARATOR.name());
    result.setAutoCompletion(AutoCompletedComponentDemo::applyAutoCompletion);
    result.setDefaultValueSupplier(AutoCompletedComponentDemo::loadDefaultValue);
    return result;
}

From source file:org.apache.jackrabbit.oak.scalability.suites.ScalabilityNodeRelationshipSuite.java

protected void createIndexes(Session session) throws RepositoryException {
    Map<String, Map<String, String>> orderedMap = Maps.newHashMap();
    String persistencePath = "";

    // define indexes on properties
    switch (INDEX_TYPE) {
    case PROPERTY:
        OakIndexUtils.propertyIndexDefinition(session, "customIndexActivity", new String[] { SOURCE_ID }, false,
                (!CUSTOM_TYPE ? new String[0] : new String[] { CUSTOM_ACT_NODE_TYPE }));
        OakIndexUtils.propertyIndexDefinition(session, "customIndexRelationship", new String[] { SOURCE_ID },
                false, (!CUSTOM_TYPE ? new String[0] : new String[] { CUSTOM_REL_NODE_TYPE }));
        break;/* www.  j a v  a2  s  .  c om*/
    // define ordered indexes on properties
    case ORDERED:
        OakIndexUtils.orderedIndexDefinition(session, "customIndexActivity", ASYNC_INDEX,
                new String[] { CREATED }, false,
                (!CUSTOM_TYPE ? new String[0] : new String[] { CUSTOM_ACT_NODE_TYPE }),
                OrderedIndex.OrderDirection.DESC.getDirection());
        OakIndexUtils.orderedIndexDefinition(session, "customIndexRelationship", ASYNC_INDEX,
                new String[] { CREATED }, false,
                (!CUSTOM_TYPE ? new String[0] : new String[] { CUSTOM_REL_NODE_TYPE }),
                OrderedIndex.OrderDirection.DESC.getDirection());
        break;
    // define lucene index on properties
    case LUCENE_FILE:
        persistencePath = "target" + StandardSystemProperty.FILE_SEPARATOR.value() + "lucene"
                + String.valueOf(System.currentTimeMillis());
        OakIndexUtils.luceneIndexDefinition(session, "customIndexActivity", ASYNC_INDEX,
                new String[] { SOURCE_ID, CREATED },
                new String[] { PropertyType.TYPENAME_STRING, PropertyType.TYPENAME_DATE }, orderedMap,
                persistencePath);
        break;
    case LUCENE_FILE_DOC:
        persistencePath = "target" + StandardSystemProperty.FILE_SEPARATOR.value() + "lucene"
                + String.valueOf(System.currentTimeMillis());
    case LUCENE_DOC:
        Map<String, String> propMap = Maps.newHashMap();
        propMap.put(LuceneIndexConstants.PROP_TYPE, PropertyType.TYPENAME_DATE);
        orderedMap.put(CREATED, propMap);
    case LUCENE:
        OakIndexUtils.luceneIndexDefinition(session, "customIndexActivity", ASYNC_INDEX,
                new String[] { SOURCE_ID, CREATED },
                new String[] { PropertyType.TYPENAME_STRING, PropertyType.TYPENAME_DATE }, orderedMap,
                persistencePath);
        break;
    }
}

From source file:org.apache.jackrabbit.oak.scalability.suites.ScalabilityNodeSuite.java

protected void createIndexes(Session session) throws RepositoryException {
    Map<String, Map<String, String>> orderedMap = Maps.newHashMap();
    String persistencePath = "";

    switch (INDEX_TYPE) {
    case ORDERED:
        // define ordered indexes on properties
        OakIndexUtils.orderedIndexDefinition(session, "customIndexParent", ASYNC_INDEX,
                new String[] { DATE_PROP }, false,
                (nodeTypes.isEmpty() ? new String[0] : new String[] { nodeTypes.get(0) }),
                OrderedIndex.OrderDirection.DESC.getDirection());
        OakIndexUtils.orderedIndexDefinition(session, "customIndexDescendant", ASYNC_INDEX,
                new String[] { DATE_PROP }, false,
                (nodeTypes.isEmpty() ? new String[0] : new String[] { nodeTypes.get(1) }),
                OrderedIndex.OrderDirection.DESC.getDirection());
        break;//from w ww  . jav  a  2 s. co  m
    // define lucene index on properties
    case LUCENE_FILE:
        persistencePath = "target" + StandardSystemProperty.FILE_SEPARATOR.value() + "lucene"
                + String.valueOf(System.currentTimeMillis());
        OakIndexUtils.luceneIndexDefinition(session, "customIndex", ASYNC_INDEX,
                new String[] { FILTER_PROP, DATE_PROP },
                new String[] { PropertyType.TYPENAME_STRING, PropertyType.TYPENAME_DATE }, null,
                persistencePath);
        break;
    case LUCENE_FILE_DOC:
        persistencePath = "target" + StandardSystemProperty.FILE_SEPARATOR.value() + "lucene"
                + String.valueOf(System.currentTimeMillis());
    case LUCENE_DOC:
        Map<String, String> propMap = Maps.newHashMap();
        propMap.put(LuceneIndexConstants.PROP_TYPE, PropertyType.TYPENAME_DATE);
        orderedMap.put(DATE_PROP, propMap);
    case LUCENE:
        OakIndexUtils.luceneIndexDefinition(session, "customIndex", ASYNC_INDEX,
                new String[] { FILTER_PROP, DATE_PROP },
                new String[] { PropertyType.TYPENAME_STRING, PropertyType.TYPENAME_DATE }, orderedMap,
                persistencePath);
        break;
    case PROPERTY:
        break;
    }
}

From source file:com.google.devtools.build.lib.profiler.output.SkylarkHtml.java

/**
 * Computes a string keeping the structure of the input but reducing the amount of characters on
 * elements at the front if necessary./*from   w  w w .  j  av a2 s. c om*/
 *
 * <p>Reduces the length of function location strings by keeping at least the last element fully
 * intact and at most {@link #NUM_LOCATION_CHARS_UNABBREVIATED} from other
 * elements from the end. Elements before are abbreviated with their first two characters.
 *
 * <p>Example:
 * "//source/tree/with/very/descriptive/and/long/hierarchy/of/directories/longfilename.bzl:42"
 * becomes: "//so/tr/wi/ve/de/an/lo/hierarch/of/directories/longfilename.bzl:42"
 *
 * <p>There is no fixed length to the result as the last element is kept and the location may
 * have many elements.
 *
 * @param location Either a sequence of path elements separated by
 *     {@link StandardSystemProperty#FILE_SEPARATOR} and preceded by some root element
 *     (e.g. "/", "C:\") or path elements separated by "." and having no root element.
 */
private String abbreviatePath(String location) {
    String[] elements;
    int lowestAbbreviateIndex;
    String root;
    String separator = StandardSystemProperty.FILE_SEPARATOR.value();
    if (location.contains(separator)) {
        elements = location.split(separator);
        // must take care to preserve file system roots (e.g. "/", "C:\"), keep separate
        lowestAbbreviateIndex = 1;
        root = location.substring(0, location.indexOf(separator) + 1);
    } else {
        // must be java class name for a builtin function
        elements = location.split("\\.");
        lowestAbbreviateIndex = 0;
        root = "";
        separator = ".";
    }

    String last = elements[elements.length - 1];
    int remaining = NUM_LOCATION_CHARS_UNABBREVIATED - last.length();
    // start from the next to last element of the location and add until "remaining" many
    // chars added, abbreviate rest with first 2 characters
    for (int index = elements.length - 2; index >= lowestAbbreviateIndex; index--) {
        String element = elements[index];
        if (remaining > 0) {
            int length = Math.min(remaining, element.length());
            element = element.substring(0, length);
            remaining -= length;
        } else {
            element = element.substring(0, Math.min(2, element.length()));
        }
        elements[index] = element;
    }
    return root + Joiner.on(separator).join(Arrays.asList(elements).subList(1, elements.length));
}

From source file:org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.java

private boolean pathsOverlap(String firstPath, String secondPath) {
    if (firstPath.equals(secondPath)) {
        return true;
    }/* w  ww .  j ava 2  s  .  com*/

    String shorter;
    String longer;
    if (firstPath.length() > secondPath.length()) {
        shorter = secondPath;
        longer = firstPath;
    } else {
        shorter = firstPath;
        longer = secondPath;
    }
    return longer.startsWith(shorter + StandardSystemProperty.FILE_SEPARATOR.value());
}