javatips.net counter

Java Examples for java.util.Arrays

The following java examples will help you to understand the usage of java.util.Arrays. These source code samples are taken from different open source projects.

Example 1
Project: lombok-intellij-plugin-master  File: EqualsAndHashCodeExplicitOfAndExclude.java View source code
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public boolean equals(final java.lang.Object o) {
    if (o == this)
        return true;
    if (!(o instanceof EqualsAndHashCode))
        return false;
    final EqualsAndHashCode other = (EqualsAndHashCode) o;
    if (!other.canEqual((java.lang.Object) this))
        return false;
    if (this.x != other.x)
        return false;
    if (!java.util.Arrays.deepEquals(this.z, other.z))
        return false;
    return true;
}
Example 2
Project: xith3d-master  File: OpenGLStatesCache.java View source code
public final void update(boolean _coordsArrayEnabled, boolean _normalsArrayEnabled, boolean _colorsArrayEnabled, int _texCoordArraysEnableMask, int[] _texGenEnableMask, boolean[] _texture1DEnabled, boolean[] _texture2DEnabled, boolean[] _texture3DEnabled, boolean[] _textureCMEnabled, long _vertexAttribsEnableMask, int _currentServerTextureUnit, int _currentClientTextureUnit, int _maxUsedVertexAttrib, int _colorWriteMask, boolean _depthWriteMask, boolean _assemblyVertexShadersEnabled, boolean _assemblyFragmentShadersEnabled, int _currentGLSLShaderProgram, boolean _depthTestEnabled, boolean _alphaTestEnabled, boolean _stencilTestEnabled, boolean _scissorTestEnabled, boolean[] _clipPlaneEnabled, boolean _blendingEnabled, boolean _pointSmoothEnabled, boolean _lineStippleEnabled, boolean _lineSmoothEnabled, boolean _polygonSmoothEnabled, @SuppressWarnings("unused") boolean _polygonOffsetPointEnabled, @SuppressWarnings("unused") boolean _polygonOffsetLineEnabled, @SuppressWarnings("unused") boolean _polygonOffsetFillEnabled, boolean _cullFaceEnabled, boolean _normalizeEnabled, boolean _colorMaterialEnabled, boolean _lightingEnabled, boolean[] _lightEnabled, boolean _fogEnabled, float[] _color) {
    this.coordsArrayEnabled = _coordsArrayEnabled;
    this.normalsArrayEnabled = _normalsArrayEnabled;
    this.colorsArrayEnabled = _colorsArrayEnabled;
    this.texCoordArraysEnableMask = _texCoordArraysEnableMask;
    System.arraycopy(_texGenEnableMask, 0, this.texGenEnableMask, 0, _texGenEnableMask.length);
    System.arraycopy(_texture1DEnabled, 0, this.texture1DEnabled, 0, _texture1DEnabled.length);
    System.arraycopy(_texture2DEnabled, 0, this.texture2DEnabled, 0, _texture2DEnabled.length);
    System.arraycopy(_texture3DEnabled, 0, this.texture3DEnabled, 0, _texture3DEnabled.length);
    System.arraycopy(_textureCMEnabled, 0, this.textureCMEnabled, 0, _textureCMEnabled.length);
    this.vertexAttribsEnableMask = _vertexAttribsEnableMask;
    this.currentServerTextureUnit = _currentServerTextureUnit;
    this.currentClientTextureUnit = _currentClientTextureUnit;
    this.maxUsedVertexAttrib = _maxUsedVertexAttrib;
    this.colorWriteMask = _colorWriteMask;
    this.depthWriteMask = _depthWriteMask;
    this.assemblyVertexShadersEnabled = _assemblyVertexShadersEnabled;
    this.assemblyFragmentShadersEnabled = _assemblyFragmentShadersEnabled;
    this.currentGLSLShaderProgram = _currentGLSLShaderProgram;
    this.depthTestEnabled = _depthTestEnabled;
    this.alphaTestEnabled = _alphaTestEnabled;
    this.stencilTestEnabled = _stencilTestEnabled;
    this.scissorTestEnabled = _scissorTestEnabled;
    System.arraycopy(_clipPlaneEnabled, 0, this.clipPlaneEnabled, 0, _clipPlaneEnabled.length);
    this.blendingEnabled = _blendingEnabled;
    this.pointSmoothEnabled = _pointSmoothEnabled;
    this.lineStippleEnabled = _lineStippleEnabled;
    this.lineSmoothEnabled = _lineSmoothEnabled;
    this.polygonSmoothEnabled = _polygonSmoothEnabled;
    this.cullFaceEnabled = _cullFaceEnabled;
    this.normalizeEnabled = _normalizeEnabled;
    this.colorMaterialEnabled = _colorMaterialEnabled;
    this.lightingEnabled = _lightingEnabled;
    System.arraycopy(_lightEnabled, 0, this.lightEnabled, 0, _lightEnabled.length);
    this.fogEnabled = _fogEnabled;
    this.color.set(_color);
    this.currentBoundArrayVBO = -1;
    this.currentBoundElementVBO = -1;
    java.util.Arrays.fill(lastFrameId, -1L);
    java.util.Arrays.fill(currentBoundTexture, null);
    java.util.Arrays.fill(currentTexAttribs, null);
    java.util.Arrays.fill(currentTexCoordGen, null);
    java.util.Arrays.fill(currentTextureMode, null);
    java.util.Arrays.fill(currentTextureBlendColor, null);
    java.util.Arrays.fill(currentCombineMode_RGB, null);
    java.util.Arrays.fill(currentCombineMode_Alpha, null);
    java.util.Arrays.fill(currentCombineSource0_RGB, null);
    java.util.Arrays.fill(currentCombineSource0_Alpha, null);
    java.util.Arrays.fill(currentCombineSource1_RGB, null);
    java.util.Arrays.fill(currentCombineSource1_Alpha, null);
    java.util.Arrays.fill(currentCombineSource2_RGB, null);
    java.util.Arrays.fill(currentCombineSource2_Alpha, null);
    java.util.Arrays.fill(currentCombineFunction0_RGB, null);
    java.util.Arrays.fill(currentCombineFunction0_Alpha, null);
    java.util.Arrays.fill(currentCombineFunction1_RGB, null);
    java.util.Arrays.fill(currentCombineFunction1_Alpha, null);
    java.util.Arrays.fill(currentCombineFunction2_RGB, null);
    java.util.Arrays.fill(currentCombineFunction2_Alpha, null);
    java.util.Arrays.fill(currentCombineRGBScale, -1);
    java.util.Arrays.fill(currentCompareMode, null);
    java.util.Arrays.fill(currentCompareFunc, null);
    java.util.Arrays.fill(currentTextureMatrix, null);
}
Example 3
Project: GDSC-SMLM-master  File: SearchSpaceTest.java View source code
@Test
public void canEnumerateSearchSpace() {
    SearchDimension d1 = new SearchDimension(0, 10, 1, 1);
    SearchDimension d2 = new SearchDimension(0, 10, 0.5, 2, 2.5, 7.5);
    double[][] ss = SearchSpace.createSearchSpace(createDimensions(d1, d2));
    Assert.assertEquals(d1.getMaxLength() * d2.getMaxLength(), ss.length);
//for (double[] p : ss)
//	System.out.println(java.util.Arrays.toString(p));
}
Example 4
Project: xxl-master  File: BPlusIndexedSetSubSubSetOperationPrimitiveTest.java View source code
public void containsAllFalse() {
    boolean result1 = subSet.containsAll(java.util.Arrays.asList(-1));
    Assert.assertEquals(result1, true);
    boolean result2 = subSet.containsAll(java.util.Arrays.asList(MAX_ITEMS_TO_INSERT1));
    Assert.assertEquals(result2, true);
    boolean result3 = subSet.containsAll(java.util.Arrays.asList("A"));
    Assert.assertEquals(result3, true);
}
Example 5
Project: sosies-generator-master  File: AbstractCollectionTest.java View source code
/** 
     * Tests [email protected] Collection#addAll(Collection)}.
     */
@Test(timeout = 1000)
public void testCollectionAddAll() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(), this, "testCollectionAddAll");
    if (!(isAddSupported())) {
        return;
    }
    resetEmpty();
    resetEmpty();
    E[] elements = getFullElements();
    boolean r = getCollection().addAll(java.util.Arrays.asList(elements));
    getConfirmed().addAll(java.util.Arrays.asList(elements));
    verify();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4544, r);
    for (final E element : elements) {
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4546, getCollection(), 4545, getCollection().contains(element));
    }
    resetFull();
    int size = getCollection().size();
    elements = getOtherElements();
    r = getCollection().addAll(java.util.Arrays.asList(elements));
    getConfirmed().addAll(java.util.Arrays.asList(elements));
    verify();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4547, r);
    for (final E element : elements) {
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4549, getCollection(), 4548, getCollection().contains(element));
    }
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4550, (size + (elements.length)));
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4552, getCollection(), 4551, getCollection().size());
    resetFull();
    size = getCollection().size();
    r = getCollection().addAll(java.util.Arrays.asList(getFullElements()));
    getConfirmed().addAll(java.util.Arrays.asList(getFullElements()));
    verify();
    if (r) {
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4553, (size < (getCollection().size())));
    } else {
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4554, size);
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4556, getCollection(), 4555, getCollection().size());
    }
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
Example 6
Project: Time4J-master  File: OrdinalDateData.java View source code
public static Iterable<Object[]> dataStdYear() {
    return Arrays.asList(new Object[][] { { 1, 1, 1 }, { 2, 1, 2 }, { 3, 1, 3 }, { 4, 1, 4 }, { 5, 1, 5 }, { 6, 1, 6 }, { 7, 1, 7 }, { 8, 1, 8 }, { 9, 1, 9 }, { 10, 1, 10 }, { 11, 1, 11 }, { 12, 1, 12 }, { 13, 1, 13 }, { 14, 1, 14 }, { 15, 1, 15 }, { 16, 1, 16 }, { 17, 1, 17 }, { 18, 1, 18 }, { 19, 1, 19 }, { 20, 1, 20 }, { 21, 1, 21 }, { 22, 1, 22 }, { 23, 1, 23 }, { 24, 1, 24 }, { 25, 1, 25 }, { 26, 1, 26 }, { 27, 1, 27 }, { 28, 1, 28 }, { 29, 1, 29 }, { 30, 1, 30 }, { 31, 1, 31 }, { 32, 2, 1 }, { 33, 2, 2 }, { 34, 2, 3 }, { 35, 2, 4 }, { 36, 2, 5 }, { 37, 2, 6 }, { 38, 2, 7 }, { 39, 2, 8 }, { 40, 2, 9 }, { 41, 2, 10 }, { 42, 2, 11 }, { 43, 2, 12 }, { 44, 2, 13 }, { 45, 2, 14 }, { 46, 2, 15 }, { 47, 2, 16 }, { 48, 2, 17 }, { 49, 2, 18 }, { 50, 2, 19 }, { 51, 2, 20 }, { 52, 2, 21 }, { 53, 2, 22 }, { 54, 2, 23 }, { 55, 2, 24 }, { 56, 2, 25 }, { 57, 2, 26 }, { 58, 2, 27 }, { 59, 2, 28 }, { 60, 3, 1 }, { 61, 3, 2 }, { 62, 3, 3 }, { 63, 3, 4 }, { 64, 3, 5 }, { 65, 3, 6 }, { 66, 3, 7 }, { 67, 3, 8 }, { 68, 3, 9 }, { 69, 3, 10 }, { 70, 3, 11 }, { 71, 3, 12 }, { 72, 3, 13 }, { 73, 3, 14 }, { 74, 3, 15 }, { 75, 3, 16 }, { 76, 3, 17 }, { 77, 3, 18 }, { 78, 3, 19 }, { 79, 3, 20 }, { 80, 3, 21 }, { 81, 3, 22 }, { 82, 3, 23 }, { 83, 3, 24 }, { 84, 3, 25 }, { 85, 3, 26 }, { 86, 3, 27 }, { 87, 3, 28 }, { 88, 3, 29 }, { 89, 3, 30 }, { 90, 3, 31 }, { 91, 4, 1 }, { 92, 4, 2 }, { 93, 4, 3 }, { 94, 4, 4 }, { 95, 4, 5 }, { 96, 4, 6 }, { 97, 4, 7 }, { 98, 4, 8 }, { 99, 4, 9 }, { 100, 4, 10 }, { 101, 4, 11 }, { 102, 4, 12 }, { 103, 4, 13 }, { 104, 4, 14 }, { 105, 4, 15 }, { 106, 4, 16 }, { 107, 4, 17 }, { 108, 4, 18 }, { 109, 4, 19 }, { 110, 4, 20 }, { 111, 4, 21 }, { 112, 4, 22 }, { 113, 4, 23 }, { 114, 4, 24 }, { 115, 4, 25 }, { 116, 4, 26 }, { 117, 4, 27 }, { 118, 4, 28 }, { 119, 4, 29 }, { 120, 4, 30 }, { 121, 5, 1 }, { 122, 5, 2 }, { 123, 5, 3 }, { 124, 5, 4 }, { 125, 5, 5 }, { 126, 5, 6 }, { 127, 5, 7 }, { 128, 5, 8 }, { 129, 5, 9 }, { 130, 5, 10 }, { 131, 5, 11 }, { 132, 5, 12 }, { 133, 5, 13 }, { 134, 5, 14 }, { 135, 5, 15 }, { 136, 5, 16 }, { 137, 5, 17 }, { 138, 5, 18 }, { 139, 5, 19 }, { 140, 5, 20 }, { 141, 5, 21 }, { 142, 5, 22 }, { 143, 5, 23 }, { 144, 5, 24 }, { 145, 5, 25 }, { 146, 5, 26 }, { 147, 5, 27 }, { 148, 5, 28 }, { 149, 5, 29 }, { 150, 5, 30 }, { 151, 5, 31 }, { 152, 6, 1 }, { 153, 6, 2 }, { 154, 6, 3 }, { 155, 6, 4 }, { 156, 6, 5 }, { 157, 6, 6 }, { 158, 6, 7 }, { 159, 6, 8 }, { 160, 6, 9 }, { 161, 6, 10 }, { 162, 6, 11 }, { 163, 6, 12 }, { 164, 6, 13 }, { 165, 6, 14 }, { 166, 6, 15 }, { 167, 6, 16 }, { 168, 6, 17 }, { 169, 6, 18 }, { 170, 6, 19 }, { 171, 6, 20 }, { 172, 6, 21 }, { 173, 6, 22 }, { 174, 6, 23 }, { 175, 6, 24 }, { 176, 6, 25 }, { 177, 6, 26 }, { 178, 6, 27 }, { 179, 6, 28 }, { 180, 6, 29 }, { 181, 6, 30 }, { 182, 7, 1 }, { 183, 7, 2 }, { 184, 7, 3 }, { 185, 7, 4 }, { 186, 7, 5 }, { 187, 7, 6 }, { 188, 7, 7 }, { 189, 7, 8 }, { 190, 7, 9 }, { 191, 7, 10 }, { 192, 7, 11 }, { 193, 7, 12 }, { 194, 7, 13 }, { 195, 7, 14 }, { 196, 7, 15 }, { 197, 7, 16 }, { 198, 7, 17 }, { 199, 7, 18 }, { 200, 7, 19 }, { 201, 7, 20 }, { 202, 7, 21 }, { 203, 7, 22 }, { 204, 7, 23 }, { 205, 7, 24 }, { 206, 7, 25 }, { 207, 7, 26 }, { 208, 7, 27 }, { 209, 7, 28 }, { 210, 7, 29 }, { 211, 7, 30 }, { 212, 7, 31 }, { 213, 8, 1 }, { 214, 8, 2 }, { 215, 8, 3 }, { 216, 8, 4 }, { 217, 8, 5 }, { 218, 8, 6 }, { 219, 8, 7 }, { 220, 8, 8 }, { 221, 8, 9 }, { 222, 8, 10 }, { 223, 8, 11 }, { 224, 8, 12 }, { 225, 8, 13 }, { 226, 8, 14 }, { 227, 8, 15 }, { 228, 8, 16 }, { 229, 8, 17 }, { 230, 8, 18 }, { 231, 8, 19 }, { 232, 8, 20 }, { 233, 8, 21 }, { 234, 8, 22 }, { 235, 8, 23 }, { 236, 8, 24 }, { 237, 8, 25 }, { 238, 8, 26 }, { 239, 8, 27 }, { 240, 8, 28 }, { 241, 8, 29 }, { 242, 8, 30 }, { 243, 8, 31 }, { 244, 9, 1 }, { 245, 9, 2 }, { 246, 9, 3 }, { 247, 9, 4 }, { 248, 9, 5 }, { 249, 9, 6 }, { 250, 9, 7 }, { 251, 9, 8 }, { 252, 9, 9 }, { 253, 9, 10 }, { 254, 9, 11 }, { 255, 9, 12 }, { 256, 9, 13 }, { 257, 9, 14 }, { 258, 9, 15 }, { 259, 9, 16 }, { 260, 9, 17 }, { 261, 9, 18 }, { 262, 9, 19 }, { 263, 9, 20 }, { 264, 9, 21 }, { 265, 9, 22 }, { 266, 9, 23 }, { 267, 9, 24 }, { 268, 9, 25 }, { 269, 9, 26 }, { 270, 9, 27 }, { 271, 9, 28 }, { 272, 9, 29 }, { 273, 9, 30 }, { 274, 10, 1 }, { 275, 10, 2 }, { 276, 10, 3 }, { 277, 10, 4 }, { 278, 10, 5 }, { 279, 10, 6 }, { 280, 10, 7 }, { 281, 10, 8 }, { 282, 10, 9 }, { 283, 10, 10 }, { 284, 10, 11 }, { 285, 10, 12 }, { 286, 10, 13 }, { 287, 10, 14 }, { 288, 10, 15 }, { 289, 10, 16 }, { 290, 10, 17 }, { 291, 10, 18 }, { 292, 10, 19 }, { 293, 10, 20 }, { 294, 10, 21 }, { 295, 10, 22 }, { 296, 10, 23 }, { 297, 10, 24 }, { 298, 10, 25 }, { 299, 10, 26 }, { 300, 10, 27 }, { 301, 10, 28 }, { 302, 10, 29 }, { 303, 10, 30 }, { 304, 10, 31 }, { 305, 11, 1 }, { 306, 11, 2 }, { 307, 11, 3 }, { 308, 11, 4 }, { 309, 11, 5 }, { 310, 11, 6 }, { 311, 11, 7 }, { 312, 11, 8 }, { 313, 11, 9 }, { 314, 11, 10 }, { 315, 11, 11 }, { 316, 11, 12 }, { 317, 11, 13 }, { 318, 11, 14 }, { 319, 11, 15 }, { 320, 11, 16 }, { 321, 11, 17 }, { 322, 11, 18 }, { 323, 11, 19 }, { 324, 11, 20 }, { 325, 11, 21 }, { 326, 11, 22 }, { 327, 11, 23 }, { 328, 11, 24 }, { 329, 11, 25 }, { 330, 11, 26 }, { 331, 11, 27 }, { 332, 11, 28 }, { 333, 11, 29 }, { 334, 11, 30 }, { 335, 12, 1 }, { 336, 12, 2 }, { 337, 12, 3 }, { 338, 12, 4 }, { 339, 12, 5 }, { 340, 12, 6 }, { 341, 12, 7 }, { 342, 12, 8 }, { 343, 12, 9 }, { 344, 12, 10 }, { 345, 12, 11 }, { 346, 12, 12 }, { 347, 12, 13 }, { 348, 12, 14 }, { 349, 12, 15 }, { 350, 12, 16 }, { 351, 12, 17 }, { 352, 12, 18 }, { 353, 12, 19 }, { 354, 12, 20 }, { 355, 12, 21 }, { 356, 12, 22 }, { 357, 12, 23 }, { 358, 12, 24 }, { 359, 12, 25 }, { 360, 12, 26 }, { 361, 12, 27 }, { 362, 12, 28 }, { 363, 12, 29 }, { 364, 12, 30 }, { 365, 12, 31 } });
}
Example 7
Project: j2objc-master  File: ArraysTest.java View source code
/**
	 * @tests java.util.Arrays#asList(java.lang.Object[])
	 */
public void test_asList$Ljava_lang_Object() {
    // Test for method java.util.List
    // java.util.Arrays.asList(java.lang.Object [])
    List convertedList = Arrays.asList(objectArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == objectArray[counter]);
    }
    convertedList.set(50, new Integer(1000));
    assertTrue("set/get did not work on coverted list", convertedList.get(50).equals(new Integer(1000)));
    convertedList.set(50, new Integer(50));
    new Support_UnmodifiableCollectionTest("", convertedList).runTest();
    Object[] myArray = (Object[]) (objectArray.clone());
    myArray[30] = null;
    myArray[60] = null;
    convertedList = Arrays.asList(myArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == myArray[counter]);
    }
    try {
        Arrays.asList((Object[]) null);
        fail("asList with null arg didn't throw NPE");
    } catch (NullPointerException e) {
    }
}
Example 8
Project: seasar2-master  File: MessageResourceBundleFactoryTest.java View source code
/**
     * @throws Exception
     */
public void testCalcurateBundleNames() throws Exception {
    // 言語��
    String[] bundleNames = MessageResourceBundleFactory.calcurateBundleNames(BASE_NAME, Locale.JAPANESE);
    List expected = java.util.Arrays.asList(new String[] { BASE_NAME, BASE_NAME + "_ja" });
    assertEquals(expected, java.util.Arrays.asList(bundleNames));
    // 言語�国
    bundleNames = MessageResourceBundleFactory.calcurateBundleNames(BASE_NAME, new Locale("ja", "JP"));
    expected = java.util.Arrays.asList(new String[] { BASE_NAME, BASE_NAME + "_ja", BASE_NAME + "_ja_JP" });
    assertEquals(expected, java.util.Arrays.asList(bundleNames));
    // 言語�国��リアント
    bundleNames = MessageResourceBundleFactory.calcurateBundleNames(BASE_NAME, new Locale("ja", "JP", "WIN"));
    expected = java.util.Arrays.asList(new String[] { BASE_NAME, BASE_NAME + "_ja", BASE_NAME + "_ja_JP", BASE_NAME + "_ja_JP_WIN" });
    assertEquals(expected, java.util.Arrays.asList(bundleNames));
    // 言語��リアント
    bundleNames = MessageResourceBundleFactory.calcurateBundleNames(BASE_NAME, new Locale("ja", "", "WIN"));
    expected = java.util.Arrays.asList(new String[] { BASE_NAME, BASE_NAME + "_ja", BASE_NAME + "_ja__WIN" });
    assertEquals(expected, java.util.Arrays.asList(bundleNames));
    // 国��リアント
    bundleNames = MessageResourceBundleFactory.calcurateBundleNames(BASE_NAME, new Locale("", "JP", "WIN"));
    expected = java.util.Arrays.asList(new String[] { BASE_NAME, BASE_NAME + "__JP", BASE_NAME + "__JP_WIN" });
    assertEquals(expected, java.util.Arrays.asList(bundleNames));
    // 国��
    bundleNames = MessageResourceBundleFactory.calcurateBundleNames(BASE_NAME, new Locale("", "JP"));
    expected = java.util.Arrays.asList(new String[] { BASE_NAME, BASE_NAME + "__JP" });
    assertEquals(expected, java.util.Arrays.asList(bundleNames));
    // �リアント��
    bundleNames = MessageResourceBundleFactory.calcurateBundleNames(BASE_NAME, new Locale("", "", "WIN"));
    expected = java.util.Arrays.asList(new String[] { BASE_NAME, BASE_NAME + "___WIN" });
    assertEquals(expected, java.util.Arrays.asList(bundleNames));
}
Example 9
Project: JaMoPP-master  File: JaMoPPDocumentation.java View source code
@SuppressWarnings("unused")
public void generateDocumentation() throws Exception {
    int dummyVar;
    // generated code will be inserted here
    // The code in this method is generated from: /org.emftext.language.java.doc/src/org/emftext/language/java/doc/JaMoPPDocumentation.natspec
    // Never change this method or any contents of this file, all local changes will be overwritten.
    // Change _NatSpecTemplate.java instead.
    // Documentation - JaMoPP User Guide
    de.devboost.natspec.library.documentation.Documentation documentation_JaMoPP_User_Guide = documentationSupport.initDocumentation(java.util.Arrays.asList(new java.lang.String[] { "JaMoPP", "User", "Guide" }));
    // Section - Overview
    de.devboost.natspec.library.documentation.Section section_Overview = documentationSupport.addSection(java.util.Arrays.asList(new java.lang.String[] { "Overview" }), documentation_JaMoPP_User_Guide);
    // JaMoPP is a tool...
    de.devboost.natspec.library.documentation.Line line_JaMoPP_is_a_tool___ = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "JaMoPP", "is", "a", "tool..." }), section_Overview);
    // Subsection - Java API
    de.devboost.natspec.library.documentation.Subsection subsection_Java_API = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Java", "API" }), section_Overview);
    // Subsection - Model API
    de.devboost.natspec.library.documentation.Subsection subsection_Model_API = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Model", "API" }), section_Overview);
    // EMOF / Ecore
    de.devboost.natspec.library.documentation.Line line_EMOF___Ecore = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "EMOF", "/", "Ecore" }), subsection_Model_API);
    // Paragraph PackageReference
    de.devboost.natspec.library.documentation.Paragraph paragraph_PackageReference = documentationSupport.createParagraphWithHeading(java.util.Arrays.asList(new java.lang.String[] { "PackageReference" }), subsection_Model_API);
    // Model elements of type 'PackageReference' are used as target elements for
    de.devboost.natspec.library.documentation.Line line_Model_elements_of_type__PackageReference__are_used_as_target_elements_for = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "Model", "elements", "of", "type", "'PackageReference'", "are", "used", "as", "target", "elements", "for" }), paragraph_PackageReference);
    // references that point to packages. For example, consider the following code:
    de.devboost.natspec.library.documentation.Line line_references_that_point_to_packages__For_example__consider_the_following_code_ = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "references", "that", "point", "to", "packages.", "For", "example,", "consider", "the", "following", "code:" }), paragraph_PackageReference);
    // Code new com.ClassOrPackage.ClassOrInnerClass();
    de.devboost.natspec.library.documentation.Code code_new_com_ClassOrPackage_ClassOrInnerClass___ = documentationSupport.code(new java.lang.StringBuilder().append("new").append(" ").append("com.ClassOrPackage.ClassOrInnerClass();").toString(), paragraph_PackageReference);
    // While parsing the code, it is not known whether 'ClassOrPackage' is a class or
    de.devboost.natspec.library.documentation.Line line_While_parsing_the_code__it_is_not_known_whether__ClassOrPackage__is_a_class_or = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "While", "parsing", "the", "code,", "it", "is", "not", "known", "whether", "'ClassOrPackage'", "is", "a", "class", "or" }), paragraph_PackageReference);
    // a package. Therefore, the parser creates an element of type 'ElementReference'
    de.devboost.natspec.library.documentation.Line line_a_package__Therefore__the_parser_creates_an_element_of_type__ElementReference_ = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "a", "package.", "Therefore,", "the", "parser", "creates", "an", "element", "of", "type", "'ElementReference'" }), paragraph_PackageReference);
    // for each of the parts of the fully qualified name.
    de.devboost.natspec.library.documentation.Line line_for_each_of_the_parts_of_the_fully_qualified_name_ = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "for", "each", "of", "the", "parts", "of", "the", "fully", "qualified", "name." }), paragraph_PackageReference);
    // Paragraph
    de.devboost.natspec.library.documentation.Paragraph paragraph_ = documentationSupport.createParagraphWithHeading(java.util.Arrays.asList(new java.lang.String[] {}), subsection_Model_API);
    // While resolving references, the information whether such an element is a class
    de.devboost.natspec.library.documentation.Line line_While_resolving_references__the_information_whether_such_an_element_is_a_class = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "While", "resolving", "references,", "the", "information", "whether", "such", "an", "element", "is", "a", "class" }), paragraph_);
    // or a package is available. If it turns out that that elements are packages
    de.devboost.natspec.library.documentation.Line line_or_a_package_is_available__If_it_turns_out_that_that_elements_are_packages = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "or", "a", "package", "is", "available.", "If", "it", "turns", "out", "that", "that", "elements", "are", "packages" }), paragraph_);
    // (because there is a class 'ClassOrInnerClass' within package
    de.devboost.natspec.library.documentation.Line line__because_there_is_a_class__ClassOrInnerClass__within_package = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "(because", "there", "is", "a", "class", "'ClassOrInnerClass'", "within", "package" }), paragraph_);
    // 'com.ClassOrPackage' on the class path) the reference 'target' of
    de.devboost.natspec.library.documentation.Line line__com_ClassOrPackage__on_the_class_path__the_reference__target__of = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "'com.ClassOrPackage'", "on", "the", "class", "path)", "the", "reference", "'target'", "of" }), paragraph_);
    // 'ElementReference' must point to a 'PackageReference'. In this case,
    de.devboost.natspec.library.documentation.Line line__ElementReference__must_point_to_a__PackageReference___In_this_case_ = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "'ElementReference'", "must", "point", "to", "a", "'PackageReference'.", "In", "this", "case," }), paragraph_);
    // 'PackageReferences' are created on demand and they are stored in the root of the
    de.devboost.natspec.library.documentation.Line line__PackageReferences__are_created_on_demand_and_they_are_stored_in_the_root_of_the = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "'PackageReferences'", "are", "created", "on", "demand", "and", "they", "are", "stored", "in", "the", "root", "of", "the" }), paragraph_);
    // respective resource.
    de.devboost.natspec.library.documentation.Line line_respective_resource_ = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "respective", "resource." }), paragraph_);
    // Paragraph
    de.devboost.natspec.library.documentation.Paragraph paragraph_0 = documentationSupport.createParagraphWithHeading(java.util.Arrays.asList(new java.lang.String[] {}), subsection_Model_API);
    // Note that there is no model element 'Package' because Java package do not
    de.devboost.natspec.library.documentation.Line line_Note_that_there_is_no_model_element__Package__because_Java_package_do_not = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "Note", "that", "there", "is", "no", "model", "element", "'Package'", "because", "Java", "package", "do", "not" }), paragraph_0);
    // correspond to resource (i.e, files).
    de.devboost.natspec.library.documentation.Line line_correspond_to_resource__i_e__files__ = documentationSupport.createPlainContents(java.util.Arrays.asList(new String[] { "correspond", "to", "resource", "(i.e,", "files)." }), paragraph_0);
    // Subsection - XML API
    de.devboost.natspec.library.documentation.Subsection subsection_XML_API = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "XML", "API" }), section_Overview);
    // Subsection - Building Java Extensions
    de.devboost.natspec.library.documentation.Subsection subsection_Building_Java_Extensions = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Building", "Java", "Extensions" }), section_Overview);
    // Section - Setup
    de.devboost.natspec.library.documentation.Section section_Setup = documentationSupport.addSection(java.util.Arrays.asList(new java.lang.String[] { "Setup" }), documentation_JaMoPP_User_Guide);
    // Subsection - Setting up Stand-alone Applications
    de.devboost.natspec.library.documentation.Subsection subsection_Setting_up_Stand_alone_Applications = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Setting", "up", "Stand-alone", "Applications" }), section_Setup);
    // Subsection - Loading and Saving Java Models
    de.devboost.natspec.library.documentation.Subsection subsection_Loading_and_Saving_Java_Models = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Loading", "and", "Saving", "Java", "Models" }), section_Setup);
    // Subsection - Integrating into the Eclipse IDE
    de.devboost.natspec.library.documentation.Subsection subsection_Integrating_into_the_Eclipse_IDE = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Integrating", "into", "the", "Eclipse", "IDE" }), section_Setup);
    // Subsection - Integrating into Continuous Integration Systems
    de.devboost.natspec.library.documentation.Subsection subsection_Integrating_into_Continuous_Integration_Systems = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Integrating", "into", "Continuous", "Integration", "Systems" }), section_Setup);
    // Section - XMI
    de.devboost.natspec.library.documentation.Section section_XMI = documentationSupport.addSection(java.util.Arrays.asList(new java.lang.String[] { "XMI" }), documentation_JaMoPP_User_Guide);
    // Subsection - Translating Java Code to XMI/XML
    de.devboost.natspec.library.documentation.Subsection subsection_Translating_Java_Code_to_XMI_XML = documentationSupport.addSubsection(java.util.Arrays.asList(new java.lang.String[] { "Translating", "Java", "Code", "to", "XMI/XML" }), section_XMI);
    // Section - Base API
    de.devboost.natspec.library.documentation.Section section_Base_API = documentationSupport.addSection(java.util.Arrays.asList(new java.lang.String[] { "Base", "API" }), documentation_JaMoPP_User_Guide);
    // Section - Utility API
    de.devboost.natspec.library.documentation.Section section_Utility_API = documentationSupport.addSection(java.util.Arrays.asList(new java.lang.String[] { "Utility", "API" }), documentation_JaMoPP_User_Guide);
    // Section - Extended Navigation API
    de.devboost.natspec.library.documentation.Section section_Extended_Navigation_API = documentationSupport.addSection(java.util.Arrays.asList(new java.lang.String[] { "Extended", "Navigation", "API" }), documentation_JaMoPP_User_Guide);
    // Section - Extended Modification API
    de.devboost.natspec.library.documentation.Section section_Extended_Modification_API = documentationSupport.addSection(java.util.Arrays.asList(new java.lang.String[] { "Extended", "Modification", "API" }), documentation_JaMoPP_User_Guide);
}
Example 10
Project: library-master  File: Storage.java View source code
private double computeAverage(long[] values, boolean percent) {
    java.util.Arrays.sort(values);
    int limit = 0;
    if (percent) {
        limit = values.length / 10;
    }
    long count = 0;
    for (int i = limit; i < values.length - limit; i++) {
        count = count + values[i];
    }
    return (double) count / (double) (values.length - 2 * limit);
}
Example 11
Project: zstack-master  File: APIQueryVirtualRouterVmReply.java View source code
public static APIQueryVirtualRouterVmReply __example__() {
    APIQueryVirtualRouterVmReply reply = new APIQueryVirtualRouterVmReply();
    VirtualRouterVmInventory vr = new VirtualRouterVmInventory();
    vr.setName("Test-Router");
    vr.setDescription("this is a virtual router vm");
    vr.setClusterUuid(uuid());
    vr.setImageUuid(uuid());
    vr.setInstanceOfferingUuid(uuid());
    vr.setManagementNetworkUuid(uuid());
    vr.setPublicNetworkUuid(uuid());
    reply.setInventories(Arrays.asList(vr));
    return reply;
}
Example 12
Project: 99-problems-master  File: Problem4_6.java View source code
public static boolean findPair(int[] s1, int[] s2, int x) {
    /*
            Sort one array let say s2
            for each el in s1
               do a binary search in s2 for x-el
               if found return el and (x-el)
         */
    Arrays.sort(s2);
    for (int f : s1) {
        int s = x - f;
        if (Arrays.binarySearch(s2, s) >= 0) {
            return true;
        }
    }
    return false;
}
Example 13
Project: AlgoDS-master  File: Factorials.java View source code
public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    String s = in.nextLine();
    int num = Integer.parseInt(s.split(" ")[0]);
    int marks = s.split(" ")[1].length();
    long sum = 1;
    for (int i = num; i > 0; i -= marks) {
        sum *= i;
    }
    System.out.println(sum);
    Arrays.stream(new int[] {}).sum();
}
Example 14
Project: Algorithms-and-Data-Structures-in-Java-master  File: CountSmallerElementsOnRHS.java View source code
public static void main(String a[]) {
    System.out.println(Arrays.toString(getSmallerElementsCountOnRHSNaive(new int[] { 12, 1, 2, 3, 0, 11, 4 })));
    System.out.println(Arrays.toString(getSmallerElementsCountOnRHSNaive(new int[] { 5, 4, 3, 2, 1 })));
    System.out.println(Arrays.toString(getSmallerElementsCountOnRHSNaive(new int[] { 1, 2, 3, 4, 5 })));
}
Example 15
Project: android-runtime-master  File: Main.java View source code
public static void main(String[] args) throws IOException {
    if (args.length < 3) {
        throw new IllegalArgumentException("Expects at least three arguments");
    }
    String inputBindingFilename = args[0];
    String outputDir = args[1];
    String[] libs = Arrays.copyOfRange(args, 2, args.length);
    new Generator(outputDir, libs).writeBindings(inputBindingFilename);
}
Example 16
Project: aranea-master  File: Configuration.java View source code
@Bean(name = "exposedBeanNames")
public List<String> exposedBeanNames() {
    return Arrays.asList("authenticationManager", "compass", "transactionManager", "validator", "mailCleaner", "personsEditor", "timeEditor", "sectionEditor", "calendarEditor", "checkBoxEditor", "rolesEditor", "tagsEditor", "pageImageService", "imageCaptchaService", "mailSender", "imageDirectory");
}
Example 17
Project: basic-algorithm-operations-master  File: Question.java View source code
public static void main(String[] args) {
    String[] array = { "apple", "banana", "carrot", "ele", "duck", "papel", "tarroc", "cudk", "eel", "lee" };
    System.out.println(AssortedMethods.stringArrayToString(array));
    Arrays.sort(array, new AnagramComparator());
    System.out.println(AssortedMethods.stringArrayToString(array));
}
Example 18
Project: ChipsLayoutManager-master  File: GravityDataProvider.java View source code
static Collection<Object[]> getInvalidGravityModifierParams() {
    return Arrays.asList(new Object[][] { //start lower than minStart
    { INVALID, 0, 100, new Rect(0, -50, 0, 0), new Rect(0, 0, 0, 0) }, //start lower than minStart
    { INVALID, 20, 100, new Rect(0, 10, 0, 0), new Rect(0, 0, 0, 0) }, //end bigger than maxEnd
    { INVALID, 20, 100, new Rect(0, 20, 0, 120), new Rect(0, 0, 0, 0) } });
}
Example 19
Project: coding2017-master  File: MiniJVM.java View source code
public void run(String[] classpath, String className) throws Exception {
    ClassFileLoader loader = new ClassFileLoader();
    Arrays.stream(classpath).forEach(loader::addClassPath);
    MethodArea methodArea = MethodArea.getInstance();
    methodArea.setClassFileLoader(loader);
    ExecutorEngine executorEngine = new ExecutorEngine();
    executorEngine.execute(methodArea.getMainMethod(className.replaceAll("\\.", "/")));
}
Example 20
Project: CtCI-6th-Edition-master  File: QuestionA.java View source code
public static int[] smallestK(int[] array, int k) {
    if (k <= 0 || k > array.length) {
        throw new IllegalArgumentException();
    }
    /* Sort array. */
    Arrays.sort(array);
    /* Copy first k elements. */
    int[] smallest = new int[k];
    for (int i = 0; i < k; i++) {
        smallest[i] = array[i];
    }
    return smallest;
}
Example 21
Project: ctci-master  File: Question.java View source code
public static void printPairSums(int[] array, int sum) {
    Arrays.sort(array);
    int first = 0;
    int last = array.length - 1;
    while (first < last) {
        int s = array[first] + array[last];
        if (s == sum) {
            System.out.println(array[first] + " " + array[last]);
            ++first;
            --last;
        } else {
            if (s < sum) {
                ++first;
            } else {
                --last;
            }
        }
    }
}
Example 22
Project: distributed-session-manager-master  File: SessionPersistPolicy.java View source code
public static SessionPersistPolicy fromName(String name) {
    for (SessionPersistPolicy policy : SessionPersistPolicy.values()) {
        if (policy.name().equalsIgnoreCase(name)) {
            return policy;
        }
    }
    throw new IllegalArgumentException("Invalid session persist policy [" + name + "]. Must be one of " + Arrays.asList(SessionPersistPolicy.values()) + ".");
}
Example 23
Project: dwoss-master  File: LastCharSorterTest.java View source code
@Test
public void testSorter() {
    List<String> unsorted = Arrays.asList("11118", "11111", "11117", "11113", "11112", "11115", "71116", "11119", "31110", "51114");
    List<String> sorted = Arrays.asList("31110", "11111", "11112", "11113", "51114", "11115", "71116", "11117", "11118", "11119");
    Collections.sort(unsorted, new LastCharSorter());
    assertEquals(sorted, unsorted);
}
Example 24
Project: EasyMPermission-master  File: EqualsAndHashCodeWithOnParam.java View source code
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public boolean equals(@Nullable final java.lang.Object o) {
    if ((o == this))
        return true;
    if ((!(o instanceof EqualsAndHashCodeWithOnParam)))
        return false;
    final EqualsAndHashCodeWithOnParam other = (EqualsAndHashCodeWithOnParam) o;
    if ((!other.canEqual((java.lang.Object) this)))
        return false;
    if ((this.x != other.x))
        return false;
    if ((!java.util.Arrays.equals(this.y, other.y)))
        return false;
    if ((!java.util.Arrays.deepEquals(this.z, other.z)))
        return false;
    final java.lang.Object this$a = this.a;
    final java.lang.Object other$a = other.a;
    if (((this$a == null) ? (other$a != null) : (!this$a.equals(other$a))))
        return false;
    final java.lang.Object this$b = this.b;
    final java.lang.Object other$b = other.b;
    if (((this$b == null) ? (other$b != null) : (!this$b.equals(other$b))))
        return false;
    return true;
}
Example 25
Project: fb-contrib-eclipse-quick-fixes-master  File: FormatStringBugs.java View source code
public String stuff(String[] args, String thing) {
    System.out.printf("%s%n", Arrays.toString(new int[] { 1, 2 }));
    System.out.printf("%s%n", thing);
    System.out.printf("%d %s %s %n", 5, Boolean.FALSE, thing);
    System.out.printf("%s%n", Arrays.toString(args));
    return String.format("%nSize: %d contents: %s %n", args.length, Arrays.asList(args));
}
Example 26
Project: featurehouse_fstcomp_examples-master  File: Main.java View source code
public void run() {
    boolean[] causesBirth = new boolean[9];
    boolean[] causesDeath = new boolean[9];
    Arrays.fill(causesDeath, true);
    causesDeath[2] = false;
    causesDeath[3] = false;
    causesBirth[3] = true;
    new GolView(new GODLModel(30, 30, new RuleSet(causesBirth, causesDeath))).setVisible(true);
}
Example 27
Project: hw-master  File: TestCorpusFreq.java View source code
public static void main(String[] args) {
    CaesarCipher c = new CaesarCipher();
    long t1 = System.nanoTime();
    c.buildcorpusFreqs("Pride_and_Prejudice.txt");
    long t2 = System.nanoTime();
    System.out.println(java.util.Arrays.toString(c.corpusFreqs));
    System.out.println("Time: " + (t2 - t1) + " ns / " + ((double) (t2 - t1) / 1000000) + " ms / " + ((double) (t2 - t1) / 1000000000) + " s");
}
Example 28
Project: intellij-community-master  File: beforeReducingMapping.java View source code
public static void main(String[] args) {
    List<String> input = Arrays.asList("a", "bbb", "cc", "ddd", "  x", "ee");
    Map<Integer, String> map = input.stream().collect(Collectors.gr < caret > oupingBy(String::length, Collectors.mapping(String::trim, Collectors.collectingAndThen(Collectors.reducing(( s1,  s2) -> s1.compareTo(s2) > 0 ? s1 : s2), Optional::get))));
    System.out.println(map);
}
Example 29
Project: JAVA-KOANS-master  File: AnonymousInnerClassTest.java View source code
@Test
public void testAnonymousInnerClassIsCoolToUseAsKoan() throws Exception {
    final String definitelyAUniqueString = "meh1294120240912049";
    stubAllKoans(Arrays.asList(new Object() {

        @Koan
        public void printMsg() {
            System.out.println(definitelyAUniqueString);
        }
    }));
    new CommandLineArgumentRunner().run();
    assertSystemOutContains(definitelyAUniqueString);
}
Example 30
Project: Java8InAction-master  File: Laziness.java View source code
public static void main(String[] args) {
    List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);
    List<Integer> twoEvenSquares = numbers.stream().filter( n -> {
        System.out.println("filtering " + n);
        return n % 2 == 0;
    }).map( n -> {
        System.out.println("mapping " + n);
        return n * n;
    }).limit(2).collect(toList());
}
Example 31
Project: JavaSE6Tutorial-master  File: NewArraysDemo.java View source code
public static void main(String args[]) {
    int[][] arr1 = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
    int[][] arr2 = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
    int[][] arr3 = { { 0, 1, 3 }, { 4, 6, 4 }, { 7, 8, 9 } };
    System.out.println("arr1 內容等於 arr2 ? " + Arrays.deepEquals(arr1, arr2));
    System.out.println("arr1 內容等於 arr3 ? " + Arrays.deepEquals(arr1, arr3));
    System.out.println("arr1 deepToString()\n\t" + Arrays.deepToString(arr1));
}
Example 32
Project: json-collection-master  File: DataContainerTest.java View source code
@Test
public void replaceFooPropertiesInTemplate() throws Exception {
    Template template = Template.create(Arrays.asList(Property.template("foo"), Property.template("bar")));
    Property replacedFooProperty = Property.value("foo", Value.of("Hello"));
    Template replaced = template.replace(replacedFooProperty);
    assertNotSame(template, replaced);
    assertEquals(replacedFooProperty, replaced.getDataAsMap().get("foo"));
}
Example 33
Project: koa-master  File: AnonymousInnerClassTest.java View source code
@Test
public void testAnonymousInnerClassIsCoolToUseAsKoan() throws Exception {
    final String definitelyAUniqueString = "meh1294120240912049";
    stubAllKoans(Arrays.asList(new Object() {

        @Koan
        public void printMsg() {
            System.out.println(definitelyAUniqueString);
        }
    }));
    new CommandLineArgumentRunner().run();
    assertSystemOutContains(definitelyAUniqueString);
}
Example 34
Project: lombok-master  File: EqualsAndHashCodeWithOnParam.java View source code
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public boolean equals(@Nullable final java.lang.Object o) {
    if ((o == this))
        return true;
    if ((!(o instanceof EqualsAndHashCodeWithOnParam)))
        return false;
    final EqualsAndHashCodeWithOnParam other = (EqualsAndHashCodeWithOnParam) o;
    if ((!other.canEqual((java.lang.Object) this)))
        return false;
    if ((this.x != other.x))
        return false;
    if ((!java.util.Arrays.equals(this.y, other.y)))
        return false;
    if ((!java.util.Arrays.deepEquals(this.z, other.z)))
        return false;
    final java.lang.Object this$a = this.a;
    final java.lang.Object other$a = other.a;
    if (((this$a == null) ? (other$a != null) : (!this$a.equals(other$a))))
        return false;
    final java.lang.Object this$b = this.b;
    final java.lang.Object other$b = other.b;
    if (((this$b == null) ? (other$b != null) : (!this$b.equals(other$b))))
        return false;
    return true;
}
Example 35
Project: mldht-master  File: SortedCoWSet.java View source code
public boolean add(T toAdd) {
    synchronized (copyOnWriteLock) {
        int insertIndex = java.util.Arrays.binarySearch(storage, toAdd, comparator);
        if (insertIndex >= 0) {
            // already present
            return false;
        }
        insertIndex = -(insertIndex + 1);
        T[] newStorage = java.util.Arrays.copyOf(storage, storage.length + 1);
        if (newStorage.length > 1)
            System.arraycopy(newStorage, insertIndex, newStorage, insertIndex + 1, newStorage.length - insertIndex - 1);
        newStorage[insertIndex] = toAdd;
        storage = newStorage;
    }
    return true;
}
Example 36
Project: oreva-master  File: ParameterizedTestHelper.java View source code
public static List<Object[]> addVariants(List<Object[]> parametersList, Object... variants) {
    List<Object[]> newParametersList = new ArrayList<Object[]>();
    for (Object[] parameters : parametersList) {
        int newParametersLength = parameters.length + 1;
        for (Object variant : variants) {
            Object[] newParameters = Arrays.copyOf(parameters, newParametersLength);
            newParameters[newParametersLength - 1] = variant;
            newParametersList.add(newParameters);
        }
    }
    return newParametersList;
}
Example 37
Project: PlotSquared-master  File: ArrayUtil.java View source code
public static final <T> T[] concatAll(T[] first, T[]... rest) {
    int totalLength = first.length;
    for (T[] array : rest) {
        totalLength += array.length;
    }
    T[] result = Arrays.copyOf(first, totalLength);
    int offset = first.length;
    for (T[] array : rest) {
        System.arraycopy(array, 0, result, offset, array.length);
        offset += array.length;
    }
    return result;
}
Example 38
Project: Robin-Client-master  File: LocaleUtils.java View source code
public static List<Locale> getSortedAvailableLocales() {
    List<Locale> result = Arrays.asList(Locale.getAvailableLocales());
    Collections.sort(result, new Comparator<Locale>() {

        @Override
        public int compare(Locale lhs, Locale rhs) {
            return lhs.getDisplayName().compareTo(rhs.getDisplayName());
        }
    });
    return result;
}
Example 39
Project: SimpleFlatMapper-master  File: ImmutableSetCollectorTest.java View source code
@Test
public void testCreateSet() {
    ImmutableSetCollector<String> collectorHandler = new ImmutableSetCollector<String>();
    collectorHandler.accept("1");
    collectorHandler.accept("2");
    collectorHandler.accept("3");
    assertEquals(new HashSet<String>(Arrays.asList("1", "2", "3")), collectorHandler.getSet());
    try {
        collectorHandler.getSet().add("3");
        fail();
    } catch (UnsupportedOperationException e) {
    }
}
Example 40
Project: Sizzle-master  File: TestSizzleStringIntrinsics.java View source code
@Test
public void testSizzleStringIntrinsicsSplitCsvLine() {
    final byte[][] splitCsvLine = SizzleStringIntrinsics.splitCsvLine("abc,1".getBytes());
    final byte[][] expected = new byte[2][];
    expected[0] = "abc".getBytes();
    expected[1] = "1".getBytes();
    Assert.assertEquals("length is incorrect", 2, splitCsvLine.length);
    Assert.assertTrue("not equal", Arrays.equals(expected[0], splitCsvLine[0]));
    Assert.assertTrue("not equal", Arrays.equals(expected[1], splitCsvLine[1]));
}
Example 41
Project: swagger-core-master  File: ReaderExtensionsTest.java View source code
@Test
public void getExtensionsTest() {
    final List<ReaderExtension> extensions = ReaderExtensions.getExtensions();
    Assert.assertEquals(extensions.size(), 3);
    final List<Integer> originalPriority = new ArrayList<Integer>();
    for (ReaderExtension extension : extensions) {
        originalPriority.add(extension.getPriority());
    }
    Assert.assertEquals(originalPriority, Arrays.asList(0, 10, 20));
}
Example 42
Project: tutorial-master  File: NewArraysDemo.java View source code
public static void main(String args[]) {
    int[][] arr1 = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
    int[][] arr2 = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
    int[][] arr3 = { { 0, 1, 3 }, { 4, 6, 4 }, { 7, 8, 9 } };
    System.out.println("arr1 內容等於 arr2 ? " + Arrays.deepEquals(arr1, arr2));
    System.out.println("arr1 內容等於 arr3 ? " + Arrays.deepEquals(arr1, arr3));
    System.out.println("arr1 deepToString()\n\t" + Arrays.deepToString(arr1));
}
Example 43
Project: Work_book-master  File: EmployeeSortTest.java View source code
public static void main(String[] args) {
    Employee[] staff = new Employee[3];
    staff[0] = new Employee("Harry Hacker", 35000);
    staff[1] = new Employee("Carl Cracker", 75000);
    staff[2] = new Employee("Tony Tester", 38000);
    Arrays.sort(staff);
    System.out.println(staff[0].compareTo(staff[1]));
    //Afisarea informatiei despre toate obiectele Employee
    for (Employee e : staff) {
        System.out.println("name=" + e.getName() + ",salary=" + e.getSalary());
    }
}
Example 44
Project: yoursway-commons-master  File: Assert.java View source code
public static void assertion(boolean condition, String message) {
    if (condition)
        return;
    AssertionError error = new AssertionError(message);
    List<StackTraceElement> list = Arrays.asList(error.getStackTrace());
    List<StackTraceElement> subList = list.subList(1, list.size());
    StackTraceElement[] trace = subList.toArray(new StackTraceElement[list.size() - 1]);
    error.setStackTrace(trace);
    error.printStackTrace(System.err);
}
Example 45
Project: android-sdk-sources-for-api-level-23-master  File: ArraysTest.java View source code
/**
     * java.util.Arrays#asList(java.lang.Object[])
     */
public void test_asList$Ljava_lang_Object() {
    // Test for method java.util.List
    // java.util.Arrays.asList(java.lang.Object [])
    List convertedList = Arrays.asList(objectArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == objectArray[counter]);
    }
    convertedList.set(50, new Integer(1000));
    assertTrue("set/get did not work on coverted list", convertedList.get(50).equals(new Integer(1000)));
    convertedList.set(50, new Integer(50));
    new Support_UnmodifiableCollectionTest("", convertedList).runTest();
    Object[] myArray = (Object[]) (objectArray.clone());
    myArray[30] = null;
    myArray[60] = null;
    convertedList = Arrays.asList(myArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == myArray[counter]);
    }
    try {
        Arrays.asList((Object[]) null);
        fail("asList with null arg didn't throw NPE");
    } catch (NullPointerException e) {
    }
}
Example 46
Project: ARTPart-master  File: ArraysTest.java View source code
/**
     * java.util.Arrays#asList(java.lang.Object[])
     */
public void test_asList$Ljava_lang_Object() {
    // Test for method java.util.List
    // java.util.Arrays.asList(java.lang.Object [])
    List convertedList = Arrays.asList(objectArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == objectArray[counter]);
    }
    convertedList.set(50, new Integer(1000));
    assertTrue("set/get did not work on coverted list", convertedList.get(50).equals(new Integer(1000)));
    convertedList.set(50, new Integer(50));
    new Support_UnmodifiableCollectionTest("", convertedList).runTest();
    Object[] myArray = (Object[]) (objectArray.clone());
    myArray[30] = null;
    myArray[60] = null;
    convertedList = Arrays.asList(myArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == myArray[counter]);
    }
    try {
        Arrays.asList((Object[]) null);
        fail("asList with null arg didn't throw NPE");
    } catch (NullPointerException e) {
    }
}
Example 47
Project: android-libcore64-master  File: ArraysTest.java View source code
/**
     * java.util.Arrays#asList(java.lang.Object[])
     */
public void test_asList$Ljava_lang_Object() {
    // Test for method java.util.List
    // java.util.Arrays.asList(java.lang.Object [])
    List convertedList = Arrays.asList(objectArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == objectArray[counter]);
    }
    convertedList.set(50, new Integer(1000));
    assertTrue("set/get did not work on coverted list", convertedList.get(50).equals(new Integer(1000)));
    convertedList.set(50, new Integer(50));
    new Support_UnmodifiableCollectionTest("", convertedList).runTest();
    Object[] myArray = (Object[]) (objectArray.clone());
    myArray[30] = null;
    myArray[60] = null;
    convertedList = Arrays.asList(myArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == myArray[counter]);
    }
    try {
        Arrays.asList((Object[]) null);
        fail("asList with null arg didn't throw NPE");
    } catch (NullPointerException e) {
    }
}
Example 48
Project: android_libcore-master  File: ArraysTest.java View source code
/**
     * @tests java.util.Arrays#asList(java.lang.Object[])
     */
@TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "asList", args = { java.lang.Object[].class })
public void test_asList$Ljava_lang_Object() {
    // Test for method java.util.List
    // java.util.Arrays.asList(java.lang.Object [])
    List convertedList = Arrays.asList(objectArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == objectArray[counter]);
    }
    convertedList.set(50, new Integer(1000));
    assertTrue("set/get did not work on coverted list", convertedList.get(50).equals(new Integer(1000)));
    convertedList.set(50, new Integer(50));
    new Support_UnmodifiableCollectionTest("", convertedList).runTest();
    Object[] myArray = (Object[]) (objectArray.clone());
    myArray[30] = null;
    myArray[60] = null;
    convertedList = Arrays.asList(myArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == myArray[counter]);
    }
    try {
        Arrays.asList((Object[]) null);
        fail("asList with null arg didn't throw NPE");
    } catch (NullPointerException e) {
    }
}
Example 49
Project: android_platform_libcore-master  File: ArraysTest.java View source code
/**
     * java.util.Arrays#asList(java.lang.Object[])
     */
public void test_asList$Ljava_lang_Object() {
    // Test for method java.util.List
    // java.util.Arrays.asList(java.lang.Object [])
    List convertedList = Arrays.asList(objectArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == objectArray[counter]);
    }
    convertedList.set(50, new Integer(1000));
    assertTrue("set/get did not work on coverted list", convertedList.get(50).equals(new Integer(1000)));
    convertedList.set(50, new Integer(50));
    new Support_UnmodifiableCollectionTest("", convertedList).runTest();
    Object[] myArray = (Object[]) (objectArray.clone());
    myArray[30] = null;
    myArray[60] = null;
    convertedList = Arrays.asList(myArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == myArray[counter]);
    }
    try {
        Arrays.asList((Object[]) null);
        fail("asList with null arg didn't throw NPE");
    } catch (NullPointerException e) {
    }
}
Example 50
Project: robovm-master  File: ArraysTest.java View source code
/**
     * java.util.Arrays#asList(java.lang.Object[])
     */
public void test_asList$Ljava_lang_Object() {
    // Test for method java.util.List
    // java.util.Arrays.asList(java.lang.Object [])
    List convertedList = Arrays.asList(objectArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == objectArray[counter]);
    }
    convertedList.set(50, new Integer(1000));
    assertTrue("set/get did not work on coverted list", convertedList.get(50).equals(new Integer(1000)));
    convertedList.set(50, new Integer(50));
    new Support_UnmodifiableCollectionTest("", convertedList).runTest();
    Object[] myArray = (Object[]) (objectArray.clone());
    myArray[30] = null;
    myArray[60] = null;
    convertedList = Arrays.asList(myArray);
    for (int counter = 0; counter < arraySize; counter++) {
        assertTrue("Array and List converted from array do not contain identical elements", convertedList.get(counter) == myArray[counter]);
    }
    try {
        Arrays.asList((Object[]) null);
        fail("asList with null arg didn't throw NPE");
    } catch (NullPointerException e) {
    }
}
Example 51
Project: Aspose_Email_Java-master  File: RetreiveExtAttributesForCalendarItems.java View source code
public static void RetreiveExtAttributesForCalendarItems() {
    //ExStart: RetreiveExtAttributesForCalendarItems
    IEWSClient client = EWSClient.getEWSClient("https://exchange.office365.com/Exchange.asmx", "username", "password");
    java.util.List<String> uriList = java.util.Arrays.asList(client.listItems(client.getMailboxInfo().getCalendarUri()));
    //Define the Extended Attribute Property Descriptor for searching purpose
    //In this case, we have a K1 Long named property for Calendar item
    UUID uuid = UUID.fromString("00020329-0000-0000-C000-000000000046");
    PropertyDescriptor propertyDescriptor = new PidNamePropertyDescriptor("K1", PropertyDataType.Integer32, uuid);
    java.util.List<PropertyDescriptor> propertyDescriptors = java.util.Arrays.asList(new PropertyDescriptor[] { propertyDescriptor });
    IGenericList<MapiCalendar> mapiCalendarList = client.fetchMapiCalendar(uriList, propertyDescriptors);
    for (MapiCalendar cal : mapiCalendarList) {
        for (MapiNamedProperty namedProperty : (Iterable<MapiNamedProperty>) cal.getNamedProperties().getValues()) {
            System.out.println(namedProperty.getNameId() + " = " + namedProperty.getInt32());
        }
    }
//ExEnd: RetreiveExtAttributesForCalendarItems
}
Example 52
Project: blizzys-backup-master  File: Public.java View source code
@Override
public final java.util.List<org.jooq.Sequence<?>> getSequences() {
    return java.util.Arrays.<org.jooq.Sequence<?>>asList(de.blizzy.backup.database.schema.Sequences.SYSTEM_SEQUENCE_272ECCB1_C60B_481D_A120_FE6BE013F157, de.blizzy.backup.database.schema.Sequences.SYSTEM_SEQUENCE_3DB333FB_C924_4A63_B127_4D4510874A0B, de.blizzy.backup.database.schema.Sequences.SYSTEM_SEQUENCE_4E57D207_CE3B_4692_8806_5237E4801233);
}
Example 53
Project: carrot2-master  File: PrimeFinder.java View source code
public static int nextPrime(int desiredCapacity) {
    int i = java.util.Arrays.binarySearch(primeCapacities, desiredCapacity);
    if (i < 0) {
        // desired capacity not found, choose next prime greater than desired capacity
        // remember the semantics of binarySearch...
        i = -i - 1;
    }
    return primeCapacities[i];
}
Example 54
Project: java-8-lambdas-exercises-master  File: RefactorTest.java View source code
@Test
public void allStringJoins() {
    List<Supplier<Refactor.LongTrackFinder>> finders = Arrays.<Supplier<Refactor.LongTrackFinder>>asList(Refactor.Step0::new, Refactor.Step1::new, Refactor.Step2::new, Refactor.Step3::new, Refactor.Step4::new);
    List<Album> albums = unmodifiableList(asList(SampleData.aLoveSupreme, SampleData.sampleShortAlbum));
    List<Album> noTracks = unmodifiableList(asList(SampleData.sampleShortAlbum));
    finders.forEach( finder -> {
        System.out.println("Testing: " + finder.toString());
        Refactor.LongTrackFinder longTrackFinder = finder.get();
        Set<String> longTracks = longTrackFinder.findLongTracks(albums);
        assertEquals("[Acknowledgement, Resolution]", longTracks.toString());
        longTracks = longTrackFinder.findLongTracks(noTracks);
        assertTrue(longTracks.isEmpty());
    });
}
Example 55
Project: abmash-master  File: LinkPredicate.java View source code
@Override
public void buildCommands() {
    List<String> linkSelectors = Arrays.asList("a");
    JQuery linkQuery = JQueryFactory.select("'" + StringUtils.join(linkSelectors, ',') + "'", 0);
    if (text != null) {
        containsText(linkQuery, text);
        containsAttribute(linkQuery, "*", text);
    } else {
        add(linkQuery.setWeight(50));
    }
}
Example 56
Project: ABRAID-MP-master  File: JsonFileUploadResponseTest.java View source code
@Test
public void constructorBindsFieldsCorrectly() {
    // Arrange
    String expectedStatus = "SUCCESS";
    List<String> expectedMessages = Arrays.asList("1", "2", "3");
    // Act
    JsonFileUploadResponse result = new JsonFileUploadResponse(expectedStatus.equals("SUCCESS"), expectedMessages);
    // Assert
    assertThat(result.getStatus()).isEqualTo(expectedStatus);
    assertThat(result.getMessages()).isEqualTo(expectedMessages);
}
Example 57
Project: addis-master  File: JGraphCoordinateAssignmentTest.java View source code
@Test
public void test() {
    int[] in = { 2, 2, 8, 8, 8, 8, 2, 3, 8, 2, 8, 2, 8, 8, 2, 8, 2, 2, 8, 2, 2, 3, 2, 2, 2, 2, 2, 8, 2, 8, 2, 2, 8, 2, 8, 8, 8, 8, 2, 8, 8 };
    int[] out = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
    final int n = in.length;
    JGraphCoordinateAssignment.WeightedCellSorter[] actual = new JGraphCoordinateAssignment.WeightedCellSorter[n];
    JGraphCoordinateAssignment.WeightedCellSorter[] expected = new JGraphCoordinateAssignment.WeightedCellSorter[n];
    for (int i = 0; i < n; ++i) {
        actual[i] = new JGraphCoordinateAssignment.WeightedCellSorter();
        actual[i].weightedValue = in[i];
        expected[i] = new JGraphCoordinateAssignment.WeightedCellSorter();
        expected[i].weightedValue = out[i];
    }
    Arrays.sort(actual);
    Assert.assertArrayEquals(expected, actual);
}
Example 58
Project: algorithmic-programming-master  File: Prob1_3_1_AreStringsPermutations.java View source code
/**
     * Run time complexity: O(n log n)
     * Space complexity: no extra space needed
     *
     * @param str1
     * @param str2
     * @return
     */
public static boolean checkIfPermutations(String str1, String str2) {
    if (str1.length() != str2.length())
        return false;
    char chars1[] = str1.toCharArray();
    char chars2[] = str2.toCharArray();
    Arrays.sort(chars1);
    Arrays.sort(chars2);
    for (int i = 0; i < str1.length(); i++) {
        if (chars1[i] != chars2[i])
            return false;
    }
    return true;
}
Example 59
Project: aliyun-odps-java-sdk-master  File: StructTypeInfoTest.java View source code
@Test
public void testName() {
    String[] names = { "name", "age", "parents" };
    TypeInfo[] infos = { TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.getArrayTypeInfo(TypeInfoFactory.getCharTypeInfo(20)) };
    StructTypeInfo structTypeInfo = TypeInfoFactory.getStructTypeInfo(Arrays.asList(names), Arrays.asList(infos));
    Assert.assertArrayEquals(names, structTypeInfo.getFieldNames().toArray());
    Assert.assertEquals("STRUCT<name:STRING,age:BIGINT,parents:ARRAY<CHAR(20)>>", structTypeInfo.getTypeName());
}
Example 60
Project: Amoeba-for-Aladdin-master  File: ArrayToString.java View source code
public static void main(String args[]) {
    int count = 10;
    byte[] arr = new byte[count];
    for (int i = 0; i < count; i++) {
        arr[i] |= (1 << (i & 7));
        System.out.print(arr[i] + " ");
    }
    System.out.println();
    System.out.println(Arrays.toString(arr));
//		int parameterCount = 12;
//        int nullCount = (parameterCount + 7) / 8;
//        byte[] nullBitsBuffer = new byte[nullCount];
//
//        for (int i = 0; i < parameterCount; i++) {
//            nullBitsBuffer[i] |= (1 << (i & 7));
//            System.out.print(nullBitsBuffer[i / 8]+" ");
//        }
//        System.out.println();
//        System.out.println(Arrays.toString(nullBitsBuffer));
}
Example 61
Project: amza-master  File: WALKeyTest.java View source code
@Test
public void testPrefixUpperExclusive() throws Exception {
    for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
        byte[] lower = new byte[] { 0, 0, 0, (byte) i };
        byte[] upper = WALKey.prefixUpperExclusive(lower);
        int c = KeyUtil.compare(lower, upper);
        Assert.assertTrue(c < 0, Arrays.toString(lower) + " vs " + Arrays.toString(upper) + " = " + c);
    }
}
Example 62
Project: AndroidScreencast-master  File: Main.java View source code
public static void main(String args[]) {
    LOGGER.debug("main(String[] args={}) - start", Arrays.toString(args));
    try {
        Application application = MainComponentProvider.mainComponent().application();
        application.init();
        application.start();
    } finally {
        LOGGER.debug("main(String[] args={}) - end", Arrays.toString(args));
    }
}
Example 63
Project: AppletIntegration-master  File: AppletIntegrationSampleUI.java View source code
@Override
protected void init(VaadinRequest request) {
    AppletIntegration applet = new AppletIntegration() {

        private static final long serialVersionUID = 1L;

        @Override
        public void attach() {
            setAppletArchives(Arrays.asList(new String[] { "Othello.jar" }));
            setCodebase("http://www.w3.org/People/mimasa/test/object/java/applets/");
            setAppletClass("Othello.class");
            setWidth("800px");
            setHeight("500px");
        }
    };
    setContent(applet);
}
Example 64
Project: ApprovalTests.Java-master  File: ValidationErrorTestUtils.java View source code
/************************************************************************/
public static void testError(ValidationError error, boolean passExpected) {
    if (error.isOk() != passExpected) {
        TestCase.assertEquals("Validation Errors  - " + error.toString(), passExpected, error.isOk());
    }
    if (error.getTracker().hasRemainingErrors()) {
        TestCase.assertFalse("HTML didn't catch all errors - " + Arrays.asList(error.getTracker().getRemainingErrors()), error.getTracker().hasRemainingErrors());
    }
}
Example 65
Project: available-master  File: WorkerFactoryTest.java View source code
@Ignore
@Test
public void test() throws InterruptedException {
    WorkerFactory leaderFactory = new WorkerFactory().buildByLeader("2", Arrays.asList("1", "3"), "521");
    leaderFactory.start();
    WorkerFactory followerFactory = new WorkerFactory().buildByFollower("3", "521", new DefaultRecvCallableHandler());
    followerFactory.start();
    leaderFactory.enQueue(new MQPacket("hahah".getBytes(), null));
    Thread.currentThread().join();
}
Example 66
Project: bagit-java-master  File: BagInfoRequirementTest.java View source code
@Test
public void testEquals() {
    BagInfoRequirement requirement = new BagInfoRequirement(true, Arrays.asList("foo"));
    BagInfoRequirement sameRequirement = new BagInfoRequirement(true, Arrays.asList("foo"));
    assertEquals(requirement, sameRequirement);
    assertFalse(requirement.equals(null));
    BagInfoRequirement differentRequirement = new BagInfoRequirement(false, Arrays.asList("foo"));
    assertFalse(requirement.equals(differentRequirement));
    BagInfoRequirement differentListOfAcceptableValues = new BagInfoRequirement();
    differentListOfAcceptableValues.setRequired(true);
    differentListOfAcceptableValues.setAcceptableValues(Arrays.asList("bar"));
    assertFalse(requirement.equals(differentListOfAcceptableValues));
}
Example 67
Project: byte-buddy-master  File: ByteBuddyAgentProcessProviderTest.java View source code
@Test
public void testObjectProperties() throws Exception {
    ObjectPropertyAssertion.of(ByteBuddyAgent.ProcessProvider.ForCurrentVm.ForLegacyVm.class).apply();
    final Iterator<Method> methods = Arrays.asList(Object.class.getDeclaredMethods()).iterator();
    ObjectPropertyAssertion.of(ByteBuddyAgent.ProcessProvider.ForCurrentVm.ForJava9CapableVm.class).create(new ObjectPropertyAssertion.Creator<Method>() {

        @Override
        public Method create() {
            return methods.next();
        }
    }).apply();
    ObjectPropertyAssertion.of(ByteBuddyAgent.AttachmentProvider.Accessor.Unavailable.class).apply();
}
Example 68
Project: ClassAnalyzer-master  File: StackMapTable.java View source code
@Override
public String toString() {
    return "StackMapTable{" + "attributeNameIndex=" + getAttributeNameIndex() + " [attribute name = " + ((ConstantUtf8Info) (constantPool.getCpInfo()[getAttributeNameIndex() - 1])).getValue() + "]" + ", attributeLength=" + getAttributeLength() + ", NumberOfEntries=" + NumberOfEntries + ", stackMapFrameEntries=" + Arrays.toString(stackMapFrameEntries) + '}';
}
Example 69
Project: cms-ce-master  File: AbstractInvalidContentQueryException.java View source code
static String buildMessage(String name, String... issues) {
    List<String> issueList = Arrays.asList(issues);
    StringBuffer message = new StringBuffer();
    message.append("The " + name + " have the following issues: ").append(issueList.get(0));
    for (int i = 1; i < issueList.size(); i++) {
        message.append("\n").append(issueList.get(i));
    }
    return message.toString();
}
Example 70
Project: codjo-control-master  File: SqlNameCodec.java View source code
public static List<String> decodeList(String encodedValue) {
    if (encodedValue == null) {
        return Collections.emptyList();
    }
    String contentWithoutBracket = encodedValue.substring(1, encodedValue.length() - 1);
    if (contentWithoutBracket.trim().length() == 0) {
        return Collections.emptyList();
    }
    String[] split = contentWithoutBracket.split(", ");
    return Arrays.asList(split);
}
Example 71
Project: consul-api-master  File: SingleUrlParametersTest.java View source code
@Test
public void testToUrlParameters() throws Exception {
    UrlParameters parameters = new SingleUrlParameters("key");
    Assert.assertEquals(Arrays.asList("key"), parameters.toUrlParameters());
    parameters = new SingleUrlParameters("key", "value");
    Assert.assertEquals(Arrays.asList("key=value"), parameters.toUrlParameters());
    parameters = new SingleUrlParameters("key", "value value");
    Assert.assertEquals(Arrays.asList("key=value+value"), parameters.toUrlParameters());
}
Example 72
Project: course-mongodb-M101J-master  File: DocumentTest.java View source code
public static void main(String[] args) {
    Document document = //
    new Document().append("userName", //
    "jyemin").append("birthDate", //
    new Date(234832423)).append("programmer", //
    true).append("age", //
    8).append("languages", //
    Arrays.asList("Java", "C++")).append("address", //
    new Document("street", "20 Main").append("town", //
    "Westfield").append("zip", "56789"));
    Helpers.printJson(document);
}
Example 73
Project: CupCarbon-master  File: Command_PRINTFILE.java View source code
@Override
public double execute() {
    SimLog.add("S" + sensor.getId() + " PRINTF " + Arrays.toString(arg));
    String message = "";
    String part = "";
    for (int i = 1; i < arg.length; i++) {
        part = sensor.getScript().getVariableValue(arg[i]);
        message += part + " ";
    }
    sensor.getScript().printFile(message);
    return 0;
}
Example 74
Project: daisydiff-master  File: NodeTest.java View source code
@Test
public void testGetParentTree() throws Exception {
    TagNode root = new TagNode(null, "root", new AttributesImpl());
    TagNode intermediate = new TagNode(root, "middle", new AttributesImpl());
    root.addChild(intermediate);
    TagNode leaf = new TagNode(intermediate, "leaf", new AttributesImpl());
    intermediate.addChild(leaf);
    assertEquals(Arrays.asList(root, intermediate), leaf.getParentTree());
}
Example 75
Project: dbo-2015-master  File: Main.java View source code
public static void main(String[] args) {
    Pessoa pedro = new Pessoa("Pedro");
    Pessoa maria = new Pessoa("Maria");
    Pessoa luciano = new Pessoa("Luciano");
    Pessoa raquel = new Pessoa("Raquel");
    Pessoa leonardo = new Pessoa("Leonardo");
    Pessoa alaides = new Pessoa("Alaides");
    pedro.casaCom(maria);
    System.out.println(pedro.getConjuge());
    System.out.println(maria.getConjuge());
    maria.addDependente(luciano);
    maria.addDependente(raquel);
    System.out.println(Arrays.toString(maria.getDependentes()));
    System.out.println(maria.getDependentes().length);
}
Example 76
Project: de.persosim.simulator-master  File: AuthenticatedAuxiliaryDataTest.java View source code
@Test
public void testGetDiscretionaryDataImmutability() {
    byte[] data = new byte[] { 1, 2, 3, 4, 5 };
    byte[] expected = Arrays.copyOf(data, data.length);
    AuthenticatedAuxiliaryData authData = new AuthenticatedAuxiliaryData(RoleOid.id_AT, data);
    data[0] = 2;
    byte[] result = authData.getDiscretionaryData();
    assertArrayEquals(expected, result);
    result[0] = 3;
    assertArrayEquals(expected, authData.getDiscretionaryData());
}
Example 77
Project: distributeme-master  File: List.java View source code
public static void main(String a[]) throws Exception {
    if (a.length != 2) {
        System.out.println("Use java ... " + List.class + " host port");
        System.exit(-1);
    }
    String host = a[0];
    int port = Integer.parseInt(a[1]);
    Registry registry = null;
    registry = LocateRegistry.getRegistry(host, port);
    String[] services = registry.list();
    System.out.println("Services @ " + host + ":" + port + " are: " + Arrays.toString(services));
}
Example 78
Project: elements-of-programming-interviews-master  File: Rotate2DArrayTest.java View source code
@Test
public void rotateMatix1() {
    expected = Arrays.asList(Arrays.asList(13, 9, 5, 1), Arrays.asList(14, 10, 6, 2), Arrays.asList(15, 11, 7, 3), Arrays.asList(16, 12, 8, 4));
    matrix = Arrays.asList(Arrays.asList(1, 2, 3, 4), Arrays.asList(5, 6, 7, 8), Arrays.asList(9, 10, 11, 12), Arrays.asList(13, 14, 15, 16));
    test(expected, matrix);
}
Example 79
Project: EMV-NFC-Paycard-Enrollment-master  File: EmvCardTest.java View source code
@Test
public void testCard() {
    EmvCard card = new EmvCard();
    card.setAid("0000");
    card.setApplicationLabel("VISA");
    card.setCardNumber("12345678");
    card.setHolderFirstname("FirstName");
    card.setHolderLastname("Lastname");
    card.setAtrDescription(Arrays.asList("test", "ok"));
    Assertions.assertThat(card.getAtrDescription()).isEqualTo(Arrays.asList("test", "ok"));
    EmvCard card2 = new EmvCard();
    card2.setCardNumber("12345678");
    // Check equals
    Assertions.assertThat(card.equals(card2)).isTrue();
}
Example 80
Project: entermedia-core-master  File: EmStringUtils.java View source code
public static List<String> split(String inText) {
    if (inText == null) {
        return null;
    }
    String text = inText.replace("\r", "");
    text = text.replace(",", "\n");
    //		String value = inText.replace(',', '\n').replace('\r', '\n').replace('\n', ' ');
    //
    //		String[] paths = org.apache.commons.lang.StringUtils.split(value,'\n');
    //		return Arrays.asList(paths);
    StrTokenizer str = new StrTokenizer(text, '\n');
    return str.getTokenList();
}
Example 81
Project: fastjson-master  File: BigSpecailStringTest.java View source code
public void test_big_special_key() throws Exception {
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < 16; ++i) {
        buf.append('\\');
        buf.append('\"');
        char[] chars = new char[1024];
        Arrays.fill(chars, '0');
        buf.append(chars);
    }
    String text = buf.toString();
    String json = JSON.toJSONString(text);
    String text2 = (String) JSON.parse(json);
    Assert.assertEquals(text, text2);
}
Example 82
Project: fhnw-master  File: EmbeddedEuropeModel.java View source code
@Override
public Europe getEurope() {
    return new Europe(Arrays.asList(new Country(0, "Schweiz", 41_285), new Country(1, "Deutschland", 357_121.41), new Country(2, "Frankreich", 668_763.00), new Country(3, "Italien", 301_338), new Country(4, "Österreich", 83_878.99)));
// yes, there are more countries in Europe but we just keep it simple...
}
Example 83
Project: filemq-master  File: TestFmqHash.java View source code
@Test
public void testFmqHash() {
    System.out.printf(" * fmq_hash: ");
    byte[] buffer = new byte[1024];
    Arrays.fill(buffer, (byte) 0xAA);
    FmqHash hash = new FmqHash();
    hash.update(buffer, 1024);
    byte[] data = hash.data();
    int size = hash.size();
    assertEquals(size, 20);
    assertEquals(data[0], (byte) 0xDE);
    assertEquals(data[1], (byte) 0xB2);
    assertEquals(data[2], (byte) 0x38);
    assertEquals(data[3], (byte) 0x07);
    hash.destroy();
    System.out.printf("OK\n");
}
Example 84
Project: fitnesse-master  File: SplitFixture.java View source code
public List<Object> query() {
    List<Object> table = new ArrayList<>();
    for (String lineContent : lines) {
        List<Object> line = new ArrayList<>();
        String[] words = lineContent.split(",");
        for (int i = 0; i < words.length; i++) {
            String word = words[i];
            line.add(Arrays.asList(Integer.toString(i + 1), word));
        }
        table.add(line);
    }
    return table;
}
Example 85
Project: fitNevis-master  File: SplitFixture.java View source code
public List<Object> query() {
    List<Object> table = new ArrayList<Object>();
    for (String lineContent : lines) {
        List<Object> line = new ArrayList<Object>();
        String words[] = lineContent.split(",");
        for (int i = 0; i < words.length; i++) {
            String word = words[i];
            line.add(Arrays.asList(Integer.toString(i + 1), word));
        }
        table.add(line);
    }
    return table;
}
Example 86
Project: GaitLib-master  File: MedianFilter.java View source code
/**
     * Return the median of <code>input</code>.
     */
public float getFilteredValue(float[] input) {
    int length = input.length;
    if (length == 0) {
        return 0;
    }
    float[] sortedArray = new float[length];
    System.arraycopy(input, 0, sortedArray, 0, length);
    Arrays.sort(sortedArray);
    int middle = length / 2;
    if (length % 2 == 1) {
        return sortedArray[middle];
    } else {
        return (sortedArray[middle - 1] + sortedArray[middle]) / 2;
    }
}
Example 87
Project: geojson-jackson-master  File: MultiLineStringTest.java View source code
@Test
public void itShouldSerialize() throws Exception {
    MultiLineString multiLineString = new MultiLineString();
    multiLineString.add(Arrays.asList(new LngLatAlt(100, 0), new LngLatAlt(101, 1)));
    multiLineString.add(Arrays.asList(new LngLatAlt(102, 2), new LngLatAlt(103, 3)));
    assertEquals("{\"type\":\"MultiLineString\",\"coordinates\":" + "[[[100.0,0.0],[101.0,1.0]],[[102.0,2.0],[103.0,3.0]]]}", mapper.writeValueAsString(multiLineString));
}
Example 88
Project: geowave-master  File: ByteUtilsTest.java View source code
@Test
public void test() {
    double oneTwo = ByteUtils.toDouble("12".getBytes());
    double oneOneTwo = ByteUtils.toDouble("112".getBytes());
    double oneThree = ByteUtils.toDouble("13".getBytes());
    double oneOneThree = ByteUtils.toDouble("113".getBytes());
    assertTrue(oneTwo > oneOneTwo);
    assertTrue(oneThree > oneTwo);
    assertTrue(oneOneTwo < oneOneThree);
    assertTrue(Arrays.equals(ByteUtils.toPaddedBytes("113".getBytes()), ByteUtils.toBytes(oneOneThree)));
}
Example 89
Project: git-starteam-master  File: AlphanumComparatorTest.java View source code
@Test
public void testCompare() {
    ArrayList<String> list = new ArrayList<String>();
    list.add("Package 1.2.30.0");
    list.add("Package 2.0.1.0");
    list.add("Package 1.1.31.0");
    list.add("Package 1.2.31.0");
    list.add("Package 1.3.29.0");
    list.add("Package 1.3.3.0");
    Object unsorted[] = list.toArray();
    Arrays.sort(unsorted, new AlphanumComparator());
    assertArrayEquals(new String[] { "Package 1.1.31.0", "Package 1.2.30.0", "Package 1.2.31.0", "Package 1.3.3.0", "Package 1.3.29.0", "Package 2.0.1.0" }, unsorted);
}
Example 90
Project: gitblit-master  File: SecureRandomTest.java View source code
@Test
public void testRandomBytes() {
    SecureRandom sr = new SecureRandom();
    byte[] bytes1 = sr.randomBytes(10);
    assertEquals(10, bytes1.length);
    byte[] bytes2 = sr.randomBytes(10);
    assertEquals(10, bytes2.length);
    assertFalse(Arrays.equals(bytes1, bytes2));
    assertEquals(0, sr.randomBytes(0).length);
    assertEquals(200, sr.randomBytes(200).length);
}
Example 91
Project: Glowstone-master  File: BlockDirt.java View source code
@Override
public Collection<ItemStack> getDrops(GlowBlock block, ItemStack tool) {
    //TODO switch to MaterialData instead of using magic values
    if (block.getData() == 1) {
        //Coarse dirt
        return Arrays.asList(new ItemStack(Material.DIRT, 1, (short) 1));
    } else {
        //normal dirt and podzol drop normal dirt
        return Arrays.asList(new ItemStack(Material.DIRT));
    }
}
Example 92
Project: GlowstonePlusPlus-master  File: BlockDirt.java View source code
@Override
public Collection<ItemStack> getDrops(GlowBlock block, ItemStack tool) {
    //TODO switch to MaterialData instead of using magic values
    if (block.getData() == 1) {
        //Coarse dirt
        return Arrays.asList(new ItemStack(Material.DIRT, 1, (short) 1));
    } else {
        //normal dirt and podsol drop normal dirt
        return Arrays.asList(new ItemStack(Material.DIRT));
    }
}
Example 93
Project: gmf-tooling.uml2tools-master  File: LMInterLifeLineMessage.java View source code
public void layoutHorizontally(boolean fullLayout) {
    int startMiddleXPos = getSendMessageHorizontalPositioning().getSendMiddleXPos();
    int endMiddleXPos = getReceiveMessageHorizontalPositioning().getReceiveMiddleXPos();
    boolean fromLeftToRight = startMiddleXPos < endMiddleXPos;
    int startXPos = getSendMessageHorizontalPositioning().getSendEndXPos(fromLeftToRight);
    //CR #27330
    //int endXPos = getReceiveMessageHorizontalPositioning().getReceiveEndXPos(!fromLeftToRight);
    int endXPos = getReceiveEndXPos(!fromLeftToRight);
    //Reply message start and end points should be swapped
    if (!isFromSendToReceive()) {
        int t = startXPos;
        startXPos = endXPos;
        endXPos = t;
    }
    Point[] linkPoints = getGdeLink().getLinkPoints();
    int startYPos;
    int endYPos;
    if (linkPoints.length < 1) {
        startYPos = 0;
        endYPos = 0;
    } else {
        startYPos = linkPoints[0].y;
        endYPos = linkPoints[linkPoints.length - 1].y;
    }
    Point[] newPoints = { new Point(startXPos, startYPos), new Point(endXPos, endYPos) };
    //System.out.println("[LMLifeLineBracket.setLMMessageEndHorizontalPosition] from "+java.util.Arrays.asList(linkPoints)+" to "+java.util.Arrays.asList(newPoints));
    getGdeLink().setLinkPoints(newPoints);
    if (isFromSendToReceive()) {
        MessageLabelLayouter.layoutMessageLabelsHorizontally(getGdeLink(), startXPos, endXPos, fullLayout);
    } else {
        MessageLabelLayouter.layoutMessageLabelsHorizontally(getGdeLink(), endXPos, startXPos, fullLayout);
    }
}
Example 94
Project: guide-master  File: Streams13.java View source code
public static void main(String[] args) {
    SecureRandom secureRandom = new SecureRandom(new byte[] { 1, 3, 3, 7 });
    int[] randoms = IntStream.generate(secureRandom::nextInt).filter( n -> n > 0).limit(10).toArray();
    System.out.println(Arrays.toString(randoms));
    int[] nums = IntStream.iterate(1,  n -> n * 2).limit(11).toArray();
    System.out.println(Arrays.toString(nums));
}
Example 95
Project: halfnes-master  File: JInputTest.java View source code
@Test
public void testJInput() {
    ControllerEnvironment controllerEnvironment = ControllerEnvironment.getDefaultEnvironment();
    Controller[] controllers = controllerEnvironment.getControllers();
    System.out.println(String.format("%s controllers found.", controllers.length));
    Arrays.asList(controllers).forEach( controller -> {
        System.out.println(String.format("  %s (%s)", controller, controller.getType()));
    });
}
Example 96
Project: hartley-master  File: SubscriberInspector.java View source code
/**
     * Report the subscription methods declared on the subscriber.
     */
public Set<Method> subscriptionsOn(Object subscriber) {
    SubscriptionMethodFilter filter = new SubscriptionMethodFilter();
    Class<?> subscriberClass = subscriber.getClass();
    List<Method> methods = Arrays.asList(subscriberClass.getMethods());
    Set<Method> subscriptions = new HashSet<Method>();
    for (Method method : methods) {
        if (filter.accepts(method)) {
            subscriptions.add(method);
        }
    }
    return subscriptions;
}
Example 97
Project: HotPotato-master  File: ItemUtil.java View source code
public static ItemStack potato() {
    ItemStack itemStack = new ItemStack(Material.POTATO_ITEM);
    ItemMeta itemMeta = itemStack.getItemMeta();
    itemMeta.setDisplayName(ChatColor.YELLOW + "Hot Potato");
    itemMeta.setLore(new ArrayList<String>(Arrays.asList(ChatColor.GRAY + "Left click a player", "to lose the potato.")));
    itemStack.setItemMeta(itemMeta);
    return itemStack;
}
Example 98
Project: hprose-java-master  File: LogHandler.java View source code
@Override
public Promise<Object> handle(String name, Object[] args, HproseContext context, NextInvokeHandler next) {
    System.out.println("before invoke: " + name + ", " + Arrays.deepToString(args));
    Promise<Object> result = next.handle(name, args, context);
    result.then((Object value) -> System.out.println("after invoke: " + name + ", " + Arrays.deepToString(args) + ", " + value));
    return result;
}
Example 99
Project: htm.java-master  File: SequenceMachineTest.java View source code
@Test
public void testGenerateNumbers() {
    int[] expected = { 4, 6, 2, 1, 7, 20, 21, 22, 23, 24, -1, 14, 16, 12, 11, 17, 20, 21, 22, 23, 24, -1 };
    SequenceMachine sm = new SequenceMachine(null);
    List<Integer> result = sm.generateNumbers(2, 10, new Tuple(5, 10));
    assertTrue(Arrays.equals(expected, ArrayUtils.toPrimitive(result.toArray(new Integer[0]))));
}
Example 100
Project: intellij-samples-master  File: LambdaEvaluation.java View source code
public static void main(String[] args) {
    List<String> words = new ArrayList<>();
    words.addAll(Arrays.asList(("I do not know where family doctors acquired illegibly perplexing handwriting; " + "nevertheless, extraordinary pharmaceutical intellectuality counterbalancing indecipherability " + "transcendentalizes intercommunication's incomprehensibleness").split(" ")));
//Evaluate the following lambda in debugger: words.stream().filter(s -> s.length() < 13).toArray()
}
Example 101
Project: interview-master  File: NumberOfTrianglesInUnsortedArray.java View source code
public int numberOfTriangles(int input[]) {
    Arrays.sort(input);
    int count = 0;
    for (int i = 0; i < input.length - 2; i++) {
        int k = i + 2;
        for (int j = i + 1; j < input.length; j++) {
            while (k < input.length && input[i] + input[j] > input[k]) {
                k++;
            }
            count += k - j - 1;
        }
    }
    return count;
}