Example usage for java.util Arrays deepToString

List of usage examples for java.util Arrays deepToString

Introduction

In this page you can find the example usage for java.util Arrays deepToString.

Prototype

public static String deepToString(Object[] a) 

Source Link

Document

Returns a string representation of the "deep contents" of the specified array.

Usage

From source file:com.celements.pagetype.service.PageTypeService.java

public List<String> getPageTypesConfigNamesForCategories(Set<String> catList, boolean onlyVisible) {
    List<String> pageTypeConfigNameList = new ArrayList<String>();
    for (PageTypeReference pageTypeRef : getPageTypeRefsForCategories(catList, onlyVisible)) {
        pageTypeConfigNameList.add(pageTypeRef.getConfigName());
    }//from www . j  ava 2  s. co m
    LOGGER.debug("getPageTypesConfigNamesForCategories: return "
            + Arrays.deepToString(pageTypeConfigNameList.toArray()));
    return pageTypeConfigNameList;
}

From source file:com.github.tell.mathematics.combinatorics.Combination.java

public T[][] makeCombination() {
    if (numberOfSelection == 0) {
        //noinspection unchecked
        return (T[][]) Array.newInstance(cls, 1, 0);

    } else if (numberOfSelection == 1) {
        @SuppressWarnings("unchecked")
        final T[][] result = (T[][]) Array.newInstance(cls, elements.length, 0);
        assert result.length == elements.length : String.format("result = %s, numberOfSelection = %s",
                Arrays.deepToString(result), numberOfSelection);
        for (int i = 0; i < elements.length; i++) {
            result[i] = Arrays.copyOfRange(elements, i, i + 1);
        }//from  ww w.  ja v  a2s . c  o  m
        return result;

    } else if (numberOfSelection == elements.length) {
        @SuppressWarnings("unchecked")
        final T[][] result = (T[][]) Array.newInstance(cls, 1, 0);
        result[0] = ArrayUtils.clone(elements);
        return result;

    } else if (numberOfSelection == elements.length - 1) {
        @SuppressWarnings("unchecked")
        final T[][] result = (T[][]) Array.newInstance(cls, elements.length, 0);
        for (int i = elements.length - 1; i >= 0; i--) {
            final int j = elements.length - 1 - i;
            result[j] = Arrays.copyOf(elements, i);
            result[j] = ArrayUtils.addAll(result[j], ArrayUtils.subarray(elements, i + 1, elements.length));
            logger.trace("generated array = {}", Arrays.deepToString(result[j]));
        }
        return result;

    } else {
        final T[] partialElements = Arrays.copyOf(elements, elements.length - 1);

        logger.trace("partialElements = {}, numberOfSelection = {}", Arrays.deepToString(partialElements),
                numberOfSelection);

        final Combination<T> leftHandSideGenerator = new Combination<T>(partialElements, numberOfSelection);
        final T[][] leftCombination = leftHandSideGenerator.makeCombination();

        final Combination<T> rightHandSideGenerator = new Combination<T>(partialElements,
                numberOfSelection - 1);
        final T[][] rightCombination = rightHandSideGenerator.makeCombination();
        for (int i = 0; i < rightCombination.length; i++) {
            rightCombination[i] = ArrayUtils.add(rightCombination[i], elements[elements.length - 1]);
        }

        //noinspection unchecked
        return ArrayUtils.addAll(leftCombination, rightCombination);
    }
}

From source file:org.apache.http.HC4.impl.conn.InMemoryDnsResolver.java

/**
 * {@inheritDoc}//from   w ww.  ja  va 2 s .c o  m
 */
@Override
public InetAddress[] resolve(final String host) throws UnknownHostException {
    final InetAddress[] resolvedAddresses = dnsMap.get(host);
    if (log.isInfoEnabled()) {
        log.info("Resolving " + host + " to " + Arrays.deepToString(resolvedAddresses));
    }
    if (resolvedAddresses == null) {
        throw new UnknownHostException(host + " cannot be resolved");
    }
    return resolvedAddresses;
}

From source file:com.epam.reportportal.apache.http.impl.conn.InMemoryDnsResolver.java

/**
 * {@inheritDoc}/*from   www.  ja v  a 2 s . c  o m*/
 */
public InetAddress[] resolve(final String host) throws UnknownHostException {
    final InetAddress[] resolvedAddresses = dnsMap.get(host);
    if (log.isInfoEnabled()) {
        log.info("Resolving " + host + " to " + Arrays.deepToString(resolvedAddresses));
    }
    if (resolvedAddresses == null) {
        throw new UnknownHostException(host + " cannot be resolved");
    }
    return resolvedAddresses;
}

From source file:bi.meteorite.pages.SaikuTable.java

public void shouldNotHaveRowElementsWhere(BeanMatcher... matchers) {
    List<WebElement> rows = getRowElementsWhere(matchers);
    if (!rows.isEmpty()) {
        throw new AssertionError("Expecting a table with no rows where: " + Arrays.deepToString(matchers));
    }//from  www  . j av  a  2s .c o  m
}

From source file:org.apache.http2.impl.conn.InMemoryDnsResolver.java

/**
 * {@inheritDoc}//from  w w w. j av a2s  .co  m
 */
public InetAddress[] resolve(String host) throws UnknownHostException {
    InetAddress[] resolvedAddresses = dnsMap.get(host);
    if (log.isInfoEnabled()) {
        log.info("Resolving " + host + " to " + Arrays.deepToString(resolvedAddresses));
    }
    if (resolvedAddresses == null) {
        throw new UnknownHostException(host + " cannot be resolved");
    }
    return resolvedAddresses;
}

From source file:org.n52.ifgicopter.spf.input.GpxGeneratedInputPlugin.java

/**
 * @param currentWaypoint//from w  ww.ja  v a 2  s .co  m
 * @return
 */
@Override
protected Map<String, Object> getDataSet(WptType currentWaypoint) {
    Map<String, Object> newDataSet = getTimeAndCoordinateDataSet(currentWaypoint);

    int value1 = GpxUtil.randomNumber(this.rand, RANDOM_INT_RANGE[0], RANDOM_INT_RANGE[1]);
    // a little bit randomization
    double value2 = this.values2[this.value2Pointer++ % this.values2.length]
            * (this.rand.nextDouble() * 0.2d + 0.9d);
    value2 = GpxUtil.roundToDecimals(value2, 3);

    newDataSet.put("temperature", Integer.valueOf(value1));
    // newDataSet.put("humidity", Double.valueOf(value2));
    newDataSet.put("pollutant", Double.valueOf(value2));

    log.debug("SENDING DATA: " + Arrays.deepToString(newDataSet.entrySet().toArray()));
    return newDataSet;
}

From source file:de.kopis.glacier.parsers.GlacierUploaderOptionParserTest.java

@Test
public void hasOptionalCredentialsOptionWithFile() {
    final String[] newArgs = Arrays.copyOf(args, args.length + 2);
    newArgs[newArgs.length - 2] = "--credentials";
    newArgs[newArgs.length - 1] = "/path/to/aws.properties";

    final OptionSet optionSet = optionsParser.parse(newArgs);
    assertTrue("Option 'credentials' not found in " + Arrays.deepToString(optionSet.specs().toArray()),
            optionSet.has("credentials"));
    assertEquals(/*from  w  ww.j  av  a2s  . co  m*/
            "Value of option 'credentials' not found in " + Arrays.deepToString(optionSet.specs().toArray()),
            new File("/path/to/aws.properties"), optionSet.valueOf("credentials"));
}

From source file:org.directwebremoting.filter.AuditLogAjaxFilter.java

/**
 * Similar to {@link Object#toString()} except that we ensure we don't
 * return long strings, and format strings with quotes. We're probably more
 * interested in what it is rather than the exact detail.
 *///  ww  w  . jav  a2s  .co m
private String toString(Object reply) {
    if (reply == null) {
        return "null";
    }

    if (reply.getClass().isArray()) {
        if (reply.getClass().getComponentType().isPrimitive()) {
            StringBuilder builder = new StringBuilder();
            builder.append("[");
            for (int i = 0; i < Array.getLength(reply); i++) {
                if (i != 0) {
                    builder.append(",");
                }
                builder.append(Array.get(reply, i));
            }
            builder.append("]");
            reply = builder.toString();
        } else {
            reply = Arrays.deepToString((Object[]) reply);
        }
    }

    if (reply instanceof String) {
        return shorten((String) reply, maxStringLength);
    }

    if (toStringClasses.contains(reply.getClass())) {
        return reply.toString();
    }

    return shorten(reply.toString(), maxStringLength);
    //return reply.getClass().getSimpleName() + "(...)";
}

From source file:com.runwaysdk.business.generation.AspectJCompiler.java

/**
 * Calls the AspectJ Compiler and wraps any errors or failures in a {@link CompilerException}
 *
 * @param args/*w  w w  . j av  a  2 s .c  o m*/
 *          Arguments for the compiler
 * @throws CompilerException
 *           if compilation fails
 */
private void callAJC(String args[]) {
    Log log = LogFactory.getLog(COMPILER_LOG);
    log.trace(Arrays.deepToString(args));

    fails.clear();
    errors.clear();
    warnings.clear();
    infos.clear();

    if (0 < Main.bareMain(args, false, fails, errors, warnings, infos)) {
        // We have errors
        String message = new String();
        for (String error : errors) {
            message += '\n' + error;
        }
        for (String fail : fails) {
            message += '\n' + fail;
        }
        throw new CompilerException("Errors found during compilation:" + message, message);
    }
}