before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
public void setTintResource(int res) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundResource(res); } if (mNavBarAvailable) { mNavBarTintView.setBackgroundResource(res); } }
public void setTintResource(int res) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundResource(res); } <DeepExtract> if (mNavBarAvailable) { mNavBarTintView.setBackgroundResource(res); } </DeepExtract> }
MissZzzReader
positive
922
@Override public void onSubscribe(Subscription subscription) { Trader.this.subscription = subscription; subscription.request(1); }
@Override public void onSubscribe(Subscription subscription) { Trader.this.subscription = subscription; <DeepExtract> subscription.request(1); </DeepExtract> }
conga
positive
923
@Override public void initProgramHandle() { super.initProgramHandle(); mCurveTextureHandle = GLES30.glGetUniformLocation(mProgramHandle, "curveTexture"); mMaskTextureHandle = GLES30.glGetUniformLocation(mProgramHandle, "maskTexture"); mMaskTexture1Handle = GLES30.glGetUniformLocation(mProgramHandle, "maskTexture1"); byte[] arrayOfByte = new byte[2048]; int[] arrayOfInt1 = { 0, 1, 2, 3, 5, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 16, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 38, 39, 40, 41, 42, 44, 45, 47, 48, 49, 51, 52, 54, 55, 56, 59, 60, 62, 63, 64, 66, 67, 70, 71, 72, 74, 76, 78, 79, 80, 83, 84, 85, 88, 89, 90, 93, 94, 95, 98, 99, 100, 102, 104, 106, 107, 108, 109, 112, 113, 114, 116, 117, 118, 119, 120, 122, 124, 125, 126, 128, 129, 130, 131, 132, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 190, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 12, 12, 13, 14, 16, 16, 17, 19, 20, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 66, 69, 70, 72, 73, 76, 77, 78, 80, 82, 84, 85, 87, 89, 90, 93, 94, 95, 98, 99, 100, 103, 104, 106, 108, 109, 111, 112, 114, 116, 117, 118, 120, 122, 123, 124, 125, 126, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 178, 179, 179, 180, 181, 181, 182, 182, 183, 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt3 = { 0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 12, 12, 13, 14, 16, 16, 17, 18, 20, 20, 21, 22, 23, 25, 25, 26, 27, 29, 30, 31, 31, 32, 34, 35, 36, 37, 39, 40, 41, 41, 42, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 76, 78, 79, 80, 82, 83, 84, 85, 88, 89, 90, 92, 93, 94, 95, 98, 99, 100, 102, 103, 104, 106, 107, 108, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt4 = { 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 }; for (int i = 0; i < 256; i++) { arrayOfByte[(i * 4)] = ((byte) arrayOfInt1[i]); arrayOfByte[(1 + i * 4)] = ((byte) arrayOfInt2[i]); arrayOfByte[(2 + i * 4)] = ((byte) arrayOfInt3[i]); arrayOfByte[(3 + i * 4)] = ((byte) arrayOfInt4[i]); } int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 }; for (int j = 0; j < 256; j++) { arrayOfByte[(1024 + j * 4)] = ((byte) arrayOfInt5[j]); arrayOfByte[(1 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(2 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(3 + (1024 + j * 4))] = -1; } mCurveTexture = OpenGLUtils.createTexture(arrayOfByte, 256, 2); mMaskTexture = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask.png"); mMaskTexture1 = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask1.png"); }
@Override public void initProgramHandle() { super.initProgramHandle(); mCurveTextureHandle = GLES30.glGetUniformLocation(mProgramHandle, "curveTexture"); mMaskTextureHandle = GLES30.glGetUniformLocation(mProgramHandle, "maskTexture"); mMaskTexture1Handle = GLES30.glGetUniformLocation(mProgramHandle, "maskTexture1"); <DeepExtract> byte[] arrayOfByte = new byte[2048]; int[] arrayOfInt1 = { 0, 1, 2, 3, 5, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 16, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 38, 39, 40, 41, 42, 44, 45, 47, 48, 49, 51, 52, 54, 55, 56, 59, 60, 62, 63, 64, 66, 67, 70, 71, 72, 74, 76, 78, 79, 80, 83, 84, 85, 88, 89, 90, 93, 94, 95, 98, 99, 100, 102, 104, 106, 107, 108, 109, 112, 113, 114, 116, 117, 118, 119, 120, 122, 124, 125, 126, 128, 129, 130, 131, 132, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 190, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 12, 12, 13, 14, 16, 16, 17, 19, 20, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 66, 69, 70, 72, 73, 76, 77, 78, 80, 82, 84, 85, 87, 89, 90, 93, 94, 95, 98, 99, 100, 103, 104, 106, 108, 109, 111, 112, 114, 116, 117, 118, 120, 122, 123, 124, 125, 126, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 178, 179, 179, 180, 181, 181, 182, 182, 183, 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt3 = { 0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 12, 12, 13, 14, 16, 16, 17, 18, 20, 20, 21, 22, 23, 25, 25, 26, 27, 29, 30, 31, 31, 32, 34, 35, 36, 37, 39, 40, 41, 41, 42, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 76, 78, 79, 80, 82, 83, 84, 85, 88, 89, 90, 92, 93, 94, 95, 98, 99, 100, 102, 103, 104, 106, 107, 108, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt4 = { 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 }; for (int i = 0; i < 256; i++) { arrayOfByte[(i * 4)] = ((byte) arrayOfInt1[i]); arrayOfByte[(1 + i * 4)] = ((byte) arrayOfInt2[i]); arrayOfByte[(2 + i * 4)] = ((byte) arrayOfInt3[i]); arrayOfByte[(3 + i * 4)] = ((byte) arrayOfInt4[i]); } int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 }; for (int j = 0; j < 256; j++) { arrayOfByte[(1024 + j * 4)] = ((byte) arrayOfInt5[j]); arrayOfByte[(1 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(2 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(3 + (1024 + j * 4))] = -1; } mCurveTexture = OpenGLUtils.createTexture(arrayOfByte, 256, 2); mMaskTexture = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask.png"); mMaskTexture1 = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask1.png"); </DeepExtract> }
VideoClipEditViewTest
positive
924
private void voiceTextSearch(String keyword) { Log.i(TAG, "keyword=[" + keyword + "]"); String curCharacter; if (null == keyword) { curCharacter = keyword; } else { curCharacter = keyword.trim(); } if (TextUtils.isEmpty(curCharacter)) { AppInfoHelper.getInstance().t9Search(null, true); } else { AppInfoHelper.getInstance().t9Search(curCharacter, true); } }
private void voiceTextSearch(String keyword) { <DeepExtract> Log.i(TAG, "keyword=[" + keyword + "]"); String curCharacter; if (null == keyword) { curCharacter = keyword; } else { curCharacter = keyword.trim(); } if (TextUtils.isEmpty(curCharacter)) { AppInfoHelper.getInstance().t9Search(null, true); } else { AppInfoHelper.getInstance().t9Search(curCharacter, true); } </DeepExtract> }
XDesktopHelper
positive
925
public static int getInt(String key, int defValue) { if (CACHED_PARAMS.containsKey(key)) { return (int) CACHED_PARAMS.get(key); } int result = preferences.getInt(key, defValue); if (result == null) { return; } putString(key, JSON.toJSONString(result)); return result; }
public static int getInt(String key, int defValue) { if (CACHED_PARAMS.containsKey(key)) { return (int) CACHED_PARAMS.get(key); } int result = preferences.getInt(key, defValue); <DeepExtract> if (result == null) { return; } putString(key, JSON.toJSONString(result)); </DeepExtract> return result; }
jixieshou-autowatch-kuaishou
positive
926
@Override public void run() { for (Iterator<Block> iterator = this.cachedSigns.iterator(); iterator.hasNext(); ) { Block b = iterator.next(); if (b.getChunk().isLoaded()) { if (b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) { if (!this.updateSign(b)) { iterator.remove(); } } else { iterator.remove(); } } } }
@Override public void run() { <DeepExtract> for (Iterator<Block> iterator = this.cachedSigns.iterator(); iterator.hasNext(); ) { Block b = iterator.next(); if (b.getChunk().isLoaded()) { if (b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) { if (!this.updateSign(b)) { iterator.remove(); } } else { iterator.remove(); } } } </DeepExtract> }
PexelCore
positive
927
private void notifyOnImagePickComplete(ImageItem imageItem) { ArrayList<ImageItem> list = new ArrayList<>(); list.add(imageItem); Intent intent = new Intent(); intent.putExtra(ImagePicker.INTENT_KEY_PICKER_RESULT, list); setResult(ImagePicker.REQ_PICKER_RESULT_CODE, intent); super.finish(); if (dialogInterface != null) { dialogInterface.dismiss(); } PickerActivityManager.removeActivity(this); }
private void notifyOnImagePickComplete(ImageItem imageItem) { ArrayList<ImageItem> list = new ArrayList<>(); list.add(imageItem); Intent intent = new Intent(); intent.putExtra(ImagePicker.INTENT_KEY_PICKER_RESULT, list); setResult(ImagePicker.REQ_PICKER_RESULT_CODE, intent); <DeepExtract> super.finish(); if (dialogInterface != null) { dialogInterface.dismiss(); } PickerActivityManager.removeActivity(this); </DeepExtract> }
BaseDemo
positive
928
public static void main(String[] args) { try { Display.setDisplayMode(new DisplayMode(WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1])); Display.setTitle(WINDOW_TITLE); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); cleanUp(true); } pbo = glGenBuffers(); glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glReadPixels(0, 0, WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1], GL_RGB, GL_UNSIGNED_BYTE, 0); while (!Display.isCloseRequested()) { render(); logic(); input(); update(); } Display.destroy(); System.exit(false ? 1 : 0); }
public static void main(String[] args) { try { Display.setDisplayMode(new DisplayMode(WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1])); Display.setTitle(WINDOW_TITLE); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); cleanUp(true); } pbo = glGenBuffers(); glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glReadPixels(0, 0, WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1], GL_RGB, GL_UNSIGNED_BYTE, 0); while (!Display.isCloseRequested()) { render(); logic(); input(); update(); } <DeepExtract> Display.destroy(); System.exit(false ? 1 : 0); </DeepExtract> }
YouTube-tutorials
positive
929
public boolean onZkException(String path, byte[] data, CountBean count) { if (count.getCount() > retryTime) { return false; } else { return RedisZookeeperUtils.zkCreateNode(zookeeper, path, data, CreateMode.PERSISTENT, count, this); } }
public boolean onZkException(String path, byte[] data, CountBean count) { <DeepExtract> if (count.getCount() > retryTime) { return false; } else { return RedisZookeeperUtils.zkCreateNode(zookeeper, path, data, CreateMode.PERSISTENT, count, this); } </DeepExtract> }
redis-cluster
positive
931
@Override public boolean offer(T value) { final Node<T> newNode = new Node<>(this, value); _size++; modCount++; if (_first == null) { assert (_last == null); _first = _last = newNode; } else { assert (_last != null); _last._next = newNode; newNode._previous = _last; _last = newNode; } assert (_first._previous == null); assert (_last._next == null); return true; }
@Override public boolean offer(T value) { <DeepExtract> final Node<T> newNode = new Node<>(this, value); _size++; modCount++; if (_first == null) { assert (_last == null); _first = _last = newNode; } else { assert (_last != null); _last._next = newNode; newNode._previous = _last; _last = newNode; } assert (_first._previous == null); assert (_last._next == null); </DeepExtract> return true; }
tektosyne
positive
932
private void initView() { mTimeRulerView = findViewById(R.id.ruler_id_timeRulerView); mTimeRulerPickScaleView = findViewById(R.id.ruler_id_timeRulerPickView); mShowTimeTv = findViewById(R.id.time_tv); mResetBtn = findViewById(R.id.btn_reset); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.title_timeruler_view); Calendar startCalendar1 = Calendar.getInstance(); startCalendar1.set(Calendar.HOUR_OF_DAY, 0); startCalendar1.set(Calendar.MINUTE, 0); startCalendar1.set(Calendar.SECOND, 0); startCalendar1.set(Calendar.MILLISECOND, 0); Calendar stopCalendar1 = Calendar.getInstance(); stopCalendar1.set(Calendar.HOUR_OF_DAY, 2); stopCalendar1.set(Calendar.MINUTE, 0); stopCalendar1.set(Calendar.SECOND, 0); stopCalendar1.set(Calendar.MILLISECOND, 0); Calendar startCalendar2 = Calendar.getInstance(); startCalendar2.set(Calendar.HOUR_OF_DAY, 3); startCalendar2.set(Calendar.MINUTE, 0); startCalendar2.set(Calendar.SECOND, 0); startCalendar2.set(Calendar.MILLISECOND, 0); Calendar stopCalendar2 = Calendar.getInstance(); stopCalendar2.set(Calendar.HOUR_OF_DAY, 23); stopCalendar2.set(Calendar.MINUTE, 59); stopCalendar2.set(Calendar.SECOND, 59); stopCalendar2.set(Calendar.MILLISECOND, 999); TimeRulerView.TimeInfo timeInfo1 = new TimeRulerView.TimeInfo(startCalendar1, stopCalendar1); TimeRulerView.TimeInfo timeInfo2 = new TimeRulerView.TimeInfo(startCalendar2, stopCalendar2); ArrayList<TimeRulerView.TimeInfo> timeInfos = new ArrayList<>(); timeInfos.add(timeInfo1); timeInfos.add(timeInfo2); mTimeRulerView.setTimeInfos(timeInfos); mTimeRulerView.invalidate(); }
private void initView() { mTimeRulerView = findViewById(R.id.ruler_id_timeRulerView); mTimeRulerPickScaleView = findViewById(R.id.ruler_id_timeRulerPickView); mShowTimeTv = findViewById(R.id.time_tv); mResetBtn = findViewById(R.id.btn_reset); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.title_timeruler_view); <DeepExtract> Calendar startCalendar1 = Calendar.getInstance(); startCalendar1.set(Calendar.HOUR_OF_DAY, 0); startCalendar1.set(Calendar.MINUTE, 0); startCalendar1.set(Calendar.SECOND, 0); startCalendar1.set(Calendar.MILLISECOND, 0); Calendar stopCalendar1 = Calendar.getInstance(); stopCalendar1.set(Calendar.HOUR_OF_DAY, 2); stopCalendar1.set(Calendar.MINUTE, 0); stopCalendar1.set(Calendar.SECOND, 0); stopCalendar1.set(Calendar.MILLISECOND, 0); Calendar startCalendar2 = Calendar.getInstance(); startCalendar2.set(Calendar.HOUR_OF_DAY, 3); startCalendar2.set(Calendar.MINUTE, 0); startCalendar2.set(Calendar.SECOND, 0); startCalendar2.set(Calendar.MILLISECOND, 0); Calendar stopCalendar2 = Calendar.getInstance(); stopCalendar2.set(Calendar.HOUR_OF_DAY, 23); stopCalendar2.set(Calendar.MINUTE, 59); stopCalendar2.set(Calendar.SECOND, 59); stopCalendar2.set(Calendar.MILLISECOND, 999); TimeRulerView.TimeInfo timeInfo1 = new TimeRulerView.TimeInfo(startCalendar1, stopCalendar1); TimeRulerView.TimeInfo timeInfo2 = new TimeRulerView.TimeInfo(startCalendar2, stopCalendar2); ArrayList<TimeRulerView.TimeInfo> timeInfos = new ArrayList<>(); timeInfos.add(timeInfo1); timeInfos.add(timeInfo2); mTimeRulerView.setTimeInfos(timeInfos); mTimeRulerView.invalidate(); </DeepExtract> }
WidgetCase
positive
933
private static void ParseCommandLineSettings(String[] args) throws Exception { HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("MAIN_DIRECTORY")) Settings.MAIN_DIR = keyValueMap.get("MAIN_DIRECTORY"); else { if (System.getProperty("user.dir") + "/" == null) throw new Exception("A value for " + "MAIN_DIRECTORY" + " must be set at the command line."); else Settings.MAIN_DIR = System.getProperty("user.dir") + "/"; } if (!Settings.MAIN_DIR.endsWith("/")) Settings.MAIN_DIR += "/"; Settings.VERSION_FILE = "Version.txt"; HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("EXPERIMENT_FILE")) Settings.EXPERIMENT_FILE = keyValueMap.get("EXPERIMENT_FILE"); else { if (null == null) throw new Exception("A value for " + "EXPERIMENT_FILE" + " must be set at the command line."); else Settings.EXPERIMENT_FILE = null; } Settings.INTERNALS_DIR = FileUtilities.CreateDirectoryIfNotExists(Settings.MAIN_DIR + "Internals/"); Settings.DEBUG = Boolean.parseBoolean(GetArgValue(args, "DEBUG", "false")); String numAvailableProcessors = String.valueOf(Runtime.getRuntime().availableProcessors()); Settings.NUM_THREADS = Integer.parseInt(GetArgValue(args, "NUM_THREADS", numAvailableProcessors)); Settings.THREAD_TIMEOUT_MINUTES = Long.parseLong(GetArgValue(args, "THREAD_TIMEOUT_MINUTES", "60")); Settings.PAUSE_SECONDS = Long.parseLong(GetArgValue(args, "PAUSE_SECONDS", "5")); Settings.EXPORT_DATA = Boolean.parseBoolean(GetArgValue(args, "EXPORT_DATA", "false")); HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("LEARNER_TEMPLATES_FILE")) Settings.LEARNER_TEMPLATES_FILE = keyValueMap.get("LEARNER_TEMPLATES_FILE"); else { if ("Config/Learner_Templates.txt" == null) throw new Exception("A value for " + "LEARNER_TEMPLATES_FILE" + " must be set at the command line."); else Settings.LEARNER_TEMPLATES_FILE = "Config/Learner_Templates.txt"; } HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("CLASSIFICATION_ALGORITHMS_FILE")) Settings.CLASSIFICATION_ALGORITHMS_FILE = keyValueMap.get("CLASSIFICATION_ALGORITHMS_FILE"); else { if ("Config/Classification_Algorithms.txt" == null) throw new Exception("A value for " + "CLASSIFICATION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.CLASSIFICATION_ALGORITHMS_FILE = "Config/Classification_Algorithms.txt"; } HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("FEATURE_SELECTION_ALGORITHMS_FILE")) Settings.FEATURE_SELECTION_ALGORITHMS_FILE = keyValueMap.get("FEATURE_SELECTION_ALGORITHMS_FILE"); else { if ("Config/Feature_Selection_Algorithms.txt" == null) throw new Exception("A value for " + "FEATURE_SELECTION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.FEATURE_SELECTION_ALGORITHMS_FILE = "Config/Feature_Selection_Algorithms.txt"; } Settings.ParseLearners(); Settings.ParseAlgorithms(); }
private static void ParseCommandLineSettings(String[] args) throws Exception { HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("MAIN_DIRECTORY")) Settings.MAIN_DIR = keyValueMap.get("MAIN_DIRECTORY"); else { if (System.getProperty("user.dir") + "/" == null) throw new Exception("A value for " + "MAIN_DIRECTORY" + " must be set at the command line."); else Settings.MAIN_DIR = System.getProperty("user.dir") + "/"; } if (!Settings.MAIN_DIR.endsWith("/")) Settings.MAIN_DIR += "/"; Settings.VERSION_FILE = "Version.txt"; HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("EXPERIMENT_FILE")) Settings.EXPERIMENT_FILE = keyValueMap.get("EXPERIMENT_FILE"); else { if (null == null) throw new Exception("A value for " + "EXPERIMENT_FILE" + " must be set at the command line."); else Settings.EXPERIMENT_FILE = null; } Settings.INTERNALS_DIR = FileUtilities.CreateDirectoryIfNotExists(Settings.MAIN_DIR + "Internals/"); Settings.DEBUG = Boolean.parseBoolean(GetArgValue(args, "DEBUG", "false")); String numAvailableProcessors = String.valueOf(Runtime.getRuntime().availableProcessors()); Settings.NUM_THREADS = Integer.parseInt(GetArgValue(args, "NUM_THREADS", numAvailableProcessors)); Settings.THREAD_TIMEOUT_MINUTES = Long.parseLong(GetArgValue(args, "THREAD_TIMEOUT_MINUTES", "60")); Settings.PAUSE_SECONDS = Long.parseLong(GetArgValue(args, "PAUSE_SECONDS", "5")); Settings.EXPORT_DATA = Boolean.parseBoolean(GetArgValue(args, "EXPORT_DATA", "false")); HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("LEARNER_TEMPLATES_FILE")) Settings.LEARNER_TEMPLATES_FILE = keyValueMap.get("LEARNER_TEMPLATES_FILE"); else { if ("Config/Learner_Templates.txt" == null) throw new Exception("A value for " + "LEARNER_TEMPLATES_FILE" + " must be set at the command line."); else Settings.LEARNER_TEMPLATES_FILE = "Config/Learner_Templates.txt"; } HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("CLASSIFICATION_ALGORITHMS_FILE")) Settings.CLASSIFICATION_ALGORITHMS_FILE = keyValueMap.get("CLASSIFICATION_ALGORITHMS_FILE"); else { if ("Config/Classification_Algorithms.txt" == null) throw new Exception("A value for " + "CLASSIFICATION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.CLASSIFICATION_ALGORITHMS_FILE = "Config/Classification_Algorithms.txt"; } <DeepExtract> HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("FEATURE_SELECTION_ALGORITHMS_FILE")) Settings.FEATURE_SELECTION_ALGORITHMS_FILE = keyValueMap.get("FEATURE_SELECTION_ALGORITHMS_FILE"); else { if ("Config/Feature_Selection_Algorithms.txt" == null) throw new Exception("A value for " + "FEATURE_SELECTION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.FEATURE_SELECTION_ALGORITHMS_FILE = "Config/Feature_Selection_Algorithms.txt"; } </DeepExtract> Settings.ParseLearners(); Settings.ParseAlgorithms(); }
ML-Flex
positive
934
@Override public void onEnable() { GameBoxSettings.defineGameBoxData(this); if ((NmsFactory.getNmsUtility()) == null) { sendVersionError(); Bukkit.getPluginManager().disablePlugin(this); return; } this.gameRegistry = new GameRegistry(this); if (!prepareForReload()) return; if (pManager != null) { pManager.shutDown(); HandlerList.unregisterAll(pManager); pManager = null; } GameBox instance = this; BukkitRunnable rampUpGameBox = new BukkitRunnable() { @Override public void run() { if (GameBoxSettings.bungeeMode) { dataBase.registerBukkitBridge(bukkitBridge == null ? (bukkitBridge = new BukkitBridge(instance)) : bukkitBridge); } if (GameBoxSettings.econEnabled) { if (!setupEconomy()) { getLogger().log(Level.SEVERE, "No economy found!"); getLogger().log(Level.SEVERE, "Even though it is enabled in the configuration file..."); GameBoxSettings.econEnabled = false; Bukkit.getPluginManager().disablePlugin(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } return; } } reloadListeners(); GBPlayer.clearTokenListeners(); inventoryTitleMessenger = new InventoryTitleMessenger(instance); pManager = new PluginManager(instance); pManager.setGuiManager(new GuiManager(instance)); pManager.setInviteInputHandler(new InviteInputHandler(instance)); pManager.setInvitationHandler(new InvitationHandler(instance)); commands = new GameBoxCommands(instance); pManager.loadPlayers(); gameRegistry.reload(); if (modulesManager != null) { modulesManager.shutDown(); HandlerList.unregisterAll(modulesManager); } modulesManager = new ModulesManager(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_SUCCESS); } debug(" running late checks in GameBox"); runLateChecks(); } }; new BukkitRunnable() { @Override public void run() { if (loadDatabase()) { rampUpGameBox.runTask(instance); } else { new BukkitRunnable() { @Override public void run() { instance.getLogger().severe("Failed to load the database"); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } Bukkit.getPluginManager().disablePlugin(instance); } }.runTask(instance); } } }.runTaskAsynchronously(this); if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { new PlaceholderAPIHook(this); Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " Hooked into PlaceholderAPI"); } hookCalendarEvents(); if (GameBoxSettings.bStatsMetrics) { setupMetrics(); } else { Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " You have opt out bStats... That's sad!"); } }
@Override public void onEnable() { GameBoxSettings.defineGameBoxData(this); if ((NmsFactory.getNmsUtility()) == null) { sendVersionError(); Bukkit.getPluginManager().disablePlugin(this); return; } this.gameRegistry = new GameRegistry(this); if (!prepareForReload()) return; if (pManager != null) { pManager.shutDown(); HandlerList.unregisterAll(pManager); pManager = null; } GameBox instance = this; BukkitRunnable rampUpGameBox = new BukkitRunnable() { @Override public void run() { if (GameBoxSettings.bungeeMode) { dataBase.registerBukkitBridge(bukkitBridge == null ? (bukkitBridge = new BukkitBridge(instance)) : bukkitBridge); } if (GameBoxSettings.econEnabled) { if (!setupEconomy()) { getLogger().log(Level.SEVERE, "No economy found!"); getLogger().log(Level.SEVERE, "Even though it is enabled in the configuration file..."); GameBoxSettings.econEnabled = false; Bukkit.getPluginManager().disablePlugin(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } return; } } reloadListeners(); GBPlayer.clearTokenListeners(); inventoryTitleMessenger = new InventoryTitleMessenger(instance); pManager = new PluginManager(instance); pManager.setGuiManager(new GuiManager(instance)); pManager.setInviteInputHandler(new InviteInputHandler(instance)); pManager.setInvitationHandler(new InvitationHandler(instance)); commands = new GameBoxCommands(instance); pManager.loadPlayers(); gameRegistry.reload(); if (modulesManager != null) { modulesManager.shutDown(); HandlerList.unregisterAll(modulesManager); } modulesManager = new ModulesManager(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_SUCCESS); } debug(" running late checks in GameBox"); runLateChecks(); } }; new BukkitRunnable() { @Override public void run() { if (loadDatabase()) { rampUpGameBox.runTask(instance); } else { new BukkitRunnable() { @Override public void run() { instance.getLogger().severe("Failed to load the database"); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } Bukkit.getPluginManager().disablePlugin(instance); } }.runTask(instance); } } }.runTaskAsynchronously(this); <DeepExtract> if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { new PlaceholderAPIHook(this); Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " Hooked into PlaceholderAPI"); } hookCalendarEvents(); if (GameBoxSettings.bStatsMetrics) { setupMetrics(); } else { Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " You have opt out bStats... That's sad!"); } </DeepExtract> }
gamebox
positive
935
public void preInit(FMLPreInitializationEvent event) { registry.init(); NetworkRegistry.INSTANCE.registerGuiHandler(AuraCascade.instance, new GuiHandler()); PylonRecipeRegistry.init(); ProcessorRecipeRegistry.init(); PotionManager.init(); eventHandler = new EventHandler(); MinecraftForge.EVENT_BUS.register(eventHandler); EnchantmentManager.init(); eventHandlerEnch = new EnchantEventHandler(); MinecraftForge.EVENT_BUS.register(eventHandlerEnch); EntityRegistry.registerModEntity(EntityFairy.class, "Fairy", 0, AuraCascade.instance, 50, 250, true); EntityRegistry.registerModEntity(EntityMinerExplosion.class, "ExplosionMiner", 1, AuraCascade.instance, 50, 40, true); QuestManager.init(); ModCreativeTab.INSTANCE = new ModCreativeTab(); AngelsteelToolHelper.initMaterials(); registry = new BlockRegistry(); registry.preInit(); EnchantEventHandler.init(); networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(ConstantMod.modId); networkWrapper.registerMessage(PacketBurst.class, PacketBurst.class, 0, Side.CLIENT); networkWrapper.registerMessage(PacketFairyUpdate.class, PacketFairyUpdate.class, 1, Side.CLIENT); networkWrapper.registerMessage(PacketFairyRequestUpdate.class, PacketFairyRequestUpdate.class, 2, Side.SERVER); networkWrapper.registerMessage(PacketAngelJump.PacketAngelJumpHandler.class, PacketAngelJump.class, 4, Side.SERVER); networkWrapper.registerMessage(PacketSyncQuestData.PacketSyncQuestDataHandler.class, PacketSyncQuestData.class, 5, Side.CLIENT); if (Config.villageGeneration) { VillagerRegistry.instance().registerVillageCreationHandler(new AuraHutHandler()); } MapGenStructureIO.registerStructureComponent(ComponentAuraHut.class, "aura:auraHut"); }
public void preInit(FMLPreInitializationEvent event) { <DeepExtract> registry.init(); NetworkRegistry.INSTANCE.registerGuiHandler(AuraCascade.instance, new GuiHandler()); PylonRecipeRegistry.init(); ProcessorRecipeRegistry.init(); PotionManager.init(); eventHandler = new EventHandler(); MinecraftForge.EVENT_BUS.register(eventHandler); EnchantmentManager.init(); eventHandlerEnch = new EnchantEventHandler(); MinecraftForge.EVENT_BUS.register(eventHandlerEnch); EntityRegistry.registerModEntity(EntityFairy.class, "Fairy", 0, AuraCascade.instance, 50, 250, true); EntityRegistry.registerModEntity(EntityMinerExplosion.class, "ExplosionMiner", 1, AuraCascade.instance, 50, 40, true); QuestManager.init(); </DeepExtract> ModCreativeTab.INSTANCE = new ModCreativeTab(); AngelsteelToolHelper.initMaterials(); registry = new BlockRegistry(); registry.preInit(); EnchantEventHandler.init(); networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(ConstantMod.modId); networkWrapper.registerMessage(PacketBurst.class, PacketBurst.class, 0, Side.CLIENT); networkWrapper.registerMessage(PacketFairyUpdate.class, PacketFairyUpdate.class, 1, Side.CLIENT); networkWrapper.registerMessage(PacketFairyRequestUpdate.class, PacketFairyRequestUpdate.class, 2, Side.SERVER); networkWrapper.registerMessage(PacketAngelJump.PacketAngelJumpHandler.class, PacketAngelJump.class, 4, Side.SERVER); networkWrapper.registerMessage(PacketSyncQuestData.PacketSyncQuestDataHandler.class, PacketSyncQuestData.class, 5, Side.CLIENT); if (Config.villageGeneration) { VillagerRegistry.instance().registerVillageCreationHandler(new AuraHutHandler()); } MapGenStructureIO.registerStructureComponent(ComponentAuraHut.class, "aura:auraHut"); }
Aura-Cascade
positive
936
@Override public void onClick(View view) { mEmailView.setError(null); mPasswordView.setError(null); clearErrorMessage(); String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } else if (!isEmailValid(email)) { mEmailView.setError(getString(R.string.error_invalid_email)); focusView = mEmailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { String userEmail = mEmailView.getText().toString(); String userPassword = mPasswordView.getText().toString(); String requestBodyString = "{\"username\":\"" + userEmail + "\",\"password\":\"" + userPassword + "\"}"; LoginRequest userLoginRequest = new LoginRequest(this, requestBodyString); httpRequestQueue.add(userLoginRequest); } }
@Override public void onClick(View view) { <DeepExtract> mEmailView.setError(null); mPasswordView.setError(null); clearErrorMessage(); String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } else if (!isEmailValid(email)) { mEmailView.setError(getString(R.string.error_invalid_email)); focusView = mEmailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { String userEmail = mEmailView.getText().toString(); String userPassword = mPasswordView.getText().toString(); String requestBodyString = "{\"username\":\"" + userEmail + "\",\"password\":\"" + userPassword + "\"}"; LoginRequest userLoginRequest = new LoginRequest(this, requestBodyString); httpRequestQueue.add(userLoginRequest); } </DeepExtract> }
grapevine
positive
937
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragdialogactivity); FragmentManager fm = getSupportFragmentManager(); EditNameDialogFrag editNameDialog = new EditNameDialogFrag(); editNameDialog.show(fm, "fragment_edit_name"); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragdialogactivity); <DeepExtract> FragmentManager fm = getSupportFragmentManager(); EditNameDialogFrag editNameDialog = new EditNameDialogFrag(); editNameDialog.show(fm, "fragment_edit_name"); </DeepExtract> }
Android-Examples
positive
938
public void handleClose(CloseEvent event) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Panel Closed", "Closed panel id:'" + event.getComponent().getId() + "'"); FacesContext.getCurrentInstance().addMessage(null, message); }
public void handleClose(CloseEvent event) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Panel Closed", "Closed panel id:'" + event.getComponent().getId() + "'"); <DeepExtract> FacesContext.getCurrentInstance().addMessage(null, message); </DeepExtract> }
primefaces-showcase
positive
939
@Override public StandardField getField(MSDOSHeaderKey key) { return getField(key).getValue(); }
@Override public StandardField getField(MSDOSHeaderKey key) { <DeepExtract> return getField(key).getValue(); </DeepExtract> }
PortEx
positive
940
public static void main(String[] args) throws Exception { Small s = new Small(); Window w = s.getFrame(); w.setLocation(100, 180); Thread.sleep(999); ins.scale(w); w.pack(); }
public static void main(String[] args) throws Exception { Small s = new Small(); Window w = s.getFrame(); w.setLocation(100, 180); Thread.sleep(999); <DeepExtract> ins.scale(w); w.pack(); </DeepExtract> }
SmallSimpleSafe
positive
941
public static void main(String[] args) { int[] arr = new int[] { 4, 5, 6, 3, 2, 1 }; int n = arr.length, i, j; for (i = n - 1; i >= 1; i--) if (arr[i - 1] < arr[i]) { i--; break; } for (j = i; j < n - 1; j++) if (arr[j] > arr[j + 1]) { break; } int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; for (int l = j, k = n - 1; l < k; l++, k--) { temp = arr[l]; arr[l] = arr[k]; arr[k] = temp; } for (int h : arr) System.out.print(h); }
public static void main(String[] args) { int[] arr = new int[] { 4, 5, 6, 3, 2, 1 }; <DeepExtract> int n = arr.length, i, j; for (i = n - 1; i >= 1; i--) if (arr[i - 1] < arr[i]) { i--; break; } for (j = i; j < n - 1; j++) if (arr[j] > arr[j + 1]) { break; } int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; for (int l = j, k = n - 1; l < k; l++, k--) { temp = arr[l]; arr[l] = arr[k]; arr[k] = temp; } for (int h : arr) System.out.print(h); </DeepExtract> }
Cracking-The-Coding-Interview-Solutions
positive
942
public Builder setLottieText(String text) { if (mCircleParams.lottieParams == null) { mCircleParams.lottieParams = new LottieParams(); } mCircleParams.lottieParams.text = text; return this; }
public Builder setLottieText(String text) { <DeepExtract> if (mCircleParams.lottieParams == null) { mCircleParams.lottieParams = new LottieParams(); } </DeepExtract> mCircleParams.lottieParams.text = text; return this; }
Android-CircleDialog
positive
943
public Criteria andJeNotEqualTo(BigDecimal value) { if (value == null) { throw new RuntimeException("Value for " + "je" + " cannot be null"); } criteria.add(new Criterion("je <>", value)); return (Criteria) this; }
public Criteria andJeNotEqualTo(BigDecimal value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "je" + " cannot be null"); } criteria.add(new Criterion("je <>", value)); </DeepExtract> return (Criteria) this; }
einvoice
positive
944
@Override public void onDateChanged() { mAdapter.notifyDataSetChanged(); postSetSelectionFromTop(mController.getSelectedDay().year - mController.getMinYear(), mViewSize / 2 - mChildSize / 2); }
@Override public void onDateChanged() { mAdapter.notifyDataSetChanged(); <DeepExtract> postSetSelectionFromTop(mController.getSelectedDay().year - mController.getMinYear(), mViewSize / 2 - mChildSize / 2); </DeepExtract> }
HijriDatePicker
positive
946
@FXML private void deleteButtonAction(ActionEvent event) { final int idx = fullMediaList.indexOf(factory.getSelectedCell().getItem()); final MediaFile item = fullMediaList.get(idx); item.setDeleted(true); imageView.setImage(null); getTitleLabel().setVisible(false); getCameraLabel().setVisible(false); getFilenameLabel().setVisible(false); getRatingControl().setVisible(false); savingMediaFileEdits(item); }
@FXML private void deleteButtonAction(ActionEvent event) { <DeepExtract> final int idx = fullMediaList.indexOf(factory.getSelectedCell().getItem()); final MediaFile item = fullMediaList.get(idx); item.setDeleted(true); imageView.setImage(null); getTitleLabel().setVisible(false); getCameraLabel().setVisible(false); getFilenameLabel().setVisible(false); getRatingControl().setVisible(false); savingMediaFileEdits(item); </DeepExtract> }
PhotoSlide
positive
947
@Override protected Boolean process(Object input) throws Exception { if (!Validate.isPortValid(port)) { throw new IllegalArgumentException("Specified port " + port + " is not a valid port."); } ServerSocket ss = null; Socket s = null; DatagramSocket ds = null; try { ss = new ServerSocket(port); ds = new DatagramSocket(port); s = new Socket("localhost", port); return true; } catch (IOException e) { } finally { if (ds != null) { try { ds.close(); } catch (Exception ex) { } } if (ss != null) { try { ss.close(); } catch (IOException e) { } } if (s != null) { try { s.close(); } catch (IOException e) { } } } return false; }
@Override protected Boolean process(Object input) throws Exception { <DeepExtract> if (!Validate.isPortValid(port)) { throw new IllegalArgumentException("Specified port " + port + " is not a valid port."); } ServerSocket ss = null; Socket s = null; DatagramSocket ds = null; try { ss = new ServerSocket(port); ds = new DatagramSocket(port); s = new Socket("localhost", port); return true; } catch (IOException e) { } finally { if (ds != null) { try { ds.close(); } catch (Exception ex) { } } if (ss != null) { try { ss.close(); } catch (IOException e) { } } if (s != null) { try { s.close(); } catch (IOException e) { } } } return false; </DeepExtract> }
arquillian-droidium
positive
949
public JsonParser setInput(final String inpnam, final Reader inpsrc, final boolean inpcls) { if (inpClose && inpReader != null) { try { inpReader.close(); } catch (final Throwable ign) { ; } } objectStack.clear(); accumulator.setLength(0); if (false) { accumulator.trimToSize(); } inpName = null; inpReader = null; inpLine = 1; inpColumn = 0; objectData = new ObjectData(""); pushBack = -1; evtCode = 0; evtLine = 0; evtColumn = 0; mbrName = ""; mbrValue = ""; inpName = inpnam; inpReader = inpsrc; inpClose = inpcls; if (optPreloadInput) { inpReader = preloadInput(inpnam, inpReader, inpClose, 0); inpClose = true; } return this; }
public JsonParser setInput(final String inpnam, final Reader inpsrc, final boolean inpcls) { <DeepExtract> if (inpClose && inpReader != null) { try { inpReader.close(); } catch (final Throwable ign) { ; } } objectStack.clear(); accumulator.setLength(0); if (false) { accumulator.trimToSize(); } inpName = null; inpReader = null; inpLine = 1; inpColumn = 0; objectData = new ObjectData(""); pushBack = -1; evtCode = 0; evtLine = 0; evtColumn = 0; mbrName = ""; mbrValue = ""; </DeepExtract> inpName = inpnam; inpReader = inpsrc; inpClose = inpcls; if (optPreloadInput) { inpReader = preloadInput(inpnam, inpReader, inpClose, 0); inpClose = true; } return this; }
marc4j
positive
950
public void download(final String url, final String saveapkpath, final long fileSize, final OnDownloadListener listener) { DownLoadCallBack downLoadCallBack = new DownLoadCallBack(); this.listener = listener; this.saveapkpath = saveapkpath; this.fileSize = fileSize; Request request = new Request.Builder().url(url).build(); okHttpClient.newCall(request).enqueue(downLoadCallBack); }
public void download(final String url, final String saveapkpath, final long fileSize, final OnDownloadListener listener) { DownLoadCallBack downLoadCallBack = new DownLoadCallBack(); <DeepExtract> this.listener = listener; this.saveapkpath = saveapkpath; this.fileSize = fileSize; </DeepExtract> Request request = new Request.Builder().url(url).build(); okHttpClient.newCall(request).enqueue(downLoadCallBack); }
AppServiceRestFul
positive
951
public void sendRedirect(String location) throws IOException { List valueList = new ArrayList(); headers.put("Location", valueList); valueList.add(location); wasRedirectSent = true; }
public void sendRedirect(String location) throws IOException { <DeepExtract> List valueList = new ArrayList(); headers.put("Location", valueList); valueList.add(location); </DeepExtract> wasRedirectSent = true; }
cdi-unit
positive
953
protected void onReset() { mIsBeingDragged = false; mLayoutVisibilityChangesEnabled = true; mHeaderLayout.reset(); mFooterLayout.reset(); smoothScrollTo(0, getPullToRefreshScrollDuration()); }
protected void onReset() { mIsBeingDragged = false; mLayoutVisibilityChangesEnabled = true; mHeaderLayout.reset(); mFooterLayout.reset(); <DeepExtract> smoothScrollTo(0, getPullToRefreshScrollDuration()); </DeepExtract> }
GotyeSDK-Android
positive
955
@Test public void handle_withMessage0x312D_notifiesOnDistanceUpdatedUpdate() { return new DisplayedDistanceSubscription() { @Override protected void onDistanceUpdated(int distance) { internalSubscription.onDistanceUpdated(distance); } }; subscription.handle(new DataMemoryMessage(DISTANCE_LOW.getLocation(), 0x31, 0x2D)); internalSubscription.onDistanceUpdated(12589); }
@Test public void handle_withMessage0x312D_notifiesOnDistanceUpdatedUpdate() { return new DisplayedDistanceSubscription() { @Override protected void onDistanceUpdated(int distance) { internalSubscription.onDistanceUpdated(distance); } }; subscription.handle(new DataMemoryMessage(DISTANCE_LOW.getLocation(), 0x31, 0x2D)); <DeepExtract> internalSubscription.onDistanceUpdated(12589); </DeepExtract> }
waterrower-core
positive
956
private void obtainAttrs(AttributeSet attrs) { TypedArray ta = mContext.obtainStyledAttributes(attrs, R.styleable.TitleView); mLeftText = ta.getString(R.styleable.TitleView_leftText); mRightText = ta.getString(R.styleable.TitleView_rightText); mTitle = ta.getString(R.styleable.TitleView_title); mLeftTextColor = ta.getColor(R.styleable.TitleView_leftTextColor, DEF_TEXT_COLOR); mRightTextColor = ta.getColor(R.styleable.TitleView_rightTextColor, DEF_TEXT_COLOR); mTitleColor = ta.getColor(R.styleable.TitleView_titleColor, DEF_TEXT_COLOR); mLeftResId = ta.getResourceId(R.styleable.TitleView_leftIcon, DEF_RES); mRightResId = ta.getResourceId(R.styleable.TitleView_rightIcon, DEF_RES); mLeftVisibility = ta.getInt(R.styleable.TitleView_leftVisibility, DEF_VALUE); mLeftTextSize = ta.getDimension(R.styleable.TitleView_leftTextSize, DEF_TEXT_SIZE); mRightTextSize = ta.getDimension(R.styleable.TitleView_rightTextSize, DEF_TEXT_SIZE); mTitleSize = ta.getDimension(R.styleable.TitleView_titleSize, DEF_TEXT_SIZE); if (mLeftVisibility == 0) { mLeftVisibility = View.VISIBLE; } else if (mLeftVisibility == 1) { mLeftVisibility = View.INVISIBLE; } else { mLeftVisibility = View.GONE; } mRightVisibility = ta.getInt(R.styleable.TitleView_rightVisibility, DEF_VALUE); if (mRightVisibility == 0) { mRightVisibility = View.VISIBLE; } else if (mRightVisibility == 1) { mRightVisibility = View.INVISIBLE; } else { mRightVisibility = View.GONE; } mTitleVisibility = ta.getInt(R.styleable.TitleView_titleVisibility, DEF_VALUE); if (mTitleVisibility == 0) { mTitleVisibility = View.VISIBLE; } else if (mTitleVisibility == 1) { mTitleVisibility = View.INVISIBLE; } else { mTitleVisibility = View.GONE; } ta.recycle(); }
private void obtainAttrs(AttributeSet attrs) { TypedArray ta = mContext.obtainStyledAttributes(attrs, R.styleable.TitleView); mLeftText = ta.getString(R.styleable.TitleView_leftText); mRightText = ta.getString(R.styleable.TitleView_rightText); mTitle = ta.getString(R.styleable.TitleView_title); mLeftTextColor = ta.getColor(R.styleable.TitleView_leftTextColor, DEF_TEXT_COLOR); mRightTextColor = ta.getColor(R.styleable.TitleView_rightTextColor, DEF_TEXT_COLOR); mTitleColor = ta.getColor(R.styleable.TitleView_titleColor, DEF_TEXT_COLOR); mLeftResId = ta.getResourceId(R.styleable.TitleView_leftIcon, DEF_RES); mRightResId = ta.getResourceId(R.styleable.TitleView_rightIcon, DEF_RES); mLeftVisibility = ta.getInt(R.styleable.TitleView_leftVisibility, DEF_VALUE); mLeftTextSize = ta.getDimension(R.styleable.TitleView_leftTextSize, DEF_TEXT_SIZE); mRightTextSize = ta.getDimension(R.styleable.TitleView_rightTextSize, DEF_TEXT_SIZE); mTitleSize = ta.getDimension(R.styleable.TitleView_titleSize, DEF_TEXT_SIZE); if (mLeftVisibility == 0) { mLeftVisibility = View.VISIBLE; } else if (mLeftVisibility == 1) { mLeftVisibility = View.INVISIBLE; } else { mLeftVisibility = View.GONE; } mRightVisibility = ta.getInt(R.styleable.TitleView_rightVisibility, DEF_VALUE); if (mRightVisibility == 0) { mRightVisibility = View.VISIBLE; } else if (mRightVisibility == 1) { mRightVisibility = View.INVISIBLE; } else { mRightVisibility = View.GONE; } mTitleVisibility = ta.getInt(R.styleable.TitleView_titleVisibility, DEF_VALUE); <DeepExtract> if (mTitleVisibility == 0) { mTitleVisibility = View.VISIBLE; } else if (mTitleVisibility == 1) { mTitleVisibility = View.INVISIBLE; } else { mTitleVisibility = View.GONE; } </DeepExtract> ta.recycle(); }
CommonLibrary
positive
957
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { getWritableDatabase().execSQL(SQL_DELETE_TABLE); Logger.e(TAG, SQL_CREATE_TABLE); db.execSQL(SQL_CREATE_TABLE); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { getWritableDatabase().execSQL(SQL_DELETE_TABLE); <DeepExtract> Logger.e(TAG, SQL_CREATE_TABLE); db.execSQL(SQL_CREATE_TABLE); </DeepExtract> }
NutritionMaster
positive
958
@Override public void actionPerformed(ActionEvent arg0) { zoomFactor = Math.round(LatticeView.getZoomFactor() - 0.01 * 100) / 100.0; guiConf.zoomFactor = zoomFactor; if (LatticeView.getZoomFactor() < 0) { LatticeView.setZoomFactor(0); } latticeGraphView.repaint(); }
@Override public void actionPerformed(ActionEvent arg0) { <DeepExtract> zoomFactor = Math.round(LatticeView.getZoomFactor() - 0.01 * 100) / 100.0; guiConf.zoomFactor = zoomFactor; </DeepExtract> if (LatticeView.getZoomFactor() < 0) { LatticeView.setZoomFactor(0); } latticeGraphView.repaint(); }
conexp-ng
positive
959
private AVLNode doubleRotateRL(AVLNode n) { AVLNode left1 = n.right.left; n.right.left = left1.right; left1.right = n.right; n.right.height = Math.max(height(n.right.left), height(n.right.right)) + 1; left1.height = Math.max(height(left1.left), n.right.height) + 1; return left1; AVLNode right1 = n.right; n.right = right1.left; right1.left = n; n.height = Math.max(height(n.left), height(n.right)) + 1; right1.height = Math.max(n.height, height(right1.right)) + 1; return right1; }
private AVLNode doubleRotateRL(AVLNode n) { AVLNode left1 = n.right.left; n.right.left = left1.right; left1.right = n.right; n.right.height = Math.max(height(n.right.left), height(n.right.right)) + 1; left1.height = Math.max(height(left1.left), n.right.height) + 1; return left1; <DeepExtract> AVLNode right1 = n.right; n.right = right1.left; right1.left = n; n.height = Math.max(height(n.left), height(n.right)) + 1; right1.height = Math.max(n.height, height(right1.right)) + 1; return right1; </DeepExtract> }
Algorithm-and-Leetcode
positive
960
public void actionPerformed(java.awt.event.ActionEvent evt) { Object source = evt.getSource(); if (source == groundToggle) { Globals.tab = Tab.ground; setCurrentTab(groundPanel); } else if (source == heightToggle) { Globals.tab = Tab.height; setCurrentTab(heightPanel); } else if (source == floorsToggle) { Globals.tab = Tab.floors; setCurrentTab(floorsPanel); } else if (source == wallsToggle) { Globals.tab = Tab.walls; setCurrentTab(wallsPanel); } else if (source == roofsToggle) { Globals.tab = Tab.roofs; setCurrentTab(roofsPanel); } else if (source == objectsToggle) { Globals.tab = Tab.objects; setCurrentTab(objectsPanel); } else if (source == animalsToggle) { Globals.tab = Tab.animals; setCurrentTab(animalsPanel); } else if (source == labelsToggle) { Globals.tab = Tab.labels; setCurrentTab(labelsPanel); } else if (source == bordersToggle) { Globals.tab = Tab.borders; setCurrentTab(bordersPanel); } else if (source == bridgesToggle) { Globals.tab = Tab.bridges; setCurrentTab(bridgesPanel); } else if (source == symmetryToggle) { Globals.tab = Tab.symmetry; setCurrentTab(symmetryPanel); } else if (source == cavesToggle) { Globals.tab = Tab.caves; setCurrentTab(cavesPanel); } Analytics.getInstance().screenView().screenName(Globals.tab.toString()).sendAsync(); }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> Object source = evt.getSource(); if (source == groundToggle) { Globals.tab = Tab.ground; setCurrentTab(groundPanel); } else if (source == heightToggle) { Globals.tab = Tab.height; setCurrentTab(heightPanel); } else if (source == floorsToggle) { Globals.tab = Tab.floors; setCurrentTab(floorsPanel); } else if (source == wallsToggle) { Globals.tab = Tab.walls; setCurrentTab(wallsPanel); } else if (source == roofsToggle) { Globals.tab = Tab.roofs; setCurrentTab(roofsPanel); } else if (source == objectsToggle) { Globals.tab = Tab.objects; setCurrentTab(objectsPanel); } else if (source == animalsToggle) { Globals.tab = Tab.animals; setCurrentTab(animalsPanel); } else if (source == labelsToggle) { Globals.tab = Tab.labels; setCurrentTab(labelsPanel); } else if (source == bordersToggle) { Globals.tab = Tab.borders; setCurrentTab(bordersPanel); } else if (source == bridgesToggle) { Globals.tab = Tab.bridges; setCurrentTab(bridgesPanel); } else if (source == symmetryToggle) { Globals.tab = Tab.symmetry; setCurrentTab(symmetryPanel); } else if (source == cavesToggle) { Globals.tab = Tab.caves; setCurrentTab(cavesPanel); } Analytics.getInstance().screenView().screenName(Globals.tab.toString()).sendAsync(); </DeepExtract> }
DeedPlanner-2
positive
962
@Override public void setImageResource(int resId) { super.setImageResource(resId); if (getDrawable() == null) { mBitmap = null; } if (getDrawable() instanceof BitmapDrawable) { mBitmap = ((BitmapDrawable) getDrawable()).getBitmap(); } try { Bitmap bitmap; if (getDrawable() instanceof ColorDrawable) { bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); } else { bitmap = Bitmap.createBitmap(getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight(), BITMAP_CONFIG); } Canvas canvas = new Canvas(bitmap); getDrawable().setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); getDrawable().draw(canvas); mBitmap = bitmap; } catch (OutOfMemoryError e) { mBitmap = null; } if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBitmapPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); }
@Override public void setImageResource(int resId) { super.setImageResource(resId); if (getDrawable() == null) { mBitmap = null; } if (getDrawable() instanceof BitmapDrawable) { mBitmap = ((BitmapDrawable) getDrawable()).getBitmap(); } try { Bitmap bitmap; if (getDrawable() instanceof ColorDrawable) { bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); } else { bitmap = Bitmap.createBitmap(getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight(), BITMAP_CONFIG); } Canvas canvas = new Canvas(bitmap); getDrawable().setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); getDrawable().draw(canvas); mBitmap = bitmap; } catch (OutOfMemoryError e) { mBitmap = null; } <DeepExtract> if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBitmapPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); </DeepExtract> }
nicehair
positive
963
@Override public boolean getAutoCommit() throws SQLException { if (isClosed) throw new SQLException("The connection is closed"); if (xaConnection == null) throw new SQLException("The connection is invalid"); return xaConnection.getConnection().getAutoCommit(); }
@Override public boolean getAutoCommit() throws SQLException { <DeepExtract> if (isClosed) throw new SQLException("The connection is closed"); if (xaConnection == null) throw new SQLException("The connection is invalid"); </DeepExtract> return xaConnection.getConnection().getAutoCommit(); }
kumuluzee
positive
965
public Criteria andMoneyIsNotNull() { if ("money is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("money is not null")); return (Criteria) this; }
public Criteria andMoneyIsNotNull() { <DeepExtract> if ("money is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("money is not null")); </DeepExtract> return (Criteria) this; }
garbage-collection
positive
968
void initFromCameraParameters(Camera paramCamera) { Camera.Parameters localParameters = paramCamera.getParameters(); return this.previewFormat; this.previewFormatString = localParameters.get("preview-format"); Log.d(TAG, "Default preview format: " + this.previewFormat + '/' + this.previewFormatString); Display localDisplay = ((WindowManager) this.context.getSystemService("window")).getDefaultDisplay(); this.screenResolution = new Point(localDisplay.getWidth(), localDisplay.getHeight()); Log.d(TAG, "Screen resolution: " + this.screenResolution); String str = localParameters.get("preview-size-values"); if (str == null) str = localParameters.get("preview-size-value"); Point localPoint = null; if (str != null) { Log.d(TAG, "preview-size-values parameter: " + str); localPoint = findBestPreviewSizeValue(str, this.screenResolution); } if (localPoint == null) localPoint = new Point(this.screenResolution.x >> 3 << 3, this.screenResolution.y >> 3 << 3); return localPoint; Log.d(TAG, "Camera resolution: " + this.screenResolution); }
void initFromCameraParameters(Camera paramCamera) { Camera.Parameters localParameters = paramCamera.getParameters(); return this.previewFormat; this.previewFormatString = localParameters.get("preview-format"); Log.d(TAG, "Default preview format: " + this.previewFormat + '/' + this.previewFormatString); Display localDisplay = ((WindowManager) this.context.getSystemService("window")).getDefaultDisplay(); this.screenResolution = new Point(localDisplay.getWidth(), localDisplay.getHeight()); Log.d(TAG, "Screen resolution: " + this.screenResolution); <DeepExtract> String str = localParameters.get("preview-size-values"); if (str == null) str = localParameters.get("preview-size-value"); Point localPoint = null; if (str != null) { Log.d(TAG, "preview-size-values parameter: " + str); localPoint = findBestPreviewSizeValue(str, this.screenResolution); } if (localPoint == null) localPoint = new Point(this.screenResolution.x >> 3 << 3, this.screenResolution.y >> 3 << 3); return localPoint; </DeepExtract> Log.d(TAG, "Camera resolution: " + this.screenResolution); }
deviceShow
positive
969
@Test public void shouldFindAValueTowardsTargetWithDomainAcrossZeroMarker() { assertThatFor(integers().from(-4000).upToAndIncluding(4000)).check(i -> i <= -3900); assertTrue("Expected to be greater than " + -3900 + ", but received " + smallestValueFound(), smallestValueFound() > -3900); }
@Test public void shouldFindAValueTowardsTargetWithDomainAcrossZeroMarker() { assertThatFor(integers().from(-4000).upToAndIncluding(4000)).check(i -> i <= -3900); <DeepExtract> assertTrue("Expected to be greater than " + -3900 + ", but received " + smallestValueFound(), smallestValueFound() > -3900); </DeepExtract> }
QuickTheories
positive
970
public int submit(T item) { Objects.requireNonNull(item); int lag = 0; boolean complete, unowned; ReentrantLock lock = this.lock; lock.lock(); try { Thread t = Thread.currentThread(), o; BufferedSubscription<T> b = clients; if ((unowned = ((o = owner) != t)) && o != null) owner = null; if (b == null) complete = closed; else { complete = false; boolean cleanMe = false; BufferedSubscription<T> retries = null, rtail = null, next; do { next = b.next; int stat = b.offer(item, unowned); if (stat == 0) { b.nextRetry = null; if (rtail == null) retries = b; else rtail.nextRetry = b; rtail = b; } else if (stat < 0) cleanMe = true; else if (stat > lag) lag = stat; } while ((b = next) != null); if (retries != null || cleanMe) lag = retryOffer(item, Long.MAX_VALUE, null, retries, lag, cleanMe); } } finally { lock.unlock(); } if (complete) throw new IllegalStateException("Closed"); else return lag; }
public int submit(T item) { <DeepExtract> Objects.requireNonNull(item); int lag = 0; boolean complete, unowned; ReentrantLock lock = this.lock; lock.lock(); try { Thread t = Thread.currentThread(), o; BufferedSubscription<T> b = clients; if ((unowned = ((o = owner) != t)) && o != null) owner = null; if (b == null) complete = closed; else { complete = false; boolean cleanMe = false; BufferedSubscription<T> retries = null, rtail = null, next; do { next = b.next; int stat = b.offer(item, unowned); if (stat == 0) { b.nextRetry = null; if (rtail == null) retries = b; else rtail.nextRetry = b; rtail = b; } else if (stat < 0) cleanMe = true; else if (stat > lag) lag = stat; } while ((b = next) != null); if (retries != null || cleanMe) lag = retryOffer(item, Long.MAX_VALUE, null, retries, lag, cleanMe); } } finally { lock.unlock(); } if (complete) throw new IllegalStateException("Closed"); else return lag; </DeepExtract> }
java9-concurrent-backport
positive
971
public void init(Context context) { this.context = context; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { AudioAttributes attributes = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); soundPool = new SoundPool.Builder().setAudioAttributes(attributes).setMaxStreams(1).build(); } else { soundPool = new SoundPool(1, AudioManager.MODE_RINGTONE, 0); } audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); EMClient.getInstance().callManager().getCallOptions().setIsSendPushIfOffline(true); EMClient.getInstance().callManager().getCallOptions().setEnableExternalVideoData(false); EMClient.getInstance().callManager().getCallOptions().enableFixedVideoResolution(true); EMClient.getInstance().callManager().getCallOptions().setMaxVideoKbps(800); EMClient.getInstance().callManager().getCallOptions().setMinVideoKbps(150); EMClient.getInstance().callManager().getCallOptions().setVideoResolution(640, 480); EMClient.getInstance().callManager().getCallOptions().setMaxVideoFrameRate(30); EMClient.getInstance().callManager().getCallOptions().setAudioSampleRate(48000); EMClient.getInstance().callManager().getVideoCallHelper().setPreferMovFormatEnable(true); }
public void init(Context context) { this.context = context; <DeepExtract> if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { AudioAttributes attributes = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); soundPool = new SoundPool.Builder().setAudioAttributes(attributes).setMaxStreams(1).build(); } else { soundPool = new SoundPool(1, AudioManager.MODE_RINGTONE, 0); } </DeepExtract> audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); EMClient.getInstance().callManager().getCallOptions().setIsSendPushIfOffline(true); EMClient.getInstance().callManager().getCallOptions().setEnableExternalVideoData(false); EMClient.getInstance().callManager().getCallOptions().enableFixedVideoResolution(true); EMClient.getInstance().callManager().getCallOptions().setMaxVideoKbps(800); EMClient.getInstance().callManager().getCallOptions().setMinVideoKbps(150); EMClient.getInstance().callManager().getCallOptions().setVideoResolution(640, 480); EMClient.getInstance().callManager().getCallOptions().setMaxVideoFrameRate(30); EMClient.getInstance().callManager().getCallOptions().setAudioSampleRate(48000); EMClient.getInstance().callManager().getVideoCallHelper().setPreferMovFormatEnable(true); }
VMChat
positive
972
public void onCreateRouter(ActionEvent event) { txtRouterPackage.setDisable(!chkCreateRouter.isSelected()); txtRouterName.setDisable(!chkCreateRouter.isSelected()); }
public void onCreateRouter(ActionEvent event) { <DeepExtract> txtRouterPackage.setDisable(!chkCreateRouter.isSelected()); txtRouterName.setDisable(!chkCreateRouter.isSelected()); </DeepExtract> }
vertx-generator
positive
973
public CVPipelineSettings getCurrentPipelineSettings() { if (currentPipelineIndex < 0) { switch(currentPipelineIndex) { case DRIVERMODE_INDEX: return driverModePipeline.getSettings(); case CAL_3D_INDEX: return calibration3dPipeline.getSettings(); } } for (var setting : userPipelineSettings) { if (setting.pipelineIndex == currentPipelineIndex) return setting; } return null; }
public CVPipelineSettings getCurrentPipelineSettings() { <DeepExtract> if (currentPipelineIndex < 0) { switch(currentPipelineIndex) { case DRIVERMODE_INDEX: return driverModePipeline.getSettings(); case CAL_3D_INDEX: return calibration3dPipeline.getSettings(); } } for (var setting : userPipelineSettings) { if (setting.pipelineIndex == currentPipelineIndex) return setting; } return null; </DeepExtract> }
photonvision
positive
974
public static void main(String[] args) { Date date1 = new Date(18, 05, 1992); Date date2 = new Date(07, 03, 2019); int date1Days = date1.convertToDays(); int date2Days = date2.convertToDays(); int difference = Math.abs(date1Days - date2Days); System.out.println("------------------------------------------------------------"); System.out.println("There are " + difference + " days between " + date1.printDate() + " and " + date2.printDate() + "."); System.out.println("------------------------------------------------------------"); }
public static void main(String[] args) { Date date1 = new Date(18, 05, 1992); Date date2 = new Date(07, 03, 2019); <DeepExtract> int date1Days = date1.convertToDays(); int date2Days = date2.convertToDays(); int difference = Math.abs(date1Days - date2Days); System.out.println("------------------------------------------------------------"); System.out.println("There are " + difference + " days between " + date1.printDate() + " and " + date2.printDate() + "."); System.out.println("------------------------------------------------------------"); </DeepExtract> }
PGR-103-2020
positive
975
void importDocument(BlockContainer asciidocFile) { Document document = asciidoctor.loadFile(file, parameters); for (Object o : document.getBlocks()) { if (o instanceof StructuralNode) { StructuralNode block = (StructuralNode) o; if (block instanceof ListItem) continue; try { AsciidocBlockDescriptor blockDescriptor = scanOneBlock(block); asciidocFile.getAsciidocBlocks().add(blockDescriptor); scanBlocks(block.getBlocks(), blockDescriptor); } catch (Exception e) { LOGGER.warn("Error while scanning Asciidoc block " + block.getNodeName() + "; reason is: " + e, e); } } } }
void importDocument(BlockContainer asciidocFile) { Document document = asciidoctor.loadFile(file, parameters); <DeepExtract> for (Object o : document.getBlocks()) { if (o instanceof StructuralNode) { StructuralNode block = (StructuralNode) o; if (block instanceof ListItem) continue; try { AsciidocBlockDescriptor blockDescriptor = scanOneBlock(block); asciidocFile.getAsciidocBlocks().add(blockDescriptor); scanBlocks(block.getBlocks(), blockDescriptor); } catch (Exception e) { LOGGER.warn("Error while scanning Asciidoc block " + block.getNodeName() + "; reason is: " + e, e); } } } </DeepExtract> }
jqassistant-plugins
positive
976
protected boolean lowLevelFastqRead(Text key, SequencedFragment value) throws IOException { long skipped = lineReader.skip(1); pos += skipped; if (skipped == 0) return false; int bytesRead = lineReader.readLine(key, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; value.clear(); int bytesRead = lineReader.readLine(value.getSequence(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; int bytesRead = lineReader.readLine(buffer, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; if (buffer.getLength() == 0 || buffer.getBytes()[0] != '+') throw new RuntimeException("unexpected fastq line separating sequence and quality at " + makePositionMessage() + ". Line: " + buffer + ". \nSequence ID: " + key); int bytesRead = lineReader.readLine(value.getQuality(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; lookForIlluminaIdentifier = lookForIlluminaIdentifier && scanIlluminaId(key, value); if (!lookForIlluminaIdentifier) scanNameForReadNumber(key, value); return true; }
protected boolean lowLevelFastqRead(Text key, SequencedFragment value) throws IOException { long skipped = lineReader.skip(1); pos += skipped; if (skipped == 0) return false; int bytesRead = lineReader.readLine(key, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; value.clear(); int bytesRead = lineReader.readLine(value.getSequence(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; int bytesRead = lineReader.readLine(buffer, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; if (buffer.getLength() == 0 || buffer.getBytes()[0] != '+') throw new RuntimeException("unexpected fastq line separating sequence and quality at " + makePositionMessage() + ". Line: " + buffer + ". \nSequence ID: " + key); <DeepExtract> int bytesRead = lineReader.readLine(value.getQuality(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; </DeepExtract> lookForIlluminaIdentifier = lookForIlluminaIdentifier && scanIlluminaId(key, value); if (!lookForIlluminaIdentifier) scanNameForReadNumber(key, value); return true; }
Hadoop-BAM
positive
977
void button_load_clicked() { FileDialog dialog = new FileDialog(new Frame(), "Load", FileDialog.LOAD); dialog.setVisible(true); String filename = dialog.getDirectory() + dialog.getFile(); if (filename == null) return; point_list.removeAllElements(); if (buffer != null) { buffer_gc.setColor(colors[0]); buffer_gc.fillRect(0, 0, XLEN, YLEN); } repaint(); try { BufferedReader fp = new BufferedReader(new FileReader(filename)); String line; while ((line = fp.readLine()) != null) { StringTokenizer st = new StringTokenizer(line, " \t\n\r\f:"); if (st.countTokens() == 5) { byte value = (byte) atoi(st.nextToken()); st.nextToken(); double x = atof(st.nextToken()); st.nextToken(); double y = atof(st.nextToken()); point_list.addElement(new point(x, y, value)); } else if (st.countTokens() == 3) { double y = atof(st.nextToken()); st.nextToken(); double x = atof(st.nextToken()); point_list.addElement(new point(x, y, current_value)); } else break; } fp.close(); } catch (IOException e) { System.err.print(e); } int n = point_list.size(); for (int i = 0; i < n; i++) draw_point(point_list.elementAt(i)); }
void button_load_clicked() { FileDialog dialog = new FileDialog(new Frame(), "Load", FileDialog.LOAD); dialog.setVisible(true); String filename = dialog.getDirectory() + dialog.getFile(); if (filename == null) return; point_list.removeAllElements(); if (buffer != null) { buffer_gc.setColor(colors[0]); buffer_gc.fillRect(0, 0, XLEN, YLEN); } repaint(); try { BufferedReader fp = new BufferedReader(new FileReader(filename)); String line; while ((line = fp.readLine()) != null) { StringTokenizer st = new StringTokenizer(line, " \t\n\r\f:"); if (st.countTokens() == 5) { byte value = (byte) atoi(st.nextToken()); st.nextToken(); double x = atof(st.nextToken()); st.nextToken(); double y = atof(st.nextToken()); point_list.addElement(new point(x, y, value)); } else if (st.countTokens() == 3) { double y = atof(st.nextToken()); st.nextToken(); double x = atof(st.nextToken()); point_list.addElement(new point(x, y, current_value)); } else break; } fp.close(); } catch (IOException e) { System.err.print(e); } <DeepExtract> int n = point_list.size(); for (int i = 0; i < n; i++) draw_point(point_list.elementAt(i)); </DeepExtract> }
wasindoor
positive
978
@Test public void unpooled() throws IOException { ByteArrayPool pool = new ByteArrayPool(0); byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); }
@Test public void unpooled() throws IOException { ByteArrayPool pool = new ByteArrayPool(0); <DeepExtract> byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); </DeepExtract> byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); <DeepExtract> byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); </DeepExtract> }
mvp-android-framework
positive
979
public PageAssertion withElement(String elementId, ElementAttributeAssertion elementAttrAssertion) { HtmlElement htmlElement = ((HtmlPage) page).getElementById(elementId); assertEquals(expected, htmlElement.getTextContent()); return this; }
public PageAssertion withElement(String elementId, ElementAttributeAssertion elementAttrAssertion) { HtmlElement htmlElement = ((HtmlPage) page).getElementById(elementId); <DeepExtract> assertEquals(expected, htmlElement.getTextContent()); </DeepExtract> return this; }
mojave
positive
980
@Test public void testGetRegistries_remote() throws Exception { ZookeeperRegistryClient reader = new ZookeeperRegistryClient(client, objectMapper, config); CountDownLatch latch = new CountDownLatch(1); InetSocketAddress addr = new InetSocketAddress(1234); if (true) { reader.addListener(entry -> { if (entry.gondolaAddress.equals(addr)) { latch.countDown(); } }); } String hostId = registryClient.register(SITE_1_HOST_3_CLUSTERS, addr, URI.create("https://api1.yahoo.com:4443")); if (true) { latch.await(); } List<RegistryClient.Entry> writerEntries = registryClient.getEntries().entrySet().stream().map(Map.Entry::getValue).filter(e -> e.hostId.equals(hostId)).collect(Collectors.toList()); assertEquals(writerEntries.size(), 1); Map<String, RegistryClient.Entry> readerEntries = reader.getEntries(); assertEquals(readerEntries.size(), 1); for (RegistryClient.Entry e : writerEntries) { RegistryClient.Entry readerEntry = readerEntries.get(e.hostId); assertEquals(readerEntry.hostId, e.hostId); assertEquals(readerEntry.gondolaAddress, e.gondolaAddress); } }
@Test public void testGetRegistries_remote() throws Exception { ZookeeperRegistryClient reader = new ZookeeperRegistryClient(client, objectMapper, config); <DeepExtract> CountDownLatch latch = new CountDownLatch(1); InetSocketAddress addr = new InetSocketAddress(1234); if (true) { reader.addListener(entry -> { if (entry.gondolaAddress.equals(addr)) { latch.countDown(); } }); } String hostId = registryClient.register(SITE_1_HOST_3_CLUSTERS, addr, URI.create("https://api1.yahoo.com:4443")); if (true) { latch.await(); } List<RegistryClient.Entry> writerEntries = registryClient.getEntries().entrySet().stream().map(Map.Entry::getValue).filter(e -> e.hostId.equals(hostId)).collect(Collectors.toList()); assertEquals(writerEntries.size(), 1); Map<String, RegistryClient.Entry> readerEntries = reader.getEntries(); assertEquals(readerEntries.size(), 1); for (RegistryClient.Entry e : writerEntries) { RegistryClient.Entry readerEntry = readerEntries.get(e.hostId); assertEquals(readerEntry.hostId, e.hostId); assertEquals(readerEntry.gondolaAddress, e.gondolaAddress); } </DeepExtract> }
gondola
positive
981
public Criteria andPhoneLessThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "phone" + " cannot be null"); } criteria.add(new Criterion("phone <=", value)); return (Criteria) this; }
public Criteria andPhoneLessThanOrEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "phone" + " cannot be null"); } criteria.add(new Criterion("phone <=", value)); </DeepExtract> return (Criteria) this; }
ssmBillBook
positive
982
protected OkRequest<T> writePartHeader(final String name, final String filename, final String contentType) throws IOException { final StringBuilder partBuffer = new StringBuilder(); partBuffer.append("form-data; name=\"").append(name); if (filename != null) { partBuffer.append("\"; filename=\"").append(filename); } partBuffer.append('"'); return send("Content-Disposition").send(": ").send(partBuffer.toString()).send(CRLF); if (contentType != null) { partHeader(HEADER_CONTENT_TYPE, contentType); } final InputStream stream; stream = new BufferedInputStream(new FileInputStream(CRLF)); return send(stream); }
protected OkRequest<T> writePartHeader(final String name, final String filename, final String contentType) throws IOException { final StringBuilder partBuffer = new StringBuilder(); partBuffer.append("form-data; name=\"").append(name); if (filename != null) { partBuffer.append("\"; filename=\"").append(filename); } partBuffer.append('"'); return send("Content-Disposition").send(": ").send(partBuffer.toString()).send(CRLF); if (contentType != null) { partHeader(HEADER_CONTENT_TYPE, contentType); } <DeepExtract> final InputStream stream; stream = new BufferedInputStream(new FileInputStream(CRLF)); return send(stream); </DeepExtract> }
AppKit
positive
984
public Criteria andHttpInterfaceRequestMethodIsNull() { if ("http_interface_request_method is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("http_interface_request_method is null")); return (Criteria) this; }
public Criteria andHttpInterfaceRequestMethodIsNull() { <DeepExtract> if ("http_interface_request_method is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("http_interface_request_method is null")); </DeepExtract> return (Criteria) this; }
AnyMock
positive
985
public static boolean yidongMatch(String phone) { CommonPool<Pattern> pool = factory.build(PhoneOperatorEnum.YIDONG); Pattern pattern = null; try { pattern = pool.borrow(); return pattern.matcher(phone).matches(); } finally { pool.returnObj(pattern); } }
public static boolean yidongMatch(String phone) { <DeepExtract> CommonPool<Pattern> pool = factory.build(PhoneOperatorEnum.YIDONG); Pattern pattern = null; try { pattern = pool.borrow(); return pattern.matcher(phone).matches(); } finally { pool.returnObj(pattern); } </DeepExtract> }
SMS-Sender
positive
986
@Test public void contextLoads1UsingSystemProperty() { System.setProperty("spring.config.class", "com.example.Config"); Context context = Mockito.mock(Context.class); LambdaLogger logger = Mockito.mock(LambdaLogger.class); when(context.getLogger()).thenReturn(logger); ApplicationLambdaEntry lambdaEntry = new ApplicationLambdaEntry(); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); }
@Test public void contextLoads1UsingSystemProperty() { System.setProperty("spring.config.class", "com.example.Config"); <DeepExtract> Context context = Mockito.mock(Context.class); LambdaLogger logger = Mockito.mock(LambdaLogger.class); when(context.getLogger()).thenReturn(logger); ApplicationLambdaEntry lambdaEntry = new ApplicationLambdaEntry(); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); </DeepExtract> }
spring-teaching-demos
positive
988
public boolean isEqual(Tree T2) { if (root == null && T2.root == null) return true; else if (root == null || T2.root == null) return false; else return (isEqualUtil(root.left, T2.root.left) && isEqualUtil(root.right, T2.root.right) && (root.value == T2.root.value)); }
public boolean isEqual(Tree T2) { <DeepExtract> if (root == null && T2.root == null) return true; else if (root == null || T2.root == null) return false; else return (isEqualUtil(root.left, T2.root.left) && isEqualUtil(root.right, T2.root.right) && (root.value == T2.root.value)); </DeepExtract> }
Problem-Solving-in-Data-Structures-Algorithms-using-Java
positive
989
public synchronized Quad[] searchPage(int pageNum, String text) { if (pageNum > pageCount - 1) pageNum = pageCount - 1; else if (pageNum < 0) pageNum = 0; if (pageNum != currentPage) { currentPage = pageNum; if (page != null) page.destroy(); page = null; if (displayList != null) displayList.destroy(); displayList = null; page = doc.loadPage(pageNum); Rect b = page.getBounds(); pageWidth = b.x1 - b.x0; pageHeight = b.y1 - b.y0; } return page.search(text); }
public synchronized Quad[] searchPage(int pageNum, String text) { <DeepExtract> if (pageNum > pageCount - 1) pageNum = pageCount - 1; else if (pageNum < 0) pageNum = 0; if (pageNum != currentPage) { currentPage = pageNum; if (page != null) page.destroy(); page = null; if (displayList != null) displayList.destroy(); displayList = null; page = doc.loadPage(pageNum); Rect b = page.getBounds(); pageWidth = b.x1 - b.x0; pageHeight = b.y1 - b.y0; } </DeepExtract> return page.search(text); }
MuPdfSo
positive
990
@Test public void testFrameNewElementsIterator() { Iterator<? extends ComputerVertex> framed = graph.frame(Arrays.asList(dev6, dev7).iterator(), ComputerVertex.class); Assert.assertNotNull(framed); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev6Name, framed.next().getName()); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev7Name, framed.next().getName()); Assert.assertFalse(framed.hasNext()); }
@Test public void testFrameNewElementsIterator() { Iterator<? extends ComputerVertex> framed = graph.frame(Arrays.asList(dev6, dev7).iterator(), ComputerVertex.class); <DeepExtract> Assert.assertNotNull(framed); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev6Name, framed.next().getName()); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev7Name, framed.next().getName()); Assert.assertFalse(framed.hasNext()); </DeepExtract> }
Ferma
positive
991
@Override public void init() { pelletTimer = Timing.sec(6 * 0.5f); pelletDisplay = PelletDisplay.SIMPLE; guys().forEach(Lifecycle::init); pacMan.tf.vx = -0.55f; pacMan.moveDir = Direction.LEFT; pacMan.ai.setState(PacManState.AWAKE); ghosts().forEach(ghost -> { ghost.moveDir = Direction.LEFT; ghost.tf.setVelocity(-0.55f, 0); ghost.ai.setState(GhostState.CHASING); ghost.ai.state(GhostState.CHASING).removeTimer(); }); int size = 2 * Tile.TS; int x = world.width() * Tile.TS; Ghost[] ghosts = Stream.of(blinky, inky, pinky, clyde).toArray(Ghost[]::new); for (int i = 0; i < ghosts.length; ++i) { ghosts[i].tf.setPosition(x, tf.y); x -= size; } pacMan.tf.setPosition(x, tf.y); }
@Override public void init() { pelletTimer = Timing.sec(6 * 0.5f); pelletDisplay = PelletDisplay.SIMPLE; guys().forEach(Lifecycle::init); pacMan.tf.vx = -0.55f; pacMan.moveDir = Direction.LEFT; pacMan.ai.setState(PacManState.AWAKE); ghosts().forEach(ghost -> { ghost.moveDir = Direction.LEFT; ghost.tf.setVelocity(-0.55f, 0); ghost.ai.setState(GhostState.CHASING); ghost.ai.state(GhostState.CHASING).removeTimer(); }); <DeepExtract> int size = 2 * Tile.TS; int x = world.width() * Tile.TS; Ghost[] ghosts = Stream.of(blinky, inky, pinky, clyde).toArray(Ghost[]::new); for (int i = 0; i < ghosts.length; ++i) { ghosts[i].tf.setPosition(x, tf.y); x -= size; } pacMan.tf.setPosition(x, tf.y); </DeepExtract> }
pacman
positive
992
public int solution(String[] lines) { int answer = 0; int[] startTimes = new int[lines.length]; int[] endTimes = new int[lines.length]; for (int i = 0; i < lines.length; i++) { String[] log = lines[i].split(" "); String[] responseTime = log[1].split(":"); int processingTime = (int) (Double.parseDouble(log[2].substring(0, log[2].length() - 1)) * 1000); int startTime = 0; int endTime = 0; endTime += Integer.parseInt(responseTime[0]) * 60 * 60 * 1000; endTime += Integer.parseInt(responseTime[1]) * 60 * 1000; endTime += (int) (Double.parseDouble(responseTime[2]) * 1000); startTime = endTime - processingTime + 1; startTimes[i] = startTime; endTimes[i] = endTime; } for (int i = 0; i < lines.length; i++) { int cnt = 0; int startOfSection = startTimes[i]; int endOfSection = startOfSection + 1000; answer = getAnswer(lines, answer, startTimes, endTimes, cnt, startOfSection, endOfSection); cnt = 0; startOfSection = endTimes[i]; endOfSection = startOfSection + 1000; answer = getAnswer(lines, answer, startTimes, endTimes, cnt, startOfSection, endOfSection); } return answer; }
public int solution(String[] lines) { int answer = 0; int[] startTimes = new int[lines.length]; int[] endTimes = new int[lines.length]; <DeepExtract> for (int i = 0; i < lines.length; i++) { String[] log = lines[i].split(" "); String[] responseTime = log[1].split(":"); int processingTime = (int) (Double.parseDouble(log[2].substring(0, log[2].length() - 1)) * 1000); int startTime = 0; int endTime = 0; endTime += Integer.parseInt(responseTime[0]) * 60 * 60 * 1000; endTime += Integer.parseInt(responseTime[1]) * 60 * 1000; endTime += (int) (Double.parseDouble(responseTime[2]) * 1000); startTime = endTime - processingTime + 1; startTimes[i] = startTime; endTimes[i] = endTime; } </DeepExtract> for (int i = 0; i < lines.length; i++) { int cnt = 0; int startOfSection = startTimes[i]; int endOfSection = startOfSection + 1000; answer = getAnswer(lines, answer, startTimes, endTimes, cnt, startOfSection, endOfSection); cnt = 0; startOfSection = endTimes[i]; endOfSection = startOfSection + 1000; answer = getAnswer(lines, answer, startTimes, endTimes, cnt, startOfSection, endOfSection); } return answer; }
algorithm-study
positive
993
public void discoverSearch(final UploadSearchParams uploadSearchParams) { if (uploadSearchParams == null) return; SessionManager sessionManager = visenzeAnalytics.getSessionManager(); DataCollection dataCollection = visenzeAnalytics.getDataCollection(); if (uploadSearchParams.getUid() == null) { uploadSearchParams.setUid(sessionManager.getUid()); } if (uploadSearchParams.getSid() == null) { uploadSearchParams.setSid(sessionManager.getSessionId()); } if (uploadSearchParams.getAppId() == null) { uploadSearchParams.setAppId(dataCollection.getAppId()); } if (uploadSearchParams.getAppName() == null) { uploadSearchParams.setAppName(dataCollection.getAppName()); } if (uploadSearchParams.getAppVersion() == null) { uploadSearchParams.setAppVersion(dataCollection.getAppVersion()); } if (uploadSearchParams.getDeviceBrand() == null) { uploadSearchParams.setDeviceBrand(dataCollection.getDeviceBrand()); } if (uploadSearchParams.getDeviceModel() == null) { uploadSearchParams.setDeviceModel(dataCollection.getDeviceModel()); } if (uploadSearchParams.getLanguage() == null) { uploadSearchParams.setLanguage(dataCollection.getLanguage()); } if (uploadSearchParams.getOs() == null) { uploadSearchParams.setOs(dataCollection.getOs()); } if (uploadSearchParams.getOsv() == null) { uploadSearchParams.setOsv(dataCollection.getOsv()); } if (uploadSearchParams.getPlatform() == null) { uploadSearchParams.setPlatform(dataCollection.getPlatform()); } try { searchOperations.discoverSearch(uploadSearchParams, mListener); } catch (ViSearchException e) { Log.e("ViSearch SDK", e.getMessage()); } }
public void discoverSearch(final UploadSearchParams uploadSearchParams) { <DeepExtract> if (uploadSearchParams == null) return; SessionManager sessionManager = visenzeAnalytics.getSessionManager(); DataCollection dataCollection = visenzeAnalytics.getDataCollection(); if (uploadSearchParams.getUid() == null) { uploadSearchParams.setUid(sessionManager.getUid()); } if (uploadSearchParams.getSid() == null) { uploadSearchParams.setSid(sessionManager.getSessionId()); } if (uploadSearchParams.getAppId() == null) { uploadSearchParams.setAppId(dataCollection.getAppId()); } if (uploadSearchParams.getAppName() == null) { uploadSearchParams.setAppName(dataCollection.getAppName()); } if (uploadSearchParams.getAppVersion() == null) { uploadSearchParams.setAppVersion(dataCollection.getAppVersion()); } if (uploadSearchParams.getDeviceBrand() == null) { uploadSearchParams.setDeviceBrand(dataCollection.getDeviceBrand()); } if (uploadSearchParams.getDeviceModel() == null) { uploadSearchParams.setDeviceModel(dataCollection.getDeviceModel()); } if (uploadSearchParams.getLanguage() == null) { uploadSearchParams.setLanguage(dataCollection.getLanguage()); } if (uploadSearchParams.getOs() == null) { uploadSearchParams.setOs(dataCollection.getOs()); } if (uploadSearchParams.getOsv() == null) { uploadSearchParams.setOsv(dataCollection.getOsv()); } if (uploadSearchParams.getPlatform() == null) { uploadSearchParams.setPlatform(dataCollection.getPlatform()); } </DeepExtract> try { searchOperations.discoverSearch(uploadSearchParams, mListener); } catch (ViSearchException e) { Log.e("ViSearch SDK", e.getMessage()); } }
visearch-sdk-android
positive
994
private static boolean match(Object o1, Object o2) { if (o1 == null) { return (o2 == null); } if (o2 == null || !(o2 instanceof XMLAttribute)) { return false; } XMLAttribute other = (XMLAttribute) o2; return match(_name, other._name) && match(_value, other._value) && match(_next, other._next); }
private static boolean match(Object o1, Object o2) { if (o1 == null) { return (o2 == null); } <DeepExtract> if (o2 == null || !(o2 instanceof XMLAttribute)) { return false; } XMLAttribute other = (XMLAttribute) o2; return match(_name, other._name) && match(_value, other._value) && match(_next, other._next); </DeepExtract> }
webstart
positive
995
public void add(double label, double prediction) { if (!examples.containsKey(prediction)) { examples.put(prediction, label); } else { int[] oldVals = examples.get(prediction); oldVals[0] += label[0]; oldVals[1] += label[1]; examples.put(prediction, oldVals); } }
public void add(double label, double prediction) { <DeepExtract> if (!examples.containsKey(prediction)) { examples.put(prediction, label); } else { int[] oldVals = examples.get(prediction); oldVals[0] += label[0]; oldVals[1] += label[1]; examples.put(prediction, oldVals); } </DeepExtract> }
Conjecture
positive
996
public void read(org.apache.thrift7.protocol.TProtocol iprot) throws org.apache.thrift7.TException { iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == org.apache.thrift7.protocol.TType.STOP) { break; } switch(field.id) { case 0: if (field.type == org.apache.thrift7.protocol.TType.I64) { this.success = iprot.readI64(); set_success_isSet(true); } else { org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } break; default: org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); }
public void read(org.apache.thrift7.protocol.TProtocol iprot) throws org.apache.thrift7.TException { <DeepExtract> </DeepExtract> iprot.readStructBegin(); <DeepExtract> </DeepExtract> while (true) { <DeepExtract> </DeepExtract> field = iprot.readFieldBegin(); <DeepExtract> </DeepExtract> if (field.type == org.apache.thrift7.protocol.TType.STOP) { <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> switch(field.id) { <DeepExtract> </DeepExtract> case 0: <DeepExtract> </DeepExtract> if (field.type == org.apache.thrift7.protocol.TType.I64) { <DeepExtract> </DeepExtract> this.success = iprot.readI64(); <DeepExtract> </DeepExtract> set_success_isSet(true); <DeepExtract> </DeepExtract> } else { <DeepExtract> </DeepExtract> org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> default: <DeepExtract> </DeepExtract> org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> iprot.readFieldEnd(); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> iprot.readStructEnd(); <DeepExtract> </DeepExtract> }
storm-scribe
positive
997
public void registerPlayerListener(PodAdddictPlayerListener listener) { if (mIsClosed) { throw new IllegalStateException("Client instance can't be used after being closed."); } mPodAdddictPlayerListeners.add(listener); if (mState == STATE_PLAYING) { listener.onPlayerPlay(mPlayerPlaylist.getCurrentTrack(), mPlayerPlaylist.getCurrentTrackIndex()); } else if (mState == STATE_PAUSED) { listener.onPlayerPause(); } }
public void registerPlayerListener(PodAdddictPlayerListener listener) { <DeepExtract> if (mIsClosed) { throw new IllegalStateException("Client instance can't be used after being closed."); } </DeepExtract> mPodAdddictPlayerListeners.add(listener); if (mState == STATE_PLAYING) { listener.onPlayerPlay(mPlayerPlaylist.getCurrentTrack(), mPlayerPlaylist.getCurrentTrackIndex()); } else if (mState == STATE_PAUSED) { listener.onPlayerPause(); } }
pod-adddict
positive
998
@Override public Reader getCharacterStream(int i) throws SQLException { if (closed) { throw new SQLException("ResultSet is closed"); } return null; }
@Override public Reader getCharacterStream(int i) throws SQLException { <DeepExtract> if (closed) { throw new SQLException("ResultSet is closed"); } </DeepExtract> return null; }
rodriguez
positive
1,000
@Override public void onExecuteWrite(BluetoothDevice device, int requestId, boolean execute) { super.onExecuteWrite(device, requestId, execute); if (mBluetoothGattServer != null) { mBluetoothGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0, new byte[] {}); } Log.i("ADV-CB", "executeWriteStorages : " + execute); for (int i = mWriteList.size() - 1; i >= 0; i--) { WriteStorage storage = mWriteList.get(i); if (storage != null && storage.getDeviceAddress().equalsIgnoreCase(device.getAddress())) { if (execute) { if (storage.isCharacter()) { onCharacterWrite(storage.getDeviceAddress(), storage.getUUID(), storage.getFullData()); } } mWriteList.remove(storage); storage.clearData(); } } }
@Override public void onExecuteWrite(BluetoothDevice device, int requestId, boolean execute) { super.onExecuteWrite(device, requestId, execute); if (mBluetoothGattServer != null) { mBluetoothGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0, new byte[] {}); } <DeepExtract> Log.i("ADV-CB", "executeWriteStorages : " + execute); for (int i = mWriteList.size() - 1; i >= 0; i--) { WriteStorage storage = mWriteList.get(i); if (storage != null && storage.getDeviceAddress().equalsIgnoreCase(device.getAddress())) { if (execute) { if (storage.isCharacter()) { onCharacterWrite(storage.getDeviceAddress(), storage.getUUID(), storage.getFullData()); } } mWriteList.remove(storage); storage.clearData(); } } </DeepExtract> }
BLETestStuff
positive
1,001
public static String addSecond(String date, int hourAmount) { String dateString = null; DateStyle dateStyle = getDateStyle(date); if (dateStyle != null) { Date myDate = StringToDate(date, dateStyle); myDate = addInteger(myDate, Calendar.SECOND, hourAmount); dateString = DateToString(myDate, dateStyle); } return dateString; }
public static String addSecond(String date, int hourAmount) { <DeepExtract> String dateString = null; DateStyle dateStyle = getDateStyle(date); if (dateStyle != null) { Date myDate = StringToDate(date, dateStyle); myDate = addInteger(myDate, Calendar.SECOND, hourAmount); dateString = DateToString(myDate, dateStyle); } return dateString; </DeepExtract> }
SuperNote
positive
1,002
@Test public void testAsyncOperation(TestContext context) { Async async = context.async(); vertx.setTimer(10, l -> list -> { assertThat(list, hasItems("a", "b", "c")); async.complete(); }.handle(Arrays.asList("a", "b", "c"))); }
@Test public void testAsyncOperation(TestContext context) { Async async = context.async(); <DeepExtract> vertx.setTimer(10, l -> list -> { assertThat(list, hasItems("a", "b", "c")); async.complete(); }.handle(Arrays.asList("a", "b", "c"))); </DeepExtract> }
vertx-examples
positive
1,003
@Override public void onCancel() { FacebookOperationCanceledException e = new FacebookOperationCanceledException(); if (e.getMessage() != null) { Log.e(TAG, e.toString()); } String errMsg = "Facebook error: " + e.getMessage(); int errorCode = INVALID_ERROR_CODE; if (e instanceof FacebookOperationCanceledException) { errMsg = "User cancelled dialog"; errorCode = 4201; } else if (e instanceof FacebookDialogException) { errMsg = "Dialog error: " + e.getMessage(); } if (showDialogContext != null) { showDialogContext.error(getErrorResponse(e, errMsg, errorCode)); } else { Log.e(TAG, "Error already sent so no context, msg: " + errMsg + ", code: " + errorCode); } }
@Override public void onCancel() { FacebookOperationCanceledException e = new FacebookOperationCanceledException(); <DeepExtract> if (e.getMessage() != null) { Log.e(TAG, e.toString()); } String errMsg = "Facebook error: " + e.getMessage(); int errorCode = INVALID_ERROR_CODE; if (e instanceof FacebookOperationCanceledException) { errMsg = "User cancelled dialog"; errorCode = 4201; } else if (e instanceof FacebookDialogException) { errMsg = "Dialog error: " + e.getMessage(); } if (showDialogContext != null) { showDialogContext.error(getErrorResponse(e, errMsg, errorCode)); } else { Log.e(TAG, "Error already sent so no context, msg: " + errMsg + ", code: " + errorCode); } </DeepExtract> }
newschool-frontend
positive
1,004
@Override public void map(CaseConfig caseConfig) { super.mapTo(this); Map<String, String> client = config.getMapProperty("xclient"); if (client != null) { for (Map.Entry<String, String> pair : client.entrySet()) { ((XclientSession) this).getXclient().put(pair.getKey(), pair.getValue()); } } }
@Override public void map(CaseConfig caseConfig) { <DeepExtract> super.mapTo(this); Map<String, String> client = config.getMapProperty("xclient"); if (client != null) { for (Map.Entry<String, String> pair : client.entrySet()) { ((XclientSession) this).getXclient().put(pair.getKey(), pair.getValue()); } } </DeepExtract> }
robin
positive
1,005
public ValveWriter close() throws IOException { this.indentation--; this.writeIndentation().write(CLOSE_TAG + ValveWriter.LINE_BREAK); return this; }
public ValveWriter close() throws IOException { this.indentation--; <DeepExtract> this.writeIndentation().write(CLOSE_TAG + ValveWriter.LINE_BREAK); </DeepExtract> return this; }
sourcecraft
positive
1,006
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { ArrayList<String> password = new ArrayList<>(); int arraySize; int randomIndex; Random random = new SecureRandom(); int length = Integer.parseInt(passwordLength.getText().toString()); if (!checkBoxLowerCase.isChecked() && !checkBoxUpperCase.isChecked() && !checkBoxNumbers.isChecked() && !checkBoxSpecialChars.isChecked()) { generatedPassword = ""; passwordDisplay.setText(""); return; } while (password.size() < length) { if (checkBoxLowerCase.isChecked()) { arraySize = lowerCase.length; randomIndex = random.nextInt(arraySize); password.add(lowerCase[randomIndex]); } if (checkBoxUpperCase.isChecked()) { arraySize = upperCase.length; randomIndex = random.nextInt(arraySize); password.add(upperCase[randomIndex]); } if (checkBoxNumbers.isChecked()) { arraySize = numbers.length; randomIndex = random.nextInt(arraySize); password.add(numbers[randomIndex]); } if (checkBoxSpecialChars.isChecked()) { arraySize = specialChars.length; randomIndex = random.nextInt(arraySize); password.add(specialChars[randomIndex]); } } Collections.shuffle(password); while (password.size() > length) { password.remove(0); } generatedPassword = TextUtils.join("", password); passwordDisplay.setText(generatedPassword); }
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { <DeepExtract> ArrayList<String> password = new ArrayList<>(); int arraySize; int randomIndex; Random random = new SecureRandom(); int length = Integer.parseInt(passwordLength.getText().toString()); if (!checkBoxLowerCase.isChecked() && !checkBoxUpperCase.isChecked() && !checkBoxNumbers.isChecked() && !checkBoxSpecialChars.isChecked()) { generatedPassword = ""; passwordDisplay.setText(""); return; } while (password.size() < length) { if (checkBoxLowerCase.isChecked()) { arraySize = lowerCase.length; randomIndex = random.nextInt(arraySize); password.add(lowerCase[randomIndex]); } if (checkBoxUpperCase.isChecked()) { arraySize = upperCase.length; randomIndex = random.nextInt(arraySize); password.add(upperCase[randomIndex]); } if (checkBoxNumbers.isChecked()) { arraySize = numbers.length; randomIndex = random.nextInt(arraySize); password.add(numbers[randomIndex]); } if (checkBoxSpecialChars.isChecked()) { arraySize = specialChars.length; randomIndex = random.nextInt(arraySize); password.add(specialChars[randomIndex]); } } Collections.shuffle(password); while (password.size() > length) { password.remove(0); } generatedPassword = TextUtils.join("", password); passwordDisplay.setText(generatedPassword); </DeepExtract> }
rcloneExplorer
positive
1,007
public static void main(String[] args) { BenchmarkSettings.loadSettings(args); BenchmarkSettings.printSettings(); SparkUpfront s = new SparkUpfront(); cfg = new ConfUtils(BenchmarkSettings.conf); SparkConf sconf = new SparkConf().setMaster(cfg.getSPARK_MASTER()).setAppName("Spark App").setSparkHome(cfg.getSPARK_HOME()).setJars(new String[] { cfg.getSPARK_APPLICATION_JAR() }).set("spark.hadoop.cloneConf", "false").set("spark.executor.memory", cfg.getSPARK_EXECUTOR_MEMORY()).set("spark.driver.memory", cfg.getSPARK_DRIVER_MEMORY()).set("spark.task.cpus", "1"); try { sconf.registerKryoClasses(new Class<?>[] { Class.forName("org.apache.hadoop.io.LongWritable"), Class.forName("org.apache.hadoop.io.Text") }); } catch (ClassNotFoundException e) { e.printStackTrace(); } ctx = new JavaSparkContext(sconf); ctx.hadoopConfiguration().setBoolean(FileInputFormat.INPUT_DIR_RECURSIVE, true); ctx.hadoopConfiguration().set("fs.hdfs.impl", org.apache.hadoop.hdfs.DistributedFileSystem.class.getName()); sqlContext = new SQLContext(ctx); sqlContext.sql(createTpch); TPCHWorkload w = new TPCHWorkload(); w.setUp(); for (int i = 0; i < w.supportedQueries.length; i++) { Query q = w.getQuery(w.supportedQueries[i]); long start = System.currentTimeMillis(); String query = q.createQueryString(); System.out.println("Query:" + query); DataFrame df = sqlContext.sql(query); long result = df.count(); long end = System.currentTimeMillis(); System.out.println("RES: Query: " + w.supportedQueries[i] + ";Time Taken: " + (end - start) + "; Result: " + result); } }
public static void main(String[] args) { BenchmarkSettings.loadSettings(args); BenchmarkSettings.printSettings(); SparkUpfront s = new SparkUpfront(); cfg = new ConfUtils(BenchmarkSettings.conf); SparkConf sconf = new SparkConf().setMaster(cfg.getSPARK_MASTER()).setAppName("Spark App").setSparkHome(cfg.getSPARK_HOME()).setJars(new String[] { cfg.getSPARK_APPLICATION_JAR() }).set("spark.hadoop.cloneConf", "false").set("spark.executor.memory", cfg.getSPARK_EXECUTOR_MEMORY()).set("spark.driver.memory", cfg.getSPARK_DRIVER_MEMORY()).set("spark.task.cpus", "1"); try { sconf.registerKryoClasses(new Class<?>[] { Class.forName("org.apache.hadoop.io.LongWritable"), Class.forName("org.apache.hadoop.io.Text") }); } catch (ClassNotFoundException e) { e.printStackTrace(); } ctx = new JavaSparkContext(sconf); ctx.hadoopConfiguration().setBoolean(FileInputFormat.INPUT_DIR_RECURSIVE, true); ctx.hadoopConfiguration().set("fs.hdfs.impl", org.apache.hadoop.hdfs.DistributedFileSystem.class.getName()); sqlContext = new SQLContext(ctx); sqlContext.sql(createTpch); <DeepExtract> TPCHWorkload w = new TPCHWorkload(); w.setUp(); for (int i = 0; i < w.supportedQueries.length; i++) { Query q = w.getQuery(w.supportedQueries[i]); long start = System.currentTimeMillis(); String query = q.createQueryString(); System.out.println("Query:" + query); DataFrame df = sqlContext.sql(query); long result = df.count(); long end = System.currentTimeMillis(); System.out.println("RES: Query: " + w.supportedQueries[i] + ";Time Taken: " + (end - start) + "; Result: " + result); } </DeepExtract> }
amoeba
positive
1,008
public static Result lbfgs(double[] x, Function proc_evaluate, ProgressCallback proc_progress, Params param) { int n = x.length; Result ret = new Result(null); double[] step = new double[] { 0 }; final int m = param.m; double[] d, w, pf = null; double[] fx = new double[] { 0 }; double rate = 0; line_search_proc linesearch = new line_search_backtracking(); callback_data_t cd = new callback_data_t(); cd.n = n; cd.proc_evaluate = proc_evaluate; cd.proc_progress = proc_progress; if (n <= 0) { return new Result(Status.LBFGSERR_INVALID_N); } if (param.epsilon < 0.) { return new Result(Status.LBFGSERR_INVALID_EPSILON); } if (param.past < 0) { return new Result(Status.LBFGSERR_INVALID_TESTPERIOD); } if (param.delta < 0.) { return new Result(Status.LBFGSERR_INVALID_DELTA); } if (param.min_step < 0.) { return new Result(Status.LBFGSERR_INVALID_MINSTEP); } if (param.max_step < param.min_step) { return new Result(Status.LBFGSERR_INVALID_MAXSTEP); } if (param.ftol < 0.) { return new Result(Status.LBFGSERR_INVALID_FTOL); } if (param.linesearch == LinesearchAlgorithm.LBFGS_LINESEARCH_BACKTRACKING_WOLFE || param.linesearch == LinesearchAlgorithm.LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE) { if (param.wolfe <= param.ftol || 1. <= param.wolfe) { return new Result(Status.LBFGSERR_INVALID_WOLFE); } } if (param.gtol < 0.) { return new Result(Status.LBFGSERR_INVALID_GTOL); } if (param.xtol < 0.) { return new Result(Status.LBFGSERR_INVALID_XTOL); } if (param.max_linesearch <= 0) { return new Result(Status.LBFGSERR_INVALID_MAXLINESEARCH); } if (param.orthantwise_c < 0.) { return new Result(Status.LBFGSERR_INVALID_ORTHANTWISE); } if (param.orthantwise_start < 0 || n < param.orthantwise_start) { return new Result(Status.LBFGSERR_INVALID_ORTHANTWISE_START); } if (param.orthantwise_end < 0) { param.orthantwise_end = n; } if (n < param.orthantwise_end) { return new Result(Status.LBFGSERR_INVALID_ORTHANTWISE_END); } if (param.orthantwise_c != 0.) { linesearch = new line_search_backtracking_owlqn(); } else { switch(param.linesearch) { case LBFGS_LINESEARCH_MORETHUENTE: linesearch = new line_search_morethuente(); break; case LBFGS_LINESEARCH_BACKTRACKING_ARMIJO: case LBFGS_LINESEARCH_BACKTRACKING_WOLFE: case LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE: linesearch = new line_search_backtracking(); break; default: return new Result(Status.LBFGSERR_INVALID_LINESEARCH); } } xp = new double[n]; g = new double[n]; gp = new double[n]; d = new double[n]; w = new double[n]; if (param.orthantwise_c != 0) { pg = new double[n]; } else { pg = new double[0]; } lm = new iteration_data_t[m]; for (i = 0; i < m; ++i) { lm[i] = new iteration_data_t(); it = lm[i]; it.alpha = 0; it.ys = 0; it.s = new double[n]; it.y = new double[n]; } if (0 < param.past) { pf = new double[param.past]; } double sqloss = 0; Arr.fill(g, 0); for (int i = 0; i < cd.n; i++) { double pred = Arr.innerProduct(x, X[i]); double resid = pred - Y[i]; sqloss += Math.pow(resid, 2); for (int j = 0; j < Nfeat; j++) { g[j] += X[i][j] * resid; } } return sqloss; if (0. != param.orthantwise_c) { xnorm = owlqn_x1norm(x, param.orthantwise_start, param.orthantwise_end); fx[0] += xnorm * param.orthantwise_c; owlqn_pseudo_gradient(pg, x, g, n, param.orthantwise_c, param.orthantwise_start, param.orthantwise_end); } if (pf != null) { pf[0] = fx[0]; } if (param.orthantwise_c == 0.) { vecncpy(d, g, n); } else { vecncpy(d, pg, n); } double s = vecdot(x, x, n); return Math.sqrt(s); if (param.orthantwise_c == 0.) { gnorm = vec2norm(g, n); } else { gnorm = vec2norm(pg, n); } if (xnorm < 1.0) xnorm = 1.0; if (gnorm / xnorm <= param.epsilon) { return new Result(Status.LBFGS_ALREADY_MINIMIZED); } double s = vec2norm(d, n); return 1.0 / s; k = 1; end = 0; for (; ; ) { veccpy(xp, x, n); veccpy(gp, g, n); if (param.orthantwise_c == 0.) { ls = linesearch.go(n, x, fx, g, d, step, xp, gp, w, cd, param); } else { ls = linesearch.go(n, x, fx, g, d, step, xp, pg, w, cd, param); owlqn_pseudo_gradient(pg, x, g, n, param.orthantwise_c, param.orthantwise_start, param.orthantwise_end); } if (ls != null && ls.isError()) { veccpy(x, xp, n); veccpy(g, gp, n); ret.status = ls; ret.objective = fx[0]; return ret; } xnorm = vec2norm(x, n); if (param.orthantwise_c == 0.) { gnorm = vec2norm(g, n); } else { gnorm = vec2norm(pg, n); } if (cd.proc_progress != null) { int stopEarly = cd.proc_progress.apply(x, g, fx[0], xnorm, gnorm, step[0], cd.n, k, ls); if (stopEarly != 0) { ret.status = Status.LBFGS_STOP; ret.additionalStatus = stopEarly; ret.objective = fx[0]; return ret; } } if (xnorm < 1.0) xnorm = 1.0; if (gnorm / xnorm <= param.epsilon) { ret.status = Status.LBFGS_SUCCESS; break; } if (pf != null) { if (param.past <= k) { rate = (pf[k % param.past] - fx[0]) / fx[0]; if (rate < param.delta) { ret.status = Status.LBFGS_STOP; break; } } pf[k % param.past] = fx[0]; } if (param.max_iterations != 0 && param.max_iterations < k + 1) { ret.status = Status.LBFGSERR_MAXIMUMITERATION; break; } it = lm[end]; vecdiff(it.s, x, xp, n); vecdiff(it.y, g, gp, n); ys = vecdot(it.y, it.s, n); yy = vecdot(it.y, it.y, n); it.ys = ys; bound = (m <= k) ? m : k; ++k; end = (end + 1) % m; if (param.orthantwise_c == 0.) { vecncpy(d, g, n); } else { vecncpy(d, pg, n); } j = end; for (i = 0; i < bound; ++i) { j = (j + m - 1) % m; it = lm[j]; it.alpha = vecdot(it.s, d, n); it.alpha /= it.ys; vecadd(d, it.y, -it.alpha, n); } vecscale(d, ys / yy, n); for (i = 0; i < bound; ++i) { it = lm[j]; beta = vecdot(it.y, d, n); beta /= it.ys; vecadd(d, it.s, it.alpha - beta, n); j = (j + 1) % m; } if (param.orthantwise_c != 0.) { for (i = param.orthantwise_start; i < param.orthantwise_end; ++i) { if (d[i] * pg[i] >= 0) { d[i] = 0; } } } step[0] = 1.0; } ret.objective = fx[0]; return ret; }
public static Result lbfgs(double[] x, Function proc_evaluate, ProgressCallback proc_progress, Params param) { int n = x.length; Result ret = new Result(null); double[] step = new double[] { 0 }; final int m = param.m; double[] d, w, pf = null; double[] fx = new double[] { 0 }; double rate = 0; line_search_proc linesearch = new line_search_backtracking(); callback_data_t cd = new callback_data_t(); cd.n = n; cd.proc_evaluate = proc_evaluate; cd.proc_progress = proc_progress; if (n <= 0) { return new Result(Status.LBFGSERR_INVALID_N); } if (param.epsilon < 0.) { return new Result(Status.LBFGSERR_INVALID_EPSILON); } if (param.past < 0) { return new Result(Status.LBFGSERR_INVALID_TESTPERIOD); } if (param.delta < 0.) { return new Result(Status.LBFGSERR_INVALID_DELTA); } if (param.min_step < 0.) { return new Result(Status.LBFGSERR_INVALID_MINSTEP); } if (param.max_step < param.min_step) { return new Result(Status.LBFGSERR_INVALID_MAXSTEP); } if (param.ftol < 0.) { return new Result(Status.LBFGSERR_INVALID_FTOL); } if (param.linesearch == LinesearchAlgorithm.LBFGS_LINESEARCH_BACKTRACKING_WOLFE || param.linesearch == LinesearchAlgorithm.LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE) { if (param.wolfe <= param.ftol || 1. <= param.wolfe) { return new Result(Status.LBFGSERR_INVALID_WOLFE); } } if (param.gtol < 0.) { return new Result(Status.LBFGSERR_INVALID_GTOL); } if (param.xtol < 0.) { return new Result(Status.LBFGSERR_INVALID_XTOL); } if (param.max_linesearch <= 0) { return new Result(Status.LBFGSERR_INVALID_MAXLINESEARCH); } if (param.orthantwise_c < 0.) { return new Result(Status.LBFGSERR_INVALID_ORTHANTWISE); } if (param.orthantwise_start < 0 || n < param.orthantwise_start) { return new Result(Status.LBFGSERR_INVALID_ORTHANTWISE_START); } if (param.orthantwise_end < 0) { param.orthantwise_end = n; } if (n < param.orthantwise_end) { return new Result(Status.LBFGSERR_INVALID_ORTHANTWISE_END); } if (param.orthantwise_c != 0.) { linesearch = new line_search_backtracking_owlqn(); } else { switch(param.linesearch) { case LBFGS_LINESEARCH_MORETHUENTE: linesearch = new line_search_morethuente(); break; case LBFGS_LINESEARCH_BACKTRACKING_ARMIJO: case LBFGS_LINESEARCH_BACKTRACKING_WOLFE: case LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE: linesearch = new line_search_backtracking(); break; default: return new Result(Status.LBFGSERR_INVALID_LINESEARCH); } } xp = new double[n]; g = new double[n]; gp = new double[n]; d = new double[n]; w = new double[n]; if (param.orthantwise_c != 0) { pg = new double[n]; } else { pg = new double[0]; } lm = new iteration_data_t[m]; for (i = 0; i < m; ++i) { lm[i] = new iteration_data_t(); it = lm[i]; it.alpha = 0; it.ys = 0; it.s = new double[n]; it.y = new double[n]; } if (0 < param.past) { pf = new double[param.past]; } double sqloss = 0; Arr.fill(g, 0); for (int i = 0; i < cd.n; i++) { double pred = Arr.innerProduct(x, X[i]); double resid = pred - Y[i]; sqloss += Math.pow(resid, 2); for (int j = 0; j < Nfeat; j++) { g[j] += X[i][j] * resid; } } return sqloss; if (0. != param.orthantwise_c) { xnorm = owlqn_x1norm(x, param.orthantwise_start, param.orthantwise_end); fx[0] += xnorm * param.orthantwise_c; owlqn_pseudo_gradient(pg, x, g, n, param.orthantwise_c, param.orthantwise_start, param.orthantwise_end); } if (pf != null) { pf[0] = fx[0]; } if (param.orthantwise_c == 0.) { vecncpy(d, g, n); } else { vecncpy(d, pg, n); } double s = vecdot(x, x, n); return Math.sqrt(s); if (param.orthantwise_c == 0.) { gnorm = vec2norm(g, n); } else { gnorm = vec2norm(pg, n); } if (xnorm < 1.0) xnorm = 1.0; if (gnorm / xnorm <= param.epsilon) { return new Result(Status.LBFGS_ALREADY_MINIMIZED); } <DeepExtract> double s = vec2norm(d, n); return 1.0 / s; </DeepExtract> k = 1; end = 0; for (; ; ) { veccpy(xp, x, n); veccpy(gp, g, n); if (param.orthantwise_c == 0.) { ls = linesearch.go(n, x, fx, g, d, step, xp, gp, w, cd, param); } else { ls = linesearch.go(n, x, fx, g, d, step, xp, pg, w, cd, param); owlqn_pseudo_gradient(pg, x, g, n, param.orthantwise_c, param.orthantwise_start, param.orthantwise_end); } if (ls != null && ls.isError()) { veccpy(x, xp, n); veccpy(g, gp, n); ret.status = ls; ret.objective = fx[0]; return ret; } xnorm = vec2norm(x, n); if (param.orthantwise_c == 0.) { gnorm = vec2norm(g, n); } else { gnorm = vec2norm(pg, n); } if (cd.proc_progress != null) { int stopEarly = cd.proc_progress.apply(x, g, fx[0], xnorm, gnorm, step[0], cd.n, k, ls); if (stopEarly != 0) { ret.status = Status.LBFGS_STOP; ret.additionalStatus = stopEarly; ret.objective = fx[0]; return ret; } } if (xnorm < 1.0) xnorm = 1.0; if (gnorm / xnorm <= param.epsilon) { ret.status = Status.LBFGS_SUCCESS; break; } if (pf != null) { if (param.past <= k) { rate = (pf[k % param.past] - fx[0]) / fx[0]; if (rate < param.delta) { ret.status = Status.LBFGS_STOP; break; } } pf[k % param.past] = fx[0]; } if (param.max_iterations != 0 && param.max_iterations < k + 1) { ret.status = Status.LBFGSERR_MAXIMUMITERATION; break; } it = lm[end]; vecdiff(it.s, x, xp, n); vecdiff(it.y, g, gp, n); ys = vecdot(it.y, it.s, n); yy = vecdot(it.y, it.y, n); it.ys = ys; bound = (m <= k) ? m : k; ++k; end = (end + 1) % m; if (param.orthantwise_c == 0.) { vecncpy(d, g, n); } else { vecncpy(d, pg, n); } j = end; for (i = 0; i < bound; ++i) { j = (j + m - 1) % m; it = lm[j]; it.alpha = vecdot(it.s, d, n); it.alpha /= it.ys; vecadd(d, it.y, -it.alpha, n); } vecscale(d, ys / yy, n); for (i = 0; i < bound; ++i) { it = lm[j]; beta = vecdot(it.y, d, n); beta /= it.ys; vecadd(d, it.s, it.alpha - beta, n); j = (j + 1) % m; } if (param.orthantwise_c != 0.) { for (i = param.orthantwise_start; i < param.orthantwise_end; ++i) { if (d[i] * pg[i] >= 0) { d[i] = 0; } } } step[0] = 1.0; } ret.objective = fx[0]; return ret; }
myutil
positive
1,009
@Override public void run() { if (mBoardRelease != null) { showReleasesInfo(false, null, false); } else { if (mDeviceInfoData != null) { boolean hasDFUService = mFirmwareUpdater.hasCurrentConnectedDeviceDFUService(); if (hasDFUService) { showReleasesInfo(false, null, false); } else { showReleasesInfo(true, getString(R.string.connectedsettings_dfunotfound), false); mCustomFirmwareButton.setVisibility(View.GONE); mCustomBootloaderButton.setVisibility(View.GONE); } } else { showReleasesInfo(true, getString(R.string.connectedsettings_retrievinginfo), true); } } }
@Override public void run() { <DeepExtract> if (mBoardRelease != null) { showReleasesInfo(false, null, false); } else { if (mDeviceInfoData != null) { boolean hasDFUService = mFirmwareUpdater.hasCurrentConnectedDeviceDFUService(); if (hasDFUService) { showReleasesInfo(false, null, false); } else { showReleasesInfo(true, getString(R.string.connectedsettings_dfunotfound), false); mCustomFirmwareButton.setVisibility(View.GONE); mCustomBootloaderButton.setVisibility(View.GONE); } } else { showReleasesInfo(true, getString(R.string.connectedsettings_retrievinginfo), true); } } </DeepExtract> }
Bluefruit_LE_Connect_Android
positive
1,010
public static void main(String[] args) { int overflow = 0; ListNode result = new ListNode(0); ListNode p = new ListNode(5), q = new ListNode(5), curr = result; while (p != null || q != null) { int pval = p == null ? 0 : p.val; int qval = q == null ? 0 : q.val; int value = pval + qval + overflow; overflow = 0; if (value >= 10) overflow++; curr.next = new ListNode(value % 10); curr = curr.next; if (p != null) p = p.next; if (q != null) q = q.next; } if (overflow > 0) { curr.next = new ListNode(overflow); } return result.next; }
public static void main(String[] args) { <DeepExtract> int overflow = 0; ListNode result = new ListNode(0); ListNode p = new ListNode(5), q = new ListNode(5), curr = result; while (p != null || q != null) { int pval = p == null ? 0 : p.val; int qval = q == null ? 0 : q.val; int value = pval + qval + overflow; overflow = 0; if (value >= 10) overflow++; curr.next = new ListNode(value % 10); curr = curr.next; if (p != null) p = p.next; if (q != null) q = q.next; } if (overflow > 0) { curr.next = new ListNode(overflow); } return result.next; </DeepExtract> }
JavaZone
positive
1,011
@VisibleForTesting int retrieveFirstNumberOfSubjects() { return numberOfSubjects; }
@VisibleForTesting int retrieveFirstNumberOfSubjects() { <DeepExtract> return numberOfSubjects; </DeepExtract> }
groningen
positive
1,012
@CodeTranslate public void memberExpressionAccessedByMethod() throws Exception { VariableTest.o = member; }
@CodeTranslate public void memberExpressionAccessedByMethod() throws Exception { <DeepExtract> VariableTest.o = member; </DeepExtract> }
vertx-codetrans
positive
1,013
@Override public boolean onCreate() { if (getContext() == null) { init(getApplicationByReflect()); return; } init((Application) getContext().getApplicationContext()); return true; }
@Override public boolean onCreate() { <DeepExtract> if (getContext() == null) { init(getApplicationByReflect()); return; } init((Application) getContext().getApplicationContext()); </DeepExtract> return true; }
MVPFramework
positive
1,014
public boolean more() throws JSONException { int c; if (this.usePrevious) { this.usePrevious = false; c = this.previous; } else { try { c = this.reader.read(); } catch (IOException exception) { throw new JSONException(exception); } if (c <= 0) { this.eof = true; c = 0; } } this.index += 1; if (this.previous == '\r') { this.line += 1; this.character = c == '\n' ? 0 : 1; } else if (c == '\n') { this.line += 1; this.character = 0; } else { this.character += 1; } this.previous = (char) c; return this.previous; if (this.end()) { return false; } if (this.usePrevious || this.index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.index -= 1; this.character -= 1; this.usePrevious = true; this.eof = false; return true; }
public boolean more() throws JSONException { int c; if (this.usePrevious) { this.usePrevious = false; c = this.previous; } else { try { c = this.reader.read(); } catch (IOException exception) { throw new JSONException(exception); } if (c <= 0) { this.eof = true; c = 0; } } this.index += 1; if (this.previous == '\r') { this.line += 1; this.character = c == '\n' ? 0 : 1; } else if (c == '\n') { this.line += 1; this.character = 0; } else { this.character += 1; } this.previous = (char) c; return this.previous; if (this.end()) { return false; } <DeepExtract> if (this.usePrevious || this.index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.index -= 1; this.character -= 1; this.usePrevious = true; this.eof = false; </DeepExtract> return true; }
renren-api2-sdk-java
positive
1,015
@Override public void run() { if (stack.size() <= 0) return; contentFrameLayout.setLayoutTransition(null); View showView = wrapper.getView(); View preView = stack.peek().getView(); stack.push(wrapper); contentFrameLayout.addView(showView); pushOutAnimator.setTarget(preView); pushOutAnimator.start(); pushInAnimator.setTarget(showView); pushInAnimator.setFloatValues(contentFrameLayout.getWidth(), 0); pushInAnimator.start(); refreshTitle(); refreshOptionsMenu(); }
@Override public void run() { <DeepExtract> if (stack.size() <= 0) return; contentFrameLayout.setLayoutTransition(null); View showView = wrapper.getView(); View preView = stack.peek().getView(); stack.push(wrapper); contentFrameLayout.addView(showView); pushOutAnimator.setTarget(preView); pushOutAnimator.start(); pushInAnimator.setTarget(showView); pushInAnimator.setFloatValues(contentFrameLayout.getWidth(), 0); pushInAnimator.start(); refreshTitle(); refreshOptionsMenu(); </DeepExtract> }
flyapp
positive
1,016
@Override public void addComment(XmlElement xmlElement) { Map<String, Object> map = new HashMap<>(); map.put("mgb", MergeConstants.NEW_ELEMENT_TAG); map.put("xmlElement", xmlElement); if (this.suppressAllComments) { return; } String[] comments = getComments(map, EnumNode.ADD_COMMENT); if (comments != null) { if (comments.length == 1 && !StringUtility.stringHasValue(comments[0])) { return; } for (String comment : comments) { xmlElement.addElement(new TextElement(comment)); } } }
@Override public void addComment(XmlElement xmlElement) { Map<String, Object> map = new HashMap<>(); map.put("mgb", MergeConstants.NEW_ELEMENT_TAG); map.put("xmlElement", xmlElement); <DeepExtract> if (this.suppressAllComments) { return; } String[] comments = getComments(map, EnumNode.ADD_COMMENT); if (comments != null) { if (comments.length == 1 && !StringUtility.stringHasValue(comments[0])) { return; } for (String comment : comments) { xmlElement.addElement(new TextElement(comment)); } } </DeepExtract> }
mybatis-generator-plugin
positive
1,017
public void setDeviceName(java.lang.String deviceName) throws IOException { try { if (wrtr != null) { wrtr.close(); wrtr = null; } if (rdr != null) { rdr.close(); rdr = null; } } catch (IOException e) { e.printStackTrace(); } this.deviceName = deviceName; wrtr = new RandomAccessFile(deviceName, "rw"); rdr = wrtr; long result = -1; Field dscrField; FileDescriptor dscr; try { dscr = wrtr.getFD(); try { dscrField = FileDescriptor.class.getDeclaredField("handle"); } catch (NoSuchFieldException ex) { dscrField = FileDescriptor.class.getDeclaredField("fd"); } dscrField.setAccessible(true); result = dscrField.getLong(dscr); } catch (Exception ex) { log.log(Level.SEVERE, "getFD", ex); } return result; SerialExt.serialPortDescriptor = (int) serialDeviceDescriptor; }
public void setDeviceName(java.lang.String deviceName) throws IOException { try { if (wrtr != null) { wrtr.close(); wrtr = null; } if (rdr != null) { rdr.close(); rdr = null; } } catch (IOException e) { e.printStackTrace(); } this.deviceName = deviceName; wrtr = new RandomAccessFile(deviceName, "rw"); rdr = wrtr; <DeepExtract> long result = -1; Field dscrField; FileDescriptor dscr; try { dscr = wrtr.getFD(); try { dscrField = FileDescriptor.class.getDeclaredField("handle"); } catch (NoSuchFieldException ex) { dscrField = FileDescriptor.class.getDeclaredField("fd"); } dscrField.setAccessible(true); result = dscrField.getLong(dscr); } catch (Exception ex) { log.log(Level.SEVERE, "getFD", ex); } return result; </DeepExtract> SerialExt.serialPortDescriptor = (int) serialDeviceDescriptor; }
AndrOBD
positive
1,018
private static void bindPreferenceSummaryToValue(Preference preference) { preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); String stringValue = PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), "").toString(); if (preference instanceof ListPreference) { ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); } else if (preference instanceof RingtonePreference) { if (TextUtils.isEmpty(stringValue)) { preference.setSummary(R.string.pref_ringtone_silent); } else { Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue)); if (ringtone == null) { preference.setSummary(null); } else { String name = ringtone.getTitle(preference.getContext()); preference.setSummary(name); } } } else { preference.setSummary(stringValue); } return true; }
private static void bindPreferenceSummaryToValue(Preference preference) { preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); <DeepExtract> String stringValue = PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), "").toString(); if (preference instanceof ListPreference) { ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); } else if (preference instanceof RingtonePreference) { if (TextUtils.isEmpty(stringValue)) { preference.setSummary(R.string.pref_ringtone_silent); } else { Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue)); if (ringtone == null) { preference.setSummary(null); } else { String name = ringtone.getTitle(preference.getContext()); preference.setSummary(name); } } } else { preference.setSummary(stringValue); } return true; </DeepExtract> }
EverExample
positive
1,019
@Nullable @Override protected Parcelable onSaveInstanceState() { final Parcelable superState = super.onSaveInstanceState(); if (isPersistent()) { return superState; } final SavedState myState = new SavedState(superState); return mChecked; return myState; }
@Nullable @Override protected Parcelable onSaveInstanceState() { final Parcelable superState = super.onSaveInstanceState(); if (isPersistent()) { return superState; } final SavedState myState = new SavedState(superState); <DeepExtract> return mChecked; </DeepExtract> return myState; }
SamsungOneUi
positive
1,020
public static Builder newBuilder(net.osrg.namazu.InspectorMessage.InspectorMsgReq prototype) { if (prototype instanceof net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) { return mergeFrom((net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) prototype); } else { super.mergeFrom(prototype); return this; } }
public static Builder newBuilder(net.osrg.namazu.InspectorMessage.InspectorMsgReq prototype) { <DeepExtract> if (prototype instanceof net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) { return mergeFrom((net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) prototype); } else { super.mergeFrom(prototype); return this; } </DeepExtract> }
namazu
positive
1,021
@Override public int execute(Config config) throws IOException { var log = Log.create(name(), config.getOrThrow("pro", ProConf.class).loglevel()); var frozerConf = config.getOrThrow(name(), FrozerConf.class); log.debug(config, conf -> "config " + frozerConf); String rootModuleName = frozerConf.rootModule().orElseThrow(() -> new IllegalArgumentException("no root module specified")); ModuleFinder finder = ModuleFinder.of(frozerConf.modulePath().toArray(Path[]::new)); var rootModule = finder.find(rootModuleName).orElseThrow(() -> new IllegalStateException("no root module " + rootModuleName + " not found")); var dependencies = new LinkedHashSet<String>(); var requires = new LinkedHashSet<String>(); ModuleHelper.resolveOnlyRequires(finder, List.of(rootModuleName), new ResolverListener() { @Override public void module(String moduleName) { dependencies.add(moduleName); } @Override public void dependencyNotFound(String moduleName, String dependencyChain) { requires.add(moduleName); } }); dependencies.removeAll(requires); var packages = dependencies.stream().filter(not(rootModuleName::equals)).flatMap(name -> finder.find(name).stream()).map(ModuleReference::descriptor).flatMap(descriptor -> Stream.<String>concat(descriptor.exports().stream().map(Exports::source), descriptor.packages().stream())).collect(toUnmodifiableSet()); var rootModuleName = rootModule.descriptor().name(); var internalRootModuleName = rootModuleName.replace('.', '/'); var internalPackageNameMap = packages.stream().map(name -> name.replace('.', '/')).collect(toUnmodifiableMap(name -> name, name -> internalRootModuleName + '/' + name)); var newPackages = new HashSet<String>(); Path path = frozerConf.moduleFrozenArtifactSourcePath().resolve(rootModuleName + ".jar"); Files.createDirectories(path.getParent()); try (var output = Files.newOutputStream(path); var outputStream = new JarOutputStream(output)) { var entryNames = new HashSet<>(); for (var dependency : dependencies) { var reference = finder.find(dependency).orElseThrow(); try (var reader = reference.open()) { for (String filename : (Iterable<String>) reader.list()::iterator) { if (filename.equals("module-info.class") || filename.endsWith("/") || filename.startsWith("META-INF")) { continue; } if (!entryNames.add(filename)) { System.out.println("duplicate entry " + filename + " skip it !"); continue; } try (var inputStream = reader.open(filename).orElseThrow(() -> new IOException("can not read " + filename))) { if (!filename.endsWith(".class")) { getPackage(filename).ifPresent(newPackages::add); outputStream.putNextEntry(new JarEntry(filename)); inputStream.transferTo(outputStream); continue; } var newFilename = interpolateInternalName(internalPackageNameMap, filename); getPackage(newFilename).ifPresent(newPackages::add); outputStream.putNextEntry(new JarEntry(newFilename)); outputStream.write(rewriteBytecode(internalPackageNameMap, inputStream.readAllBytes())); } } } } outputStream.putNextEntry(new JarEntry("module-info.class")); var builder = ModuleDescriptor.newOpenModule(rootModuleName); var rootModuleDescriptor = rootModule.descriptor(); rootModuleDescriptor.version().ifPresent(builder::version); requires.forEach(builder::requires); rootModuleDescriptor.exports().forEach(builder::exports); rootModuleDescriptor.opens().forEach(builder::opens); builder.packages(rootModuleDescriptor.packages()); dependencies.stream().flatMap(name -> finder.find(name).stream()).map(ModuleReference::descriptor).forEach(descriptor -> { descriptor.provides().forEach(provides -> { builder.provides(interpolateClassName(internalPackageNameMap, provides.service()), provides.providers().stream().map(provider -> interpolateClassName(internalPackageNameMap, provider)).collect(toUnmodifiableList())); }); descriptor.uses().forEach(uses -> builder.uses(interpolateClassName(internalPackageNameMap, uses))); }); builder.packages(newPackages); var moduleDescriptor = builder.build(); outputStream.write(ModuleHelper.moduleDescriptorToBinary(moduleDescriptor)); } return 0; }
@Override public int execute(Config config) throws IOException { var log = Log.create(name(), config.getOrThrow("pro", ProConf.class).loglevel()); var frozerConf = config.getOrThrow(name(), FrozerConf.class); log.debug(config, conf -> "config " + frozerConf); String rootModuleName = frozerConf.rootModule().orElseThrow(() -> new IllegalArgumentException("no root module specified")); ModuleFinder finder = ModuleFinder.of(frozerConf.modulePath().toArray(Path[]::new)); var rootModule = finder.find(rootModuleName).orElseThrow(() -> new IllegalStateException("no root module " + rootModuleName + " not found")); var dependencies = new LinkedHashSet<String>(); var requires = new LinkedHashSet<String>(); ModuleHelper.resolveOnlyRequires(finder, List.of(rootModuleName), new ResolverListener() { @Override public void module(String moduleName) { dependencies.add(moduleName); } @Override public void dependencyNotFound(String moduleName, String dependencyChain) { requires.add(moduleName); } }); dependencies.removeAll(requires); var packages = dependencies.stream().filter(not(rootModuleName::equals)).flatMap(name -> finder.find(name).stream()).map(ModuleReference::descriptor).flatMap(descriptor -> Stream.<String>concat(descriptor.exports().stream().map(Exports::source), descriptor.packages().stream())).collect(toUnmodifiableSet()); <DeepExtract> var rootModuleName = rootModule.descriptor().name(); var internalRootModuleName = rootModuleName.replace('.', '/'); var internalPackageNameMap = packages.stream().map(name -> name.replace('.', '/')).collect(toUnmodifiableMap(name -> name, name -> internalRootModuleName + '/' + name)); var newPackages = new HashSet<String>(); Path path = frozerConf.moduleFrozenArtifactSourcePath().resolve(rootModuleName + ".jar"); Files.createDirectories(path.getParent()); try (var output = Files.newOutputStream(path); var outputStream = new JarOutputStream(output)) { var entryNames = new HashSet<>(); for (var dependency : dependencies) { var reference = finder.find(dependency).orElseThrow(); try (var reader = reference.open()) { for (String filename : (Iterable<String>) reader.list()::iterator) { if (filename.equals("module-info.class") || filename.endsWith("/") || filename.startsWith("META-INF")) { continue; } if (!entryNames.add(filename)) { System.out.println("duplicate entry " + filename + " skip it !"); continue; } try (var inputStream = reader.open(filename).orElseThrow(() -> new IOException("can not read " + filename))) { if (!filename.endsWith(".class")) { getPackage(filename).ifPresent(newPackages::add); outputStream.putNextEntry(new JarEntry(filename)); inputStream.transferTo(outputStream); continue; } var newFilename = interpolateInternalName(internalPackageNameMap, filename); getPackage(newFilename).ifPresent(newPackages::add); outputStream.putNextEntry(new JarEntry(newFilename)); outputStream.write(rewriteBytecode(internalPackageNameMap, inputStream.readAllBytes())); } } } } outputStream.putNextEntry(new JarEntry("module-info.class")); var builder = ModuleDescriptor.newOpenModule(rootModuleName); var rootModuleDescriptor = rootModule.descriptor(); rootModuleDescriptor.version().ifPresent(builder::version); requires.forEach(builder::requires); rootModuleDescriptor.exports().forEach(builder::exports); rootModuleDescriptor.opens().forEach(builder::opens); builder.packages(rootModuleDescriptor.packages()); dependencies.stream().flatMap(name -> finder.find(name).stream()).map(ModuleReference::descriptor).forEach(descriptor -> { descriptor.provides().forEach(provides -> { builder.provides(interpolateClassName(internalPackageNameMap, provides.service()), provides.providers().stream().map(provider -> interpolateClassName(internalPackageNameMap, provider)).collect(toUnmodifiableList())); }); descriptor.uses().forEach(uses -> builder.uses(interpolateClassName(internalPackageNameMap, uses))); }); builder.packages(newPackages); var moduleDescriptor = builder.build(); outputStream.write(ModuleHelper.moduleDescriptorToBinary(moduleDescriptor)); } </DeepExtract> return 0; }
pro
positive
1,022
public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields; switch(fieldId) { default: fields = null; } if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; }
public static _Fields findByThriftIdOrThrow(int fieldId) { <DeepExtract> _Fields fields; switch(fieldId) { default: fields = null; } </DeepExtract> if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; }
tiny-mmo
positive
1,024
public void setScale(float scale) { mScale = scale; loadUrl("javascript:document.getElementById('content').style.zoom=\"" + (int) (mScale * 100) + "%\""); loadUrl("javascript:elem=document.getElementById('content');window.HTMLOUT.reportContentHeight(" + mParentSize.x + "*elem.offsetHeight/elem.offsetWidth)"); if (mCore.isNoghtMode()) { toNightMode(); } else { toDayMode(); } }
public void setScale(float scale) { mScale = scale; loadUrl("javascript:document.getElementById('content').style.zoom=\"" + (int) (mScale * 100) + "%\""); <DeepExtract> loadUrl("javascript:elem=document.getElementById('content');window.HTMLOUT.reportContentHeight(" + mParentSize.x + "*elem.offsetHeight/elem.offsetWidth)"); </DeepExtract> if (mCore.isNoghtMode()) { toNightMode(); } else { toDayMode(); } }
zReader-mupdf
positive
1,025
@Override @Deprecated public void setMinScale(float minScale) { checkZoomLevels(minScale, mMidScale, mMaxScale); mMinScale = minScale; }
@Override @Deprecated public void setMinScale(float minScale) { <DeepExtract> checkZoomLevels(minScale, mMidScale, mMaxScale); mMinScale = minScale; </DeepExtract> }
AppleFramework
positive
1,026
@Override public void onPrepared(MediaPlayer player) { LogUtils.d(TAG, "onPrepared from MediaPlayer"); LogUtils.d(TAG, "configMediaPlayerState. mAudioFocus=", mAudioFocus); if (mAudioFocus == AUDIO_NO_FOCUS_NO_DUCK) { if (mState == PlaybackStateCompat.STATE_PLAYING) { pause(); } } else { if (mAudioFocus == AUDIO_NO_FOCUS_CAN_DUCK) { mMediaPlayer.setVolume(VOLUME_DUCK, VOLUME_DUCK); } else { if (mMediaPlayer != null) { mMediaPlayer.setVolume(VOLUME_NORMAL, VOLUME_NORMAL); } } if (mPlayOnFocusGain) { if (mMediaPlayer != null && !mMediaPlayer.isPlaying()) { LogUtils.d(TAG, "configMediaPlayerState startMediaPlayer. seeking to ", mCurrentPosition); if (mCurrentPosition == mMediaPlayer.getCurrentPosition()) { mMediaPlayer.start(); mState = PlaybackStateCompat.STATE_PLAYING; } else { mMediaPlayer.seekTo(mCurrentPosition); mState = PlaybackStateCompat.STATE_BUFFERING; } } mPlayOnFocusGain = false; } } if (mCallback != null) { mCallback.onPlaybackStatusChanged(mState); } }
@Override public void onPrepared(MediaPlayer player) { LogUtils.d(TAG, "onPrepared from MediaPlayer"); <DeepExtract> LogUtils.d(TAG, "configMediaPlayerState. mAudioFocus=", mAudioFocus); if (mAudioFocus == AUDIO_NO_FOCUS_NO_DUCK) { if (mState == PlaybackStateCompat.STATE_PLAYING) { pause(); } } else { if (mAudioFocus == AUDIO_NO_FOCUS_CAN_DUCK) { mMediaPlayer.setVolume(VOLUME_DUCK, VOLUME_DUCK); } else { if (mMediaPlayer != null) { mMediaPlayer.setVolume(VOLUME_NORMAL, VOLUME_NORMAL); } } if (mPlayOnFocusGain) { if (mMediaPlayer != null && !mMediaPlayer.isPlaying()) { LogUtils.d(TAG, "configMediaPlayerState startMediaPlayer. seeking to ", mCurrentPosition); if (mCurrentPosition == mMediaPlayer.getCurrentPosition()) { mMediaPlayer.start(); mState = PlaybackStateCompat.STATE_PLAYING; } else { mMediaPlayer.seekTo(mCurrentPosition); mState = PlaybackStateCompat.STATE_BUFFERING; } } mPlayOnFocusGain = false; } } if (mCallback != null) { mCallback.onPlaybackStatusChanged(mState); } </DeepExtract> }
LyricHere
positive
1,027
protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) { if (values == null || values.size() == 0) { throw new RuntimeException("Value list for " + property + " cannot be null or empty"); } List<java.sql.Date> dateList = new ArrayList<java.sql.Date>(); Iterator<Date> iter = values.iterator(); while (iter.hasNext()) { dateList.add(new java.sql.Date(iter.next().getTime())); } if (dateList == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, dateList)); }
protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) { if (values == null || values.size() == 0) { throw new RuntimeException("Value list for " + property + " cannot be null or empty"); } List<java.sql.Date> dateList = new ArrayList<java.sql.Date>(); Iterator<Date> iter = values.iterator(); while (iter.hasNext()) { dateList.add(new java.sql.Date(iter.next().getTime())); } <DeepExtract> if (dateList == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, dateList)); </DeepExtract> }
chat-software
positive
1,028
public Criteria andNameBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "name" + " cannot be null"); } criteria.add(new Criterion("name between", value1, value2)); return (Criteria) this; }
public Criteria andNameBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "name" + " cannot be null"); } criteria.add(new Criterion("name between", value1, value2)); </DeepExtract> return (Criteria) this; }
CuitJavaEEPractice
positive
1,030
public Criteria andTitleNotLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "title" + " cannot be null"); } criteria.add(new Criterion("title not like", value)); return (Criteria) this; }
public Criteria andTitleNotLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "title" + " cannot be null"); } criteria.add(new Criterion("title not like", value)); </DeepExtract> return (Criteria) this; }
yurencloud-public
positive
1,031
@Override public void onClick(View view) { Intent notificationIntent = new Intent(getApplicationContext(), receiveActivity.class); notificationIntent.putExtra("mytype", "Expand text"); PendingIntent contentIntent = PendingIntent.getActivity(MainActivity.this, NotID, notificationIntent, 0); NotificationCompat.Builder build = new NotificationCompat.Builder(getApplicationContext()).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)).setSmallIcon(R.drawable.ic_launcher).setTicker("This is a notification marquee").setWhen(System.currentTimeMillis()).setContentTitle("Message Title 7").setContentText("Message Content 7 will have more space for text").setContentIntent(contentIntent).addAction(android.R.drawable.ic_menu_edit, "Edit", contentIntent).setAutoCancel(true); Notification noti = new NotificationCompat.BigTextStyle(build).bigText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent consequat dictum sem. Aliquam lacus turpis, aliquet id dictum id, fringilla nec tortor. Sed consectetur eros vel lectus ornare a vulputate dui eleifend. Integer ac lorem ipsum, in placerat ligula. Mauris et dictum risus. Aliquam vestibulum nibh vitae nibh vehicula nec ullamcorper sapien feugiat. Proin vel porttitor diam. In laoreet eleifend ipsum eget lobortis. Suspendisse est magna, egestas non sodales ac, eleifend sit amet tellus.").build(); nm.notify(NotID, noti); NotID++; }
@Override public void onClick(View view) { <DeepExtract> Intent notificationIntent = new Intent(getApplicationContext(), receiveActivity.class); notificationIntent.putExtra("mytype", "Expand text"); PendingIntent contentIntent = PendingIntent.getActivity(MainActivity.this, NotID, notificationIntent, 0); NotificationCompat.Builder build = new NotificationCompat.Builder(getApplicationContext()).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)).setSmallIcon(R.drawable.ic_launcher).setTicker("This is a notification marquee").setWhen(System.currentTimeMillis()).setContentTitle("Message Title 7").setContentText("Message Content 7 will have more space for text").setContentIntent(contentIntent).addAction(android.R.drawable.ic_menu_edit, "Edit", contentIntent).setAutoCancel(true); Notification noti = new NotificationCompat.BigTextStyle(build).bigText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent consequat dictum sem. Aliquam lacus turpis, aliquet id dictum id, fringilla nec tortor. Sed consectetur eros vel lectus ornare a vulputate dui eleifend. Integer ac lorem ipsum, in placerat ligula. Mauris et dictum risus. Aliquam vestibulum nibh vitae nibh vehicula nec ullamcorper sapien feugiat. Proin vel porttitor diam. In laoreet eleifend ipsum eget lobortis. Suspendisse est magna, egestas non sodales ac, eleifend sit amet tellus.").build(); nm.notify(NotID, noti); NotID++; </DeepExtract> }
Android-Examples
positive
1,032
public static Color darker(Color c) { int min = 0; int max = 255; int r = TradeUtility.intWithinRange(c.getRed() + -OFFSET_COLOR_AMOUNT, min, max); int g = TradeUtility.intWithinRange(c.getGreen() + -OFFSET_COLOR_AMOUNT, min, max); int b = TradeUtility.intWithinRange(c.getBlue() + -OFFSET_COLOR_AMOUNT, min, max); return new Color(r, g, b); }
public static Color darker(Color c) { <DeepExtract> int min = 0; int max = 255; int r = TradeUtility.intWithinRange(c.getRed() + -OFFSET_COLOR_AMOUNT, min, max); int g = TradeUtility.intWithinRange(c.getGreen() + -OFFSET_COLOR_AMOUNT, min, max); int b = TradeUtility.intWithinRange(c.getBlue() + -OFFSET_COLOR_AMOUNT, min, max); return new Color(r, g, b); </DeepExtract> }
SlimTrade
positive
1,033
@Test public void replaceAndRemove4() { expected = "ddcdcdd"; input = "acdbbca"; k = 7; assertEquals(expected, ReplaceAndRemove.replaceAndRemove(input.toCharArray(), k)); }
@Test public void replaceAndRemove4() { expected = "ddcdcdd"; input = "acdbbca"; k = 7; <DeepExtract> assertEquals(expected, ReplaceAndRemove.replaceAndRemove(input.toCharArray(), k)); </DeepExtract> }
Elements-of-programming-interviews
positive
1,034
@Override public void onRefresh() { super.onRefresh(); TaskManager rt = new TaskManager(getActivity()); NodeInfoRequest nir = new NodeInfoRequest(); rt.startNewRequestTask(nir); if (!swipeRefreshLayout.isRefreshing()) { swipeRefreshLayout.post(() -> swipeRefreshLayout.setRefreshing(true)); } }
@Override public void onRefresh() { super.onRefresh(); <DeepExtract> TaskManager rt = new TaskManager(getActivity()); NodeInfoRequest nir = new NodeInfoRequest(); rt.startNewRequestTask(nir); if (!swipeRefreshLayout.isRefreshing()) { swipeRefreshLayout.post(() -> swipeRefreshLayout.setRefreshing(true)); } </DeepExtract> }
android-wallet-app
positive
1,035