Example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Prototype

String[] EMPTY_STRING_ARRAY

To view the source code for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Click Source Link

Document

An empty immutable String array.

Usage

From source file:com.opengamma.financial.analytics.timeseries.YieldCurveConversionSeriesFunction.java

/**
 * No curves names are excluded.
 */
public YieldCurveConversionSeriesFunction() {
    this(ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:com.genericworkflownodes.knime.parameter.StringListParameter.java

/**
 * Returns the valid values of the {@link StringListParameter}.
 * //from  w  w w  .  j  a  v a2s .c o m
 * @return The valid values.
 */
public String[] getRestrictions() {
    if (!validValues.isEmpty()) {
        return validValues.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
    } else {
        return null;
    }
}

From source file:com.google.gdt.eclipse.designer.wizards.model.project.ConfigureWizardPage.java

public void createControl(Composite parent) {
    initializeDialogUnits(parent);//from w ww .  j av  a 2  s.  co m
    //
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout());
    //
    Link openPreferencesLink = new Link(composite, SWT.NONE);
    openPreferencesLink.setText("<a>Click here to configure GWT...</a>");
    openPreferencesLink.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(getShell(), MainPreferencePage.ID,
                    ArrayUtils.EMPTY_STRING_ARRAY, null).open();
            if (MainPreferencePage.validateLocation()) {
                setPageComplete(true);
                getWizard().getContainer().showPage(getNextPage());
            }
        }
    });
    //
    setControl(composite);
    Dialog.applyDialogFont(composite);
}

From source file:com.seitenbau.jenkins.plugins.dynamicparameter.config.DynamicParameterManagement.java

/**
 * Get a list of all class path directories.
 * @return a list of directory names or an empty array
 *///from ww  w.  j av a 2 s  .c  o  m
public String[] getClassPathDirectories() throws IOException {
    checkReadPermission();

    File classPathDir = new File(getBaseDirectoryPath());
    if (classPathDir.isDirectory()) {
        return classPathDir.list();
    }
    return ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:com.google.gdt.eclipse.designer.uibinder.model.property.StylePropertyEditorTest.java

public void test_getText_defaultValue() throws Exception {
    Property property = getStyleProperty(null, ArrayUtils.EMPTY_STRING_ARRAY);
    assertEquals("", getPropertyText(property));
}

From source file:com.cyclopsgroup.waterview.spi.ThemeManager.java

/**
 * Get all theme names/*from   w  ww .  j  a v a 2s.  c om*/
 *
 * @return Array of them names
 */
public String[] getThemeNames() {
    HashSet names = new HashSet();
    for (Iterator i = themeProviders.iterator(); i.hasNext();) {
        ThemeProvider provider = (ThemeProvider) i.next();
        CollectionUtils.addAll(names, provider.getThemeNames());
    }
    return (String[]) names.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:com.huawei.streaming.util.StreamingUtils.java

/**
 * /* ww  w  . j a v  a2s  .co  m*/
 *     
 * 
 * jdk??String.split()
 * 10 String.split() 250 split 45
 * 
 * @param strOriginal ?
 * @param strSeparatorChars 
 * @param iMax ?-1
 * @param blPreserveAllTokens ??
 * @return  ????
 */
public static String[] splitByWholeSeparator(String strOriginal, String strSeparatorChars, int iMax,
        boolean blPreserveAllTokens) {
    //???
    if (strOriginal == null) {
        LOG.warn("strOriginal is null!");
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }

    //?
    int iLength = strOriginal.length();

    if (iLength == 0) {
        LOG.warn("strOriginal is empty!");
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }

    //??
    if ((strSeparatorChars == null) || (EMPTY_STR.equals(strSeparatorChars))) {
        LOG.warn("strSeparatorChars is invalid!");
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }

    //
    int iSeparatorLength = strSeparatorChars.length();

    //??list
    ArrayList<String> substrList = new ArrayList<String>();

    //
    int iNumberOfSubstrings = 0;

    //?
    int iBegin = 0;

    //??
    int iEnd = 0;

    while (iEnd < iLength) {
        //?
        iEnd = strOriginal.indexOf(strSeparatorChars, iBegin);

        //
        if (iEnd > -1) {
            if (iEnd > iBegin) {
                iNumberOfSubstrings += 1;

                //???
                if (iNumberOfSubstrings == iMax) {
                    iEnd = iLength;

                    substrList.add(strOriginal.substring(iBegin));
                } else {
                    //??
                    substrList.add(strOriginal.substring(iBegin, iEnd));

                    //? 
                    iBegin = iEnd + iSeparatorLength;
                }
            } else {
                //?
                if (blPreserveAllTokens) {
                    iNumberOfSubstrings += 1;

                    //???
                    if (iNumberOfSubstrings == iMax) {
                        iEnd = iLength;

                        substrList.add(strOriginal.substring(iBegin));
                    }
                    //?
                    else {
                        substrList.add(EMPTY_STR);
                    }
                }

                //? 
                iBegin = iEnd + iSeparatorLength;
            }
        }
        //????
        else {
            //????
            substrList.add(strOriginal.substring(iBegin));

            iEnd = iLength;
        }
    }

    //?
    return (String[]) substrList.toArray(new String[substrList.size()]);
}

From source file:ch.systemsx.cisd.openbis.plugin.generic.client.web.server.parser.NewSampleParserObjectFactoryTest.java

@Test
public final void testCreateObjectWithNullOrNotEnoughColumns() {
    final NewSampleParserObjectFactory parserObjectFactory = createNewSampleParserObjectFactory(
            createPropertyMapper(), true);
    boolean fail = true;
    try {//  w  w w .  j  a v a 2s  . c  o m
        parserObjectFactory.createObject(null);
    } catch (AssertionError e) {
        fail = false;
    }
    assertFalse(fail);
    try {
        parserObjectFactory.createObject(ArrayUtils.EMPTY_STRING_ARRAY);
        fail(String.format("'%s' expected.", ch.systemsx.cisd.common.parser.IndexOutOfBoundsException.class));
    } catch (final ch.systemsx.cisd.common.parser.IndexOutOfBoundsException ex) {
        // Nothing to do here.
    }
}

From source file:com.opengamma.web.server.conversion.LocalVolatilitySurfaceMoneynessConverter.java

@Override
public Object convertForDisplay(ResultConverterCache context, ValueSpecification valueSpec,
        LocalVolatilitySurfaceMoneyness value, ConversionMode mode) {
    Map<String, Object> result = new HashMap<String, Object>();
    if (value.getSurface() instanceof InterpolatedDoublesSurface) {
        InterpolatedDoublesSurface interpolated = (InterpolatedDoublesSurface) value.getSurface();
        result.put("xCount", interpolated.getXData().length);
        result.put("yCount", interpolated.getYData().length);
        if (mode == ConversionMode.FULL) {
            Double[] xs = interpolated.getXData();
            Double[] ys = interpolated.getYData();
            List<Double> uniqueX = new ArrayList<Double>();
            List<Double> uniqueY = new ArrayList<Double>();
            for (Double x : xs) {
                if (!uniqueX.contains(x)) {
                    uniqueX.add(x);//from   w  w w .  j  av a2  s. co  m
                }
            }
            for (Double y : ys) {
                if (!uniqueY.contains(y)) {
                    uniqueY.add(y);
                }
            }
            Collections.sort(uniqueX);
            Collections.sort(uniqueY);
            Object[] xLabels = new Object[uniqueX.size()];
            Object[] yLabels = new Object[uniqueY.size()];
            double[][] surface = new double[xs.length][ys.length];
            boolean[][] missingValues = new boolean[xs.length][ys.length];
            for (int i = 0; i < uniqueX.size(); i++) {
                xLabels[i] = uniqueX.get(i).toString();
                for (int j = 0; j < uniqueY.size(); j++) {
                    if (i == 0) {
                        yLabels[j] = uniqueY.get(j).toString();
                    }
                    try {
                        surface[i][j] = interpolated.getZValue(uniqueX.get(i), uniqueY.get(i));
                    } catch (MathException e) {
                        surface[i][j] = Double.MAX_VALUE;
                        missingValues[i][j] = true;
                    }
                }
            }
            result.put("xs", uniqueX.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
            result.put("ys", uniqueY.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
            result.put("surface", surface);
            result.put("missingValues", missingValues);
        }
    } else if (value.getSurface() instanceof FunctionalDoublesSurface) {
        FunctionalDoublesSurface functional = (FunctionalDoublesSurface) value.getSurface();

        final double[] expiries = { 0.1, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 2.5, 3., 4., 5. };
        final int nX = expiries.length;

        result.put("xCount", nX);
        result.put("yCount", 21);
        if (mode == ConversionMode.FULL) {
            String[] xLabels = new String[nX];
            String[] yLabels = new String[21];
            double[][] surface = new double[21][nX];
            boolean[][] missingValues = new boolean[21][nX];
            for (int i = 0; i < nX; i++) {
                double x = expiries[i];
                xLabels[i] = LABEL_FORMAT.format(x);
                double y = .45; // Moneyness from 0.5 to 2.0
                for (int j = 0; j < 21; j++) {
                    y += 0.05;
                    if (i == 0) {
                        yLabels[j] = LABEL_FORMAT.format(y);
                    }
                    surface[j][i] = 100 * functional.getZValue(x, y);
                }
            }
            result.put("xs", xLabels);
            result.put("ys", yLabels);
            result.put("surface", surface);
            result.put("missingValues", missingValues);
        }
    }
    return result;
}

From source file:com.seitenbau.jenkins.plugins.dynamicparameter.config.DynamicParameterManagement.java

/**
 * Get a list with uploaded files./* w  w w .  j  av  a 2s . c  o m*/
 * @param classPath class path directory to list
 * @return an array with file names or an empty array
 */
public String[] getUploadedFiles(String classPath) throws IOException {
    checkReadPermission();

    File classPathDir = getRebasedFile(classPath);
    if (classPathDir.isDirectory()) {
        return classPathDir.list();
    }
    return ArrayUtils.EMPTY_STRING_ARRAY;
}