blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
150451ea4cb6574f5999196dfc218702357c9395
19,550,691,150,625
cec628def1aad94ccbefa814d2a0dbd51588e9bd
/keyring.impl/src/org/netbeans/modules/keyring/win32/Win32Protect.java
ee59606de0f01321060a3a7ae7708634df7282b7
[]
no_license
emilianbold/netbeans-releases
https://github.com/emilianbold/netbeans-releases
ad6e6e52a896212cb628d4522a4f8ae685d84d90
2fd6dc84c187e3c79a959b3ddb4da1a9703659c7
refs/heads/master
2021-01-12T04:58:24.877000
2017-10-17T14:38:27
2017-10-17T14:38:27
78,269,363
30
15
null
false
2020-10-13T08:36:08
2017-01-07T09:07:28
2020-10-03T06:33:28
2020-10-13T08:36:06
965,667
16
11
5
null
false
false
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2010 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, the * "License"). You may not use this file except in compliance with the * License. You can obtain a copy of the License at * http://www.netbeans.org/cddl-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * If you wish your version of this file to be governed by only the CDDL * or only the GPL Version 2, indicate your decision by adding * "[Contributor] elects to include this software in this distribution * under the [CDDL or GPL Version 2] license." If you do not indicate a * single choice of license, a recipient has the option to distribute * your version of this file under either the CDDL, the GPL Version 2 or * to extend the choice of license to its licensees as provided above. * However, if you add GPL Version 2 code and therefore, elected the GPL * Version 2 license, then the option applies only if the new code is * made subject to such option by the copyright holder. * * Contributor(s): * * Portions Copyrighted 2009 Sun Microsystems, Inc. */ package org.netbeans.modules.keyring.win32; import com.sun.jna.Memory; import com.sun.jna.Native; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.WString; import com.sun.jna.win32.StdCallLibrary; import java.util.Arrays; import java.util.List; import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.logging.Logger; import org.netbeans.modules.keyring.utils.Utils; import org.netbeans.modules.keyring.spi.EncryptionProvider; import org.openide.util.Utilities; import org.openide.util.lookup.ServiceProvider; /** * Data protection utility for Microsoft Windows. * XXX org.tmatesoft.svn.core.internal.util.jna.SVNWinCrypt is a possibly more robust implementation * (though it seems to set CRYPTPROTECT_UI_FORBIDDEN which we do not necessarily want). */ @ServiceProvider(service=EncryptionProvider.class, position=100) public class Win32Protect implements EncryptionProvider { private static final Logger LOG = Logger.getLogger(Win32Protect.class.getName()); public @Override boolean enabled() { if (!Utilities.isWindows()) { LOG.fine("not running on Windows"); return false; } if (Boolean.getBoolean("netbeans.keyring.no.native")) { LOG.fine("native keyring integration disabled"); return false; } try { if (CryptLib.INSTANCE == null) { LOG.fine("loadLibrary -> null"); return false; } return true; } catch (Throwable t) { LOG.log(Level.FINE, null, t); return false; } } public @Override String id() { return "win32"; // NOI18N } public @Override byte[] encrypt(char[] cleartext) throws Exception { byte[] cleartextB = Utils.chars2Bytes(cleartext); CryptIntegerBlob input = new CryptIntegerBlob(); input.store(cleartextB); Arrays.fill(cleartextB, (byte) 0); CryptIntegerBlob output = new CryptIntegerBlob(); if (!CryptLib.INSTANCE.CryptProtectData(input, null, null, null, null, 0, output)) { throw new Exception("CryptProtectData failed: " + Native.getLastError()); } input.zero(); return output.load(); } public @Override char[] decrypt(byte[] ciphertext) throws Exception { CryptIntegerBlob input = new CryptIntegerBlob(); input.store(ciphertext); CryptIntegerBlob output = new CryptIntegerBlob(); if (!CryptLib.INSTANCE.CryptUnprotectData(input, null, null, null, null, 0, output)) { throw new Exception("CryptUnprotectData failed: " + Native.getLastError()); } byte[] result = output.load(); // XXX gives CCE because not a Memory: output.zero(); char[] cleartext = Utils.bytes2Chars(result); Arrays.fill(result, (byte) 0); return cleartext; } public @Override boolean decryptionFailed() { return false; // not much to do about it } public @Override void encryptionChangingCallback(Callable<Void> callback) {} public @Override void encryptionChanged() { assert false; } public @Override void freshKeyring(boolean fresh) {} public interface CryptLib extends StdCallLibrary { CryptLib INSTANCE = (CryptLib) Native.loadLibrary("Crypt32", CryptLib.class); // NOI18N /** @see <a href="http://msdn.microsoft.com/en-us/library/aa380261(VS.85,printer).aspx">Reference</a> */ boolean CryptProtectData( CryptIntegerBlob pDataIn, WString szDataDescr, CryptIntegerBlob pOptionalEntropy, Pointer pvReserved, Pointer pPromptStruct, int dwFlags, CryptIntegerBlob pDataOut )/* throws LastErrorException*/; /** @see <a href="http://msdn.microsoft.com/en-us/library/aa380882(VS.85,printer).aspx">Reference</a> */ boolean CryptUnprotectData( CryptIntegerBlob pDataIn, WString[] ppszDataDescr, CryptIntegerBlob pOptionalEntropy, Pointer pvReserved, Pointer pPromptStruct, int dwFlags, CryptIntegerBlob pDataOut )/* throws LastErrorException*/; } public static class CryptIntegerBlob extends Structure { public int cbData; public /*byte[]*/Pointer pbData; byte[] load() { return pbData.getByteArray(0, cbData); // XXX how to free pbData? [Kernel32]LocalFree? } void store(byte[] data) { cbData = data.length; pbData = new Memory(data.length); pbData.write(0, data, 0, cbData); } void zero() { ((Memory) pbData).clear(); } @Override protected List getFieldOrder() { return Arrays.asList( new String[] { "cbData", "pbData", } ); } } }
UTF-8
Java
7,186
java
Win32Protect.java
Java
[]
null
[]
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2010 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, the * "License"). You may not use this file except in compliance with the * License. You can obtain a copy of the License at * http://www.netbeans.org/cddl-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * If you wish your version of this file to be governed by only the CDDL * or only the GPL Version 2, indicate your decision by adding * "[Contributor] elects to include this software in this distribution * under the [CDDL or GPL Version 2] license." If you do not indicate a * single choice of license, a recipient has the option to distribute * your version of this file under either the CDDL, the GPL Version 2 or * to extend the choice of license to its licensees as provided above. * However, if you add GPL Version 2 code and therefore, elected the GPL * Version 2 license, then the option applies only if the new code is * made subject to such option by the copyright holder. * * Contributor(s): * * Portions Copyrighted 2009 Sun Microsystems, Inc. */ package org.netbeans.modules.keyring.win32; import com.sun.jna.Memory; import com.sun.jna.Native; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.WString; import com.sun.jna.win32.StdCallLibrary; import java.util.Arrays; import java.util.List; import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.logging.Logger; import org.netbeans.modules.keyring.utils.Utils; import org.netbeans.modules.keyring.spi.EncryptionProvider; import org.openide.util.Utilities; import org.openide.util.lookup.ServiceProvider; /** * Data protection utility for Microsoft Windows. * XXX org.tmatesoft.svn.core.internal.util.jna.SVNWinCrypt is a possibly more robust implementation * (though it seems to set CRYPTPROTECT_UI_FORBIDDEN which we do not necessarily want). */ @ServiceProvider(service=EncryptionProvider.class, position=100) public class Win32Protect implements EncryptionProvider { private static final Logger LOG = Logger.getLogger(Win32Protect.class.getName()); public @Override boolean enabled() { if (!Utilities.isWindows()) { LOG.fine("not running on Windows"); return false; } if (Boolean.getBoolean("netbeans.keyring.no.native")) { LOG.fine("native keyring integration disabled"); return false; } try { if (CryptLib.INSTANCE == null) { LOG.fine("loadLibrary -> null"); return false; } return true; } catch (Throwable t) { LOG.log(Level.FINE, null, t); return false; } } public @Override String id() { return "win32"; // NOI18N } public @Override byte[] encrypt(char[] cleartext) throws Exception { byte[] cleartextB = Utils.chars2Bytes(cleartext); CryptIntegerBlob input = new CryptIntegerBlob(); input.store(cleartextB); Arrays.fill(cleartextB, (byte) 0); CryptIntegerBlob output = new CryptIntegerBlob(); if (!CryptLib.INSTANCE.CryptProtectData(input, null, null, null, null, 0, output)) { throw new Exception("CryptProtectData failed: " + Native.getLastError()); } input.zero(); return output.load(); } public @Override char[] decrypt(byte[] ciphertext) throws Exception { CryptIntegerBlob input = new CryptIntegerBlob(); input.store(ciphertext); CryptIntegerBlob output = new CryptIntegerBlob(); if (!CryptLib.INSTANCE.CryptUnprotectData(input, null, null, null, null, 0, output)) { throw new Exception("CryptUnprotectData failed: " + Native.getLastError()); } byte[] result = output.load(); // XXX gives CCE because not a Memory: output.zero(); char[] cleartext = Utils.bytes2Chars(result); Arrays.fill(result, (byte) 0); return cleartext; } public @Override boolean decryptionFailed() { return false; // not much to do about it } public @Override void encryptionChangingCallback(Callable<Void> callback) {} public @Override void encryptionChanged() { assert false; } public @Override void freshKeyring(boolean fresh) {} public interface CryptLib extends StdCallLibrary { CryptLib INSTANCE = (CryptLib) Native.loadLibrary("Crypt32", CryptLib.class); // NOI18N /** @see <a href="http://msdn.microsoft.com/en-us/library/aa380261(VS.85,printer).aspx">Reference</a> */ boolean CryptProtectData( CryptIntegerBlob pDataIn, WString szDataDescr, CryptIntegerBlob pOptionalEntropy, Pointer pvReserved, Pointer pPromptStruct, int dwFlags, CryptIntegerBlob pDataOut )/* throws LastErrorException*/; /** @see <a href="http://msdn.microsoft.com/en-us/library/aa380882(VS.85,printer).aspx">Reference</a> */ boolean CryptUnprotectData( CryptIntegerBlob pDataIn, WString[] ppszDataDescr, CryptIntegerBlob pOptionalEntropy, Pointer pvReserved, Pointer pPromptStruct, int dwFlags, CryptIntegerBlob pDataOut )/* throws LastErrorException*/; } public static class CryptIntegerBlob extends Structure { public int cbData; public /*byte[]*/Pointer pbData; byte[] load() { return pbData.getByteArray(0, cbData); // XXX how to free pbData? [Kernel32]LocalFree? } void store(byte[] data) { cbData = data.length; pbData = new Memory(data.length); pbData.write(0, data, 0, cbData); } void zero() { ((Memory) pbData).clear(); } @Override protected List getFieldOrder() { return Arrays.asList( new String[] { "cbData", "pbData", } ); } } }
7,186
0.657946
0.64904
184
38.054348
26.507532
112
false
false
0
0
0
0
0
0
0.576087
false
false
3
3181823976c3a5cb1a6689d33f4fcd36074bd8be
24,086,176,616,070
ec9e860488d91e86d31133ae8836556da7f9bad8
/app/src/main/java/com/hg/danmoxiang_rrmvp/ui/activity/warehouse/ProductInWHActivity.java
40248f9b238aa7e68eb97b3b3ba3192447492680
[]
no_license
misty-rain/danmoxiang
https://github.com/misty-rain/danmoxiang
7c6939917b770ad6fdab13fe4535c59dcbe4487a
518c2a7404c4352aecfd5a6f8a3045c281b6402c
refs/heads/master
2020-04-29T12:01:49.738000
2019-03-20T10:18:52
2019-03-20T10:18:52
176,122,901
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hg.danmoxiang_rrmvp.ui.activity.warehouse; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import com.google.gson.Gson; import com.hg.danmoxiang_rrmvp.R; import com.hg.danmoxiang_rrmvp.app.contants.SysConstants; import com.hg.danmoxiang_rrmvp.mvp.base.MvpActivity; import com.hg.danmoxiang_rrmvp.mvp.contract.WareHouseContract; import com.hg.danmoxiang_rrmvp.mvp.model.entity.Materiel; import com.hg.danmoxiang_rrmvp.mvp.presenter.WareHousePresenter; import com.hg.danmoxiang_rrmvp.ui.activity.ScanningActivity; import com.hg.danmoxiang_rrmvp.ui.adapter.MaterielAdapter; import com.hg.danmoxiang_rrmvp.utils.DeviceUtils; import com.suke.widget.SwitchButton; import com.wuxiaolong.androidutils.library.LogUtil; import java.util.List; import butterknife.BindView; import butterknife.OnClick; import butterknife.OnFocusChange; public class ProductInWHActivity extends MvpActivity<WareHousePresenter> implements WareHouseContract { @BindView(R.id.toolbar_title) TextView txtTitle; @BindView(R.id.edtcodecount) TextView edtCodeCount; @BindView(R.id.edtgetcompany) EditText edtGetCompanyName; @BindView(R.id.edtmaterielcode) EditText edtMaterileCode; @BindView(R.id.edtinwhcode) EditText edtInWareHouseCode; @BindView(R.id.edtgetcount) EditText edtGetCount; @BindView(R.id.imgscann) ImageView imgScann; @BindView(R.id.switch_button) SwitchButton switchButton; @BindView(R.id.btnsave) Button btnSave; @BindView(R.id.rlmasteriellist) RecyclerView recyclerView; @BindView(R.id.showmaterieldata) View showmaterieldataView; @BindView(R.id.imglocationscan) ImageView imgLocationScan; @BindView(R.id.imgmaterielscan) ImageView imgMaterielScann; List<Materiel> mMaterielList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_in_wh); initToolBarAsHome("产品入库"); } @OnClick(R.id.imgscann) public void goSannQrCode() { startActivityForResult(new Intent(this, ScanningActivity.class), SysConstants.REQUEST_CODE_SCANN_QR_CODE); } @OnFocusChange(R.id.edtmaterielcode) public void getMaterielInfoByCode() { DeviceUtils.hideSoftKeyboard(this, edtMaterileCode); if (!TextUtils.isEmpty(edtMaterileCode.getEditableText().toString())) mvpPresenter.getMaterielByProductCode(edtMaterileCode.getEditableText().toString()); } @OnClick(R.id.btnsave) public void submitProductData() { validateForm(); } private void validateForm() { if (TextUtils.isEmpty(edtGetCompanyName.getEditableText())) { toastShow(R.string.input_get_company); return; } if (TextUtils.isEmpty(edtMaterileCode.getEditableText())) { toastShow(R.string.input_materiel_code); return; } if (null == mMaterielList || mMaterielList.size() == 0){ toastShow(R.string.text_input_materiel_data); return; } Materiel materiel = mMaterielList.get(0); String json = new Gson().toJson(materiel); LogUtil.d("materiel json:" + json); mvpPresenter.productInWH(TextUtils.isEmpty(edtInWareHouseCode.getEditableText()) ? "" : edtInWareHouseCode.getEditableText().toString(), json); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == SysConstants.REQUEST_CODE_SCANN_QR_CODE) { if (null != data) { String resultStr = data.getStringExtra("resultStr"); edtInWareHouseCode.setText(resultStr); } } } @Override protected WareHousePresenter createPresenter() { return new WareHousePresenter(this); } @Override public void showMaterielInfo(List<Materiel> materielsList) { if (null != materielsList) { mMaterielList = materielsList; showmaterieldataView.setVisibility(View.VISIBLE); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); recyclerView.setAdapter(new MaterielAdapter(materielsList, showmaterieldataView)); } } @Override public void showMsg(String msg) { showmaterieldataView.setVisibility(View.GONE); toastShow(msg); } }
UTF-8
Java
4,968
java
ProductInWHActivity.java
Java
[]
null
[]
package com.hg.danmoxiang_rrmvp.ui.activity.warehouse; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import com.google.gson.Gson; import com.hg.danmoxiang_rrmvp.R; import com.hg.danmoxiang_rrmvp.app.contants.SysConstants; import com.hg.danmoxiang_rrmvp.mvp.base.MvpActivity; import com.hg.danmoxiang_rrmvp.mvp.contract.WareHouseContract; import com.hg.danmoxiang_rrmvp.mvp.model.entity.Materiel; import com.hg.danmoxiang_rrmvp.mvp.presenter.WareHousePresenter; import com.hg.danmoxiang_rrmvp.ui.activity.ScanningActivity; import com.hg.danmoxiang_rrmvp.ui.adapter.MaterielAdapter; import com.hg.danmoxiang_rrmvp.utils.DeviceUtils; import com.suke.widget.SwitchButton; import com.wuxiaolong.androidutils.library.LogUtil; import java.util.List; import butterknife.BindView; import butterknife.OnClick; import butterknife.OnFocusChange; public class ProductInWHActivity extends MvpActivity<WareHousePresenter> implements WareHouseContract { @BindView(R.id.toolbar_title) TextView txtTitle; @BindView(R.id.edtcodecount) TextView edtCodeCount; @BindView(R.id.edtgetcompany) EditText edtGetCompanyName; @BindView(R.id.edtmaterielcode) EditText edtMaterileCode; @BindView(R.id.edtinwhcode) EditText edtInWareHouseCode; @BindView(R.id.edtgetcount) EditText edtGetCount; @BindView(R.id.imgscann) ImageView imgScann; @BindView(R.id.switch_button) SwitchButton switchButton; @BindView(R.id.btnsave) Button btnSave; @BindView(R.id.rlmasteriellist) RecyclerView recyclerView; @BindView(R.id.showmaterieldata) View showmaterieldataView; @BindView(R.id.imglocationscan) ImageView imgLocationScan; @BindView(R.id.imgmaterielscan) ImageView imgMaterielScann; List<Materiel> mMaterielList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_in_wh); initToolBarAsHome("产品入库"); } @OnClick(R.id.imgscann) public void goSannQrCode() { startActivityForResult(new Intent(this, ScanningActivity.class), SysConstants.REQUEST_CODE_SCANN_QR_CODE); } @OnFocusChange(R.id.edtmaterielcode) public void getMaterielInfoByCode() { DeviceUtils.hideSoftKeyboard(this, edtMaterileCode); if (!TextUtils.isEmpty(edtMaterileCode.getEditableText().toString())) mvpPresenter.getMaterielByProductCode(edtMaterileCode.getEditableText().toString()); } @OnClick(R.id.btnsave) public void submitProductData() { validateForm(); } private void validateForm() { if (TextUtils.isEmpty(edtGetCompanyName.getEditableText())) { toastShow(R.string.input_get_company); return; } if (TextUtils.isEmpty(edtMaterileCode.getEditableText())) { toastShow(R.string.input_materiel_code); return; } if (null == mMaterielList || mMaterielList.size() == 0){ toastShow(R.string.text_input_materiel_data); return; } Materiel materiel = mMaterielList.get(0); String json = new Gson().toJson(materiel); LogUtil.d("materiel json:" + json); mvpPresenter.productInWH(TextUtils.isEmpty(edtInWareHouseCode.getEditableText()) ? "" : edtInWareHouseCode.getEditableText().toString(), json); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == SysConstants.REQUEST_CODE_SCANN_QR_CODE) { if (null != data) { String resultStr = data.getStringExtra("resultStr"); edtInWareHouseCode.setText(resultStr); } } } @Override protected WareHousePresenter createPresenter() { return new WareHousePresenter(this); } @Override public void showMaterielInfo(List<Materiel> materielsList) { if (null != materielsList) { mMaterielList = materielsList; showmaterieldataView.setVisibility(View.VISIBLE); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); recyclerView.setAdapter(new MaterielAdapter(materielsList, showmaterieldataView)); } } @Override public void showMsg(String msg) { showmaterieldataView.setVisibility(View.GONE); toastShow(msg); } }
4,968
0.713105
0.712097
151
31.847683
26.978714
151
false
false
0
0
0
0
0
0
0.543046
false
false
3
fe827357ffd91fae84eba0b86a796f41770e2d94
22,325,240,028,385
a46efce7a625c1ef49bbcb49615f456c7fa0aae1
/lib/Polyglot/src/polyglot/frontend/AbstractExtensionInfo.java
0531ce5de0bbed4b321670f9fdd25def559657d0
[]
no_license
HistoricalValue/spawncamping-octo-ninja
https://github.com/HistoricalValue/spawncamping-octo-ninja
e2acaf21d1c1d194430c22d5c14515de9d4c588e
ecf9772df4116e7013d883b94421159857e87d60
refs/heads/master
2016-09-10T22:11:20.553000
2014-11-23T23:22:55
2014-11-23T23:22:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package polyglot.frontend; import polyglot.ast.*; import polyglot.types.*; import polyglot.types.reflect.*; import polyglot.util.*; import polyglot.visit.*; import polyglot.main.Options; import polyglot.main.Report; import java.io.*; import java.util.*; /** * This is an abstract <code>ExtensionInfo</code>. */ public abstract class AbstractExtensionInfo implements ExtensionInfo { protected Compiler compiler; private Options options; protected TypeSystem ts = null; protected NodeFactory nf = null; protected SourceLoader source_loader = null; protected TargetFactory target_factory = null; protected Stats stats; /** * A list of all active (that is, uncompleted) <code>SourceJob</code>s. */ protected LinkedList worklist; /** * A map from <code>Source</code>s to <code>SourceJob</code>s or to * the <code>COMPLETED_JOB</code> object if the SourceJob previously existed * but has now finished. The map contains entries for all * <code>Source</code>s that have had <code>Job</code>s added for them. */ protected Map jobs; protected static final Object COMPLETED_JOB = "COMPLETED JOB"; /** The currently running job, or null if no job is running. */ protected Job currentJob; public Options getOptions() { if (this.options == null) { this.options = createOptions(); } return options; } protected Options createOptions() { return new Options(this); } /** Return a Stats object to accumulate and report statistics. */ public Stats getStats() { if (this.stats == null) { this.stats = new Stats(this); } return stats; } public Compiler compiler() { return compiler; } public void initCompiler(Compiler compiler) { this.compiler = compiler; jobs = new HashMap(); worklist = new LinkedList(); // Register the extension with the compiler. compiler.addExtension(this); currentJob = null; // Create the type system and node factory. typeSystem(); nodeFactory(); initTypeSystem(); } protected abstract void initTypeSystem(); /** * Run all jobs in the work list (and any children they have) to * completion. This method returns <code>true</code> if all jobs were * successfully completed. If all jobs were successfully completed, then * the worklist will be empty. * * The scheduling of <code>Job</code>s uses two methods to maintain * scheduling invariants: <code>selectJobFromWorklist</code> selects * a <code>SourceJob</code> from <code>worklist</code> (a list of * jobs that still need to be processed); <code>enforceInvariants</code> is * called before a pass is performed on a <code>SourceJob</code> and is * responsible for ensuring all dependencies are satisfied before the * pass proceeds, i.e. enforcing any scheduling invariants. */ public boolean runToCompletion() { boolean okay = true; while (okay && ! worklist.isEmpty()) { SourceJob job = selectJobFromWorklist(); if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Running job " + job); } okay &= runAllPasses(job); if (job.completed()) { // the job has finished. Let's remove it from the map so it // can be garbage collected, and free up the AST. jobs.put(job.source(), COMPLETED_JOB); if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Completed job " + job); } } else { // the job is not yet completed (although, it really // should be...) if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Failed to complete job " + job); } worklist.add(job); } } if (Report.should_report(Report.frontend, 1)) Report.report(1, "Finished all passes -- " + (okay ? "okay" : "failed")); return okay; } /** * Select and remove a <code>SourceJob</code> from the non-empty * <code>worklist</code>. Return the selected <code>SourceJob</code> * which will be scheduled to run all of its remaining passes. */ protected SourceJob selectJobFromWorklist() { return (SourceJob)worklist.remove(0); } /** * Read a source file and compile it up to the the current job's last * barrier. */ public boolean readSource(FileSource source) { // Add a new SourceJob for the given source. If a Job for the source // already exists, then we will be given the existing job. SourceJob job = addJob(source); if (job == null) { // addJob returns null if the job has already been completed, in // which case we can just ignore the request to read in the source. return true; } // Run the new job up to the currentJob's SourceJob's last barrier, to // make sure that dependencies are satisfied. Pass.ID barrier; if (currentJob != null) { if (currentJob.sourceJob().lastBarrier() == null) { throw new InternalCompilerError("A Source Job which has " + "not reached a barrier cannot read another " + "source file."); } barrier = currentJob.sourceJob().lastBarrier().id(); } else { barrier = Pass.FIRST_BARRIER; } // Make sure we reach at least the first barrier defined // in the base compiler. This forces types to be constructed. // If FIRST_BARRIER is before "barrier", // then the second runToPass will just return true. return runToPass(job, barrier) && runToPass(job, Pass.FIRST_BARRIER); } /** * Run all pending passes on <code>job</code>. */ public boolean runAllPasses(Job job) { List pending = job.pendingPasses(); // Run until there are no more passes. if (!pending.isEmpty()) { Pass lastPass = (Pass)pending.get(pending.size() - 1); return runToPass(job, lastPass); } return true; } /** * Run a job until the <code>goal</code> pass completes. */ public boolean runToPass(Job job, Pass.ID goal) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Running " + job + " to pass named " + goal); if (job.completed(goal)) { return true; } Pass pass = job.passByID(goal); return runToPass(job, pass); } /** * Run a job up to the <code>goal</code> pass. */ public boolean runToPass(Job job, Pass goal) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Running " + job + " to pass " + goal); while (! job.pendingPasses().isEmpty()) { Pass pass = (Pass) job.pendingPasses().get(0); try { runPass(job, pass); } catch (CyclicDependencyException e) { // cause the pass to fail. job.finishPass(pass, false); } if (pass == goal) { break; } } if (job.completed()) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Job " + job + " completed"); } return job.status(); } /** * Run the pass <code>pass</code> on the job. Before running the pass on * the job, if the job is a <code>SourceJob</code>, then this method will * ensure that the scheduling invariants are enforced by calling * <code>enforceInvariants</code>. */ protected void runPass(Job job, Pass pass) throws CyclicDependencyException { // make sure that all scheduling invariants are satisfied before running // the next pass. We may thus execute some other passes on other // jobs running the given pass. try { enforceInvariants(job, pass); } catch (CyclicDependencyException e) { // A job that depends on this job is still running // an earlier pass. We cannot continue this pass, // but we can just silently fail since the job we're // that depends on this one will eventually try // to run this pass again when it reaches a barrier. return; } if (getOptions().disable_passes.contains(pass.name())) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Skipping pass " + pass); job.finishPass(pass, true); return; } if (Report.should_report(Report.frontend, 1)) Report.report(1, "Trying to run pass " + pass + " in " + job); if (job.isRunning()) { // We're currently running. We can't reach the goal. throw new CyclicDependencyException(job + " cannot reach pass " + pass); } pass.resetTimers(); boolean result = false; if (job.status()) { Job oldCurrentJob = this.currentJob; this.currentJob = job; Report.should_report.push(pass.name()); // Stop the timer on the old pass. */ Pass oldPass = oldCurrentJob != null ? oldCurrentJob.runningPass() : null; if (oldPass != null) { oldPass.toggleTimers(true); } job.setRunningPass(pass); pass.toggleTimers(false); result = pass.run(); pass.toggleTimers(false); job.setRunningPass(null); Report.should_report.pop(); this.currentJob = oldCurrentJob; // Restart the timer on the old pass. */ if (oldPass != null) { oldPass.toggleTimers(true); } // pretty-print this pass if we need to. if (getOptions().print_ast.contains(pass.name())) { System.err.println("--------------------------------" + "--------------------------------"); System.err.println("Pretty-printing AST for " + job + " after " + pass.name()); PrettyPrinter pp = new PrettyPrinter(); pp.printAst(job.ast(), new CodeWriter(System.err, 78)); } // dump this pass if we need to. if (getOptions().dump_ast.contains(pass.name())) { System.err.println("--------------------------------" + "--------------------------------"); System.err.println("Dumping AST for " + job + " after " + pass.name()); NodeVisitor dumper = new DumpAst(new CodeWriter(System.err, 78)); dumper = dumper.begin(); job.ast().visit(dumper); dumper.finish(); } // This seems to work around a VM bug on linux with JDK // 1.4.0. The mark-sweep collector will sometimes crash. // Running the GC explicitly here makes the bug go away. // If this fails, maybe run with bigger heap. // System.gc(); } Stats stats = getStats(); stats.accumPassTimes(pass.id(), pass.inclusiveTime(), pass.exclusiveTime()); if (Report.should_report(Report.time, 2)) { Report.report(2, "Finished " + pass + " status=" + str(result) + " inclusive_time=" + pass.inclusiveTime() + " exclusive_time=" + pass.exclusiveTime()); } else if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Finished " + pass + " status=" + str(result)); } job.finishPass(pass, result); } /** * Before running <code>Pass pass</code> on <code>SourceJob job</code> * make sure that all appropriate scheduling invariants are satisfied, * to ensure that all passes of other jobs that <code>job</code> depends * on will have already been done. * */ protected void enforceInvariants(Job job, Pass pass) throws CyclicDependencyException { SourceJob srcJob = job.sourceJob(); if (srcJob == null) { return; } BarrierPass lastBarrier = srcJob.lastBarrier(); if (lastBarrier != null) { // make sure that _all_ dependent jobs have completed at least up to // the last barrier (not just children). // // Ideally the invariant should be that only the source jobs that // job _depends on_ should be brought up to the last barrier. // This is work to be done in the future... List allDependentSrcs = new ArrayList(srcJob.dependencies()); Iterator i = allDependentSrcs.iterator(); while (i.hasNext()) { Source s = (Source)i.next(); Object o = jobs.get(s); if (o == COMPLETED_JOB) continue; if (o == null) { throw new InternalCompilerError("Unknown source " + s); } SourceJob sj = (SourceJob)o; if (sj.pending(lastBarrier.id())) { // Make the job run up to the last barrier. // We ignore the return result, since even if the job // fails, we will keep on going and see // how far we get... if (Report.should_report(Report.frontend, 3)) { Report.report(3, "Running " + sj + " to " + lastBarrier.id() + " for " + srcJob); } runToPass(sj, lastBarrier.id()); } } } if (pass instanceof GlobalBarrierPass) { // need to make sure that _all_ jobs have completed just up to // this global barrier. // If we hit a cyclic dependency, ignore it and run the other // jobs up to that pass. Then try again to run the cyclic // pass. If we hit the cycle again for the same job, stop. LinkedList barrierWorklist = new LinkedList(jobs.values()); while (! barrierWorklist.isEmpty()) { Object o = barrierWorklist.removeFirst(); if (o == COMPLETED_JOB) continue; SourceJob sj = (SourceJob)o; if (sj.completed(pass.id()) || sj.nextPass() == sj.passByID(pass.id())) { // the source job has either done this global pass // (which is possible if the job was loaded late in the // game), or is right up to the global barrier. continue; } // Make the job run up to just before the global barrier. // We ignore the return result, since even if the job // fails, we will keep on going and see // how far we get... Pass beforeGlobal = sj.getPreviousTo(pass.id()); if (Report.should_report(Report.frontend, 3)) { Report.report(3, "Running " + sj + " to " + beforeGlobal.id() + " for " + srcJob); } // Don't use runToPass, since that catches the // CyclicDependencyException that we should report // back to the caller. while (! sj.pendingPasses().isEmpty()) { Pass p = (Pass) sj.pendingPasses().get(0); runPass(sj, p); if (p == beforeGlobal) { break; } } } } } private static String str(boolean okay) { if (okay) { return "done"; } else { return "failed"; } } /** * Get the file name extension of source files. This is * either the language extension's default file name extension * or the string passed in with the "-sx" command-line option. */ public String[] fileExtensions() { String[] sx = getOptions() == null ? null : getOptions().source_ext; if (sx == null) { sx = defaultFileExtensions(); } if (sx.length == 0) { return defaultFileExtensions(); } return sx; } /** Get the default list of file extensions. */ public String[] defaultFileExtensions() { String ext = defaultFileExtension(); return new String[] { ext }; } /** Get the source file loader object for this extension. */ public SourceLoader sourceLoader() { if (source_loader == null) { source_loader = new SourceLoader(this, getOptions().source_path); } return source_loader; } /** Get the target factory object for this extension. */ public TargetFactory targetFactory() { if (target_factory == null) { target_factory = new TargetFactory(getOptions().output_directory, getOptions().output_ext, getOptions().output_stdout); } return target_factory; } /** Create the type system for this extension. */ protected abstract TypeSystem createTypeSystem(); /** Get the type system for this extension. */ public TypeSystem typeSystem() { if (ts == null) { ts = createTypeSystem(); } return ts; } /** Create the node factory for this extension. */ protected abstract NodeFactory createNodeFactory(); /** Get the AST node factory for this extension. */ public NodeFactory nodeFactory() { if (nf == null) { nf = createNodeFactory(); } return nf; } /** * Get the job extension for this language extension. The job * extension is used to extend the <code>Job</code> class * without subtyping. */ public JobExt jobExt() { return null; } /** * Adds a dependency from the current job to the given Source. */ public void addDependencyToCurrentJob(Source s) { if (s == null) return; if (currentJob != null) { Object o = jobs.get(s); if (o != COMPLETED_JOB) { if (Report.should_report(Report.frontend, 2)) { Report.report(2, "Adding dependency from " + currentJob.source() + " to " + s); } currentJob.sourceJob().addDependency(s); } } else { throw new InternalCompilerError("No current job!"); } } /** * Add a new <code>SourceJob</code> for the <code>Source source</code>. * A new job will be created if * needed. If the <code>Source source</code> has already been processed, * and its job discarded to release resources, then <code>null</code> * will be returned. */ public SourceJob addJob(Source source) { return addJob(source, null); } /** * Add a new <code>SourceJob</code> for the <code>Source source</code>, * with AST <code>ast</code>. * A new job will be created if * needed. If the <code>Source source</code> has already been processed, * and its job discarded to release resources, then <code>null</code> * will be returned. */ public SourceJob addJob(Source source, Node ast) { Object o = jobs.get(source); SourceJob job = null; if (o == COMPLETED_JOB) { // the job has already been completed. // We don't need to add a job return null; } else if (o == null) { // No appropriate job yet exists, we will create one. job = this.createSourceJob(source, ast); // record the job in the map and the worklist. jobs.put(source, job); worklist.addLast(job); if (Report.should_report(Report.frontend, 3)) { Report.report(3, "Adding job for " + source + " at the " + "request of job " + currentJob); } } else { job = (SourceJob)o; } // if the current source job caused this job to load, record the // dependency. if (currentJob instanceof SourceJob) { ((SourceJob)currentJob).addDependency(source); } return job; } /** * Create a new <code>SourceJob</code> for the given source and AST. * In general, this method should only be called by <code>addJob</code>. */ protected SourceJob createSourceJob(Source source, Node ast) { return new SourceJob(this, jobExt(), source, ast); } /** * Create a new non-<code>SourceJob</code> <code>Job</code>, for the * given AST. In general this method should only be called by * <code>spawnJob</code>. * * @param ast the AST the new Job is for. * @param context the context that the AST occurs in * @param outer the <code>Job</code> that spawned this job. * @param begin the first pass to perform for this job. * @param end the last pass to perform for this job. */ protected Job createJob(Node ast, Context context, Job outer, Pass.ID begin, Pass.ID end) { return new InnerJob(this, jobExt(), ast, context, outer, begin, end); } /** * Spawn a new job. All passes between the pass <code>begin</code> * and <code>end</code> inclusive will be performed immediately on * the AST <code>ast</code>. * * @param c the context that the AST occurs in * @param ast the AST the new Job is for. * @param outerJob the <code>Job</code> that spawned this job. * @param begin the first pass to perform for this job. * @param end the last pass to perform for this job. * @return the new job. The caller can check the result with * <code>j.status()</code> and get the ast with <code>j.ast()</code>. */ public Job spawnJob(Context c, Node ast, Job outerJob, Pass.ID begin, Pass.ID end) { Job j = createJob(ast, c, outerJob, begin, end); if (Report.should_report(Report.frontend, 1)) Report.report(1, this +" spawning " + j); // Run all the passes runAllPasses(j); // Return the job. The caller can check the result with j.status(). return j; } /** Get the parser for this language extension. */ public abstract Parser parser(Reader reader, FileSource source, ErrorQueue eq); /** * Replace the pass named <code>id</code> in <code>passes</code> with * the list of <code>newPasses</code>. */ public void replacePass(List passes, Pass.ID id, List newPasses) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { if (p instanceof BarrierPass) { throw new InternalCompilerError("Cannot replace a barrier pass."); } i.remove(); for (Iterator j = newPasses.iterator(); j.hasNext(); ) { i.add(j.next()); } return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Remove the pass named <code>id</code> from <code>passes</code>. */ public void removePass(List passes, Pass.ID id) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { if (p instanceof BarrierPass) { throw new InternalCompilerError("Cannot remove a barrier pass."); } i.remove(); return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Insert the list of <code>newPasses</code> into <code>passes</code> * immediately before the pass named <code>id</code>. */ public void beforePass(List passes, Pass.ID id, List newPasses) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { // Backup one position. i.previous(); for (Iterator j = newPasses.iterator(); j.hasNext(); ) { i.add(j.next()); } return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Insert the list of <code>newPasses</code> into <code>passes</code> * immediately after the pass named <code>id</code>. */ public void afterPass(List passes, Pass.ID id, List newPasses) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { for (Iterator j = newPasses.iterator(); j.hasNext(); ) { i.add(j.next()); } return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Replace the pass named <code>id</code> in <code>passes</code> with * the pass <code>pass</code>. */ public void replacePass(List passes, Pass.ID id, Pass pass) { replacePass(passes, id, Collections.singletonList(pass)); } /** * Insert the pass <code>pass</code> into <code>passes</code> * immediately before the pass named <code>id</code>. */ public void beforePass(List passes, Pass.ID id, Pass pass) { beforePass(passes, id, Collections.singletonList(pass)); } /** * Insert the pass <code>pass</code> into <code>passes</code> * immediately after the pass named <code>id</code>. */ public void afterPass(List passes, Pass.ID id, Pass pass) { afterPass(passes, id, Collections.singletonList(pass)); } /** * Get the complete list of passes for the job. */ public abstract List passes(Job job); /** * Get the sub-list of passes for the job between passes * <code>begin</code> and <code>end</code>, inclusive. */ public List passes(Job job, Pass.ID begin, Pass.ID end) { List l = passes(job); Pass p = null; Iterator i = l.iterator(); while (i.hasNext()) { p = (Pass) i.next(); if (begin == p.id()) break; if (! (p instanceof BarrierPass)) i.remove(); } while (p.id() != end && i.hasNext()) { p = (Pass) i.next(); } while (i.hasNext()) { p = (Pass) i.next(); i.remove(); } return l; } public String toString() { return getClass().getName() + " worklist=" + worklist; } public ClassFile createClassFile(File classFileSource, byte[] code){ return new ClassFile(classFileSource, code, this); } }
UTF-8
Java
27,828
java
AbstractExtensionInfo.java
Java
[]
null
[]
package polyglot.frontend; import polyglot.ast.*; import polyglot.types.*; import polyglot.types.reflect.*; import polyglot.util.*; import polyglot.visit.*; import polyglot.main.Options; import polyglot.main.Report; import java.io.*; import java.util.*; /** * This is an abstract <code>ExtensionInfo</code>. */ public abstract class AbstractExtensionInfo implements ExtensionInfo { protected Compiler compiler; private Options options; protected TypeSystem ts = null; protected NodeFactory nf = null; protected SourceLoader source_loader = null; protected TargetFactory target_factory = null; protected Stats stats; /** * A list of all active (that is, uncompleted) <code>SourceJob</code>s. */ protected LinkedList worklist; /** * A map from <code>Source</code>s to <code>SourceJob</code>s or to * the <code>COMPLETED_JOB</code> object if the SourceJob previously existed * but has now finished. The map contains entries for all * <code>Source</code>s that have had <code>Job</code>s added for them. */ protected Map jobs; protected static final Object COMPLETED_JOB = "COMPLETED JOB"; /** The currently running job, or null if no job is running. */ protected Job currentJob; public Options getOptions() { if (this.options == null) { this.options = createOptions(); } return options; } protected Options createOptions() { return new Options(this); } /** Return a Stats object to accumulate and report statistics. */ public Stats getStats() { if (this.stats == null) { this.stats = new Stats(this); } return stats; } public Compiler compiler() { return compiler; } public void initCompiler(Compiler compiler) { this.compiler = compiler; jobs = new HashMap(); worklist = new LinkedList(); // Register the extension with the compiler. compiler.addExtension(this); currentJob = null; // Create the type system and node factory. typeSystem(); nodeFactory(); initTypeSystem(); } protected abstract void initTypeSystem(); /** * Run all jobs in the work list (and any children they have) to * completion. This method returns <code>true</code> if all jobs were * successfully completed. If all jobs were successfully completed, then * the worklist will be empty. * * The scheduling of <code>Job</code>s uses two methods to maintain * scheduling invariants: <code>selectJobFromWorklist</code> selects * a <code>SourceJob</code> from <code>worklist</code> (a list of * jobs that still need to be processed); <code>enforceInvariants</code> is * called before a pass is performed on a <code>SourceJob</code> and is * responsible for ensuring all dependencies are satisfied before the * pass proceeds, i.e. enforcing any scheduling invariants. */ public boolean runToCompletion() { boolean okay = true; while (okay && ! worklist.isEmpty()) { SourceJob job = selectJobFromWorklist(); if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Running job " + job); } okay &= runAllPasses(job); if (job.completed()) { // the job has finished. Let's remove it from the map so it // can be garbage collected, and free up the AST. jobs.put(job.source(), COMPLETED_JOB); if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Completed job " + job); } } else { // the job is not yet completed (although, it really // should be...) if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Failed to complete job " + job); } worklist.add(job); } } if (Report.should_report(Report.frontend, 1)) Report.report(1, "Finished all passes -- " + (okay ? "okay" : "failed")); return okay; } /** * Select and remove a <code>SourceJob</code> from the non-empty * <code>worklist</code>. Return the selected <code>SourceJob</code> * which will be scheduled to run all of its remaining passes. */ protected SourceJob selectJobFromWorklist() { return (SourceJob)worklist.remove(0); } /** * Read a source file and compile it up to the the current job's last * barrier. */ public boolean readSource(FileSource source) { // Add a new SourceJob for the given source. If a Job for the source // already exists, then we will be given the existing job. SourceJob job = addJob(source); if (job == null) { // addJob returns null if the job has already been completed, in // which case we can just ignore the request to read in the source. return true; } // Run the new job up to the currentJob's SourceJob's last barrier, to // make sure that dependencies are satisfied. Pass.ID barrier; if (currentJob != null) { if (currentJob.sourceJob().lastBarrier() == null) { throw new InternalCompilerError("A Source Job which has " + "not reached a barrier cannot read another " + "source file."); } barrier = currentJob.sourceJob().lastBarrier().id(); } else { barrier = Pass.FIRST_BARRIER; } // Make sure we reach at least the first barrier defined // in the base compiler. This forces types to be constructed. // If FIRST_BARRIER is before "barrier", // then the second runToPass will just return true. return runToPass(job, barrier) && runToPass(job, Pass.FIRST_BARRIER); } /** * Run all pending passes on <code>job</code>. */ public boolean runAllPasses(Job job) { List pending = job.pendingPasses(); // Run until there are no more passes. if (!pending.isEmpty()) { Pass lastPass = (Pass)pending.get(pending.size() - 1); return runToPass(job, lastPass); } return true; } /** * Run a job until the <code>goal</code> pass completes. */ public boolean runToPass(Job job, Pass.ID goal) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Running " + job + " to pass named " + goal); if (job.completed(goal)) { return true; } Pass pass = job.passByID(goal); return runToPass(job, pass); } /** * Run a job up to the <code>goal</code> pass. */ public boolean runToPass(Job job, Pass goal) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Running " + job + " to pass " + goal); while (! job.pendingPasses().isEmpty()) { Pass pass = (Pass) job.pendingPasses().get(0); try { runPass(job, pass); } catch (CyclicDependencyException e) { // cause the pass to fail. job.finishPass(pass, false); } if (pass == goal) { break; } } if (job.completed()) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Job " + job + " completed"); } return job.status(); } /** * Run the pass <code>pass</code> on the job. Before running the pass on * the job, if the job is a <code>SourceJob</code>, then this method will * ensure that the scheduling invariants are enforced by calling * <code>enforceInvariants</code>. */ protected void runPass(Job job, Pass pass) throws CyclicDependencyException { // make sure that all scheduling invariants are satisfied before running // the next pass. We may thus execute some other passes on other // jobs running the given pass. try { enforceInvariants(job, pass); } catch (CyclicDependencyException e) { // A job that depends on this job is still running // an earlier pass. We cannot continue this pass, // but we can just silently fail since the job we're // that depends on this one will eventually try // to run this pass again when it reaches a barrier. return; } if (getOptions().disable_passes.contains(pass.name())) { if (Report.should_report(Report.frontend, 1)) Report.report(1, "Skipping pass " + pass); job.finishPass(pass, true); return; } if (Report.should_report(Report.frontend, 1)) Report.report(1, "Trying to run pass " + pass + " in " + job); if (job.isRunning()) { // We're currently running. We can't reach the goal. throw new CyclicDependencyException(job + " cannot reach pass " + pass); } pass.resetTimers(); boolean result = false; if (job.status()) { Job oldCurrentJob = this.currentJob; this.currentJob = job; Report.should_report.push(pass.name()); // Stop the timer on the old pass. */ Pass oldPass = oldCurrentJob != null ? oldCurrentJob.runningPass() : null; if (oldPass != null) { oldPass.toggleTimers(true); } job.setRunningPass(pass); pass.toggleTimers(false); result = pass.run(); pass.toggleTimers(false); job.setRunningPass(null); Report.should_report.pop(); this.currentJob = oldCurrentJob; // Restart the timer on the old pass. */ if (oldPass != null) { oldPass.toggleTimers(true); } // pretty-print this pass if we need to. if (getOptions().print_ast.contains(pass.name())) { System.err.println("--------------------------------" + "--------------------------------"); System.err.println("Pretty-printing AST for " + job + " after " + pass.name()); PrettyPrinter pp = new PrettyPrinter(); pp.printAst(job.ast(), new CodeWriter(System.err, 78)); } // dump this pass if we need to. if (getOptions().dump_ast.contains(pass.name())) { System.err.println("--------------------------------" + "--------------------------------"); System.err.println("Dumping AST for " + job + " after " + pass.name()); NodeVisitor dumper = new DumpAst(new CodeWriter(System.err, 78)); dumper = dumper.begin(); job.ast().visit(dumper); dumper.finish(); } // This seems to work around a VM bug on linux with JDK // 1.4.0. The mark-sweep collector will sometimes crash. // Running the GC explicitly here makes the bug go away. // If this fails, maybe run with bigger heap. // System.gc(); } Stats stats = getStats(); stats.accumPassTimes(pass.id(), pass.inclusiveTime(), pass.exclusiveTime()); if (Report.should_report(Report.time, 2)) { Report.report(2, "Finished " + pass + " status=" + str(result) + " inclusive_time=" + pass.inclusiveTime() + " exclusive_time=" + pass.exclusiveTime()); } else if (Report.should_report(Report.frontend, 1)) { Report.report(1, "Finished " + pass + " status=" + str(result)); } job.finishPass(pass, result); } /** * Before running <code>Pass pass</code> on <code>SourceJob job</code> * make sure that all appropriate scheduling invariants are satisfied, * to ensure that all passes of other jobs that <code>job</code> depends * on will have already been done. * */ protected void enforceInvariants(Job job, Pass pass) throws CyclicDependencyException { SourceJob srcJob = job.sourceJob(); if (srcJob == null) { return; } BarrierPass lastBarrier = srcJob.lastBarrier(); if (lastBarrier != null) { // make sure that _all_ dependent jobs have completed at least up to // the last barrier (not just children). // // Ideally the invariant should be that only the source jobs that // job _depends on_ should be brought up to the last barrier. // This is work to be done in the future... List allDependentSrcs = new ArrayList(srcJob.dependencies()); Iterator i = allDependentSrcs.iterator(); while (i.hasNext()) { Source s = (Source)i.next(); Object o = jobs.get(s); if (o == COMPLETED_JOB) continue; if (o == null) { throw new InternalCompilerError("Unknown source " + s); } SourceJob sj = (SourceJob)o; if (sj.pending(lastBarrier.id())) { // Make the job run up to the last barrier. // We ignore the return result, since even if the job // fails, we will keep on going and see // how far we get... if (Report.should_report(Report.frontend, 3)) { Report.report(3, "Running " + sj + " to " + lastBarrier.id() + " for " + srcJob); } runToPass(sj, lastBarrier.id()); } } } if (pass instanceof GlobalBarrierPass) { // need to make sure that _all_ jobs have completed just up to // this global barrier. // If we hit a cyclic dependency, ignore it and run the other // jobs up to that pass. Then try again to run the cyclic // pass. If we hit the cycle again for the same job, stop. LinkedList barrierWorklist = new LinkedList(jobs.values()); while (! barrierWorklist.isEmpty()) { Object o = barrierWorklist.removeFirst(); if (o == COMPLETED_JOB) continue; SourceJob sj = (SourceJob)o; if (sj.completed(pass.id()) || sj.nextPass() == sj.passByID(pass.id())) { // the source job has either done this global pass // (which is possible if the job was loaded late in the // game), or is right up to the global barrier. continue; } // Make the job run up to just before the global barrier. // We ignore the return result, since even if the job // fails, we will keep on going and see // how far we get... Pass beforeGlobal = sj.getPreviousTo(pass.id()); if (Report.should_report(Report.frontend, 3)) { Report.report(3, "Running " + sj + " to " + beforeGlobal.id() + " for " + srcJob); } // Don't use runToPass, since that catches the // CyclicDependencyException that we should report // back to the caller. while (! sj.pendingPasses().isEmpty()) { Pass p = (Pass) sj.pendingPasses().get(0); runPass(sj, p); if (p == beforeGlobal) { break; } } } } } private static String str(boolean okay) { if (okay) { return "done"; } else { return "failed"; } } /** * Get the file name extension of source files. This is * either the language extension's default file name extension * or the string passed in with the "-sx" command-line option. */ public String[] fileExtensions() { String[] sx = getOptions() == null ? null : getOptions().source_ext; if (sx == null) { sx = defaultFileExtensions(); } if (sx.length == 0) { return defaultFileExtensions(); } return sx; } /** Get the default list of file extensions. */ public String[] defaultFileExtensions() { String ext = defaultFileExtension(); return new String[] { ext }; } /** Get the source file loader object for this extension. */ public SourceLoader sourceLoader() { if (source_loader == null) { source_loader = new SourceLoader(this, getOptions().source_path); } return source_loader; } /** Get the target factory object for this extension. */ public TargetFactory targetFactory() { if (target_factory == null) { target_factory = new TargetFactory(getOptions().output_directory, getOptions().output_ext, getOptions().output_stdout); } return target_factory; } /** Create the type system for this extension. */ protected abstract TypeSystem createTypeSystem(); /** Get the type system for this extension. */ public TypeSystem typeSystem() { if (ts == null) { ts = createTypeSystem(); } return ts; } /** Create the node factory for this extension. */ protected abstract NodeFactory createNodeFactory(); /** Get the AST node factory for this extension. */ public NodeFactory nodeFactory() { if (nf == null) { nf = createNodeFactory(); } return nf; } /** * Get the job extension for this language extension. The job * extension is used to extend the <code>Job</code> class * without subtyping. */ public JobExt jobExt() { return null; } /** * Adds a dependency from the current job to the given Source. */ public void addDependencyToCurrentJob(Source s) { if (s == null) return; if (currentJob != null) { Object o = jobs.get(s); if (o != COMPLETED_JOB) { if (Report.should_report(Report.frontend, 2)) { Report.report(2, "Adding dependency from " + currentJob.source() + " to " + s); } currentJob.sourceJob().addDependency(s); } } else { throw new InternalCompilerError("No current job!"); } } /** * Add a new <code>SourceJob</code> for the <code>Source source</code>. * A new job will be created if * needed. If the <code>Source source</code> has already been processed, * and its job discarded to release resources, then <code>null</code> * will be returned. */ public SourceJob addJob(Source source) { return addJob(source, null); } /** * Add a new <code>SourceJob</code> for the <code>Source source</code>, * with AST <code>ast</code>. * A new job will be created if * needed. If the <code>Source source</code> has already been processed, * and its job discarded to release resources, then <code>null</code> * will be returned. */ public SourceJob addJob(Source source, Node ast) { Object o = jobs.get(source); SourceJob job = null; if (o == COMPLETED_JOB) { // the job has already been completed. // We don't need to add a job return null; } else if (o == null) { // No appropriate job yet exists, we will create one. job = this.createSourceJob(source, ast); // record the job in the map and the worklist. jobs.put(source, job); worklist.addLast(job); if (Report.should_report(Report.frontend, 3)) { Report.report(3, "Adding job for " + source + " at the " + "request of job " + currentJob); } } else { job = (SourceJob)o; } // if the current source job caused this job to load, record the // dependency. if (currentJob instanceof SourceJob) { ((SourceJob)currentJob).addDependency(source); } return job; } /** * Create a new <code>SourceJob</code> for the given source and AST. * In general, this method should only be called by <code>addJob</code>. */ protected SourceJob createSourceJob(Source source, Node ast) { return new SourceJob(this, jobExt(), source, ast); } /** * Create a new non-<code>SourceJob</code> <code>Job</code>, for the * given AST. In general this method should only be called by * <code>spawnJob</code>. * * @param ast the AST the new Job is for. * @param context the context that the AST occurs in * @param outer the <code>Job</code> that spawned this job. * @param begin the first pass to perform for this job. * @param end the last pass to perform for this job. */ protected Job createJob(Node ast, Context context, Job outer, Pass.ID begin, Pass.ID end) { return new InnerJob(this, jobExt(), ast, context, outer, begin, end); } /** * Spawn a new job. All passes between the pass <code>begin</code> * and <code>end</code> inclusive will be performed immediately on * the AST <code>ast</code>. * * @param c the context that the AST occurs in * @param ast the AST the new Job is for. * @param outerJob the <code>Job</code> that spawned this job. * @param begin the first pass to perform for this job. * @param end the last pass to perform for this job. * @return the new job. The caller can check the result with * <code>j.status()</code> and get the ast with <code>j.ast()</code>. */ public Job spawnJob(Context c, Node ast, Job outerJob, Pass.ID begin, Pass.ID end) { Job j = createJob(ast, c, outerJob, begin, end); if (Report.should_report(Report.frontend, 1)) Report.report(1, this +" spawning " + j); // Run all the passes runAllPasses(j); // Return the job. The caller can check the result with j.status(). return j; } /** Get the parser for this language extension. */ public abstract Parser parser(Reader reader, FileSource source, ErrorQueue eq); /** * Replace the pass named <code>id</code> in <code>passes</code> with * the list of <code>newPasses</code>. */ public void replacePass(List passes, Pass.ID id, List newPasses) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { if (p instanceof BarrierPass) { throw new InternalCompilerError("Cannot replace a barrier pass."); } i.remove(); for (Iterator j = newPasses.iterator(); j.hasNext(); ) { i.add(j.next()); } return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Remove the pass named <code>id</code> from <code>passes</code>. */ public void removePass(List passes, Pass.ID id) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { if (p instanceof BarrierPass) { throw new InternalCompilerError("Cannot remove a barrier pass."); } i.remove(); return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Insert the list of <code>newPasses</code> into <code>passes</code> * immediately before the pass named <code>id</code>. */ public void beforePass(List passes, Pass.ID id, List newPasses) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { // Backup one position. i.previous(); for (Iterator j = newPasses.iterator(); j.hasNext(); ) { i.add(j.next()); } return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Insert the list of <code>newPasses</code> into <code>passes</code> * immediately after the pass named <code>id</code>. */ public void afterPass(List passes, Pass.ID id, List newPasses) { for (ListIterator i = passes.listIterator(); i.hasNext(); ) { Pass p = (Pass) i.next(); if (p.id() == id) { for (Iterator j = newPasses.iterator(); j.hasNext(); ) { i.add(j.next()); } return; } } throw new InternalCompilerError("Pass " + id + " not found."); } /** * Replace the pass named <code>id</code> in <code>passes</code> with * the pass <code>pass</code>. */ public void replacePass(List passes, Pass.ID id, Pass pass) { replacePass(passes, id, Collections.singletonList(pass)); } /** * Insert the pass <code>pass</code> into <code>passes</code> * immediately before the pass named <code>id</code>. */ public void beforePass(List passes, Pass.ID id, Pass pass) { beforePass(passes, id, Collections.singletonList(pass)); } /** * Insert the pass <code>pass</code> into <code>passes</code> * immediately after the pass named <code>id</code>. */ public void afterPass(List passes, Pass.ID id, Pass pass) { afterPass(passes, id, Collections.singletonList(pass)); } /** * Get the complete list of passes for the job. */ public abstract List passes(Job job); /** * Get the sub-list of passes for the job between passes * <code>begin</code> and <code>end</code>, inclusive. */ public List passes(Job job, Pass.ID begin, Pass.ID end) { List l = passes(job); Pass p = null; Iterator i = l.iterator(); while (i.hasNext()) { p = (Pass) i.next(); if (begin == p.id()) break; if (! (p instanceof BarrierPass)) i.remove(); } while (p.id() != end && i.hasNext()) { p = (Pass) i.next(); } while (i.hasNext()) { p = (Pass) i.next(); i.remove(); } return l; } public String toString() { return getClass().getName() + " worklist=" + worklist; } public ClassFile createClassFile(File classFileSource, byte[] code){ return new ClassFile(classFileSource, code, this); } }
27,828
0.540032
0.53845
832
32.447117
26.140928
95
false
false
0
0
0
0
0
0
0.471154
false
false
3
7578922e99a64bb3ac46deebd9d09152838291e0
9,809,705,329,865
6b880a055ac8d27290fcbf70c372287fe0accaa5
/Player/app/src/main/java/com/loushao/player/login/LoginListener.java
06e6c0c2a47862f42475990c969dc541b4311cd5
[ "Apache-2.0" ]
permissive
MusicRevolution/LoushaoAndroid
https://github.com/MusicRevolution/LoushaoAndroid
b74a72e8db912b520ac9b6dab2a2c5def1cd3535
e39c13fa16bed945f35460b4d4c980f4b9d3982a
refs/heads/master
2020-03-17T16:45:10.816000
2018-07-02T01:15:32
2018-07-02T01:15:32
133,761,178
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.loushao.player.login; public interface LoginListener { void onSuccess(String token); void onFailure(String msg); }
UTF-8
Java
136
java
LoginListener.java
Java
[]
null
[]
package com.loushao.player.login; public interface LoginListener { void onSuccess(String token); void onFailure(String msg); }
136
0.75
0.75
6
21.666666
14.985178
33
false
false
0
0
0
0
0
0
0.5
false
false
3
633516278564682b38bb5833897c7af76921a6fa
28,621,662,081,064
360915d2f81da231c40cff40f2c22be9ad924fe2
/Exercise/src/sample/controller/MainController.java
42903c20220b4bb4cd5b3955a3715e905342f78c
[]
no_license
Lex0597/Thesis-ITS
https://github.com/Lex0597/Thesis-ITS
4600d45a779134bb8fbe14d273ceee621ab477e4
cd5a3832fe67d886448d049e9977e493e1b37114
refs/heads/master
2021-01-22T03:17:29.809000
2016-08-21T05:10:09
2016-08-21T05:10:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sample.controller; import javafx.fxml.FXML; import javafx.fxml.Initializable; import java.net.URL; import java.util.ResourceBundle; /** * Created by robertoguazon on 13/06/2016. */ public class MainController implements Initializable { @Override public void initialize(URL location, ResourceBundle resources) { } }
UTF-8
Java
343
java
MainController.java
Java
[ { "context": "mport java.util.ResourceBundle;\n\n/**\n * Created by robertoguazon on 13/06/2016.\n */\npublic class MainController im", "end": 174, "score": 0.9996076822280884, "start": 161, "tag": "USERNAME", "value": "robertoguazon" } ]
null
[]
package sample.controller; import javafx.fxml.FXML; import javafx.fxml.Initializable; import java.net.URL; import java.util.ResourceBundle; /** * Created by robertoguazon on 13/06/2016. */ public class MainController implements Initializable { @Override public void initialize(URL location, ResourceBundle resources) { } }
343
0.752187
0.728863
19
17.052631
20.205454
68
false
false
0
0
0
0
0
0
0.315789
false
false
3
a318591602aa65ea3de0a52732d06df2caf04970
31,104,153,179,663
6235d3b43a49a6d7fea4344300874e8e6853f020
/src/main/java/com/ss/android/ugc/aweme/im/sdk/chat/viewholder/ShareRankingSimpleViewHolder.java
b93fdde96089e5eee193647f3910a9326d511ee9
[]
no_license
junges521/src_awe
https://github.com/junges521/src_awe
a12bcfeb6c62bd55afba7147b83f4e3df8797019
cff4a5e230f3346f493df79744e6f2a6f20a47e2
refs/heads/master
2020-07-13T19:37:36.253000
2019-08-29T10:47:51
2019-08-29T10:47:51
205,140,726
0
0
null
true
2019-08-29T10:41:58
2019-08-29T10:41:58
2019-08-29T08:24:29
2019-08-23T11:31:27
177,015
0
0
0
null
false
false
package com.ss.android.ugc.aweme.im.sdk.chat.viewholder; import android.view.View; import com.bytedance.im.core.d.n; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.ss.android.ugc.aweme.C0906R; import com.ss.android.ugc.aweme.base.c; import com.ss.android.ugc.aweme.im.sdk.chat.model.BaseContent; import com.ss.android.ugc.aweme.im.sdk.chat.model.ShareRankingListContent; import com.ss.android.ugc.aweme.im.sdk.utils.z; public class ShareRankingSimpleViewHolder extends ShareSimpleBaseViewHolder { /* renamed from: b reason: collision with root package name */ public static ChangeQuickRedirect f51130b; public ShareRankingSimpleViewHolder(View view, int i) { super(view, i); } public void a(n nVar, n nVar2, BaseContent baseContent, int i) { if (PatchProxy.isSupport(new Object[]{nVar, nVar2, baseContent, Integer.valueOf(i)}, this, f51130b, false, 51589, new Class[]{n.class, n.class, BaseContent.class, Integer.TYPE}, Void.TYPE)) { PatchProxy.accessDispatch(new Object[]{nVar, nVar2, baseContent, Integer.valueOf(i)}, this, f51130b, false, 51589, new Class[]{n.class, n.class, BaseContent.class, Integer.TYPE}, Void.TYPE); return; } super.a(nVar, nVar2, baseContent, i); ShareRankingListContent shareRankingListContent = (ShareRankingListContent) baseContent; int type = shareRankingListContent.getType(); if (type != 2301) { switch (type) { case 1801: this.s.setText(C0906R.string.ay7); c.a(this.r, 2130840537); break; case 1802: this.s.setText(C0906R.string.ay6); c.a(this.r, 2130840536); break; case 1803: this.s.setText(C0906R.string.ay5); c.a(this.r, 2130840535); break; } } else { this.s.setText(C0906R.string.ay4); c.a(this.r, 2130840534); } this.t.setVisibility(0); this.t.setText(String.format(this.itemView.getContext().getResources().getString(C0906R.string.awe), new Object[]{shareRankingListContent.getLastUpdateTime()})); this.u.setText(C0906R.string.awd); this.i.setTag(50331648, 15); z.a().a(shareRankingListContent, this.h, this.m.getConversationId(), false); } }
UTF-8
Java
2,474
java
ShareRankingSimpleViewHolder.java
Java
[]
null
[]
package com.ss.android.ugc.aweme.im.sdk.chat.viewholder; import android.view.View; import com.bytedance.im.core.d.n; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.ss.android.ugc.aweme.C0906R; import com.ss.android.ugc.aweme.base.c; import com.ss.android.ugc.aweme.im.sdk.chat.model.BaseContent; import com.ss.android.ugc.aweme.im.sdk.chat.model.ShareRankingListContent; import com.ss.android.ugc.aweme.im.sdk.utils.z; public class ShareRankingSimpleViewHolder extends ShareSimpleBaseViewHolder { /* renamed from: b reason: collision with root package name */ public static ChangeQuickRedirect f51130b; public ShareRankingSimpleViewHolder(View view, int i) { super(view, i); } public void a(n nVar, n nVar2, BaseContent baseContent, int i) { if (PatchProxy.isSupport(new Object[]{nVar, nVar2, baseContent, Integer.valueOf(i)}, this, f51130b, false, 51589, new Class[]{n.class, n.class, BaseContent.class, Integer.TYPE}, Void.TYPE)) { PatchProxy.accessDispatch(new Object[]{nVar, nVar2, baseContent, Integer.valueOf(i)}, this, f51130b, false, 51589, new Class[]{n.class, n.class, BaseContent.class, Integer.TYPE}, Void.TYPE); return; } super.a(nVar, nVar2, baseContent, i); ShareRankingListContent shareRankingListContent = (ShareRankingListContent) baseContent; int type = shareRankingListContent.getType(); if (type != 2301) { switch (type) { case 1801: this.s.setText(C0906R.string.ay7); c.a(this.r, 2130840537); break; case 1802: this.s.setText(C0906R.string.ay6); c.a(this.r, 2130840536); break; case 1803: this.s.setText(C0906R.string.ay5); c.a(this.r, 2130840535); break; } } else { this.s.setText(C0906R.string.ay4); c.a(this.r, 2130840534); } this.t.setVisibility(0); this.t.setText(String.format(this.itemView.getContext().getResources().getString(C0906R.string.awe), new Object[]{shareRankingListContent.getLastUpdateTime()})); this.u.setText(C0906R.string.awd); this.i.setTag(50331648, 15); z.a().a(shareRankingListContent, this.h, this.m.getConversationId(), false); } }
2,474
0.634196
0.582458
55
43.981819
41.847988
202
false
false
0
0
0
0
0
0
1.345455
false
false
3
b6f319a5eeb3414656500a628679d357836166b3
31,104,153,180,001
5b2884303c8ee986a278fc0025737dcfeb43ca25
/src/com/startjava/lesson_2_3_4/robot/JagerTest.java
93457524a7261ba2a6f1583f9ee0f8305f39676b
[]
no_license
Evgen-Mutagen/startjava
https://github.com/Evgen-Mutagen/startjava
29ee68024a43147c690fbc23caf170988caaa38f
c016ddcd39f37b5450d3d61b40c781f306ef1d13
refs/heads/master
2023-07-16T06:35:17.712000
2021-09-03T12:15:44
2021-09-03T12:15:44
384,114,396
0
0
null
false
2021-07-23T13:51:48
2021-07-08T12:18:11
2021-07-22T13:51:38
2021-07-23T13:49:45
51
0
0
1
Java
false
false
package com.startjava.lesson_2_3_4.robot; public class JagerTest { public static void main(String[] args) { Jager gipsyDanger = new Jager("Mark-5","Arc-9 reactor (analog)", 6, 7); System.out.println(gipsyDanger.getMark()); System.out.println(gipsyDanger.getEnergyCore()); System.out.println(gipsyDanger.getArmor()); System.out.println(gipsyDanger.getSpeed()); gipsyDanger.launchWeapons(); Jager strikerEureka = new Jager("Mark-3","XIG Supercell Chamber", 9, 10); System.out.println(strikerEureka.getMark()); System.out.println(strikerEureka.getEnergyCore()); System.out.println(strikerEureka.getArmor()); System.out.println(strikerEureka.getSpeed()); gipsyDanger.launchWeapons(); } }
UTF-8
Java
817
java
JagerTest.java
Java
[]
null
[]
package com.startjava.lesson_2_3_4.robot; public class JagerTest { public static void main(String[] args) { Jager gipsyDanger = new Jager("Mark-5","Arc-9 reactor (analog)", 6, 7); System.out.println(gipsyDanger.getMark()); System.out.println(gipsyDanger.getEnergyCore()); System.out.println(gipsyDanger.getArmor()); System.out.println(gipsyDanger.getSpeed()); gipsyDanger.launchWeapons(); Jager strikerEureka = new Jager("Mark-3","XIG Supercell Chamber", 9, 10); System.out.println(strikerEureka.getMark()); System.out.println(strikerEureka.getEnergyCore()); System.out.println(strikerEureka.getArmor()); System.out.println(strikerEureka.getSpeed()); gipsyDanger.launchWeapons(); } }
817
0.646267
0.632803
22
36.090908
24.916058
81
false
false
0
0
0
0
0
0
0.863636
false
false
3
4f5da54f835b1b2c0ad734bee39c148c15f1d4b5
23,295,902,678,986
eef7d01566051804f59828e812cf8700627742f1
/Interface_Practice/Duck.java
d0d830021d082f95c01c0af35419e158942781a9
[]
no_license
moosongsong/JAVA_Basic
https://github.com/moosongsong/JAVA_Basic
bfc6d2a12724d850c5042bb257ee4d8b7f986104
8e2518ebfb9b17ca425082316abb2acb2a921c31
refs/heads/master
2021-04-07T03:57:22.970000
2020-03-30T04:44:31
2020-03-30T04:44:31
248,643,053
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Interface_Practice; public class Duck implements Flyable{ @Override public void fly() { System.out.println("오리, 하늘을 날다"); } public void run() { System.out.println("오리, 달리다"); } // public abstract void fly(); // 가 이렇게 되어있는 상태라고 볼 수 있다. }
UHC
Java
328
java
Duck.java
Java
[]
null
[]
package Interface_Practice; public class Duck implements Flyable{ @Override public void fly() { System.out.println("오리, 하늘을 날다"); } public void run() { System.out.println("오리, 달리다"); } // public abstract void fly(); // 가 이렇게 되어있는 상태라고 볼 수 있다. }
328
0.628676
0.628676
14
17.428572
17.430328
57
false
false
0
0
0
0
0
0
1.214286
false
false
3
e86924b5905045e23efe3dfe54ac2d888348517e
32,049,045,985,515
e1ed5f410bba8c05310b6a7dabe65b7ef62a9322
/src/main/java/com/sda/javabyd3/syga/designpatterns/zadania/ex01/Singleton.java
9cd86e56ab22b8ad0e84990d7d54b1a0b4126297
[]
no_license
pmkiedrowicz/javabyd3
https://github.com/pmkiedrowicz/javabyd3
252f70e70f0fc71e8ef9019fdd8cea5bd05ca90b
7ff8e93c041f27383b3ad31b43f014c059ef53e3
refs/heads/master
2022-01-01T08:56:08.747000
2019-07-26T19:02:50
2019-07-26T19:02:50
199,065,478
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sda.javabyd3.syga.designpatterns.zadania.ex01; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class Singleton { private static Singleton instance; private String FilePath = "C:\\Users\\sylwe\\Desktop\\Repozytorium\\Text\\Singleton.txt"; public static Singleton getInstance() { if (instance == null) { synchronized (Singleton.class) { if (instance == null) { instance = new Singleton(); } } } return instance; } public void saveLog(String text) throws IOException{ FileWriter fileWriter = new FileWriter(FilePath, true); PrintWriter printWriter = new PrintWriter(fileWriter); printWriter.println(text); printWriter.close(); } }
UTF-8
Java
788
java
Singleton.java
Java
[ { "context": " instance;\n private String FilePath = \"C:\\\\Users\\\\sylwe\\\\Desktop\\\\Repozytorium\\\\Text\\\\Singleton.txt\";\n\n p", "end": 249, "score": 0.7905773520469666, "start": 244, "tag": "USERNAME", "value": "sylwe" } ]
null
[]
package com.sda.javabyd3.syga.designpatterns.zadania.ex01; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class Singleton { private static Singleton instance; private String FilePath = "C:\\Users\\sylwe\\Desktop\\Repozytorium\\Text\\Singleton.txt"; public static Singleton getInstance() { if (instance == null) { synchronized (Singleton.class) { if (instance == null) { instance = new Singleton(); } } } return instance; } public void saveLog(String text) throws IOException{ FileWriter fileWriter = new FileWriter(FilePath, true); PrintWriter printWriter = new PrintWriter(fileWriter); printWriter.println(text); printWriter.close(); } }
788
0.670051
0.666244
28
27.142857
22.619072
90
false
false
0
0
0
0
0
0
0.464286
false
false
3
a62c6f23c4c909ece64f5025a63da3b89d0f6ff0
3,143,916,120,276
038b56366377028142ddb0b23a68615a9cbb08a0
/system/trunk/sandu-system/.svn/pristine/ed/ed8425adcb393692c80c6eafd100a7a5cd3eb169.svn-base
4b412bec13baa56251a3d0f36278d286e97bcfac
[]
no_license
moutainhigh/code
https://github.com/moutainhigh/code
445ab40f976ce8269e6caaef0d9a898150280a8c
2556d64f57b326c679a8230af20df12da2c61f98
refs/heads/master
2022-01-08T07:59:48.713000
2019-05-18T09:34:21
2019-05-18T09:34:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sandu.api.grouppurchase.bo; import lombok.Data; import java.io.Serializable; @Data public class SpuAttributeBO implements Serializable { private Integer attrId; private String attrName; private Integer attrValueId; private String attrValueName; }
UTF-8
Java
278
ed8425adcb393692c80c6eafd100a7a5cd3eb169.svn-base
Java
[]
null
[]
package com.sandu.api.grouppurchase.bo; import lombok.Data; import java.io.Serializable; @Data public class SpuAttributeBO implements Serializable { private Integer attrId; private String attrName; private Integer attrValueId; private String attrValueName; }
278
0.776978
0.776978
13
20.384615
16.927622
53
false
false
0
0
0
0
0
0
0.538462
false
false
3
42b8304ddb3509d650585cdcc57fa3eb1ab8d08f
18,416,819,820,276
7ddf5b0499c559681e2b96eb8b24c5d51283bf03
/src/BPLTypeCheckerException.java
46e9ad8abdab8d5fe8d40093ee06d97ab9d5f099
[]
no_license
shangwyoung/BPLCompiler
https://github.com/shangwyoung/BPLCompiler
7e2e3ad4043dca514acaebbb876514cbe26c4cd8
7b661cded2cb0279c423dc94a38f478c3a6f47e3
refs/heads/master
2021-05-31T16:27:42.356000
2016-05-13T05:27:47
2016-05-13T05:27:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class BPLTypeCheckerException extends Exception { public BPLTypeCheckerException() {} public BPLTypeCheckerException(String message) { super(message); } }
UTF-8
Java
170
java
BPLTypeCheckerException.java
Java
[]
null
[]
public class BPLTypeCheckerException extends Exception { public BPLTypeCheckerException() {} public BPLTypeCheckerException(String message) { super(message); } }
170
0.782353
0.782353
7
23.142857
21.970295
56
false
false
0
0
0
0
0
0
1
false
false
3
4ebe10645202bfb70759b68e44ff38b873b3cdcf
23,106,924,083,302
05948ca1cd3c0d2bcd65056d691c4d1b2e795318
/classes/android/support/v4/app/BaseFragmentActivityEclair.java
abbb10856a1a601fd2c0244bff4897489b8c54da
[]
no_license
waterwitness/xiaoenai
https://github.com/waterwitness/xiaoenai
356a1163f422c882cabe57c0cd3427e0600ff136
d24c4d457d6ea9281a8a789bc3a29905b06002c6
refs/heads/master
2021-01-10T22:14:17.059000
2016-10-08T08:39:11
2016-10-08T08:39:11
70,317,042
0
8
null
null
null
null
null
null
null
null
null
null
null
null
null
package android.support.v4.app; abstract class BaseFragmentActivityEclair extends BaseFragmentActivityDonut { void onBackPressedNotHandled() { super.onBackPressed(); } } /* Location: E:\apk\xiaoenai2\classes-dex2jar.jar!\android\support\v4\app\BaseFragmentActivityEclair.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
375
java
BaseFragmentActivityEclair.java
Java
[]
null
[]
package android.support.v4.app; abstract class BaseFragmentActivityEclair extends BaseFragmentActivityDonut { void onBackPressedNotHandled() { super.onBackPressed(); } } /* Location: E:\apk\xiaoenai2\classes-dex2jar.jar!\android\support\v4\app\BaseFragmentActivityEclair.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
375
0.717333
0.688
16
22.5
29.340672
119
false
false
0
0
0
0
0
0
0.125
false
false
3
9afb83923190afe8c52630432232a1650a6ceb8e
687,194,802,056
6579e0fd968ebdc3d412463754b47dc7038365a1
/Library/src/main/java/com/ktc/ailauncher/lib/views/waterwave/WaveView.java
35ee0ff00c4977fb41b61ab15923875592c70988
[ "Apache-2.0" ]
permissive
SmartArvin/AILauncher
https://github.com/SmartArvin/AILauncher
d410d74bfb8d50bc523ed077df5bee4c9a547754
7643d9a1ba2d425d3afa6a5f090f657cd9c66121
refs/heads/master
2020-08-10T23:37:21.546000
2020-01-10T14:54:28
2020-01-10T14:54:28
214,444,953
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ktc.ailauncher.lib.views.waterwave; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.view.MotionEvent; import android.view.View; /** * 创建波浪效果播放的载体View * @author Arvin * @date 2019.10.11 */ public class WaveView extends View implements Runnable { boolean isRunning = false; int BACKWIDTH; int BACKHEIGHT; short[] buf2; short[] buf1; int[] Bitmap2; int[] Bitmap1; public WaveView(Context context, Bitmap bmp) { super(context); Bitmap image = bmp; BACKWIDTH = image.getWidth(); BACKHEIGHT = image.getHeight(); buf2 = new short[BACKWIDTH * BACKHEIGHT]; buf1 = new short[BACKWIDTH * BACKHEIGHT]; Bitmap2 = new int[BACKWIDTH * BACKHEIGHT]; Bitmap1 = new int[BACKWIDTH * BACKHEIGHT]; image.getPixels(Bitmap1, 0, BACKWIDTH, 0, 0, BACKWIDTH, BACKHEIGHT); start(); } void dropStone(int x, int y, int stonesize, int stoneweight) { if ((x + stonesize) > BACKWIDTH || (y + stonesize) > BACKHEIGHT || (x - stonesize) < 0 || (y - stonesize) < 0) return; for (int posx = x - stonesize; posx < x + stonesize; posx++) for (int posy = y - stonesize; posy < y + stonesize; posy++) if ((posx - x) * (posx - x) + (posy - y) * (posy - y) < stonesize * stonesize) buf1[BACKWIDTH * posy + posx] = (short)-stoneweight; } protected void onDraw(Canvas canvas) { canvas.drawColor(0x00000000); canvas.drawBitmap(Bitmap2, 0, BACKWIDTH, 0, 0, BACKWIDTH, BACKHEIGHT, false, null); } public void start() { isRunning = true; Thread t = new Thread(this); t.start(); } public void key() { dropStone(BACKWIDTH / 2, BACKHEIGHT / 2, 10, 50); } public void stop() { isRunning = false; } public void run() { while (isRunning) { try { Thread.sleep(10); } catch (Exception e) { e.printStackTrace(); } ; RippleSpread(); render(); postInvalidate(); } } void RippleSpread() { for (int i = BACKWIDTH; i < BACKWIDTH * BACKHEIGHT - BACKWIDTH; i++) { buf2[i] = (short)(((buf1[i - 1] + buf1[i + 1] + buf1[i - BACKWIDTH] + buf1[i + BACKWIDTH]) >> 1) - buf2[i]); buf2[i] -= buf2[i] >> 5; } short[] ptmp = buf1; buf1 = buf2; buf2 = ptmp; } void render() { int xoff, yoff; int k = BACKWIDTH; for (int i = 1; i < BACKHEIGHT - 1; i++) { for (int j = 0; j < BACKWIDTH; j++) { xoff = buf1[k - 1] - buf1[k + 1]; yoff = buf1[k - BACKWIDTH] - buf1[k + BACKWIDTH]; if ((i + yoff) < 0) { k++; continue; } if ((i + yoff) > BACKHEIGHT) { k++; continue; } if ((j + xoff) < 0) { k++; continue; } if ((j + xoff) > BACKWIDTH) { k++; continue; } int pos1, pos2; pos1 = BACKWIDTH * (i + yoff) + (j + xoff); pos2 = BACKWIDTH * i + j; Bitmap2[pos2++] = Bitmap1[pos1++]; k++; } } } @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN && !isRunning) { dropStone((int)event.getX(), (int)event.getY(), 10, 50); } return super.onTouchEvent(event); } }
UTF-8
Java
3,872
java
WaveView.java
Java
[ { "context": "roid.view.View;\n\n/**\n * 创建波浪效果播放的载体View\n * @author Arvin\n * @date 2019.10.11\n */\npublic class WaveView ext", "end": 244, "score": 0.9995214343070984, "start": 239, "tag": "NAME", "value": "Arvin" } ]
null
[]
package com.ktc.ailauncher.lib.views.waterwave; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.view.MotionEvent; import android.view.View; /** * 创建波浪效果播放的载体View * @author Arvin * @date 2019.10.11 */ public class WaveView extends View implements Runnable { boolean isRunning = false; int BACKWIDTH; int BACKHEIGHT; short[] buf2; short[] buf1; int[] Bitmap2; int[] Bitmap1; public WaveView(Context context, Bitmap bmp) { super(context); Bitmap image = bmp; BACKWIDTH = image.getWidth(); BACKHEIGHT = image.getHeight(); buf2 = new short[BACKWIDTH * BACKHEIGHT]; buf1 = new short[BACKWIDTH * BACKHEIGHT]; Bitmap2 = new int[BACKWIDTH * BACKHEIGHT]; Bitmap1 = new int[BACKWIDTH * BACKHEIGHT]; image.getPixels(Bitmap1, 0, BACKWIDTH, 0, 0, BACKWIDTH, BACKHEIGHT); start(); } void dropStone(int x, int y, int stonesize, int stoneweight) { if ((x + stonesize) > BACKWIDTH || (y + stonesize) > BACKHEIGHT || (x - stonesize) < 0 || (y - stonesize) < 0) return; for (int posx = x - stonesize; posx < x + stonesize; posx++) for (int posy = y - stonesize; posy < y + stonesize; posy++) if ((posx - x) * (posx - x) + (posy - y) * (posy - y) < stonesize * stonesize) buf1[BACKWIDTH * posy + posx] = (short)-stoneweight; } protected void onDraw(Canvas canvas) { canvas.drawColor(0x00000000); canvas.drawBitmap(Bitmap2, 0, BACKWIDTH, 0, 0, BACKWIDTH, BACKHEIGHT, false, null); } public void start() { isRunning = true; Thread t = new Thread(this); t.start(); } public void key() { dropStone(BACKWIDTH / 2, BACKHEIGHT / 2, 10, 50); } public void stop() { isRunning = false; } public void run() { while (isRunning) { try { Thread.sleep(10); } catch (Exception e) { e.printStackTrace(); } ; RippleSpread(); render(); postInvalidate(); } } void RippleSpread() { for (int i = BACKWIDTH; i < BACKWIDTH * BACKHEIGHT - BACKWIDTH; i++) { buf2[i] = (short)(((buf1[i - 1] + buf1[i + 1] + buf1[i - BACKWIDTH] + buf1[i + BACKWIDTH]) >> 1) - buf2[i]); buf2[i] -= buf2[i] >> 5; } short[] ptmp = buf1; buf1 = buf2; buf2 = ptmp; } void render() { int xoff, yoff; int k = BACKWIDTH; for (int i = 1; i < BACKHEIGHT - 1; i++) { for (int j = 0; j < BACKWIDTH; j++) { xoff = buf1[k - 1] - buf1[k + 1]; yoff = buf1[k - BACKWIDTH] - buf1[k + BACKWIDTH]; if ((i + yoff) < 0) { k++; continue; } if ((i + yoff) > BACKHEIGHT) { k++; continue; } if ((j + xoff) < 0) { k++; continue; } if ((j + xoff) > BACKWIDTH) { k++; continue; } int pos1, pos2; pos1 = BACKWIDTH * (i + yoff) + (j + xoff); pos2 = BACKWIDTH * i + j; Bitmap2[pos2++] = Bitmap1[pos1++]; k++; } } } @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN && !isRunning) { dropStone((int)event.getX(), (int)event.getY(), 10, 50); } return super.onTouchEvent(event); } }
3,872
0.481039
0.459481
147
25.190475
24.355177
120
false
false
0
0
0
0
0
0
0.707483
false
false
3
aa27ac5f232fe9bf6112815c030c54b36d1a90de
9,560,597,259,278
8b28944490a09296db401de131e029455211b31d
/app/src/main/java/com/stayzilla/postbooking/util/OverflowLayoutDrawer.java
f02de717c0617e84676b631f874fcf89ccb6c47c
[]
no_license
yeshwanth-reddy/hack09-android
https://github.com/yeshwanth-reddy/hack09-android
a455fe942e2f583a566c87123f8ec6cffd4f4c84
42726458d565626cc55e10c42084ff54d6551b93
refs/heads/master
2020-03-06T11:15:39.465000
2016-07-17T09:30:51
2016-07-17T09:30:51
63,424,358
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stayzilla.postbooking.util; import android.app.Activity; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; import android.widget.LinearLayout; import com.stayzilla.postbooking.R; public class OverflowLayoutDrawer { private Activity activity; public int noOfLinesAdded = 0; static int NO_OF_LINES = 3; public int noOfInterestsDisplayed = 0; public boolean isSecondLayoutUsed = false; int margin; int padding; public OverflowLayoutDrawer(Activity activity) { this.activity = activity; margin = activity.getResources().getDimensionPixelSize(R.dimen.ofl_margin); padding = activity.getResources().getDimensionPixelSize(R.dimen.ofl_padding); } public void populateText(LinearLayout parentLinearLayout, View[] views) { int maxWidth = getScreenWidth(); parentLinearLayout.removeAllViews(); LinearLayout tempLinearLayout = createNewLayoutForNewLine(); int widthSoFar = 0; for (int i = 0; i < views.length; i++) { View view = views[i]; view.measure(0, 0); int measuredWidth = view.getMeasuredWidth(); int measuredHeight = view.getMeasuredHeight(); widthSoFar += measuredWidth + margin + padding; if (widthSoFar >= maxWidth) { parentLinearLayout.addView(tempLinearLayout); tempLinearLayout = createNewLayoutForNewLine(); tempLinearLayout.addView(view, new LinearLayout.LayoutParams(measuredWidth, measuredHeight)); widthSoFar = measuredWidth; } else { tempLinearLayout.addView(view); } } parentLinearLayout.addView(tempLinearLayout); } public void populateText(LinearLayout parentLinearLayout1, LinearLayout parentLinearLayout2, View[] views) { noOfLinesAdded = 0; int maxWidth = getScreenWidth(); parentLinearLayout1.removeAllViews(); parentLinearLayout2.removeAllViews(); LinearLayout tempLinearLayout = createNewLayoutForNewLine(); int widthSoFar = 0; for (int i = 0; i < views.length; i++) { View view = views[i]; view.measure(0, 0); int measuredWidth = view.getMeasuredWidth(); int measuredHeight = view.getMeasuredHeight(); widthSoFar += measuredWidth + margin + padding; if (widthSoFar >= maxWidth) { addTempLayoutToParentLayoutAsNewLine(parentLinearLayout1, parentLinearLayout2, tempLinearLayout); tempLinearLayout = createNewLayoutForNewLine(); tempLinearLayout.addView(view, new LinearLayout.LayoutParams(measuredWidth, measuredHeight)); widthSoFar = measuredWidth; } else { tempLinearLayout.addView(view); if (!isSecondLayoutUsed) { noOfInterestsDisplayed += 1; } } } addTempLayoutToParentLayoutAsNewLine(parentLinearLayout1, parentLinearLayout2, tempLinearLayout); } private int getScreenWidth() { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.widthPixels; } private LinearLayout createNewLayoutForNewLine() { LinearLayout tempLinearLayout = new LinearLayout(activity); tempLinearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); tempLinearLayout.setGravity(Gravity.LEFT); tempLinearLayout.setOrientation(LinearLayout.HORIZONTAL); return tempLinearLayout; } private void addTempLayoutToParentLayoutAsNewLine(LinearLayout parentLinearLayout1, LinearLayout parentLinearLayout2, LinearLayout tempLinearLayout) { noOfLinesAdded++; if (noOfLinesAdded <= NO_OF_LINES) { parentLinearLayout1.addView(tempLinearLayout); } else { isSecondLayoutUsed = true; parentLinearLayout2.addView(tempLinearLayout); } } }
UTF-8
Java
4,247
java
OverflowLayoutDrawer.java
Java
[]
null
[]
package com.stayzilla.postbooking.util; import android.app.Activity; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; import android.widget.LinearLayout; import com.stayzilla.postbooking.R; public class OverflowLayoutDrawer { private Activity activity; public int noOfLinesAdded = 0; static int NO_OF_LINES = 3; public int noOfInterestsDisplayed = 0; public boolean isSecondLayoutUsed = false; int margin; int padding; public OverflowLayoutDrawer(Activity activity) { this.activity = activity; margin = activity.getResources().getDimensionPixelSize(R.dimen.ofl_margin); padding = activity.getResources().getDimensionPixelSize(R.dimen.ofl_padding); } public void populateText(LinearLayout parentLinearLayout, View[] views) { int maxWidth = getScreenWidth(); parentLinearLayout.removeAllViews(); LinearLayout tempLinearLayout = createNewLayoutForNewLine(); int widthSoFar = 0; for (int i = 0; i < views.length; i++) { View view = views[i]; view.measure(0, 0); int measuredWidth = view.getMeasuredWidth(); int measuredHeight = view.getMeasuredHeight(); widthSoFar += measuredWidth + margin + padding; if (widthSoFar >= maxWidth) { parentLinearLayout.addView(tempLinearLayout); tempLinearLayout = createNewLayoutForNewLine(); tempLinearLayout.addView(view, new LinearLayout.LayoutParams(measuredWidth, measuredHeight)); widthSoFar = measuredWidth; } else { tempLinearLayout.addView(view); } } parentLinearLayout.addView(tempLinearLayout); } public void populateText(LinearLayout parentLinearLayout1, LinearLayout parentLinearLayout2, View[] views) { noOfLinesAdded = 0; int maxWidth = getScreenWidth(); parentLinearLayout1.removeAllViews(); parentLinearLayout2.removeAllViews(); LinearLayout tempLinearLayout = createNewLayoutForNewLine(); int widthSoFar = 0; for (int i = 0; i < views.length; i++) { View view = views[i]; view.measure(0, 0); int measuredWidth = view.getMeasuredWidth(); int measuredHeight = view.getMeasuredHeight(); widthSoFar += measuredWidth + margin + padding; if (widthSoFar >= maxWidth) { addTempLayoutToParentLayoutAsNewLine(parentLinearLayout1, parentLinearLayout2, tempLinearLayout); tempLinearLayout = createNewLayoutForNewLine(); tempLinearLayout.addView(view, new LinearLayout.LayoutParams(measuredWidth, measuredHeight)); widthSoFar = measuredWidth; } else { tempLinearLayout.addView(view); if (!isSecondLayoutUsed) { noOfInterestsDisplayed += 1; } } } addTempLayoutToParentLayoutAsNewLine(parentLinearLayout1, parentLinearLayout2, tempLinearLayout); } private int getScreenWidth() { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.widthPixels; } private LinearLayout createNewLayoutForNewLine() { LinearLayout tempLinearLayout = new LinearLayout(activity); tempLinearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); tempLinearLayout.setGravity(Gravity.LEFT); tempLinearLayout.setOrientation(LinearLayout.HORIZONTAL); return tempLinearLayout; } private void addTempLayoutToParentLayoutAsNewLine(LinearLayout parentLinearLayout1, LinearLayout parentLinearLayout2, LinearLayout tempLinearLayout) { noOfLinesAdded++; if (noOfLinesAdded <= NO_OF_LINES) { parentLinearLayout1.addView(tempLinearLayout); } else { isSecondLayoutUsed = true; parentLinearLayout2.addView(tempLinearLayout); } } }
4,247
0.663056
0.65717
113
36.584072
30.994354
154
false
false
0
0
0
0
0
0
0.725664
false
false
3
5d37fcc5295854c82ff2dff5d41f620e43ff4482
26,130,581,093,628
165717a0f23eb2e8fa66e69e163a3faf8e7fc75f
/pcc-imp-app/PrivacyCrashCam/app/src/main/java/edu/kit/informatik/pcc/android/network/request/AbstractMultipartPostRequest.java
ac33348f4a117d10800448e8fca1b457c1780fc6
[ "MIT" ]
permissive
KASTEL-SCBS/Demonstrator4IntegratedMethods4SbD
https://github.com/KASTEL-SCBS/Demonstrator4IntegratedMethods4SbD
5530d85b2fa58731bcc40f83a905d67aa0eb60c6
8cbf69de3ced44b7599cfab37e53a641f09695db
refs/heads/master
2022-12-24T09:58:47.006000
2020-10-08T08:27:47
2020-10-08T08:27:47
292,856,031
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.kit.informatik.pcc.android.network.request; import android.util.Log; import org.glassfish.jersey.media.multipart.MultiPart; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import javax.ws.rs.ProcessingException; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.core.Response; public abstract class AbstractMultipartPostRequest<Result> extends AbstractRequest<Result> { private MultiPart multiPart; public void setMultiPart(MultiPart multiPart) { this.multiPart = multiPart; } @Override public Response performRequest(Invocation.Builder requestBuilder) { Future<Response> futureResponse = requestBuilder.async().post(Entity.entity(multiPart, multiPart.getMediaType()), Response.class); // wait for response String responseContent; try { Response response = futureResponse.get(); responseContent = response.readEntity(String.class); Log.i(logTag(), "response: " + responseContent); return response; } catch (InterruptedException | ExecutionException | ProcessingException e) { e.printStackTrace(); Log.i(logTag(), "Failure on getting response!"); return null; } } }
UTF-8
Java
1,326
java
AbstractMultipartPostRequest.java
Java
[]
null
[]
package edu.kit.informatik.pcc.android.network.request; import android.util.Log; import org.glassfish.jersey.media.multipart.MultiPart; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import javax.ws.rs.ProcessingException; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.core.Response; public abstract class AbstractMultipartPostRequest<Result> extends AbstractRequest<Result> { private MultiPart multiPart; public void setMultiPart(MultiPart multiPart) { this.multiPart = multiPart; } @Override public Response performRequest(Invocation.Builder requestBuilder) { Future<Response> futureResponse = requestBuilder.async().post(Entity.entity(multiPart, multiPart.getMediaType()), Response.class); // wait for response String responseContent; try { Response response = futureResponse.get(); responseContent = response.readEntity(String.class); Log.i(logTag(), "response: " + responseContent); return response; } catch (InterruptedException | ExecutionException | ProcessingException e) { e.printStackTrace(); Log.i(logTag(), "Failure on getting response!"); return null; } } }
1,326
0.702866
0.702866
39
33
30.329811
138
false
false
0
0
0
0
0
0
0.666667
false
false
3
141fdf75b2c7eea080b6a08bf50b40083c2c212f
22,737,556,914,908
77d441a861c7a9dbee4e8eed1139e60dc4e25e67
/ aicoach-java/AICoachJAVA/src/gui/TelaInserirCombaterTatica.java
10eefd57f33a0ef40193048cfa1e67a3ae9d6bf8
[]
no_license
demisgomes/aicoach-java
https://github.com/demisgomes/aicoach-java
a43cc79d2fe7f40824109d8bd814157236ad202c
7082f28a1d85ca691cb71ccf5593b1ddc20402f4
refs/heads/master
2021-01-10T11:55:58.168000
2014-08-11T14:04:07
2014-08-11T14:04:07
49,304,798
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gui; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import dominio.Time; import javax.swing.JButton; import perssistencia.TaticaDAO; import perssistencia.TimeDAO; import negocio.AlgoritmoTatica; import negocio.controller.ControladorCombaterTatica; import negocio.controller.Fachada; import negocio.controller.FachadaCombaterTatica; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class TelaInserirCombaterTatica extends JFrame { private JPanel contentPane; public static Time time; public static JComboBox<String> comboBox; private static JButton btnCombater; public static JButton getBtnCombater() { return btnCombater; } public static void setBtnCombater(JButton btnCombater) { TelaInserirCombaterTatica.btnCombater = btnCombater; } /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { TelaInserirCombaterTatica frame = new TelaInserirCombaterTatica(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public TelaInserirCombaterTatica() {} public TelaInserirCombaterTatica(Time time) { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 277, 334); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); TimeDAO timeDAO=new TimeDAO(); TelaInserirCombaterTatica.time=timeDAO.retornarTime(time.getIdTime()); String [] listaTimes=new String[Time.getListaTimes().size()-1]; int countlista=0; for (int i = 0; i < Time.getListaTimes().size(); i++) { if(Time.getListaTimes().get(i).getIdTime()!=time.getIdTime()){ listaTimes[countlista]=Time.getListaTimes().get(i).getNome(); countlista++; } } comboBox = new JComboBox<String>(listaTimes); comboBox.setBounds(20, 32, 167, 20); contentPane.add(comboBox); btnCombater = new JButton("Combater"); FachadaCombaterTatica fachada = new FachadaCombaterTatica(); fachada.combaterTatica(this, "combaterTatica"); //ControladorCombaterTatica controlador = new ControladorCombaterTatica(); //controlador.acaoBotao(this); /*btnCombater.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { ControladorCombaterTatica c=new ControladorCombaterTatica(); c.controlar(TelaInserirCombaterTatica.time); Time timeEscolhido=Time.getListaTimes().get(comboBox.getSelectedIndex()); TaticaDAO tDAO=new TaticaDAO(); AlgoritmoTatica aTatica=new AlgoritmoTatica(); aTatica.combaterTatica(TelaInserirCombaterTatica.time, timeEscolhido, tDAO.retornarListaTaticas()); //aTatica.alterarEsquema(TelaInserirCombaterTatica.time, 0, tDAO.retornarTatica(time.getTatica().getNome())); TelaTatica.daTelaInserir=true; TelaTatica.naoSalvar=true; Time time=TelaInserirCombaterTatica.time; TelaTatica tela=new TelaTatica(); tela.setVisible(true); dispose(); } });*/ btnCombater.setBounds(54, 100, 95, 35); contentPane.add(btnCombater); } }
UTF-8
Java
3,419
java
TelaInserirCombaterTatica.java
Java
[]
null
[]
package gui; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import dominio.Time; import javax.swing.JButton; import perssistencia.TaticaDAO; import perssistencia.TimeDAO; import negocio.AlgoritmoTatica; import negocio.controller.ControladorCombaterTatica; import negocio.controller.Fachada; import negocio.controller.FachadaCombaterTatica; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class TelaInserirCombaterTatica extends JFrame { private JPanel contentPane; public static Time time; public static JComboBox<String> comboBox; private static JButton btnCombater; public static JButton getBtnCombater() { return btnCombater; } public static void setBtnCombater(JButton btnCombater) { TelaInserirCombaterTatica.btnCombater = btnCombater; } /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { TelaInserirCombaterTatica frame = new TelaInserirCombaterTatica(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public TelaInserirCombaterTatica() {} public TelaInserirCombaterTatica(Time time) { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 277, 334); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); TimeDAO timeDAO=new TimeDAO(); TelaInserirCombaterTatica.time=timeDAO.retornarTime(time.getIdTime()); String [] listaTimes=new String[Time.getListaTimes().size()-1]; int countlista=0; for (int i = 0; i < Time.getListaTimes().size(); i++) { if(Time.getListaTimes().get(i).getIdTime()!=time.getIdTime()){ listaTimes[countlista]=Time.getListaTimes().get(i).getNome(); countlista++; } } comboBox = new JComboBox<String>(listaTimes); comboBox.setBounds(20, 32, 167, 20); contentPane.add(comboBox); btnCombater = new JButton("Combater"); FachadaCombaterTatica fachada = new FachadaCombaterTatica(); fachada.combaterTatica(this, "combaterTatica"); //ControladorCombaterTatica controlador = new ControladorCombaterTatica(); //controlador.acaoBotao(this); /*btnCombater.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { ControladorCombaterTatica c=new ControladorCombaterTatica(); c.controlar(TelaInserirCombaterTatica.time); Time timeEscolhido=Time.getListaTimes().get(comboBox.getSelectedIndex()); TaticaDAO tDAO=new TaticaDAO(); AlgoritmoTatica aTatica=new AlgoritmoTatica(); aTatica.combaterTatica(TelaInserirCombaterTatica.time, timeEscolhido, tDAO.retornarListaTaticas()); //aTatica.alterarEsquema(TelaInserirCombaterTatica.time, 0, tDAO.retornarTatica(time.getTatica().getNome())); TelaTatica.daTelaInserir=true; TelaTatica.naoSalvar=true; Time time=TelaInserirCombaterTatica.time; TelaTatica tela=new TelaTatica(); tela.setVisible(true); dispose(); } });*/ btnCombater.setBounds(54, 100, 95, 35); contentPane.add(btnCombater); } }
3,419
0.723311
0.711904
111
28.801802
23.732677
113
false
false
0
0
0
0
0
0
2.486486
false
false
3
f1e541fa169f0551c569f1e4df6b7cd1a329f9e5
27,925,877,395,753
a7e6ec9b3e92814904814e3d01f0bd9f1153eeb6
/projectbackend/src/main/java/com/config/WebConfig.java
954530091c685efb180214b89288713a43b93a0f
[]
no_license
Shreykhanna/Online-Job-Search-Portal
https://github.com/Shreykhanna/Online-Job-Search-Portal
d3b2bc915086847a4a273e674089791fe5820b8e
d5fe49fccfbe0b599fd92f016382d2dc9cde7b75
refs/heads/master
2021-08-08T10:08:30.251000
2017-11-10T04:06:14
2017-11-10T04:06:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.multipart.commons.CommonsMultipartResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * * @author shrey */ @Configuration @EnableWebMvc @ComponentScan(basePackages="com") public class WebConfig extends WebMvcConfigurerAdapter { public void addResourceHandlers(ResourceHandlerRegistry registry){ registry.addResourceHandler("/resources/**") .addResourceLocations("/WEB-INF/resources/"); //<mvc:resources location="/WEB-INF/resources/" mapping="/resources/**"></mvc:resources> } @Bean(name = "multipartResolver") public CommonsMultipartResolver getCommonsMultipartResolver() { CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(); multipartResolver.setMaxUploadSize(20971520); // 20MB multipartResolver.setMaxInMemorySize(1048576); // 1MB return multipartResolver; } }
UTF-8
Java
1,428
java
WebConfig.java
Java
[ { "context": "tation.WebMvcConfigurerAdapter;\n\n/**\n *\n * @author shrey\n */\n@Configuration\n@EnableWebMvc\n@ComponentScan(b", "end": 715, "score": 0.9988240003585815, "start": 710, "tag": "USERNAME", "value": "shrey" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.multipart.commons.CommonsMultipartResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * * @author shrey */ @Configuration @EnableWebMvc @ComponentScan(basePackages="com") public class WebConfig extends WebMvcConfigurerAdapter { public void addResourceHandlers(ResourceHandlerRegistry registry){ registry.addResourceHandler("/resources/**") .addResourceLocations("/WEB-INF/resources/"); //<mvc:resources location="/WEB-INF/resources/" mapping="/resources/**"></mvc:resources> } @Bean(name = "multipartResolver") public CommonsMultipartResolver getCommonsMultipartResolver() { CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(); multipartResolver.setMaxUploadSize(20971520); // 20MB multipartResolver.setMaxInMemorySize(1048576); // 1MB return multipartResolver; } }
1,428
0.806022
0.793417
39
35.615383
29.962896
90
false
false
0
0
0
0
0
0
0.923077
false
false
3
55f66cde47cf1d817cf938e78f79e71118203542
20,779,051,831,722
dbf5adca095d04d7d069ecaa916e883bc1e5c73d
/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryview/InsufficientPermissionsException.java
bdfcc2ad7009575c604c5e0bf68cfda718e16b6b
[ "BSD-3-Clause" ]
permissive
fancylou/o2oa
https://github.com/fancylou/o2oa
713529a9d383de5d322d1b99073453dac79a9353
e7ec39fc586fab3d38b62415ed06448e6a9d6e26
refs/heads/master
2020-03-25T00:07:41.775000
2018-08-02T01:40:40
2018-08-02T01:40:40
143,169,936
0
0
BSD-3-Clause
true
2018-08-01T14:49:45
2018-08-01T14:49:44
2018-07-29T10:59:16
2017-05-09T19:59:31
108,580
0
0
0
null
false
null
package com.x.cms.assemble.control.jaxrs.queryview; import com.x.base.core.exception.PromptException; class InsufficientPermissionsException extends PromptException { private static final long serialVersionUID = 1859164370743532895L; InsufficientPermissionsException( String flag ) { super("视图操作权限不足。Flag:" + flag ); } }
UTF-8
Java
348
java
InsufficientPermissionsException.java
Java
[]
null
[]
package com.x.cms.assemble.control.jaxrs.queryview; import com.x.base.core.exception.PromptException; class InsufficientPermissionsException extends PromptException { private static final long serialVersionUID = 1859164370743532895L; InsufficientPermissionsException( String flag ) { super("视图操作权限不足。Flag:" + flag ); } }
348
0.80303
0.745455
12
26.5
27.112421
67
false
false
0
0
0
0
0
0
0.75
false
false
3
ae8795d8f8ddc6047a5d025057ab5c8b2c5f722c
31,860,067,466,493
cb1b1f451e9c155116a8ba6e56acbbe582c07caa
/src/com/mb/sociality/model/User.java
f6d367283e171040a966c9faf0de27beb6d5b483
[]
no_license
rockrock0850/MB_SOCIALITY_SYSTEM
https://github.com/rockrock0850/MB_SOCIALITY_SYSTEM
2a2fdf5ea153b067dd3343d6bb9f4dcda492a5f6
68a21a8d4886826982f325defb0ff6d1b6ac2f9e
refs/heads/master
2021-01-17T11:23:22.965000
2017-03-06T05:25:10
2017-03-06T05:25:10
84,033,054
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mb.sociality.model; import org.hibernate.validator.constraints.NotBlank; import org.springframework.web.multipart.MultipartFile; import com.mb.sociality.setting.ValidSetting; public class User { /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.id * @mbggenerated Tue May 10 16:41:23 CST 2016 */ private Integer id; /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.img * @mbggenerated Tue May 10 16:41:23 CST 2016 */ private String img; /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.account * @mbggenerated Tue May 10 16:41:23 CST 2016 */ @NotBlank(message = "請輸入帳號") private String account; /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.password * @mbggenerated Tue May 10 16:41:23 CST 2016 */ @NotBlank(message = "請輸入密碼") private String password; /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.id * @return the value of user.id * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public Integer getId() { return id; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.id * @param id the value for user.id * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setId(Integer id) { this.id = id; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.img * @return the value of user.img * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public String getImg() { return img; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.img * @param img the value for user.img * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setImg(String img) { this.img = img; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.account * @return the value of user.account * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public String getAccount() { return account; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.account * @param account the value for user.account * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setAccount(String account) { this.account = account; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.password * @return the value of user.password * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public String getPassword() { return password; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.password * @param password the value for user.password * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setPassword(String password) { this.password = password; } /* * 自訂欄位 */ @ValidSetting private MultipartFile file; public MultipartFile getFile() { return file; } public void setFile(MultipartFile file) { this.file = file; } }
UTF-8
Java
3,398
java
User.java
Java
[]
null
[]
package com.mb.sociality.model; import org.hibernate.validator.constraints.NotBlank; import org.springframework.web.multipart.MultipartFile; import com.mb.sociality.setting.ValidSetting; public class User { /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.id * @mbggenerated Tue May 10 16:41:23 CST 2016 */ private Integer id; /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.img * @mbggenerated Tue May 10 16:41:23 CST 2016 */ private String img; /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.account * @mbggenerated Tue May 10 16:41:23 CST 2016 */ @NotBlank(message = "請輸入帳號") private String account; /** * This field was generated by MyBatis Generator. This field corresponds to the database column user.password * @mbggenerated Tue May 10 16:41:23 CST 2016 */ @NotBlank(message = "請輸入密碼") private String password; /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.id * @return the value of user.id * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public Integer getId() { return id; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.id * @param id the value for user.id * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setId(Integer id) { this.id = id; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.img * @return the value of user.img * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public String getImg() { return img; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.img * @param img the value for user.img * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setImg(String img) { this.img = img; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.account * @return the value of user.account * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public String getAccount() { return account; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.account * @param account the value for user.account * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setAccount(String account) { this.account = account; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column user.password * @return the value of user.password * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public String getPassword() { return password; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column user.password * @param password the value for user.password * @mbggenerated Tue May 10 16:41:23 CST 2016 */ public void setPassword(String password) { this.password = password; } /* * 自訂欄位 */ @ValidSetting private MultipartFile file; public MultipartFile getFile() { return file; } public void setFile(MultipartFile file) { this.file = file; } }
3,398
0.713353
0.670623
118
27.567797
32.862701
118
false
false
0
0
0
0
0
0
1.067797
false
false
3
0307b03b4b09112a17f2206b183971e563d002ea
12,575,664,304,432
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/videoanalyzer/azure-media-videoanalyzer-edge/src/main/java/com/azure/media/videoanalyzer/edge/models/UsernamePasswordCredentials.java
08cf1ff0f6512ddcc0aa16eab752aaedcc20b544
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
Azure/azure-sdk-for-java
https://github.com/Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821000
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
false
2023-09-14T21:37:15
2011-12-06T23:33:56
2023-09-14T17:19:10
2023-09-14T21:37:14
3,043,660
1,994
1,854
1,435
Java
false
false
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.media.videoanalyzer.edge.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; /** Username and password credentials. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type") @JsonTypeName("#Microsoft.VideoAnalyzer.UsernamePasswordCredentials") @Fluent public final class UsernamePasswordCredentials extends CredentialsBase { /* * Username to be presented as part of the credentials. */ @JsonProperty(value = "username", required = true) private String username; /* * Password to be presented as part of the credentials. It is recommended * that this value is parameterized as a secret string in order to prevent * this value to be returned as part of the resource on API requests. */ @JsonProperty(value = "password", required = true) private String password; /** * Creates an instance of UsernamePasswordCredentials class. * * @param username the username value to set. * @param password the password value to set. */ @JsonCreator public UsernamePasswordCredentials( @JsonProperty(value = "username", required = true) String username, @JsonProperty(value = "password", required = true) String password) { this.username = username; this.password = password; } /** * Get the username property: Username to be presented as part of the credentials. * * @return the username value. */ public String getUsername() { return this.username; } /** * Get the password property: Password to be presented as part of the credentials. It is recommended that this value * is parameterized as a secret string in order to prevent this value to be returned as part of the resource on API * requests. * * @return the password value. */ public String getPassword() { return this.password; } }
UTF-8
Java
2,334
java
UsernamePasswordCredentials.java
Java
[ { "context": " this.username = username;\n this.password = password;\n }\n\n /**\n * Get the username property:", "end": 1721, "score": 0.939478874206543, "start": 1713, "tag": "PASSWORD", "value": "password" } ]
null
[]
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.media.videoanalyzer.edge.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; /** Username and password credentials. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type") @JsonTypeName("#Microsoft.VideoAnalyzer.UsernamePasswordCredentials") @Fluent public final class UsernamePasswordCredentials extends CredentialsBase { /* * Username to be presented as part of the credentials. */ @JsonProperty(value = "username", required = true) private String username; /* * Password to be presented as part of the credentials. It is recommended * that this value is parameterized as a secret string in order to prevent * this value to be returned as part of the resource on API requests. */ @JsonProperty(value = "password", required = true) private String password; /** * Creates an instance of UsernamePasswordCredentials class. * * @param username the username value to set. * @param password the password value to set. */ @JsonCreator public UsernamePasswordCredentials( @JsonProperty(value = "username", required = true) String username, @JsonProperty(value = "password", required = true) String password) { this.username = username; this.password = <PASSWORD>; } /** * Get the username property: Username to be presented as part of the credentials. * * @return the username value. */ public String getUsername() { return this.username; } /** * Get the password property: Password to be presented as part of the credentials. It is recommended that this value * is parameterized as a secret string in order to prevent this value to be returned as part of the resource on API * requests. * * @return the password value. */ public String getPassword() { return this.password; } }
2,336
0.700943
0.700943
65
34.907692
30.948456
120
false
false
0
0
0
0
0
0
0.292308
false
false
3
200b8dc663cfa1cd2d6e9d2872ba1dc452a70d81
34,359,800,283
8f1695fd961df9afe6cb763edf0bb6e9fed3030c
/src/main/java/com/pg/library/config/MyConnection.java
f532e6794a876bbbcb91d387d74877e13e539daf
[]
no_license
PawelGr/library-web
https://github.com/PawelGr/library-web
2159a7eb06bf892d4cdc06b7bf680e48b4078f6d
2a179d8b193a0a6e5bd6718bc6f639386e690664
refs/heads/master
2020-03-29T13:21:23.537000
2018-11-12T12:17:59
2018-11-12T12:17:59
149,954,302
0
0
null
false
2018-09-23T07:36:19
2018-09-23T06:34:06
2018-09-23T07:27:25
2018-09-23T07:36:18
0
0
0
0
HTML
false
null
package com.pg.library.config; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class MyConnection { private String dbms = "mysql"; private String userName = "root"; private String serverName = "localhost"; private String password = "2agraboso3"; private int portNumber = 3306; public java.sql.Connection getConnection() throws SQLException { java.sql.Connection conn = null; Properties connectionProps = new Properties(); connectionProps.put("user", this.userName); connectionProps.put("password", this.password); connectionProps.put("serverTimezone", "UTC"); conn = DriverManager.getConnection( "jdbc:" + this.dbms + "://" + this.serverName + ":" + this.portNumber + "/javatest", connectionProps); System.out.println("Connected to database"); return conn; } }
UTF-8
Java
989
java
MyConnection.java
Java
[ { "context": "ng dbms = \"mysql\";\n private String userName = \"root\";\n private String serverName = \"localhost\";\n ", "end": 222, "score": 0.8890343904495239, "start": 218, "tag": "USERNAME", "value": "root" }, { "context": "ame = \"localhost\";\n private String password = \"2agraboso3\";\n private int portNumber = 3306;\n\n public ", "end": 311, "score": 0.9992027282714844, "start": 301, "tag": "PASSWORD", "value": "2agraboso3" }, { "context": "userName);\n connectionProps.put(\"password\", this.password);\n connectionProps.put(\"serverTimezone\", \"", "end": 621, "score": 0.6838786005973816, "start": 608, "tag": "PASSWORD", "value": "this.password" } ]
null
[]
package com.pg.library.config; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class MyConnection { private String dbms = "mysql"; private String userName = "root"; private String serverName = "localhost"; private String password = "<PASSWORD>"; private int portNumber = 3306; public java.sql.Connection getConnection() throws SQLException { java.sql.Connection conn = null; Properties connectionProps = new Properties(); connectionProps.put("user", this.userName); connectionProps.put("password", <PASSWORD>); connectionProps.put("serverTimezone", "UTC"); conn = DriverManager.getConnection( "jdbc:" + this.dbms + "://" + this.serverName + ":" + this.portNumber + "/javatest", connectionProps); System.out.println("Connected to database"); return conn; } }
986
0.625885
0.619818
32
29.90625
20.878157
68
false
false
0
0
0
0
0
0
0.65625
false
false
3
f445053b0046ada430066b8a7b54f06ad68fbac4
32,753,420,660,286
616590eff874c708dba29a47a04c6a443f13f45f
/SeleniumFramework/src/main/java/E2EProject/Framework/Base.java
7da81f1a97c97dcefffe010d46dd3e30a1f66cf2
[]
no_license
aishmagupta/AishmasProject
https://github.com/aishmagupta/AishmasProject
d539d68a880deb3310c8c779bdbb8e41854d2526
cb9b5963ad200920438fa1b40bdbdb17fc48c3b0
refs/heads/master
2023-03-12T06:38:56.447000
2021-03-01T08:41:58
2021-03-01T08:41:58
343,133,383
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package E2EProject.Framework; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import java.util.concurrent.TimeUnit; //import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Base { private static final int OutputType = 0; public static WebDriver driver; // best to initialise driver outside public Properties prop ; public WebDriver initializeDriver() throws IOException { prop= new Properties(); FileInputStream fis = new FileInputStream("C:\\Users\\Kalka Repairs\\eclipse-workspace\\SeleniumFramework\\src\\main\\java\\resources\\data.properties"); prop.load(fis); String browser = prop.getProperty("browser"); System.out.print("Choosen browser is ["+browser+"]"); if(browser.equals("chrome")) { System.setProperty("webdriver.chrome.driver","F:\\STUDY\\Selenium new\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); } if(browser.equals("firefox")) { //code for firefox } if(browser.equals("IE")) { //code for IE } driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS); // global wait applied across all instructions return driver; } public static void getScreenshot(String TestcaseName,WebDriver driver) throws IOException { /* TakesScreenshot ts = (TakesScreenshot) driver; File source = ts.getScreenshotAs(null); String destinationfile = System.getProperty("user.dir")+"\\reports\\"+TestcaseName+"png"; FileUtils.copyFile(source, new File(destinationfile)); return destinationfile;*/ } }
UTF-8
Java
1,779
java
Base.java
Java
[]
null
[]
package E2EProject.Framework; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import java.util.concurrent.TimeUnit; //import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Base { private static final int OutputType = 0; public static WebDriver driver; // best to initialise driver outside public Properties prop ; public WebDriver initializeDriver() throws IOException { prop= new Properties(); FileInputStream fis = new FileInputStream("C:\\Users\\Kalka Repairs\\eclipse-workspace\\SeleniumFramework\\src\\main\\java\\resources\\data.properties"); prop.load(fis); String browser = prop.getProperty("browser"); System.out.print("Choosen browser is ["+browser+"]"); if(browser.equals("chrome")) { System.setProperty("webdriver.chrome.driver","F:\\STUDY\\Selenium new\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); } if(browser.equals("firefox")) { //code for firefox } if(browser.equals("IE")) { //code for IE } driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS); // global wait applied across all instructions return driver; } public static void getScreenshot(String TestcaseName,WebDriver driver) throws IOException { /* TakesScreenshot ts = (TakesScreenshot) driver; File source = ts.getScreenshotAs(null); String destinationfile = System.getProperty("user.dir")+"\\reports\\"+TestcaseName+"png"; FileUtils.copyFile(source, new File(destinationfile)); return destinationfile;*/ } }
1,779
0.743114
0.740304
62
27.693548
31.787394
155
false
false
0
0
0
0
0
0
1.741935
false
false
3
ce49d8a1ab4f0b6953c7156c79df48e60ae757e2
26,723,286,576,040
6d15e54827754f821d77947b28009641e6b8799a
/FurnitureLib-Core/src/main/java/de/Ste3et_C0st/FurnitureLib/Utilitis/SkullMetaPatcher.java
4b4111605409748e118a575a8d44715e48b016f0
[]
no_license
Ste3et/FurnitureLib
https://github.com/Ste3et/FurnitureLib
46e689b085e6bfd0968c4a2e6b60f3571ce5e0d3
3e9b84a5c485b54725273d246bab2d0fe965c51f
refs/heads/master
2023-07-06T21:40:13.813000
2023-07-01T16:52:04
2023-07-01T16:52:04
36,237,479
40
37
null
false
2022-10-31T19:12:08
2015-05-25T15:04:56
2022-02-11T08:51:11
2022-10-31T19:12:07
10,326
23
25
3
Java
false
false
package de.Ste3et_C0st.FurnitureLib.Utilitis; import java.lang.reflect.Field; import java.util.Objects; import java.util.UUID; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedSignedProperty; import de.Ste3et_C0st.FurnitureLib.NBT.NBTTagCompound; import de.Ste3et_C0st.FurnitureLib.NBT.NBTTagList; import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; public class SkullMetaPatcher { private static boolean needPatcher = FurnitureLib.isPaper() == false; public static ItemStack patchStack(ItemStack stack) { if(needPatcher == false) return stack; if(Objects.isNull(stack)) return stack; if(stack.getItemMeta() instanceof SkullMeta) { try { final Object craftBukkitMeta = MinecraftReflection.getCraftBukkitClass("inventory.CraftMetaSkull").cast(stack.getItemMeta()); final Field profileField = MinecraftReflection.getCraftBukkitClass("inventory.CraftMetaSkull").getDeclaredField("profile"); profileField.setAccessible(true); final Object savedObject = profileField.get(craftBukkitMeta); final WrappedGameProfile profile = WrappedGameProfile.fromHandle(savedObject); //System.out.println(profile.toString()); }catch (Exception e) { e.printStackTrace(); } } return stack; } public static ItemStack patch(ItemStack stack, NBTTagCompound compound) { if(needPatcher) { if(compound.hasKeyOfType("tag", 10)) { NBTTagCompound tagCompound = compound.getCompound("tag"); if(tagCompound.hasKeyOfType("SkullOwner", 10)) { NBTTagCompound skullCompound = tagCompound.getCompound("SkullOwner"); if(skullCompound.hasKeyOfType("Properties", 10)) { NBTTagCompound propertiesCompound = skullCompound.getCompound("Properties"); if(propertiesCompound.hasKeyOfType("textures", 9)) { ItemMeta headMeta = stack.getItemMeta(); NBTTagList textureCompound = propertiesCompound.getList("textures"); NBTTagCompound texturestring = textureCompound.get(0); String base64String = texturestring.getString("Value"); WrappedGameProfile gameProfile = makeProfile(base64String); try { Field profileField = headMeta.getClass().getDeclaredField("profile"); profileField.setAccessible(true); profileField.set(headMeta, gameProfile.getHandle()); } catch (NoSuchFieldException | SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } finally { stack.setItemMeta(headMeta); } } } } } } return stack; } public static boolean shouldPatch() { return needPatcher; } public static WrappedGameProfile makeProfile(String b64) { UUID id = new UUID( b64.substring(b64.length() - 20).hashCode(), b64.substring(b64.length() - 10).hashCode() ); WrappedGameProfile profile = new WrappedGameProfile(id, "Player"); profile.getProperties().put("textures", new WrappedSignedProperty("textures", b64, "furniture")); return profile; } }
UTF-8
Java
3,542
java
SkullMetaPatcher.java
Java
[]
null
[]
package de.Ste3et_C0st.FurnitureLib.Utilitis; import java.lang.reflect.Field; import java.util.Objects; import java.util.UUID; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedSignedProperty; import de.Ste3et_C0st.FurnitureLib.NBT.NBTTagCompound; import de.Ste3et_C0st.FurnitureLib.NBT.NBTTagList; import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; public class SkullMetaPatcher { private static boolean needPatcher = FurnitureLib.isPaper() == false; public static ItemStack patchStack(ItemStack stack) { if(needPatcher == false) return stack; if(Objects.isNull(stack)) return stack; if(stack.getItemMeta() instanceof SkullMeta) { try { final Object craftBukkitMeta = MinecraftReflection.getCraftBukkitClass("inventory.CraftMetaSkull").cast(stack.getItemMeta()); final Field profileField = MinecraftReflection.getCraftBukkitClass("inventory.CraftMetaSkull").getDeclaredField("profile"); profileField.setAccessible(true); final Object savedObject = profileField.get(craftBukkitMeta); final WrappedGameProfile profile = WrappedGameProfile.fromHandle(savedObject); //System.out.println(profile.toString()); }catch (Exception e) { e.printStackTrace(); } } return stack; } public static ItemStack patch(ItemStack stack, NBTTagCompound compound) { if(needPatcher) { if(compound.hasKeyOfType("tag", 10)) { NBTTagCompound tagCompound = compound.getCompound("tag"); if(tagCompound.hasKeyOfType("SkullOwner", 10)) { NBTTagCompound skullCompound = tagCompound.getCompound("SkullOwner"); if(skullCompound.hasKeyOfType("Properties", 10)) { NBTTagCompound propertiesCompound = skullCompound.getCompound("Properties"); if(propertiesCompound.hasKeyOfType("textures", 9)) { ItemMeta headMeta = stack.getItemMeta(); NBTTagList textureCompound = propertiesCompound.getList("textures"); NBTTagCompound texturestring = textureCompound.get(0); String base64String = texturestring.getString("Value"); WrappedGameProfile gameProfile = makeProfile(base64String); try { Field profileField = headMeta.getClass().getDeclaredField("profile"); profileField.setAccessible(true); profileField.set(headMeta, gameProfile.getHandle()); } catch (NoSuchFieldException | SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } finally { stack.setItemMeta(headMeta); } } } } } } return stack; } public static boolean shouldPatch() { return needPatcher; } public static WrappedGameProfile makeProfile(String b64) { UUID id = new UUID( b64.substring(b64.length() - 20).hashCode(), b64.substring(b64.length() - 10).hashCode() ); WrappedGameProfile profile = new WrappedGameProfile(id, "Player"); profile.getProperties().put("textures", new WrappedSignedProperty("textures", b64, "furniture")); return profile; } }
3,542
0.679277
0.669114
89
37.797752
30.326012
129
false
false
0
0
0
0
0
0
2.910112
false
false
3
30667cb3b404fbb33571d259c36ca3a5c5e11d3e
14,121,852,524,887
bbb3b18b1356bc9d4220e9bb8b9bbe2c36a1b6ed
/src/jp/pinetail/android/drugstore_map/libs/ShopsDao.java
dae811a40fa3b869dedc4e9df421c5cefb71a84e
[]
no_license
pinetail/drugstore-map-client
https://github.com/pinetail/drugstore-map-client
31ea722de5eb87253ee6386057c648148f18ce62
9888ee0bfd30bcba4451ec29dbb2609f03f12a28
refs/heads/master
2016-09-03T06:54:07.802000
2011-06-15T15:12:52
2011-06-15T15:12:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jp.pinetail.android.drugstore_map.libs; import org.apache.commons.lang.StringUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import jp.pinetail.android.drugstore_map.R; import jp.pinetail.android.drugstore_map.Shops; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class ShopsDao { private static final int E6 = 1000000; private static final String TABLE_NAME = "shops"; private static final String COLUMN_ID = "rowid"; private static final String COLUMN_UID = "uid"; private static final String COLUMN_CATEGORY = "category"; private static final String COLUMN_NAME = "name"; private static final String COLUMN_ADDRESS = "address"; private static final String COLUMN_TEL = "tel"; private static final String COLUMN_ACCESS = "access"; private static final String COLUMN_BUSINESS_HOURS = "business_hours"; private static final String COLUMN_HOLIDAY = "holiday"; private static final String COLUMN_LAT = "lat"; private static final String COLUMN_LNG = "lng"; private static final String COLUMN_PC_URL = "pc_url"; private static final String COLUMN_MOBILE_URL = "mobile_url"; private static final String COLUMN_COLUMN01 = "column01"; private static final String COLUMN_COLUMN02 = "column02"; private static final String COLUMN_COLUMN03 = "column03"; private static final String COLUMN_COLUMN04 = "column04"; private static final String COLUMN_COLUMN05 = "column05"; private static final String COLUMN_USE_FLG = "use_flg"; private static final String COLUMN_CREATED_AT = "created_at"; private static final String COLUMN_UPDATED_AT = "updated_at"; private static String[] CATEGORY_KEYS = {}; private static String[] CATEGORY_VALUES = {}; private static final String[] COLUMNS = {COLUMN_ID, COLUMN_UID, COLUMN_CATEGORY, COLUMN_NAME, COLUMN_ADDRESS, COLUMN_TEL, COLUMN_ACCESS, COLUMN_BUSINESS_HOURS, COLUMN_HOLIDAY, COLUMN_LAT, COLUMN_LNG, COLUMN_PC_URL, COLUMN_MOBILE_URL, COLUMN_COLUMN01, COLUMN_COLUMN02, COLUMN_COLUMN03, COLUMN_COLUMN04, COLUMN_COLUMN05, COLUMN_USE_FLG, COLUMN_CREATED_AT, COLUMN_UPDATED_AT}; private SQLiteDatabase db; private HashMap<String, String> category_map = new HashMap <String, String>(); public ShopsDao(SQLiteDatabase db, Context context) { this.db = db; CATEGORY_KEYS = context.getResources().getStringArray(R.array.list_category_key); CATEGORY_VALUES = context.getResources().getStringArray(R.array.list_category_name); for ( int i = 0; i < CATEGORY_KEYS.length; ++i ) { category_map.put(CATEGORY_KEYS[i], CATEGORY_KEYS[i]); } } public ArrayList<Shops> findAll() { ArrayList<Shops> shops = new ArrayList<Shops>(); Cursor cursor = db.query(TABLE_NAME, COLUMNS, null, null, null, null, COLUMN_ID); while(cursor.moveToNext()) { Shops info = new Shops(); info.Rowid = cursor.getInt(0); info.Uid = cursor.getString(1); info.Category = cursor.getString(2); info.Name = cursor.getString(3); info.Address = cursor.getString(4); info.Tel = cursor.getString(5); info.Access = cursor.getString(6); info.BusinessHours = cursor.getString(7); info.Holiday = cursor.getString(8); info.Lat = Double.valueOf(cursor.getString(9)); info.Lng = Double.valueOf(cursor.getString(10)); info.PcUrl = cursor.getString(11); info.MobileUrl = cursor.getString(12); info.Column01 = cursor.getString(13); info.Column02 = cursor.getString(14); info.Column03 = cursor.getString(15); info.Column04 = cursor.getString(16); info.Column05 = cursor.getString(17); info.UseFlg = cursor.getString(18); info.CreatedAt = cursor.getString(19); info.UpdatedAt = cursor.getString(20); shops.add(info); } return shops; } public ArrayList<Shops> find(SharedPreferences pref, int top, int bottom, int left, int right) { ArrayList<Shops> shops = new ArrayList<Shops>(); List<String> conditions_category = new ArrayList<String>(); List<String> conditions_wireless = new ArrayList<String>(); for ( String key : category_map.keySet() ) { String data = category_map.get( key ); if (pref.getBoolean(key, true) == true) { conditions_category.add("category like '%" + data + "%'"); } } String conditions = ""; conditions += "(" + (float)top / E6 + " <= lat and lat <=" + (float)bottom / E6 + ") and "; conditions += "(" + (float)left / E6 + " <= lng and lng <=" + (float)right / E6 + ") and "; if (conditions_category.size() > 0 && CATEGORY_KEYS.length != conditions_category.size()) { conditions += "(" + StringUtils.join(conditions_category, " or ") + ") and "; } conditions += "1 = 1"; Util.logging("i:" + conditions); Cursor cursor = db.query(TABLE_NAME, COLUMNS, conditions, null, null, null, COLUMN_NAME); // Cursor cursor = db.query(TABLE_NAME, COLUMNS, null, null, null, null, COLUMN_ID); while(cursor.moveToNext()) { Shops info = new Shops(); info.Rowid = cursor.getInt(0); info.Uid = cursor.getString(1); info.Category = cursor.getString(2); info.Name = cursor.getString(3); info.Address = cursor.getString(4); info.Tel = cursor.getString(5); info.Access = cursor.getString(6); info.BusinessHours = cursor.getString(7); info.Holiday = cursor.getString(8); info.Lat = Double.valueOf(cursor.getString(9)); info.Lng = Double.valueOf(cursor.getString(10)); info.PcUrl = cursor.getString(11); info.MobileUrl = cursor.getString(12); info.Column01 = cursor.getString(13); info.Column02 = cursor.getString(14); info.Column03 = cursor.getString(15); info.Column04 = cursor.getString(16); info.Column05 = cursor.getString(17); info.UseFlg = cursor.getString(18); info.CreatedAt = cursor.getString(19); info.UpdatedAt = cursor.getString(20); Util.logging(info.Lat.toString()); Util.logging(info.Lng.toString()); shops.add(info); } cursor.close(); return shops; } public int deleteAll() { return db.delete(TABLE_NAME, null, null); } public Shops findById(int rowid) { Shops shop = new Shops(); String conditions = "rowid = " + rowid; Util.logging("i:" + conditions); Cursor cursor = db.query(TABLE_NAME, COLUMNS, conditions, null, null, null, COLUMN_ID); while(cursor.moveToNext()) { Shops info = new Shops(); info.Rowid = cursor.getInt(0); info.Uid = cursor.getString(1); info.Category = cursor.getString(2); info.Name = cursor.getString(3); info.Address = cursor.getString(4); info.Tel = cursor.getString(5); info.Access = cursor.getString(6); info.BusinessHours = cursor.getString(7); info.Holiday = cursor.getString(8); info.Lat = Double.valueOf(cursor.getString(9)); info.Lng = Double.valueOf(cursor.getString(10)); info.PcUrl = cursor.getString(11); info.MobileUrl = cursor.getString(12); info.Column01 = cursor.getString(13); info.Column02 = cursor.getString(14); info.Column03 = cursor.getString(15); info.Column04 = cursor.getString(16); info.Column05 = cursor.getString(17); info.UseFlg = cursor.getString(18); info.CreatedAt = cursor.getString(19); info.UpdatedAt = cursor.getString(20); return info; } return shop; } }
UTF-8
Java
9,309
java
ShopsDao.java
Java
[]
null
[]
package jp.pinetail.android.drugstore_map.libs; import org.apache.commons.lang.StringUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import jp.pinetail.android.drugstore_map.R; import jp.pinetail.android.drugstore_map.Shops; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class ShopsDao { private static final int E6 = 1000000; private static final String TABLE_NAME = "shops"; private static final String COLUMN_ID = "rowid"; private static final String COLUMN_UID = "uid"; private static final String COLUMN_CATEGORY = "category"; private static final String COLUMN_NAME = "name"; private static final String COLUMN_ADDRESS = "address"; private static final String COLUMN_TEL = "tel"; private static final String COLUMN_ACCESS = "access"; private static final String COLUMN_BUSINESS_HOURS = "business_hours"; private static final String COLUMN_HOLIDAY = "holiday"; private static final String COLUMN_LAT = "lat"; private static final String COLUMN_LNG = "lng"; private static final String COLUMN_PC_URL = "pc_url"; private static final String COLUMN_MOBILE_URL = "mobile_url"; private static final String COLUMN_COLUMN01 = "column01"; private static final String COLUMN_COLUMN02 = "column02"; private static final String COLUMN_COLUMN03 = "column03"; private static final String COLUMN_COLUMN04 = "column04"; private static final String COLUMN_COLUMN05 = "column05"; private static final String COLUMN_USE_FLG = "use_flg"; private static final String COLUMN_CREATED_AT = "created_at"; private static final String COLUMN_UPDATED_AT = "updated_at"; private static String[] CATEGORY_KEYS = {}; private static String[] CATEGORY_VALUES = {}; private static final String[] COLUMNS = {COLUMN_ID, COLUMN_UID, COLUMN_CATEGORY, COLUMN_NAME, COLUMN_ADDRESS, COLUMN_TEL, COLUMN_ACCESS, COLUMN_BUSINESS_HOURS, COLUMN_HOLIDAY, COLUMN_LAT, COLUMN_LNG, COLUMN_PC_URL, COLUMN_MOBILE_URL, COLUMN_COLUMN01, COLUMN_COLUMN02, COLUMN_COLUMN03, COLUMN_COLUMN04, COLUMN_COLUMN05, COLUMN_USE_FLG, COLUMN_CREATED_AT, COLUMN_UPDATED_AT}; private SQLiteDatabase db; private HashMap<String, String> category_map = new HashMap <String, String>(); public ShopsDao(SQLiteDatabase db, Context context) { this.db = db; CATEGORY_KEYS = context.getResources().getStringArray(R.array.list_category_key); CATEGORY_VALUES = context.getResources().getStringArray(R.array.list_category_name); for ( int i = 0; i < CATEGORY_KEYS.length; ++i ) { category_map.put(CATEGORY_KEYS[i], CATEGORY_KEYS[i]); } } public ArrayList<Shops> findAll() { ArrayList<Shops> shops = new ArrayList<Shops>(); Cursor cursor = db.query(TABLE_NAME, COLUMNS, null, null, null, null, COLUMN_ID); while(cursor.moveToNext()) { Shops info = new Shops(); info.Rowid = cursor.getInt(0); info.Uid = cursor.getString(1); info.Category = cursor.getString(2); info.Name = cursor.getString(3); info.Address = cursor.getString(4); info.Tel = cursor.getString(5); info.Access = cursor.getString(6); info.BusinessHours = cursor.getString(7); info.Holiday = cursor.getString(8); info.Lat = Double.valueOf(cursor.getString(9)); info.Lng = Double.valueOf(cursor.getString(10)); info.PcUrl = cursor.getString(11); info.MobileUrl = cursor.getString(12); info.Column01 = cursor.getString(13); info.Column02 = cursor.getString(14); info.Column03 = cursor.getString(15); info.Column04 = cursor.getString(16); info.Column05 = cursor.getString(17); info.UseFlg = cursor.getString(18); info.CreatedAt = cursor.getString(19); info.UpdatedAt = cursor.getString(20); shops.add(info); } return shops; } public ArrayList<Shops> find(SharedPreferences pref, int top, int bottom, int left, int right) { ArrayList<Shops> shops = new ArrayList<Shops>(); List<String> conditions_category = new ArrayList<String>(); List<String> conditions_wireless = new ArrayList<String>(); for ( String key : category_map.keySet() ) { String data = category_map.get( key ); if (pref.getBoolean(key, true) == true) { conditions_category.add("category like '%" + data + "%'"); } } String conditions = ""; conditions += "(" + (float)top / E6 + " <= lat and lat <=" + (float)bottom / E6 + ") and "; conditions += "(" + (float)left / E6 + " <= lng and lng <=" + (float)right / E6 + ") and "; if (conditions_category.size() > 0 && CATEGORY_KEYS.length != conditions_category.size()) { conditions += "(" + StringUtils.join(conditions_category, " or ") + ") and "; } conditions += "1 = 1"; Util.logging("i:" + conditions); Cursor cursor = db.query(TABLE_NAME, COLUMNS, conditions, null, null, null, COLUMN_NAME); // Cursor cursor = db.query(TABLE_NAME, COLUMNS, null, null, null, null, COLUMN_ID); while(cursor.moveToNext()) { Shops info = new Shops(); info.Rowid = cursor.getInt(0); info.Uid = cursor.getString(1); info.Category = cursor.getString(2); info.Name = cursor.getString(3); info.Address = cursor.getString(4); info.Tel = cursor.getString(5); info.Access = cursor.getString(6); info.BusinessHours = cursor.getString(7); info.Holiday = cursor.getString(8); info.Lat = Double.valueOf(cursor.getString(9)); info.Lng = Double.valueOf(cursor.getString(10)); info.PcUrl = cursor.getString(11); info.MobileUrl = cursor.getString(12); info.Column01 = cursor.getString(13); info.Column02 = cursor.getString(14); info.Column03 = cursor.getString(15); info.Column04 = cursor.getString(16); info.Column05 = cursor.getString(17); info.UseFlg = cursor.getString(18); info.CreatedAt = cursor.getString(19); info.UpdatedAt = cursor.getString(20); Util.logging(info.Lat.toString()); Util.logging(info.Lng.toString()); shops.add(info); } cursor.close(); return shops; } public int deleteAll() { return db.delete(TABLE_NAME, null, null); } public Shops findById(int rowid) { Shops shop = new Shops(); String conditions = "rowid = " + rowid; Util.logging("i:" + conditions); Cursor cursor = db.query(TABLE_NAME, COLUMNS, conditions, null, null, null, COLUMN_ID); while(cursor.moveToNext()) { Shops info = new Shops(); info.Rowid = cursor.getInt(0); info.Uid = cursor.getString(1); info.Category = cursor.getString(2); info.Name = cursor.getString(3); info.Address = cursor.getString(4); info.Tel = cursor.getString(5); info.Access = cursor.getString(6); info.BusinessHours = cursor.getString(7); info.Holiday = cursor.getString(8); info.Lat = Double.valueOf(cursor.getString(9)); info.Lng = Double.valueOf(cursor.getString(10)); info.PcUrl = cursor.getString(11); info.MobileUrl = cursor.getString(12); info.Column01 = cursor.getString(13); info.Column02 = cursor.getString(14); info.Column03 = cursor.getString(15); info.Column04 = cursor.getString(16); info.Column05 = cursor.getString(17); info.UseFlg = cursor.getString(18); info.CreatedAt = cursor.getString(19); info.UpdatedAt = cursor.getString(20); return info; } return shop; } }
9,309
0.54689
0.528413
207
43.971016
28.196157
152
false
false
0
0
0
0
0
0
1.057971
false
false
3
1808f7a9fee2610ab7ebae6b839ff8abfad9e572
13,357,348,290,967
e24d4ffdc3697d1ca3a685902c45d972b43525d1
/gus06/entity/gus/set/check/none/EntityImpl.java
9c33f0bb67e5acfd33b1f3a37cd676268539068e
[]
no_license
gusjava/gus06-src
https://github.com/gusjava/gus06-src
50a7fc5589ea94bd7b6a02a72a592cf51c904557
126dae1458d4444074275655f896909264982f90
refs/heads/master
2021-01-10T10:21:43.787000
2017-05-27T19:42:48
2017-05-27T19:42:48
49,826,436
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gus06.entity.gus.set.check.none; import gus06.framework.*; import java.util.Set; import java.util.Iterator; public class EntityImpl implements Entity, F { public String creationDate() {return "20160805";} public boolean f(Object obj) throws Exception { Object[] o = (Object[]) obj; if(o.length!=2) throw new Exception("Wrong data number: "+o.length); Set input = (Set) o[0]; F filter = (F) o[1]; Iterator it = input.iterator(); while(it.hasNext()) { Object element = it.next(); if(filter.f(element)) return false; } return true; } }
UTF-8
Java
582
java
EntityImpl.java
Java
[]
null
[]
package gus06.entity.gus.set.check.none; import gus06.framework.*; import java.util.Set; import java.util.Iterator; public class EntityImpl implements Entity, F { public String creationDate() {return "20160805";} public boolean f(Object obj) throws Exception { Object[] o = (Object[]) obj; if(o.length!=2) throw new Exception("Wrong data number: "+o.length); Set input = (Set) o[0]; F filter = (F) o[1]; Iterator it = input.iterator(); while(it.hasNext()) { Object element = it.next(); if(filter.f(element)) return false; } return true; } }
582
0.664948
0.639175
28
19.785715
19.019459
70
false
false
0
0
0
0
0
0
1.714286
false
false
3
d4dfffc7b461440ace652cbe504efea42691c042
17,763,984,803,177
9edc7d0acce5f2f46bde7f2e20901cc25c31c7f7
/leetcode/src/array/SmallestRangeI.java
03ff7f0a669899255f92b3fd26106168375b29c4
[]
no_license
legolas007/LeetCode
https://github.com/legolas007/LeetCode
4b625b98075dfc1f8fbe1c8e4cdcb2163e9f0357
e22c63cc70c4ce097190f5312459bba724da9b37
refs/heads/master
2021-04-26T22:07:36.094000
2019-12-23T06:55:58
2019-12-23T06:55:58
124,023,206
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package array; import java.util.Arrays; /** * @Author: Usher * @Description: */ public class SmallestRangeI { public int smallestRangeI(int[] A, int K) { Arrays.sort(A); int minNum = A[0]; int maxNum = A[A.length - 1]; return 2*K >= maxNum-minNum ? 0 : maxNum-minNum-2*K; } }
UTF-8
Java
322
java
SmallestRangeI.java
Java
[ { "context": " array;\n\nimport java.util.Arrays;\n\n/**\n * @Author: Usher\n * @Description:\n */\npublic class SmallestRangeI ", "end": 63, "score": 0.9988446235656738, "start": 58, "tag": "NAME", "value": "Usher" } ]
null
[]
package array; import java.util.Arrays; /** * @Author: Usher * @Description: */ public class SmallestRangeI { public int smallestRangeI(int[] A, int K) { Arrays.sort(A); int minNum = A[0]; int maxNum = A[A.length - 1]; return 2*K >= maxNum-minNum ? 0 : maxNum-minNum-2*K; } }
322
0.574534
0.559006
17
17.941177
17.34247
60
false
false
0
0
0
0
0
0
0.411765
false
false
3
aed29bca1abef6827c1229aa39a9020ccd13f259
37,623,913,528,839
a20d8294e746b9a58f0c86c14620c29ffecf4689
/Day8/EmployCrud/src/com/hcl/jdbc/DepartmentInsert.java
d96ef5aded6f45c27a3f2f259ae89e41079df4a1
[]
no_license
1919satya/mode1-2
https://github.com/1919satya/mode1-2
6d4d122a0ee0c4a660afdcbe9a82cb90b6c1774a
45a9deb7f42d8c0a8f08901a51fe241400236576
refs/heads/master
2022-12-21T22:11:10.461000
2019-10-03T04:31:48
2019-10-03T04:31:48
212,491,085
0
0
null
false
2022-12-15T23:30:22
2019-10-03T03:37:59
2019-10-03T04:33:02
2022-12-15T23:30:21
48,076
0
0
42
JavaScript
false
false
package com.hcl.jdbc; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Scanner; /** * main function. * @author coalesce is sai. * */ public class DepartmentInsert { /** * department. * @param args is argument. */ public static void main(String[] args) { int deptno; Scanner sc = new Scanner(System.in); System.out.println("enter department no "); deptno = Integer.parseInt(sc.nextLine()); System.out.println("name of department"); String dname = sc.nextLine(); System.out.println("department location"); String loc = sc.nextLine(); System.out.println("head is"); String head = sc.nextLine(); String cmd = "insert into department values(?,?,?,?)"; Connection con = DaoConnection.getConnection(); PreparedStatement pst; try { pst = con.prepareStatement(cmd); pst.setInt(1, deptno); pst.setString(2,dname); pst.setString(3,loc); pst.setString(4,head); pst.executeUpdate(); System.out.println("**** racord inserted***"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
1,207
java
DepartmentInsert.java
Java
[ { "context": "ava.util.Scanner;\n/**\n * main function.\n * @author coalesce is sai.\n *\n */\n\npublic class DepartmentInsert {\n ", "end": 183, "score": 0.999543309211731, "start": 175, "tag": "USERNAME", "value": "coalesce" } ]
null
[]
package com.hcl.jdbc; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Scanner; /** * main function. * @author coalesce is sai. * */ public class DepartmentInsert { /** * department. * @param args is argument. */ public static void main(String[] args) { int deptno; Scanner sc = new Scanner(System.in); System.out.println("enter department no "); deptno = Integer.parseInt(sc.nextLine()); System.out.println("name of department"); String dname = sc.nextLine(); System.out.println("department location"); String loc = sc.nextLine(); System.out.println("head is"); String head = sc.nextLine(); String cmd = "insert into department values(?,?,?,?)"; Connection con = DaoConnection.getConnection(); PreparedStatement pst; try { pst = con.prepareStatement(cmd); pst.setInt(1, deptno); pst.setString(2,dname); pst.setString(3,loc); pst.setString(4,head); pst.executeUpdate(); System.out.println("**** racord inserted***"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
1,207
0.643745
0.640431
45
25.799999
15.68807
58
false
false
0
0
0
0
0
0
0.733333
false
false
3
e5885dcc40cbb571fe466c2347d3cfbf7aede1a7
39,170,101,763,125
b797299dc83450739d52e4d97988e73ae39fc902
/app/src/main/java/com/example/crazy/plan/model/Plan.java
21d316ce5f0a774eb8fd17b850dc57230ce6b2b7
[]
no_license
kiddtaurus/Plan
https://github.com/kiddtaurus/Plan
775b41707981d9317ad03c6d89e80f2cec3dda4e
416e6f21f9c120d4cd206e94cb017fc5c09b9fe8
refs/heads/master
2021-05-06T18:49:01.251000
2017-12-04T02:06:48
2017-12-04T02:06:48
112,060,293
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.crazy.plan.model; import java.util.Date; /** * Created by Crazy on 2017/11/22. */ public class Plan { private int planId; private Place place; private Date date; private String notice; public int getPlanId() { return planId; } public void setPlanId(int planId) { this.planId = planId; } public Place getPlace() { return place; } public void setPlace(Place place) { this.place = place; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getNotice() { return notice; } public void setNotice(String notice) { this.notice = notice; } public PlanState getState() { return state; } public void setState(PlanState state) { this.state = state; } private PlanState state; }
UTF-8
Java
939
java
Plan.java
Java
[ { "context": "model;\n\n\nimport java.util.Date;\n\n/**\n * Created by Crazy on 2017/11/22.\n */\n\npublic class Plan {\n priva", "end": 87, "score": 0.9737343788146973, "start": 82, "tag": "USERNAME", "value": "Crazy" } ]
null
[]
package com.example.crazy.plan.model; import java.util.Date; /** * Created by Crazy on 2017/11/22. */ public class Plan { private int planId; private Place place; private Date date; private String notice; public int getPlanId() { return planId; } public void setPlanId(int planId) { this.planId = planId; } public Place getPlace() { return place; } public void setPlace(Place place) { this.place = place; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getNotice() { return notice; } public void setNotice(String notice) { this.notice = notice; } public PlanState getState() { return state; } public void setState(PlanState state) { this.state = state; } private PlanState state; }
939
0.58147
0.57295
57
15.473684
14.148467
43
false
false
0
0
0
0
0
0
0.298246
false
false
3
714ceb2bd619b7ab9ccc5a3dbd7b0034cdb6b074
37,924,561,236,235
1fc7d48ee8ddfed5ae7d4877e84be7279af05fba
/chapter_001/src/main/java/ru/job4j/converter/Converter.java
aa3e5f3c30542bb11a00447601e5a2d0d5fd4dda
[]
no_license
Echemagin/job4j
https://github.com/Echemagin/job4j
42ed673d0979619d2c75df677d36765fc0e79d7a
49fc5b5906b7599e04a6ab22851724f8aa57e5d2
refs/heads/master
2022-06-17T19:44:59.068000
2022-06-06T08:47:28
2022-06-06T08:47:28
208,244,837
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.job4j.converter; public class Converter { public static int rubleToEuro(int value) { return value / 70; } public static int rubleToDollar(int value) { return value / 60; } public static int euroToRuble(int value) { return value * 70; } public static int dollarToRuble(int value) { return value * 60; } public static double euroToDollar(int value) { return value * (70d / 60d); } public static double dollarToEuro(int value) { return value * (60d / 70d); } public static void main(String[] args) { int euro = rubleToEuro(140); int dollar = rubleToDollar(240); int rubleFirst = euroToRuble(3); int rubleSecond = dollarToRuble(5); double dollarSecond = euroToDollar(30); double euroSecond = dollarToEuro(40); System.out.println("140 rubles are " + euro + " euro."); System.out.println("240 rubles are " + dollar + " dollars."); System.out.println("3 euro are " + rubleFirst + " rubles."); System.out.println("5 dollars are " + rubleSecond + " rubles."); System.out.println("30 euro are " + dollarSecond + " dollars."); System.out.println("40 dollars are " + euroSecond + " euro."); int in1 = 140; int expected1 = 2; int out1 = rubleToEuro(in1); boolean passed1 = expected1 == out1; System.out.println("Test result for rubleToEuro method passed:" + passed1); int in2 = 120; int expected2 = 2; int out2 = rubleToDollar(in2); boolean passed2 = expected2 == out2; System.out.println("Test result for rubleToDollar method passed:" + passed2); int in3 = 2; int expected3 = 140; int out3 = euroToRuble(in3); boolean passed3 = expected3 == out3; System.out.println("Test result for euroToRuble method passed:" + passed3); int in4 = 2; int expected4 = 120; int out4 = dollarToRuble(in4); boolean passed4 = expected4 == out4; System.out.println("Test result for dollarToRuble method passed:" + passed4); int in5 = 3; double expected5 = 3.5; double out5 = euroToDollar(in5); boolean passed5 = expected5 == out5; System.out.println("Test result for euroToDollar method passed:" + passed5); int in6 = 7; double expected6 = 6; double out6 = dollarToEuro(in6); boolean passed6 = expected6 == out6; System.out.println("Test result for dollarToEuro method passed:" + passed6); } }
UTF-8
Java
2,628
java
Converter.java
Java
[]
null
[]
package ru.job4j.converter; public class Converter { public static int rubleToEuro(int value) { return value / 70; } public static int rubleToDollar(int value) { return value / 60; } public static int euroToRuble(int value) { return value * 70; } public static int dollarToRuble(int value) { return value * 60; } public static double euroToDollar(int value) { return value * (70d / 60d); } public static double dollarToEuro(int value) { return value * (60d / 70d); } public static void main(String[] args) { int euro = rubleToEuro(140); int dollar = rubleToDollar(240); int rubleFirst = euroToRuble(3); int rubleSecond = dollarToRuble(5); double dollarSecond = euroToDollar(30); double euroSecond = dollarToEuro(40); System.out.println("140 rubles are " + euro + " euro."); System.out.println("240 rubles are " + dollar + " dollars."); System.out.println("3 euro are " + rubleFirst + " rubles."); System.out.println("5 dollars are " + rubleSecond + " rubles."); System.out.println("30 euro are " + dollarSecond + " dollars."); System.out.println("40 dollars are " + euroSecond + " euro."); int in1 = 140; int expected1 = 2; int out1 = rubleToEuro(in1); boolean passed1 = expected1 == out1; System.out.println("Test result for rubleToEuro method passed:" + passed1); int in2 = 120; int expected2 = 2; int out2 = rubleToDollar(in2); boolean passed2 = expected2 == out2; System.out.println("Test result for rubleToDollar method passed:" + passed2); int in3 = 2; int expected3 = 140; int out3 = euroToRuble(in3); boolean passed3 = expected3 == out3; System.out.println("Test result for euroToRuble method passed:" + passed3); int in4 = 2; int expected4 = 120; int out4 = dollarToRuble(in4); boolean passed4 = expected4 == out4; System.out.println("Test result for dollarToRuble method passed:" + passed4); int in5 = 3; double expected5 = 3.5; double out5 = euroToDollar(in5); boolean passed5 = expected5 == out5; System.out.println("Test result for euroToDollar method passed:" + passed5); int in6 = 7; double expected6 = 6; double out6 = dollarToEuro(in6); boolean passed6 = expected6 == out6; System.out.println("Test result for dollarToEuro method passed:" + passed6); } }
2,628
0.600457
0.5586
81
31.444445
25.233723
85
false
false
0
0
0
0
0
0
0.604938
false
false
3
1049ac08659ca465349cd59aa681dcc0c8cb61da
38,740,605,024,715
19c01a889b5aebcc0f35edf941ecacbcec360d59
/src/main/java/home/work/gwt/client/json/JsUser.java
c584f7d400ab189a803b3dfa9782a9d819496f2a
[]
no_license
troynsky/hw.gwt
https://github.com/troynsky/hw.gwt
9845e30c8281ba99b67b65e674c36b622454fc13
de72aec08696bb9c707c9df0885e445a10c20fc3
refs/heads/master
2021-09-06T08:30:13.432000
2018-02-04T09:21:04
2018-02-04T09:21:04
120,170,396
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package home.work.gwt.client.json; import com.google.gwt.core.client.JavaScriptObject; public class JsUser extends JavaScriptObject { protected JsUser() { } public native final String name() /*-{ return this.name; }-*/; }
UTF-8
Java
265
java
JsUser.java
Java
[]
null
[]
package home.work.gwt.client.json; import com.google.gwt.core.client.JavaScriptObject; public class JsUser extends JavaScriptObject { protected JsUser() { } public native final String name() /*-{ return this.name; }-*/; }
265
0.633962
0.633962
14
16.928572
18.771042
51
false
false
0
0
0
0
0
0
0.285714
false
false
3
b4bb46657ba78a534db79c265fe695fd30065e85
38,740,605,027,827
7bafc2540d5463a1a369247ecdc8cb43cf6846d2
/core/src/main/java/org/cn/core/permission/PermissionDenied.java
7c2ada4bbfe32a9e7e947429099fe7f3291b3159
[]
no_license
findById/Application
https://github.com/findById/Application
a865d9de6e553f8b155f4742fc5c0346cbfd3ffb
89e8816c3c717ff4058209b3c9b277cbc6f6d575
refs/heads/master
2021-01-17T07:51:51
2016-06-21T08:50:47
2016-06-21T08:50:47
39,247,987
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.cn.core.permission; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by chenning on 16-5-31. */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.CLASS) public @interface PermissionDenied { }
UTF-8
Java
339
java
PermissionDenied.java
Java
[ { "context": "rt java.lang.annotation.Target;\n\n/**\n * Created by chenning on 16-5-31.\n */\n@Target(ElementType.METHOD)\n@Rete", "end": 221, "score": 0.9993614554405212, "start": 213, "tag": "USERNAME", "value": "chenning" } ]
null
[]
package org.cn.core.permission; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by chenning on 16-5-31. */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.CLASS) public @interface PermissionDenied { }
339
0.79646
0.781711
14
23.214285
16.712606
44
false
false
0
0
0
0
0
0
0.357143
false
false
3
96bca25cccad2fb4aaca34f7af55a38fe48aeb8e
38,740,605,027,310
25d7c6702bec1533a4ce2529a36492b94355df6c
/core/src/java/ru/brandanalyst/core/util/Jsonable.java
6370788bc39f9987c5585db16269e22c7baa834d
[]
no_license
dhilip71288/BrandAnalytics
https://github.com/dhilip71288/BrandAnalytics
906e3e76413e757378f979ea4efefc398e076959
48c33d314db35bcae440fe3f25dc159bf499d1e5
refs/heads/master
2021-01-18T11:30:50.329000
2012-08-10T01:39:46
2012-08-10T01:39:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.brandanalyst.core.util; import org.json.JSONObject; /** * Created by IntelliJ IDEA. * User: dima * Date: 12/30/11 * Time: 10:06 PM */ public interface Jsonable { JSONObject asJson(); }
UTF-8
Java
207
java
Jsonable.java
Java
[ { "context": "Object;\n\n/**\n * Created by IntelliJ IDEA.\n * User: dima\n * Date: 12/30/11\n * Time: 10:06 PM\n */\npublic in", "end": 111, "score": 0.9989598989486694, "start": 107, "tag": "USERNAME", "value": "dima" } ]
null
[]
package ru.brandanalyst.core.util; import org.json.JSONObject; /** * Created by IntelliJ IDEA. * User: dima * Date: 12/30/11 * Time: 10:06 PM */ public interface Jsonable { JSONObject asJson(); }
207
0.676328
0.628019
13
14.923077
11.912899
34
false
false
0
0
0
0
0
0
0.230769
false
false
3
4872aa5844e3a6195f9bac4de0da991e3a86340b
27,084,063,826,744
21d8e6e726a2db49f373d494638eca97d4e310b5
/app/src/main/java/com/example/art/art/Repair.java
4a421f10a38a937ce65d961be7573b926b486459
[]
no_license
feenam/ART
https://github.com/feenam/ART
d64f9ab51baacab259ddbb4709642339c1c1036a
618474c594cf7b6c96d71d799c55a8559357035e
refs/heads/master
2021-01-11T13:38:21.604000
2017-05-10T21:46:38
2017-05-10T21:46:38
95,045,054
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.art.art; import android.content.Intent; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.Typeface; import android.support.v4.content.ContextCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.CheckBox; import android.widget.DatePicker; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.TimePicker; import java.util.ArrayList; import java.util.Date; import static android.view.View.GONE; import static com.example.art.art.Utils.setButtonState; public class Repair extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_repair); final CheckBox otherCheckBox = (CheckBox)findViewById(R.id.repair_other); final EditText otherTextInput = (EditText)findViewById(R.id.repair_other_input); otherCheckBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (otherCheckBox.isChecked()){ otherTextInput.setVisibility(View.VISIBLE); otherTextInput.requestFocus(); } else { otherTextInput.setVisibility(View.INVISIBLE); } } }); time_now_clicked(null); ActionBar ab = getSupportActionBar(); // Create a TextView programmatically. TextView tv = new TextView(getApplicationContext()); // Create a LayoutParams for TextView ViewGroup.LayoutParams lp = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, // Width of TextView ViewGroup.LayoutParams.WRAP_CONTENT); // Height of TextView // Apply the layout parameters to TextView widget tv.setLayoutParams(lp); // Set text to display in TextView tv.setText("A R T"); // ActionBar title text // Set the text color of TextView to black tv.setTextColor(Color.WHITE); tv.setTextSize((float) 30); tv.setTypeface(null, Typeface.BOLD); tv.setGravity(1); tv.setPadding(0,0,45,0); // Set the monospace font for TextView text // This will change ActionBar title text font //tv.setTypeface(Typeface.MONOSPACE); // Set the ActionBar display option ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); // Finally, set the newly created TextView as ActionBar custom view ab.setCustomView(tv); //getSupportActionBar().setDisplayUseLogoEnabled(true); //getSupportActionBar().setDisplayShowHomeEnabled(true); //getSupportActionBar().setIcon(R.drawable.back_button); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setIcon(R.drawable.back_button); } String timeOption; public void time_now_clicked(View view) { LinearLayout timeSelector = (LinearLayout)findViewById(R.id.repair_time_selection); Button nowBtn = (Button)findViewById(R.id.repair_time_now_btn); Button tomorrowBtn = (Button)findViewById(R.id.repair_time_tomorrow_btn); Button otherTimeBtn = (Button)findViewById(R.id.repair_time_other_btn); setButtonState(nowBtn, true); setButtonState(tomorrowBtn, false); setButtonState(otherTimeBtn, false); timeSelector.setVisibility(GONE); timeOption = "now"; } public void time_tomorrow_clicked(View view) { LinearLayout timeSelector = (LinearLayout)findViewById(R.id.repair_time_selection); Button nowBtn = (Button)findViewById(R.id.repair_time_now_btn); Button tomorrowBtn = (Button)findViewById(R.id.repair_time_tomorrow_btn); Button otherTimeBtn = (Button)findViewById(R.id.repair_time_other_btn); setButtonState(nowBtn, false); setButtonState(tomorrowBtn, true); setButtonState(otherTimeBtn, false); timeSelector.setVisibility(GONE); timeOption = "tomorrow"; } public void time_other_clicked(View view) { LinearLayout timeSelector = (LinearLayout)findViewById(R.id.repair_time_selection); Button nowBtn = (Button)findViewById(R.id.repair_time_now_btn); Button tomorrowBtn = (Button)findViewById(R.id.repair_time_tomorrow_btn); Button otherTimeBtn = (Button)findViewById(R.id.repair_time_other_btn); setButtonState(nowBtn, false); setButtonState(tomorrowBtn, false); setButtonState(otherTimeBtn, true); timeSelector.setVisibility(View.VISIBLE); timeOption = "other"; } // TODO: add time to log public void load_done(View view) { ArrayList<String> options = new ArrayList<>(); LinearLayout optionsLayout = (LinearLayout)findViewById(R.id.repair_options_layout); for (int i = 0; i < optionsLayout.getChildCount() - 1; i++) { CheckBox option = (CheckBox)optionsLayout.getChildAt(i); if (option.isChecked()) { options.add(option.getText().toString()); } } CheckBox otherOptionCheckBox = (CheckBox)findViewById(R.id.repair_other); EditText otherOptionInput = (EditText)findViewById(R.id.repair_other_input); if (otherOptionCheckBox.isChecked()) { options.add("Other(" + otherOptionInput.getText() + ")"); } Date requestDate; if (timeOption.equals("now")) { requestDate = new Date(); } else if (timeOption.equals("tomorrow")) { requestDate = Utils.getTomorrow(); } else { DatePicker datePicker = (DatePicker)findViewById(R.id.repair_date_picker); TimePicker timePicker = (TimePicker)findViewById(R.id.repair_time_picker); requestDate = Utils.getDate(datePicker, timePicker); } Intent result = new Intent(); result.putExtra("log_data", "Requested repair for " + Utils.joinStr(options, ", ") + " on " + Utils.formatDate(requestDate) + "."); setResult(RESULT_OK, result); finish(); } }
UTF-8
Java
6,522
java
Repair.java
Java
[]
null
[]
package com.example.art.art; import android.content.Intent; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.Typeface; import android.support.v4.content.ContextCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.CheckBox; import android.widget.DatePicker; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.TimePicker; import java.util.ArrayList; import java.util.Date; import static android.view.View.GONE; import static com.example.art.art.Utils.setButtonState; public class Repair extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_repair); final CheckBox otherCheckBox = (CheckBox)findViewById(R.id.repair_other); final EditText otherTextInput = (EditText)findViewById(R.id.repair_other_input); otherCheckBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (otherCheckBox.isChecked()){ otherTextInput.setVisibility(View.VISIBLE); otherTextInput.requestFocus(); } else { otherTextInput.setVisibility(View.INVISIBLE); } } }); time_now_clicked(null); ActionBar ab = getSupportActionBar(); // Create a TextView programmatically. TextView tv = new TextView(getApplicationContext()); // Create a LayoutParams for TextView ViewGroup.LayoutParams lp = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, // Width of TextView ViewGroup.LayoutParams.WRAP_CONTENT); // Height of TextView // Apply the layout parameters to TextView widget tv.setLayoutParams(lp); // Set text to display in TextView tv.setText("A R T"); // ActionBar title text // Set the text color of TextView to black tv.setTextColor(Color.WHITE); tv.setTextSize((float) 30); tv.setTypeface(null, Typeface.BOLD); tv.setGravity(1); tv.setPadding(0,0,45,0); // Set the monospace font for TextView text // This will change ActionBar title text font //tv.setTypeface(Typeface.MONOSPACE); // Set the ActionBar display option ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); // Finally, set the newly created TextView as ActionBar custom view ab.setCustomView(tv); //getSupportActionBar().setDisplayUseLogoEnabled(true); //getSupportActionBar().setDisplayShowHomeEnabled(true); //getSupportActionBar().setIcon(R.drawable.back_button); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setIcon(R.drawable.back_button); } String timeOption; public void time_now_clicked(View view) { LinearLayout timeSelector = (LinearLayout)findViewById(R.id.repair_time_selection); Button nowBtn = (Button)findViewById(R.id.repair_time_now_btn); Button tomorrowBtn = (Button)findViewById(R.id.repair_time_tomorrow_btn); Button otherTimeBtn = (Button)findViewById(R.id.repair_time_other_btn); setButtonState(nowBtn, true); setButtonState(tomorrowBtn, false); setButtonState(otherTimeBtn, false); timeSelector.setVisibility(GONE); timeOption = "now"; } public void time_tomorrow_clicked(View view) { LinearLayout timeSelector = (LinearLayout)findViewById(R.id.repair_time_selection); Button nowBtn = (Button)findViewById(R.id.repair_time_now_btn); Button tomorrowBtn = (Button)findViewById(R.id.repair_time_tomorrow_btn); Button otherTimeBtn = (Button)findViewById(R.id.repair_time_other_btn); setButtonState(nowBtn, false); setButtonState(tomorrowBtn, true); setButtonState(otherTimeBtn, false); timeSelector.setVisibility(GONE); timeOption = "tomorrow"; } public void time_other_clicked(View view) { LinearLayout timeSelector = (LinearLayout)findViewById(R.id.repair_time_selection); Button nowBtn = (Button)findViewById(R.id.repair_time_now_btn); Button tomorrowBtn = (Button)findViewById(R.id.repair_time_tomorrow_btn); Button otherTimeBtn = (Button)findViewById(R.id.repair_time_other_btn); setButtonState(nowBtn, false); setButtonState(tomorrowBtn, false); setButtonState(otherTimeBtn, true); timeSelector.setVisibility(View.VISIBLE); timeOption = "other"; } // TODO: add time to log public void load_done(View view) { ArrayList<String> options = new ArrayList<>(); LinearLayout optionsLayout = (LinearLayout)findViewById(R.id.repair_options_layout); for (int i = 0; i < optionsLayout.getChildCount() - 1; i++) { CheckBox option = (CheckBox)optionsLayout.getChildAt(i); if (option.isChecked()) { options.add(option.getText().toString()); } } CheckBox otherOptionCheckBox = (CheckBox)findViewById(R.id.repair_other); EditText otherOptionInput = (EditText)findViewById(R.id.repair_other_input); if (otherOptionCheckBox.isChecked()) { options.add("Other(" + otherOptionInput.getText() + ")"); } Date requestDate; if (timeOption.equals("now")) { requestDate = new Date(); } else if (timeOption.equals("tomorrow")) { requestDate = Utils.getTomorrow(); } else { DatePicker datePicker = (DatePicker)findViewById(R.id.repair_date_picker); TimePicker timePicker = (TimePicker)findViewById(R.id.repair_time_picker); requestDate = Utils.getDate(datePicker, timePicker); } Intent result = new Intent(); result.putExtra("log_data", "Requested repair for " + Utils.joinStr(options, ", ") + " on " + Utils.formatDate(requestDate) + "."); setResult(RESULT_OK, result); finish(); } }
6,522
0.66314
0.661147
167
38.053894
25.888813
92
false
false
0
0
0
0
0
0
0.706587
false
false
3
578e9b188c7f7b94e3041903c5904988e41fbb98
34,978,213,700,932
d0a7e6b37d20ff653e6daefe4984240c18269641
/acfun5_7/src/main/java/com/smile/gifshow/annotation/decouple/AsField.java
9d10d7b1b7f075a4c7bdab7fd9327545f24a485d
[]
no_license
HubertYoung/AcFun
https://github.com/HubertYoung/AcFun
3fbecdec57becae32b7cd917e4c15f16aeab95e8
e83c4a821e1dbeb7843af09d59755f3cd833e83a
refs/heads/master
2018-11-18T03:53:57.159000
2018-10-29T15:01:55
2018-10-29T15:02:01
146,857,138
6
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.smile.gifshow.annotation.decouple; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.TYPE}) @Repeatable(AsFields.class) @Retention(RetentionPolicy.SOURCE) public @interface AsField { String fieldName() default ""; String jsonKey() default ""; Class ofClass(); boolean tryOnKeyUnfound() default false; }
UTF-8
Java
508
java
AsField.java
Java
[]
null
[]
package com.smile.gifshow.annotation.decouple; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.TYPE}) @Repeatable(AsFields.class) @Retention(RetentionPolicy.SOURCE) public @interface AsField { String fieldName() default ""; String jsonKey() default ""; Class ofClass(); boolean tryOnKeyUnfound() default false; }
508
0.777559
0.777559
20
24.4
17.021751
46
false
false
0
0
0
0
0
0
0.5
false
false
3
6b8abb31e0aed3b7291007d8b96899feea128c64
36,739,150,275,698
1aa055e18b2e51457f957bc5465dabf01b4c9bd9
/WebTimViec_WEB/src/lixco/com/beans/KeywordMBean.java
a79a57b60914efb715785d8f30c44e3c894524bf
[]
no_license
quangthaiuit1/WebTimViec
https://github.com/quangthaiuit1/WebTimViec
40c8df4029c887ea28a2515dca631b27777799e8
8e3799e9fbe6f2de0f9356091f06c6dff3628ff4
refs/heads/master
2023-03-05T07:58:42.427000
2020-02-01T03:27:50
2020-02-01T03:27:50
233,335,791
0
0
null
false
2023-02-22T07:40:43
2020-01-12T04:02:46
2020-02-01T03:28:44
2023-02-22T07:40:43
52,161
0
0
3
JavaScript
false
false
package lixco.com.beans; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.inject.Inject; import lixco.com.entities.Keyword; import lixco.com.services.KeywordService; @ManagedBean @ViewScoped public class KeywordMBean implements Serializable{ private static final long serialVersionUID = 1L; private List<Keyword> keywords; @Inject private KeywordService keywordService; @PostConstruct public void init(){ keywords = new ArrayList<>(); keywords = keywordService.findAll(); } public List<Keyword> completeTheme(String input){ String queryLowerCase = input.toLowerCase(); List<Keyword> temp = new ArrayList<>(); temp = keywordService.findByNameContaining(input); return temp.stream().filter(t -> t.getName().toLowerCase().startsWith(queryLowerCase)).collect(Collectors.toList()); } public List<Keyword> getKeywords() { return keywords; } public void setKeywords(List<Keyword> keywords) { this.keywords = keywords; } }
UTF-8
Java
1,153
java
KeywordMBean.java
Java
[]
null
[]
package lixco.com.beans; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.inject.Inject; import lixco.com.entities.Keyword; import lixco.com.services.KeywordService; @ManagedBean @ViewScoped public class KeywordMBean implements Serializable{ private static final long serialVersionUID = 1L; private List<Keyword> keywords; @Inject private KeywordService keywordService; @PostConstruct public void init(){ keywords = new ArrayList<>(); keywords = keywordService.findAll(); } public List<Keyword> completeTheme(String input){ String queryLowerCase = input.toLowerCase(); List<Keyword> temp = new ArrayList<>(); temp = keywordService.findByNameContaining(input); return temp.stream().filter(t -> t.getName().toLowerCase().startsWith(queryLowerCase)).collect(Collectors.toList()); } public List<Keyword> getKeywords() { return keywords; } public void setKeywords(List<Keyword> keywords) { this.keywords = keywords; } }
1,153
0.767563
0.766696
49
22.530613
22.646441
118
false
false
0
0
0
0
0
0
1.122449
false
false
3
c8684bf82d3ca74ab0c154887c5adef688e90d11
4,672,924,431,106
378a2de9b325a3b22330df2ba8a33e26859f1e0c
/WP7Bar/src/com/tombarrasso/android/wp7bar/HomeActivity.java
b7b506a8fec2a613894bb88f26a2e9e7366f19c6
[ "Apache-2.0" ]
permissive
arnabc/StatusBar-
https://github.com/arnabc/StatusBar-
c5969c9a40b3ebd4b6d509cdffba324024e0009b
8fcd85db4697ccc8668c1f7a84caf152e0a93a72
refs/heads/master
2021-01-18T06:24:48.387000
2011-10-30T18:15:40
2011-10-30T18:15:40
4,517,995
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tombarrasso.android.wp7bar; /* * HomeActivity.java * * Copyright (C) 2011 Thomas James Barrasso * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Android Packages import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.content.Context; import android.content.ServiceConnection; import android.content.ComponentName; import android.view.View; import android.util.Log; import android.app.Dialog; import android.os.IBinder; import android.os.RemoteException; import android.widget.Checkable; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.text.method.LinkMovementMethod; import android.graphics.Color; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Spinner; import android.widget.ArrayAdapter; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; // Java Packages import java.lang.IllegalArgumentException; // UI Packages import com.tombarrasso.android.wp7ui.extras.Changelog; import com.tombarrasso.android.wp7ui.app.WPDialog; import com.tombarrasso.android.wp7ui.app.WPActivity; import com.tombarrasso.android.wp7ui.WPTheme; import com.tombarrasso.android.wp7ui.widget.WPThemeView; import com.tombarrasso.android.wp7ui.widget.WPPivotControl; // Color Picker Packages import afzkl.development.mColorPicker.ColorPickerDialog; import afzkl.development.mColorPicker.views.ColorPickerView.OnColorChangedListener; /** * This {@link Activity} manages the preferences for the * applications and talks to the GUI. It handles click * events and starts the corresponding service or change in UI. * * @author Thomas James Barrasso <contact @ tombarrasso.com> * @since 10-13-2011 * @version 1.0 * @category {@link Activity} */ public class HomeActivity extends WPActivity { public static final String TAG = HomeActivity.class.getSimpleName(), PACKAGE = HomeActivity.class.getPackage().getName(); // George Orwell would be proud. private static final int DIALOG_CHANGELOG = 1984; private final Intent mServiceIntent = new Intent(); // Pivot screen iDs. private static final int SCREEN_ONE = 0, SCREEN_TWO = 1; // Views for settings and such. private View mEnableToggle, mExpandToggle, mBootToggle, mDropToggle, mBackColorView, mIconColorView, mBackgroundDisplay, mIconDisplay, mIconToggle, mAppsToggle, mAppHideToggle, mSwipeToggle, mChangeLog; private TextView mAbout; private Spinner mDropSpinner; private WPPivotControl mPivot; // Preferences and service, private Preferences mPrefs; private boolean mIsBound = false; /** * Recursively set the text of all {@link TextView}s. */ public final void setTextColor(View mGroup, int color) { if (mGroup == null) return; if (mGroup instanceof ViewGroup) { final ViewGroup mVGroup = (ViewGroup) mGroup; for (int i = 0, e = mVGroup.getChildCount(); i < e; ++i) setTextColor(mVGroup.getChildAt(i), color); } else if (mGroup instanceof TextView) { ((TextView) mGroup).setTextColor(color); } } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { // This NEEDS to be in the initial activity // to avoid themeColor being null. WPTheme.setDefaultThemeColor(); super.shouldRemoveStatusBarListeners(false); mServiceIntent.setClassName(BarService.PACKAGE, BarService.PACKAGE + "." + BarService.TAG); mPrefs = Preferences.getInstance(this); super.onCreate(savedInstanceState); setContentView(R.layout.main); // Set up the pivot. mPivot = (WPPivotControl) findViewById(R.id.homePivot); mPivot.setTab(SCREEN_ONE, R.string.settings) .setTab(SCREEN_TWO, R.string.about); // Set light/ dark based on the theme. final View mRoot = findViewById(R.id.root); if (WPTheme.isDark() && mRoot != null) { mRoot.setBackgroundColor(Color.BLACK); setTextColor(mRoot, Color.WHITE); } else if (mRoot != null) { mRoot.setBackgroundColor(Color.WHITE); setTextColor(mRoot, Color.BLACK); } // Get rid of the overscroll glow. WPThemeView.setOverScrollMode(mRoot, WPThemeView.OVER_SCROLL_NEVER); // Find the toggle for the status bar. mEnableToggle = findViewById(R.id.enable_toggle); mExpandToggle = findViewById(R.id.expand_toggle); mBootToggle = findViewById(R.id.boot_toggle); mDropToggle = findViewById(R.id.drop_toggle); mBackColorView = findViewById(R.id.background_color_preference); mIconColorView = findViewById(R.id.icon_color_preference); mIconDisplay = findViewById(R.id.icon_pref); mBackgroundDisplay = findViewById(R.id.background_pref); mIconToggle = findViewById(R.id.icon_toggle); mAppsToggle = findViewById(R.id.apps_toggle); mAppHideToggle = findViewById(R.id.hide_toggle); mSwipeToggle = findViewById(R.id.swipe_toggle); mDropSpinner = (Spinner) findViewById(R.id.drop_spinner); mChangeLog = findViewById(R.id.changelog); mAbout = (TextView) findViewById(R.id.about_description); // Set spinner for drop duration. final ArrayAdapter<CharSequence> mAdapter = ArrayAdapter.createFromResource( this, R.array.drop_times, android.R.layout.simple_spinner_item); mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mDropSpinner.setAdapter(mAdapter); // Set the listener for when the spinner changes. final int[] mDurations = getResources().getIntArray(R.array.drop_durations); // Set the default value of the spinner. final int mDuration = mPrefs.getDropDuration(); int i = 0; for (i = 0; i < mDurations.length; ++i) if (mDurations[i] == mDuration) break; mDropSpinner.setOnItemSelectedListener(mSpinnerListener); // Set the spinner's default selection. mDropSpinner.setSelection(i); mAppsToggle.setEnabled(mPrefs.isUsingBlacklist()); // Set listener for icon and app buttons. mIconToggle.setOnClickListener(new LaunchClickListener(IconActivity.class, HomeActivity.this)); mAppsToggle.setOnClickListener(new LaunchClickListener(BlacklistActivity.class, HomeActivity.this)); // Set the display colors from preferences. mBackgroundDisplay.setBackgroundColor(mPrefs.getBackgroundColor()); mIconDisplay.setBackgroundColor(mPrefs.getIconColor()); // Set Click Listeners mBackColorView.setOnClickListener(mColorClick); mIconColorView.setOnClickListener(mColorClick); // Set initially whether or not the service is running. if (mEnableToggle instanceof Checkable) ((Checkable) mEnableToggle).setChecked((mIsBound) ? mIsBound : mPrefs.isServiceRunning()); // Set initially whether or not swipe is enabled. if (mSwipeToggle instanceof Checkable) ((Checkable) mSwipeToggle).setChecked(mPrefs.isSwipeEnabled()); if (!mPrefs.isDropEnabled()) { // If drop is disabled then we do not intercept touch // events so swipe to display system notifications // cannot be controlled. mPrefs.setSwipe(true); // Set initially whether or not swipe is enabled. if (mSwipeToggle instanceof Checkable) ((Checkable) mSwipeToggle).setChecked(true); // Disable swipe if "Click to drop" is disabled. mSwipeToggle.setEnabled(false); } // Set initially whether or expansion is automatically disabled. if (mExpandToggle instanceof Checkable) ((Checkable) mEnableToggle).setChecked((mIsBound) ? mIsBound : mPrefs.isServiceRunning()); // Set initially whether or not to set on boot. if (mBootToggle instanceof Checkable) ((Checkable) mBootToggle).setChecked(mPrefs.isSetOnBoot()); // Set initially whether or not to set on boot. if (mDropToggle instanceof Checkable) ((Checkable) mDropToggle).setChecked(mPrefs.isDropEnabled()); // Set initially whether or not to use a blacklist. if (mAppHideToggle instanceof Checkable) ((Checkable) mAppHideToggle).setChecked(mPrefs.isUsingBlacklist()); // Set these listeners AFTER determing the initial values, // lest we end up with an infinite loop! // If it is a check box listen for its changes. if (mEnableToggle instanceof CompoundButton) ((CompoundButton) mEnableToggle).setOnCheckedChangeListener(mCheckListener); // If it is a check box listen for its changes. if (mBootToggle instanceof CompoundButton) ((CompoundButton) mBootToggle).setOnCheckedChangeListener(mBootListener); // If it is a check box listen for its changes. if (mExpandToggle instanceof CompoundButton) ((CompoundButton) mExpandToggle).setOnCheckedChangeListener(mExpandListener); // If it is a check box listen for its changes. if (mDropToggle instanceof CompoundButton) ((CompoundButton) mDropToggle).setOnCheckedChangeListener(mDropListener); // If it is a check box listen for its changes. if (mAppHideToggle instanceof CompoundButton) ((CompoundButton) mAppHideToggle).setOnCheckedChangeListener(mBlacklistListener); // If it is a check box listen for its changes. if (mSwipeToggle instanceof CompoundButton) ((CompoundButton) mSwipeToggle).setOnCheckedChangeListener(mSwipeListener); // Display Change Log. final Changelog mChangelog = new Changelog(this); if (mChangelog.firstRun()) { // Attach listener to show vibration dialog. showDialog(DIALOG_CHANGELOG); } // Make description links clickable. mAbout.setMovementMethod(LinkMovementMethod.getInstance()); // When clicked, display the change log. mChangeLog.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View mView) { showDialog(DIALOG_CHANGELOG); } } ); } public static final SpinnerListener mSpinnerListener = new SpinnerListener(); public static final class SpinnerListener implements OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { final Preferences mPrefs = Preferences.getInstance(parent.getContext()); final int[] mDurations = parent.getContext() .getResources().getIntArray(R.array.drop_durations); mPrefs.setDropDuration(mDurations[pos]); } public void onNothingSelected(AdapterView parent) {} } // Create dialog boxes! protected Dialog onCreateDialog(int id) { final WPDialog mDialog = new WPDialog(this); switch(id) { case DIALOG_CHANGELOG: { // Get the dialog for the change log. final Changelog mChangeLog = new Changelog(this); return mChangeLog.getLogDialog(); } } return mDialog; } // Listener for when the button that takes the // user to the Activity to hide/ show icons is clicked. private static final class LaunchClickListener implements View.OnClickListener { private final Class mClass; private final Context mContext; public LaunchClickListener(Class mClass, Context mContext) { this.mClass = mClass; this.mContext = mContext; } @Override public void onClick(View mView) { // Launch the IconActivity. mContext.startActivity(new Intent(mContext, mClass)); } }; /** * Listener for when a background color change has occured. */ private final OnColorChangedListener mBackgroundListener = new OnColorChangedListener() { @Override public void onColorChanged(int color) { // Change the little box displaying the color, // and update the settings accordingly. mPrefs.setBackgroundColor(color); mBackgroundDisplay.setBackgroundColor(color); } }; /** * Listener for when an icon color change has occured. */ private final OnColorChangedListener mIconListener = new OnColorChangedListener() { @Override public void onColorChanged(int color) { // Change the little box displaying the color, // and update the settings accordingly. mPrefs.setIconColor(color); mIconDisplay.setBackgroundColor(color); } }; /** * Listener for when one of the two color * preferences has been clicked. */ private final View.OnClickListener mColorClick = new View.OnClickListener() { @Override public void onClick(View mView) { // Background Color if (mView.equals(mBackColorView)) { final ColorPickerDialog dialog = new ColorPickerDialog(HomeActivity.this, mPrefs.getBackgroundColor()); dialog.setOnColorChangedListener(mBackgroundListener); dialog.show(); } // Icon Color else if (mView.equals(mIconColorView)) { final ColorPickerDialog dialog = new ColorPickerDialog(HomeActivity.this, mPrefs.getIconColor()); dialog.setOnColorChangedListener(mIconListener); dialog.show(); } } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mBlacklistListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mAppsToggle.setEnabled(isChecked); mPrefs.setUsingBlacklist(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mSwipeListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setSwipe(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mCheckListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { // Toggle the service based on the checkbox. final boolean mServiceRunning = mPrefs.isServiceRunning(); if (!mServiceRunning) { startService(mServiceIntent); bindService(mServiceIntent, mConnection, 0); mIsBound = true; } else { // Surrounded in the case that the service // has not actually been bound to. try { // Remember to destroy our resources. if (mConnection != null) { final IStatusBarService mService = mConnection.getService(); if (mService != null) mService.destroy(); if (mIsBound) unbindService(mConnection); } stopService(mServiceIntent); mIsBound = false; } catch(IllegalArgumentException e) {} catch(RemoteException re) {} if (mConnection != null) mConnection.nullifyService(); } } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mBootListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setOnBoot(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mExpandListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setExpandDisabled(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mDropListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setDrop(isChecked); if (!isChecked) { // If drop is disabled then we do not intercept touch // events so swipe to display system notifications // cannot be controlled. mPrefs.setSwipe(true); // Set initially whether or not swipe is enabled. if (mSwipeToggle instanceof Checkable) ((Checkable) mSwipeToggle).setChecked(true); } mSwipeToggle.setEnabled(isChecked); } }; @Override public void onDestroy() { super.onDestroy(); if (mConnection.getService() != null) { // Unbind the Service. try { unbindService(mConnection); } catch(IllegalArgumentException e) {} mIsBound = false; if (mConnection != null) mConnection.nullifyService(); } } private static final BarServiceConnection mConnection = new BarServiceConnection(); /** * Class for interacting with the main interface of the service. */ public static final class BarServiceConnection implements ServiceConnection { private IStatusBarService mService = null; /** * @return An instance of {@link IStatusBarService} * or null if none exists. */ public final IStatusBarService getService() { return mService; } /** * Sets {@link mService} to null. */ public final void nullifyService() { mService = null; } public void onServiceConnected(ComponentName className, IBinder service) { // This is called when the connection with the service has been // established, giving us the service object we can use to // interact with the service. We are communicating with our // service through an IDL interface, so get a client-side // representation of that from the raw service object. mService = IStatusBarService.Stub.asInterface(service); } public void onServiceDisconnected(ComponentName className) { // This is called when the connection with the service has been // unexpectedly disconnected -- that is, its process crashed. mService = null; } }; }
UTF-8
Java
17,780
java
HomeActivity.java
Java
[ { "context": "\n\n/*\n * HomeActivity.java\n *\n * Copyright (C) 2011 Thomas James Barrasso\n *\n * Licensed under the Apache License, Version ", "end": 111, "score": 0.9998835325241089, "start": 90, "tag": "NAME", "value": "Thomas James Barrasso" }, { "context": "esponding service or change in UI.\n *\n * @author\t\tThomas James Barrasso <contact @ tombarrasso.com>\n * @since\t\t10-13-2011", "end": 2251, "score": 0.9998857378959656, "start": 2230, "tag": "NAME", "value": "Thomas James Barrasso" }, { "context": "I.\n *\n * @author\t\tThomas James Barrasso <contact @ tombarrasso.com>\n * @since\t\t10-13-2011\n * @version\t\t1.0\n * @categ", "end": 2278, "score": 0.9840688705444336, "start": 2263, "tag": "EMAIL", "value": "tombarrasso.com" } ]
null
[]
package com.tombarrasso.android.wp7bar; /* * HomeActivity.java * * Copyright (C) 2011 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Android Packages import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.content.Context; import android.content.ServiceConnection; import android.content.ComponentName; import android.view.View; import android.util.Log; import android.app.Dialog; import android.os.IBinder; import android.os.RemoteException; import android.widget.Checkable; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.text.method.LinkMovementMethod; import android.graphics.Color; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Spinner; import android.widget.ArrayAdapter; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; // Java Packages import java.lang.IllegalArgumentException; // UI Packages import com.tombarrasso.android.wp7ui.extras.Changelog; import com.tombarrasso.android.wp7ui.app.WPDialog; import com.tombarrasso.android.wp7ui.app.WPActivity; import com.tombarrasso.android.wp7ui.WPTheme; import com.tombarrasso.android.wp7ui.widget.WPThemeView; import com.tombarrasso.android.wp7ui.widget.WPPivotControl; // Color Picker Packages import afzkl.development.mColorPicker.ColorPickerDialog; import afzkl.development.mColorPicker.views.ColorPickerView.OnColorChangedListener; /** * This {@link Activity} manages the preferences for the * applications and talks to the GUI. It handles click * events and starts the corresponding service or change in UI. * * @author <NAME> <contact @ <EMAIL>> * @since 10-13-2011 * @version 1.0 * @category {@link Activity} */ public class HomeActivity extends WPActivity { public static final String TAG = HomeActivity.class.getSimpleName(), PACKAGE = HomeActivity.class.getPackage().getName(); // George Orwell would be proud. private static final int DIALOG_CHANGELOG = 1984; private final Intent mServiceIntent = new Intent(); // Pivot screen iDs. private static final int SCREEN_ONE = 0, SCREEN_TWO = 1; // Views for settings and such. private View mEnableToggle, mExpandToggle, mBootToggle, mDropToggle, mBackColorView, mIconColorView, mBackgroundDisplay, mIconDisplay, mIconToggle, mAppsToggle, mAppHideToggle, mSwipeToggle, mChangeLog; private TextView mAbout; private Spinner mDropSpinner; private WPPivotControl mPivot; // Preferences and service, private Preferences mPrefs; private boolean mIsBound = false; /** * Recursively set the text of all {@link TextView}s. */ public final void setTextColor(View mGroup, int color) { if (mGroup == null) return; if (mGroup instanceof ViewGroup) { final ViewGroup mVGroup = (ViewGroup) mGroup; for (int i = 0, e = mVGroup.getChildCount(); i < e; ++i) setTextColor(mVGroup.getChildAt(i), color); } else if (mGroup instanceof TextView) { ((TextView) mGroup).setTextColor(color); } } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { // This NEEDS to be in the initial activity // to avoid themeColor being null. WPTheme.setDefaultThemeColor(); super.shouldRemoveStatusBarListeners(false); mServiceIntent.setClassName(BarService.PACKAGE, BarService.PACKAGE + "." + BarService.TAG); mPrefs = Preferences.getInstance(this); super.onCreate(savedInstanceState); setContentView(R.layout.main); // Set up the pivot. mPivot = (WPPivotControl) findViewById(R.id.homePivot); mPivot.setTab(SCREEN_ONE, R.string.settings) .setTab(SCREEN_TWO, R.string.about); // Set light/ dark based on the theme. final View mRoot = findViewById(R.id.root); if (WPTheme.isDark() && mRoot != null) { mRoot.setBackgroundColor(Color.BLACK); setTextColor(mRoot, Color.WHITE); } else if (mRoot != null) { mRoot.setBackgroundColor(Color.WHITE); setTextColor(mRoot, Color.BLACK); } // Get rid of the overscroll glow. WPThemeView.setOverScrollMode(mRoot, WPThemeView.OVER_SCROLL_NEVER); // Find the toggle for the status bar. mEnableToggle = findViewById(R.id.enable_toggle); mExpandToggle = findViewById(R.id.expand_toggle); mBootToggle = findViewById(R.id.boot_toggle); mDropToggle = findViewById(R.id.drop_toggle); mBackColorView = findViewById(R.id.background_color_preference); mIconColorView = findViewById(R.id.icon_color_preference); mIconDisplay = findViewById(R.id.icon_pref); mBackgroundDisplay = findViewById(R.id.background_pref); mIconToggle = findViewById(R.id.icon_toggle); mAppsToggle = findViewById(R.id.apps_toggle); mAppHideToggle = findViewById(R.id.hide_toggle); mSwipeToggle = findViewById(R.id.swipe_toggle); mDropSpinner = (Spinner) findViewById(R.id.drop_spinner); mChangeLog = findViewById(R.id.changelog); mAbout = (TextView) findViewById(R.id.about_description); // Set spinner for drop duration. final ArrayAdapter<CharSequence> mAdapter = ArrayAdapter.createFromResource( this, R.array.drop_times, android.R.layout.simple_spinner_item); mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mDropSpinner.setAdapter(mAdapter); // Set the listener for when the spinner changes. final int[] mDurations = getResources().getIntArray(R.array.drop_durations); // Set the default value of the spinner. final int mDuration = mPrefs.getDropDuration(); int i = 0; for (i = 0; i < mDurations.length; ++i) if (mDurations[i] == mDuration) break; mDropSpinner.setOnItemSelectedListener(mSpinnerListener); // Set the spinner's default selection. mDropSpinner.setSelection(i); mAppsToggle.setEnabled(mPrefs.isUsingBlacklist()); // Set listener for icon and app buttons. mIconToggle.setOnClickListener(new LaunchClickListener(IconActivity.class, HomeActivity.this)); mAppsToggle.setOnClickListener(new LaunchClickListener(BlacklistActivity.class, HomeActivity.this)); // Set the display colors from preferences. mBackgroundDisplay.setBackgroundColor(mPrefs.getBackgroundColor()); mIconDisplay.setBackgroundColor(mPrefs.getIconColor()); // Set Click Listeners mBackColorView.setOnClickListener(mColorClick); mIconColorView.setOnClickListener(mColorClick); // Set initially whether or not the service is running. if (mEnableToggle instanceof Checkable) ((Checkable) mEnableToggle).setChecked((mIsBound) ? mIsBound : mPrefs.isServiceRunning()); // Set initially whether or not swipe is enabled. if (mSwipeToggle instanceof Checkable) ((Checkable) mSwipeToggle).setChecked(mPrefs.isSwipeEnabled()); if (!mPrefs.isDropEnabled()) { // If drop is disabled then we do not intercept touch // events so swipe to display system notifications // cannot be controlled. mPrefs.setSwipe(true); // Set initially whether or not swipe is enabled. if (mSwipeToggle instanceof Checkable) ((Checkable) mSwipeToggle).setChecked(true); // Disable swipe if "Click to drop" is disabled. mSwipeToggle.setEnabled(false); } // Set initially whether or expansion is automatically disabled. if (mExpandToggle instanceof Checkable) ((Checkable) mEnableToggle).setChecked((mIsBound) ? mIsBound : mPrefs.isServiceRunning()); // Set initially whether or not to set on boot. if (mBootToggle instanceof Checkable) ((Checkable) mBootToggle).setChecked(mPrefs.isSetOnBoot()); // Set initially whether or not to set on boot. if (mDropToggle instanceof Checkable) ((Checkable) mDropToggle).setChecked(mPrefs.isDropEnabled()); // Set initially whether or not to use a blacklist. if (mAppHideToggle instanceof Checkable) ((Checkable) mAppHideToggle).setChecked(mPrefs.isUsingBlacklist()); // Set these listeners AFTER determing the initial values, // lest we end up with an infinite loop! // If it is a check box listen for its changes. if (mEnableToggle instanceof CompoundButton) ((CompoundButton) mEnableToggle).setOnCheckedChangeListener(mCheckListener); // If it is a check box listen for its changes. if (mBootToggle instanceof CompoundButton) ((CompoundButton) mBootToggle).setOnCheckedChangeListener(mBootListener); // If it is a check box listen for its changes. if (mExpandToggle instanceof CompoundButton) ((CompoundButton) mExpandToggle).setOnCheckedChangeListener(mExpandListener); // If it is a check box listen for its changes. if (mDropToggle instanceof CompoundButton) ((CompoundButton) mDropToggle).setOnCheckedChangeListener(mDropListener); // If it is a check box listen for its changes. if (mAppHideToggle instanceof CompoundButton) ((CompoundButton) mAppHideToggle).setOnCheckedChangeListener(mBlacklistListener); // If it is a check box listen for its changes. if (mSwipeToggle instanceof CompoundButton) ((CompoundButton) mSwipeToggle).setOnCheckedChangeListener(mSwipeListener); // Display Change Log. final Changelog mChangelog = new Changelog(this); if (mChangelog.firstRun()) { // Attach listener to show vibration dialog. showDialog(DIALOG_CHANGELOG); } // Make description links clickable. mAbout.setMovementMethod(LinkMovementMethod.getInstance()); // When clicked, display the change log. mChangeLog.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View mView) { showDialog(DIALOG_CHANGELOG); } } ); } public static final SpinnerListener mSpinnerListener = new SpinnerListener(); public static final class SpinnerListener implements OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { final Preferences mPrefs = Preferences.getInstance(parent.getContext()); final int[] mDurations = parent.getContext() .getResources().getIntArray(R.array.drop_durations); mPrefs.setDropDuration(mDurations[pos]); } public void onNothingSelected(AdapterView parent) {} } // Create dialog boxes! protected Dialog onCreateDialog(int id) { final WPDialog mDialog = new WPDialog(this); switch(id) { case DIALOG_CHANGELOG: { // Get the dialog for the change log. final Changelog mChangeLog = new Changelog(this); return mChangeLog.getLogDialog(); } } return mDialog; } // Listener for when the button that takes the // user to the Activity to hide/ show icons is clicked. private static final class LaunchClickListener implements View.OnClickListener { private final Class mClass; private final Context mContext; public LaunchClickListener(Class mClass, Context mContext) { this.mClass = mClass; this.mContext = mContext; } @Override public void onClick(View mView) { // Launch the IconActivity. mContext.startActivity(new Intent(mContext, mClass)); } }; /** * Listener for when a background color change has occured. */ private final OnColorChangedListener mBackgroundListener = new OnColorChangedListener() { @Override public void onColorChanged(int color) { // Change the little box displaying the color, // and update the settings accordingly. mPrefs.setBackgroundColor(color); mBackgroundDisplay.setBackgroundColor(color); } }; /** * Listener for when an icon color change has occured. */ private final OnColorChangedListener mIconListener = new OnColorChangedListener() { @Override public void onColorChanged(int color) { // Change the little box displaying the color, // and update the settings accordingly. mPrefs.setIconColor(color); mIconDisplay.setBackgroundColor(color); } }; /** * Listener for when one of the two color * preferences has been clicked. */ private final View.OnClickListener mColorClick = new View.OnClickListener() { @Override public void onClick(View mView) { // Background Color if (mView.equals(mBackColorView)) { final ColorPickerDialog dialog = new ColorPickerDialog(HomeActivity.this, mPrefs.getBackgroundColor()); dialog.setOnColorChangedListener(mBackgroundListener); dialog.show(); } // Icon Color else if (mView.equals(mIconColorView)) { final ColorPickerDialog dialog = new ColorPickerDialog(HomeActivity.this, mPrefs.getIconColor()); dialog.setOnColorChangedListener(mIconListener); dialog.show(); } } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mBlacklistListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mAppsToggle.setEnabled(isChecked); mPrefs.setUsingBlacklist(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mSwipeListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setSwipe(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mCheckListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { // Toggle the service based on the checkbox. final boolean mServiceRunning = mPrefs.isServiceRunning(); if (!mServiceRunning) { startService(mServiceIntent); bindService(mServiceIntent, mConnection, 0); mIsBound = true; } else { // Surrounded in the case that the service // has not actually been bound to. try { // Remember to destroy our resources. if (mConnection != null) { final IStatusBarService mService = mConnection.getService(); if (mService != null) mService.destroy(); if (mIsBound) unbindService(mConnection); } stopService(mServiceIntent); mIsBound = false; } catch(IllegalArgumentException e) {} catch(RemoteException re) {} if (mConnection != null) mConnection.nullifyService(); } } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mBootListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setOnBoot(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mExpandListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setExpandDisabled(isChecked); } }; /** * Listener for when the checkbox is checked/ unchecked. */ private final OnCheckedChangeListener mDropListener = new OnCheckedChangeListener() { public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { mPrefs.setDrop(isChecked); if (!isChecked) { // If drop is disabled then we do not intercept touch // events so swipe to display system notifications // cannot be controlled. mPrefs.setSwipe(true); // Set initially whether or not swipe is enabled. if (mSwipeToggle instanceof Checkable) ((Checkable) mSwipeToggle).setChecked(true); } mSwipeToggle.setEnabled(isChecked); } }; @Override public void onDestroy() { super.onDestroy(); if (mConnection.getService() != null) { // Unbind the Service. try { unbindService(mConnection); } catch(IllegalArgumentException e) {} mIsBound = false; if (mConnection != null) mConnection.nullifyService(); } } private static final BarServiceConnection mConnection = new BarServiceConnection(); /** * Class for interacting with the main interface of the service. */ public static final class BarServiceConnection implements ServiceConnection { private IStatusBarService mService = null; /** * @return An instance of {@link IStatusBarService} * or null if none exists. */ public final IStatusBarService getService() { return mService; } /** * Sets {@link mService} to null. */ public final void nullifyService() { mService = null; } public void onServiceConnected(ComponentName className, IBinder service) { // This is called when the connection with the service has been // established, giving us the service object we can use to // interact with the service. We are communicating with our // service through an IDL interface, so get a client-side // representation of that from the raw service object. mService = IStatusBarService.Stub.asInterface(service); } public void onServiceDisconnected(ComponentName className) { // This is called when the connection with the service has been // unexpectedly disconnected -- that is, its process crashed. mService = null; } }; }
17,742
0.728515
0.726547
599
28.682804
24.466656
107
false
false
0
0
0
0
0
0
2.085142
false
false
3
05131bb31eb0ebe4975d54454d819fc26c05c4aa
4,947,802,339,096
c73844d6e56606be349366ae62f1de4aa6a2f43c
/org/jivesoftware/smack/sasl/SASLError.java
c5c4df5f775e8b0725be1b8104405db04d3dabc3
[]
no_license
sheytoon/Syna
https://github.com/sheytoon/Syna
dd5a90eb263eb020003f36bdd9da36526951974f
39c049cc28b74f75264f40a80380d9ff6462fb4c
refs/heads/master
2016-08-09T07:28:44.989000
2016-02-04T12:50:23
2016-02-04T12:50:23
51,073,909
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.jivesoftware.smack.sasl; import java.util.logging.Level; import java.util.logging.Logger; public enum SASLError { aborted, account_disabled, credentials_expired, encryption_required, incorrect_encoding, invalid_authzid, invalid_mechanism, malformed_request, mechanism_too_weak, not_authorized, temporary_auth_failure; private static final Logger LOGGER; static { LOGGER = Logger.getLogger(SASLError.class.getName()); } public static SASLError fromString(String str) { String replace = str.replace('-', '_'); SASLError sASLError = null; try { sASLError = valueOf(replace); } catch (Throwable e) { LOGGER.log(Level.WARNING, "Could not transform string '" + replace + "' to SASLError", e); } return sASLError; } public String toString() { return name().replace('_', '-'); } }
UTF-8
Java
955
java
SASLError.java
Java
[]
null
[]
package org.jivesoftware.smack.sasl; import java.util.logging.Level; import java.util.logging.Logger; public enum SASLError { aborted, account_disabled, credentials_expired, encryption_required, incorrect_encoding, invalid_authzid, invalid_mechanism, malformed_request, mechanism_too_weak, not_authorized, temporary_auth_failure; private static final Logger LOGGER; static { LOGGER = Logger.getLogger(SASLError.class.getName()); } public static SASLError fromString(String str) { String replace = str.replace('-', '_'); SASLError sASLError = null; try { sASLError = valueOf(replace); } catch (Throwable e) { LOGGER.log(Level.WARNING, "Could not transform string '" + replace + "' to SASLError", e); } return sASLError; } public String toString() { return name().replace('_', '-'); } }
955
0.619895
0.619895
39
23.487179
19.99086
102
false
false
0
0
0
0
0
0
0.666667
false
false
3
c99ba77e79b30889873ff7fbd6a013dd61f04dc9
23,965,917,524,802
eb0a78d4d95f0e33969335db82c11966d90a34c9
/core/src/main/java/com/nuodb/migrator/utils/DateTimeFormatter.java
10094c558fe2730828a9ea4c8436ebbba4a6d853
[ "BSD-3-Clause" ]
permissive
nuodb/migration-tools
https://github.com/nuodb/migration-tools
5b585551cf86b6a7f15f5b3f960b62513060d9fd
e7224feb600cbb26785ddccdaf3fec50447d1b2d
refs/heads/master
2023-09-02T12:00:54.572000
2023-08-23T10:12:59
2023-08-23T13:34:14
5,372,003
7
10
BSD-3-Clause
false
2023-09-13T13:14:46
2012-08-10T17:04:06
2023-07-11T17:47:21
2023-09-13T13:14:44
43,770
27
10
15
Java
false
false
/** * Copyright (c) 2002-2012, Hirondelle Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of NuoDB, Inc. nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY HIRONDELLE SYSTEMS ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL HIRONDELLE SYSTEMS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.nuodb.migrator.utils; import java.text.SimpleDateFormat; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Formats a {@link DateTime}, and implements {@link DateTime#format(String)}. * <p/> * <P> * This class defines a mini-language for defining how a {@link DateTime} is * formatted. See {@link DateTime#format(String)} for details regarding the * formatting mini-language. * <p/> * <P> * The DateFormatSymbols class might be used to grab the locale-specific text, * but the arrays it returns are wonky and weird, so I have avoided it. */ final class DateTimeFormatter { /** * Constructor used for patterns that represent date-time elements using * only numbers, and no localizable text. * * @param aFormat * uses the syntax described by {@link DateTime#format(String)}. */ DateTimeFormatter(String aFormat) { fFormat = aFormat; fLocale = null; fCustomLocalization = null; validateState(); } /** * Constructor used for patterns that represent date-time elements using not * only numbers, but text as well. The text needs to be localizable. * * @param aFormat * uses the syntax described by {@link DateTime#format(String)}. * @param aLocale * used to schema text for Month, Weekday, and AM-PM indicator; * required only by patterns which return localized text, instead * of numeric forms for date-time elements. */ DateTimeFormatter(String aFormat, Locale aLocale) { fFormat = aFormat; fLocale = aLocale; fCustomLocalization = null; validateState(); } /** * Constructor used for patterns that represent using not only numbers, but * customized text as well. * <p/> * <P> * This constructor exists mostly since SimpleDateFormat doesn't support all * locales, and it has a policy of N letters for text, where N != 3. * * @param aFormat * must match the syntax described by * {@link DateTime#format(String)}. * @param aMonths * contains text for all 12 months, starting with January; size * must be 12. * @param aWeekdays * contains text for all 7 weekdays, starting with Sunday; size * must be 7. * @param aAmPmIndicators * contains text for A.M and P.M. indicators (in that order); * size must be 2. */ DateTimeFormatter(String aFormat, List<String> aMonths, List<String> aWeekdays, List<String> aAmPmIndicators) { fFormat = aFormat; fLocale = null; fCustomLocalization = new CustomLocalization(aMonths, aWeekdays, aAmPmIndicators); validateState(); } /** * Format a {@link DateTime}. */ String format(DateTime aDateTime) { fEscapedRanges = new ArrayList<EscapedRange>(); fInterpretedRanges = new ArrayList<InterpretedRange>(); findEscapedRanges(); interpretInput(aDateTime); return produceFinalOutput(); } // PRIVATE private final String fFormat; private final Locale fLocale; private Collection<InterpretedRange> fInterpretedRanges; private Collection<EscapedRange> fEscapedRanges; /** * Table mapping a Locale to the names of the months. Initially empty, * populated only when a specific Locale is needed for presenting such text. * Used for MMMM and MMM tokens. */ private final Map<Locale, List<String>> fMonths = new LinkedHashMap<Locale, List<String>>(); /** * Table mapping a Locale to the names of the weekdays. Initially empty, * populated only when a specific Locale is needed for presenting such text. * Used for WWWW and WWW tokens. */ private final Map<Locale, List<String>> fWeekdays = new LinkedHashMap<Locale, List<String>>(); /** * Table mapping a Locale to the text used to indicate a.m. and p.m. * Initially empty, populated only when a specific Locale is needed for * presenting such text. Used for the 'a' token. */ private final Map<Locale, List<String>> fAmPm = new LinkedHashMap<Locale, List<String>>(); private final CustomLocalization fCustomLocalization; private final class CustomLocalization { CustomLocalization(List<String> aMonths, List<String> aWeekdays, List<String> aAmPm) { if (aMonths.size() != 12) { throw new IllegalArgumentException( "Your List of custom months must have size 12, but its size is " + aMonths.size()); } if (aWeekdays.size() != 7) { throw new IllegalArgumentException( "Your List of custom weekdays must have size 7, but its size is " + aWeekdays.size()); } if (aAmPm.size() != 2) { throw new IllegalArgumentException( "Your List of custom a.m./p.m. indicators must have size 2, but its size is " + aAmPm.size()); } Months = aMonths; Weekdays = aWeekdays; AmPmIndicators = aAmPm; } List<String> Months; List<String> Weekdays; List<String> AmPmIndicators; } /** * A section of fFormat containing a token that must be interpreted. */ private static final class InterpretedRange { int Start; int End; String Text; @Override public String toString() { return "Start:" + Start + " End:" + End + " '" + Text + "'"; } ; } /** * A section of fFormat bounded by a pair of escape characters; such ranges * contain uninterpreted text. */ private static final class EscapedRange { int Start; int End; } /** * Special character used to escape the interpretation of parts of fFormat. */ private static final String ESCAPE_CHAR = "|"; private static final Pattern ESCAPED_RANGE = Pattern.compile("\\|[^\\|]*\\|"); /* * Here, 'token' means an item in the mini-language, having special meaning * (defined below). */ // all date-related tokens are in upper case private static final String YYYY = "YYYY"; private static final String YY = "YY"; private static final String M = "M"; private static final String MM = "MM"; private static final String MMM = "MMM"; private static final String MMMM = "MMMM"; private static final String D = "D"; private static final String DD = "DD"; private static final String WWW = "WWW"; private static final String WWWW = "WWWW"; // all time-related tokens are in lower case private static final String hh = "hh"; private static final String h = "h"; private static final String m = "m"; private static final String mm = "mm"; private static final String s = "s"; private static final String ss = "ss"; /** * The 12-hour clock style. * <p/> * 12:00 am is midnight, 12:30am is 30 minutes past midnight, 12:00 pm is 12 * noon. This item is almost always used with 'a' to indicate am/pm. */ private static final String h12 = "h12"; /** * As {@link #h12}, but with leading zero. */ private static final String hh12 = "hh12"; private static final int AM = 0; // a.m. comes first in lists used by this // class private static final int PM = 1; /** * A.M./P.M. text is sensitive to Locale, in the same way that names of * months and weekdays are sensitive to Locale. */ private static final String a = "a"; private static final Pattern FRACTIONALS = Pattern.compile("f{1,9}"); private static final String EMPTY_STRING = ""; /** * The order of these items is significant, and is critical for how fFormat * is interpreted. The 'longer' tokens must come first, in any group of * related tokens. */ private static final List<String> TOKENS = new ArrayList<String>(); static { TOKENS.add(YYYY); TOKENS.add(YY); TOKENS.add(MMMM); TOKENS.add(MMM); TOKENS.add(MM); TOKENS.add(M); TOKENS.add(DD); TOKENS.add(D); TOKENS.add(WWWW); TOKENS.add(WWW); TOKENS.add(hh12); TOKENS.add(h12); TOKENS.add(hh); TOKENS.add(h); TOKENS.add(mm); TOKENS.add(m); TOKENS.add(ss); TOKENS.add(s); TOKENS.add(a); // should these be constants too? TOKENS.add("fffffffff"); TOKENS.add("ffffffff"); TOKENS.add("fffffff"); TOKENS.add("ffffff"); TOKENS.add("fffff"); TOKENS.add("ffff"); TOKENS.add("fff"); TOKENS.add("ff"); TOKENS.add("f"); } /** * Escaped ranges are bounded by a PAIR of {@link #ESCAPE_CHAR} characters. */ private void findEscapedRanges() { Matcher matcher = ESCAPED_RANGE.matcher(fFormat); while (matcher.find()) { EscapedRange escapedRange = new EscapedRange(); escapedRange.Start = matcher.start(); // first pipe escapedRange.End = matcher.end() - 1; // second pipe fEscapedRanges.add(escapedRange); } } /** * Return true only if the start of the interpreted range is in an escaped * range. */ private boolean isInEscapedRange(InterpretedRange aInterpretedRange) { boolean result = false; // innocent till shown guilty for (EscapedRange escapedRange : fEscapedRanges) { // checking only the start is sufficient, because the tokens never // contain the escape char if (escapedRange.Start <= aInterpretedRange.Start && aInterpretedRange.Start <= escapedRange.End) { result = true; break; } } return result; } /** * Scan fFormat for all tokens, in a specific order, and interpret them with * the given DateTime. The interpreted tokens are saved for output later. */ private void interpretInput(DateTime aDateTime) { String format = fFormat; for (String token : TOKENS) { Pattern pattern = Pattern.compile(token); Matcher matcher = pattern.matcher(format); while (matcher.find()) { InterpretedRange interpretedRange = new InterpretedRange(); interpretedRange.Start = matcher.start(); interpretedRange.End = matcher.end() - 1; if (!isInEscapedRange(interpretedRange)) { interpretedRange.Text = interpretThe(matcher.group(), aDateTime); fInterpretedRanges.add(interpretedRange); } } format = format.replace(token, withCharDenotingAlreadyInterpreted(token)); } } /** * Return a temp placeholder string used to identify sections of fFormat * that have already been interpreted. The returned string is a list of "@" * characters, whose length is the same as aToken. */ private String withCharDenotingAlreadyInterpreted(String aToken) { StringBuilder result = new StringBuilder(); for (int idx = 1; idx <= aToken.length(); ++idx) { // any character that isn't interpreted, or a special regex char, // will do here // the fact that it's interpreted at location x is stored elsewhere; // this is meant only to prevent multiple interpretations of the // same text result.append("@"); } return result.toString(); } /** * Render the final output returned to the caller. */ private String produceFinalOutput() { StringBuilder result = new StringBuilder(); int idx = 0; while (idx < fFormat.length()) { String letter = nextLetter(idx); InterpretedRange interpretation = getInterpretation(idx); if (interpretation != null) { result.append(interpretation.Text); idx = interpretation.End; } else { if (!ESCAPE_CHAR.equals(letter)) { result.append(letter); } } ++idx; } return result.toString(); } private InterpretedRange getInterpretation(int aIdx) { InterpretedRange result = null; for (InterpretedRange interpretedRange : fInterpretedRanges) { if (interpretedRange.Start == aIdx) { result = interpretedRange; } } return result; } private String nextLetter(int aIdx) { return fFormat.substring(aIdx, aIdx + 1); } private String interpretThe(String aCurrentToken, DateTime aDateTime) { String result = EMPTY_STRING; if (YYYY.equals(aCurrentToken)) { result = valueStr(aDateTime.getYear()); } else if (YY.equals(aCurrentToken)) { result = noCentury(valueStr(aDateTime.getYear())); } else if (MMMM.equals(aCurrentToken)) { int month = aDateTime.getMonth(); result = fullMonth(month); } else if (MMM.equals(aCurrentToken)) { int month = aDateTime.getMonth(); result = firstThreeChars(fullMonth(month)); } else if (MM.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getMonth())); } else if (M.equals(aCurrentToken)) { result = valueStr(aDateTime.getMonth()); } else if (DD.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getDay())); } else if (D.equals(aCurrentToken)) { result = valueStr(aDateTime.getDay()); } else if (WWWW.equals(aCurrentToken)) { int weekday = aDateTime.getWeekDay(); result = fullWeekday(weekday); } else if (WWW.equals(aCurrentToken)) { int weekday = aDateTime.getWeekDay(); result = firstThreeChars(fullWeekday(weekday)); } else if (hh.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getHour())); } else if (h.equals(aCurrentToken)) { result = valueStr(aDateTime.getHour()); } else if (h12.equals(aCurrentToken)) { result = valueStr(twelveHourStyle(aDateTime.getHour())); } else if (hh12.equals(aCurrentToken)) { result = addLeadingZero(valueStr(twelveHourStyle(aDateTime.getHour()))); } else if (a.equals(aCurrentToken)) { int hour = aDateTime.getHour(); result = amPmIndicator(hour); } else if (mm.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getMinute())); } else if (m.equals(aCurrentToken)) { result = valueStr(aDateTime.getMinute()); } else if (ss.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getSecond())); } else if (s.equals(aCurrentToken)) { result = valueStr(aDateTime.getSecond()); } else if (aCurrentToken.startsWith("f")) { Matcher matcher = FRACTIONALS.matcher(aCurrentToken); if (matcher.matches()) { String nanos = nanosWithLeadingZeroes(aDateTime.getNanoseconds()); int numDecimalsToShow = aCurrentToken.length(); result = firstNChars(nanos, numDecimalsToShow); } else { throw new IllegalArgumentException("Unknown token in date formatting pattern: " + aCurrentToken); } } else { throw new IllegalArgumentException("Unknown token in date formatting pattern: " + aCurrentToken); } return result; } private String valueStr(Object aItem) { String result = EMPTY_STRING; if (aItem != null) { result = String.valueOf(aItem); } return result; } private String noCentury(String aItem) { String result = EMPTY_STRING; if (DateUtils.isNotBlank(aItem)) { result = aItem.substring(2); } return result; } private String nanosWithLeadingZeroes(Integer aNanos) { String result = valueStr(aNanos); while (result.length() < 9) { result = "0" + result; } return result; } /** * Pad 0..9 with a leading zero. */ private String addLeadingZero(String aTimePart) { String result = aTimePart; if (DateUtils.isNotBlank(aTimePart) && aTimePart.length() == 1) { result = "0" + result; } return result; } private String firstThreeChars(String aText) { String result = aText; if (DateUtils.isNotBlank(aText) && aText.length() >= 3) { result = aText.substring(0, 3); } return result; } private String fullMonth(Integer aMonth) { String result = ""; if (aMonth != null) { if (fCustomLocalization != null) { result = lookupCustomMonthFor(aMonth); } else if (fLocale != null) { result = lookupMonthFor(aMonth); } else { throw new IllegalArgumentException( "Your date pattern requires either a Locale, or your own custom localizations for text:" + DateUtils.quote(fFormat)); } } return result; } private String lookupCustomMonthFor(Integer aMonth) { return fCustomLocalization.Months.get(aMonth - 1); } private String lookupMonthFor(Integer aMonth) { String result; if (!fMonths.containsKey(fLocale)) { List<String> months = new ArrayList<String>(); SimpleDateFormat format = new SimpleDateFormat("MMMM", fLocale); for (int idx = Calendar.JANUARY; idx <= Calendar.DECEMBER; ++idx) { Calendar firstDayOfMonth = new GregorianCalendar(); firstDayOfMonth.set(Calendar.YEAR, 2000); firstDayOfMonth.set(Calendar.MONTH, idx); firstDayOfMonth.set(Calendar.DAY_OF_MONTH, 15); String monthText = format.format(firstDayOfMonth.getTime()); months.add(monthText); } fMonths.put(fLocale, months); } result = fMonths.get(fLocale).get(aMonth - 1); // list is 0-based return result; } private String fullWeekday(Integer aWeekday) { String result = ""; if (aWeekday != null) { if (fCustomLocalization != null) { result = lookupCustomWeekdayFor(aWeekday); } else if (fLocale != null) { result = lookupWeekdayFor(aWeekday); } else { throw new IllegalArgumentException( "Your date pattern requires either a Locale, or your own custom localizations for text:" + DateUtils.quote(fFormat)); } } return result; } private String lookupCustomWeekdayFor(Integer aWeekday) { return fCustomLocalization.Weekdays.get(aWeekday - 1); } private String lookupWeekdayFor(Integer aWeekday) { String result; if (!fWeekdays.containsKey(fLocale)) { List<String> weekdays = new ArrayList<String>(); SimpleDateFormat format = new SimpleDateFormat("EEEE", fLocale); // Feb 8, 2009..Feb 14, 2009 runs Sun..Sat for (int idx = 8; idx <= 14; ++idx) { Calendar firstDayOfWeek = new GregorianCalendar(); firstDayOfWeek.set(Calendar.YEAR, 2009); firstDayOfWeek.set(Calendar.MONTH, 1); // month is 0-based firstDayOfWeek.set(Calendar.DAY_OF_MONTH, idx); String weekdayText = format.format(firstDayOfWeek.getTime()); weekdays.add(weekdayText); } fWeekdays.put(fLocale, weekdays); } result = fWeekdays.get(fLocale).get(aWeekday - 1); // list is 0-based return result; } private String firstNChars(String aText, int aN) { String result = aText; if (DateUtils.isNotBlank(aText) && aText.length() >= aN) { result = aText.substring(0, aN); } return result; } /** * Coerce the hour to match the number used in the 12-hour style. */ private Integer twelveHourStyle(Integer aHour) { Integer result = aHour; if (aHour != null) { if (aHour == 0) { result = 12; // eg 12:30 am } else if (aHour > 12) { result = aHour - 12; // eg 14:00 -> 2:00 } } return result; } private String amPmIndicator(Integer aHour) { String result = ""; if (aHour != null) { if (fCustomLocalization != null) { result = lookupCustomAmPmFor(aHour); } else if (fLocale != null) { result = lookupAmPmFor(aHour); } else { throw new IllegalArgumentException( "Your date pattern requires either a Locale, or your own custom localizations for text:" + DateUtils.quote(fFormat)); } } return result; } private String lookupCustomAmPmFor(Integer aHour) { String result; if (aHour < 12) { result = fCustomLocalization.AmPmIndicators.get(AM); } else { result = fCustomLocalization.AmPmIndicators.get(PM); } return result; } private String lookupAmPmFor(Integer aHour) { String result; if (!fAmPm.containsKey(fLocale)) { List<String> indicators = new ArrayList<String>(); indicators.add(getAmPmTextFor(6)); indicators.add(getAmPmTextFor(18)); fAmPm.put(fLocale, indicators); } if (aHour < 12) { result = fAmPm.get(fLocale).get(AM); } else { result = fAmPm.get(fLocale).get(PM); } return result; } private String getAmPmTextFor(Integer aHour) { SimpleDateFormat format = new SimpleDateFormat("a", fLocale); Calendar someDay = new GregorianCalendar(); someDay.set(Calendar.YEAR, 2000); someDay.set(Calendar.MONTH, 6); someDay.set(Calendar.DAY_OF_MONTH, 15); someDay.set(Calendar.HOUR_OF_DAY, aHour); return format.format(someDay.getTime()); } private void validateState() { if (!DateUtils.isNotBlank(fFormat)) { throw new IllegalArgumentException("DateTime format has no content."); } } }
UTF-8
Java
24,666
java
DateTimeFormatter.java
Java
[ { "context": "/**\n * Copyright (c) 2002-2012, Hirondelle Systems\n * All rights reserved.\n *\n * Redist", "end": 37, "score": 0.5534183979034424, "start": 33, "tag": "NAME", "value": "iron" }, { "context": "/**\n * Copyright (c) 2002-2012, Hirondelle Systems\n * All rights reserved.\n *\n * Redistribut", "end": 42, "score": 0.5225063562393188, "start": 40, "tag": "NAME", "value": "le" } ]
null
[]
/** * Copyright (c) 2002-2012, Hirondelle Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of NuoDB, Inc. nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY HIRONDELLE SYSTEMS ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL HIRONDELLE SYSTEMS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.nuodb.migrator.utils; import java.text.SimpleDateFormat; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Formats a {@link DateTime}, and implements {@link DateTime#format(String)}. * <p/> * <P> * This class defines a mini-language for defining how a {@link DateTime} is * formatted. See {@link DateTime#format(String)} for details regarding the * formatting mini-language. * <p/> * <P> * The DateFormatSymbols class might be used to grab the locale-specific text, * but the arrays it returns are wonky and weird, so I have avoided it. */ final class DateTimeFormatter { /** * Constructor used for patterns that represent date-time elements using * only numbers, and no localizable text. * * @param aFormat * uses the syntax described by {@link DateTime#format(String)}. */ DateTimeFormatter(String aFormat) { fFormat = aFormat; fLocale = null; fCustomLocalization = null; validateState(); } /** * Constructor used for patterns that represent date-time elements using not * only numbers, but text as well. The text needs to be localizable. * * @param aFormat * uses the syntax described by {@link DateTime#format(String)}. * @param aLocale * used to schema text for Month, Weekday, and AM-PM indicator; * required only by patterns which return localized text, instead * of numeric forms for date-time elements. */ DateTimeFormatter(String aFormat, Locale aLocale) { fFormat = aFormat; fLocale = aLocale; fCustomLocalization = null; validateState(); } /** * Constructor used for patterns that represent using not only numbers, but * customized text as well. * <p/> * <P> * This constructor exists mostly since SimpleDateFormat doesn't support all * locales, and it has a policy of N letters for text, where N != 3. * * @param aFormat * must match the syntax described by * {@link DateTime#format(String)}. * @param aMonths * contains text for all 12 months, starting with January; size * must be 12. * @param aWeekdays * contains text for all 7 weekdays, starting with Sunday; size * must be 7. * @param aAmPmIndicators * contains text for A.M and P.M. indicators (in that order); * size must be 2. */ DateTimeFormatter(String aFormat, List<String> aMonths, List<String> aWeekdays, List<String> aAmPmIndicators) { fFormat = aFormat; fLocale = null; fCustomLocalization = new CustomLocalization(aMonths, aWeekdays, aAmPmIndicators); validateState(); } /** * Format a {@link DateTime}. */ String format(DateTime aDateTime) { fEscapedRanges = new ArrayList<EscapedRange>(); fInterpretedRanges = new ArrayList<InterpretedRange>(); findEscapedRanges(); interpretInput(aDateTime); return produceFinalOutput(); } // PRIVATE private final String fFormat; private final Locale fLocale; private Collection<InterpretedRange> fInterpretedRanges; private Collection<EscapedRange> fEscapedRanges; /** * Table mapping a Locale to the names of the months. Initially empty, * populated only when a specific Locale is needed for presenting such text. * Used for MMMM and MMM tokens. */ private final Map<Locale, List<String>> fMonths = new LinkedHashMap<Locale, List<String>>(); /** * Table mapping a Locale to the names of the weekdays. Initially empty, * populated only when a specific Locale is needed for presenting such text. * Used for WWWW and WWW tokens. */ private final Map<Locale, List<String>> fWeekdays = new LinkedHashMap<Locale, List<String>>(); /** * Table mapping a Locale to the text used to indicate a.m. and p.m. * Initially empty, populated only when a specific Locale is needed for * presenting such text. Used for the 'a' token. */ private final Map<Locale, List<String>> fAmPm = new LinkedHashMap<Locale, List<String>>(); private final CustomLocalization fCustomLocalization; private final class CustomLocalization { CustomLocalization(List<String> aMonths, List<String> aWeekdays, List<String> aAmPm) { if (aMonths.size() != 12) { throw new IllegalArgumentException( "Your List of custom months must have size 12, but its size is " + aMonths.size()); } if (aWeekdays.size() != 7) { throw new IllegalArgumentException( "Your List of custom weekdays must have size 7, but its size is " + aWeekdays.size()); } if (aAmPm.size() != 2) { throw new IllegalArgumentException( "Your List of custom a.m./p.m. indicators must have size 2, but its size is " + aAmPm.size()); } Months = aMonths; Weekdays = aWeekdays; AmPmIndicators = aAmPm; } List<String> Months; List<String> Weekdays; List<String> AmPmIndicators; } /** * A section of fFormat containing a token that must be interpreted. */ private static final class InterpretedRange { int Start; int End; String Text; @Override public String toString() { return "Start:" + Start + " End:" + End + " '" + Text + "'"; } ; } /** * A section of fFormat bounded by a pair of escape characters; such ranges * contain uninterpreted text. */ private static final class EscapedRange { int Start; int End; } /** * Special character used to escape the interpretation of parts of fFormat. */ private static final String ESCAPE_CHAR = "|"; private static final Pattern ESCAPED_RANGE = Pattern.compile("\\|[^\\|]*\\|"); /* * Here, 'token' means an item in the mini-language, having special meaning * (defined below). */ // all date-related tokens are in upper case private static final String YYYY = "YYYY"; private static final String YY = "YY"; private static final String M = "M"; private static final String MM = "MM"; private static final String MMM = "MMM"; private static final String MMMM = "MMMM"; private static final String D = "D"; private static final String DD = "DD"; private static final String WWW = "WWW"; private static final String WWWW = "WWWW"; // all time-related tokens are in lower case private static final String hh = "hh"; private static final String h = "h"; private static final String m = "m"; private static final String mm = "mm"; private static final String s = "s"; private static final String ss = "ss"; /** * The 12-hour clock style. * <p/> * 12:00 am is midnight, 12:30am is 30 minutes past midnight, 12:00 pm is 12 * noon. This item is almost always used with 'a' to indicate am/pm. */ private static final String h12 = "h12"; /** * As {@link #h12}, but with leading zero. */ private static final String hh12 = "hh12"; private static final int AM = 0; // a.m. comes first in lists used by this // class private static final int PM = 1; /** * A.M./P.M. text is sensitive to Locale, in the same way that names of * months and weekdays are sensitive to Locale. */ private static final String a = "a"; private static final Pattern FRACTIONALS = Pattern.compile("f{1,9}"); private static final String EMPTY_STRING = ""; /** * The order of these items is significant, and is critical for how fFormat * is interpreted. The 'longer' tokens must come first, in any group of * related tokens. */ private static final List<String> TOKENS = new ArrayList<String>(); static { TOKENS.add(YYYY); TOKENS.add(YY); TOKENS.add(MMMM); TOKENS.add(MMM); TOKENS.add(MM); TOKENS.add(M); TOKENS.add(DD); TOKENS.add(D); TOKENS.add(WWWW); TOKENS.add(WWW); TOKENS.add(hh12); TOKENS.add(h12); TOKENS.add(hh); TOKENS.add(h); TOKENS.add(mm); TOKENS.add(m); TOKENS.add(ss); TOKENS.add(s); TOKENS.add(a); // should these be constants too? TOKENS.add("fffffffff"); TOKENS.add("ffffffff"); TOKENS.add("fffffff"); TOKENS.add("ffffff"); TOKENS.add("fffff"); TOKENS.add("ffff"); TOKENS.add("fff"); TOKENS.add("ff"); TOKENS.add("f"); } /** * Escaped ranges are bounded by a PAIR of {@link #ESCAPE_CHAR} characters. */ private void findEscapedRanges() { Matcher matcher = ESCAPED_RANGE.matcher(fFormat); while (matcher.find()) { EscapedRange escapedRange = new EscapedRange(); escapedRange.Start = matcher.start(); // first pipe escapedRange.End = matcher.end() - 1; // second pipe fEscapedRanges.add(escapedRange); } } /** * Return true only if the start of the interpreted range is in an escaped * range. */ private boolean isInEscapedRange(InterpretedRange aInterpretedRange) { boolean result = false; // innocent till shown guilty for (EscapedRange escapedRange : fEscapedRanges) { // checking only the start is sufficient, because the tokens never // contain the escape char if (escapedRange.Start <= aInterpretedRange.Start && aInterpretedRange.Start <= escapedRange.End) { result = true; break; } } return result; } /** * Scan fFormat for all tokens, in a specific order, and interpret them with * the given DateTime. The interpreted tokens are saved for output later. */ private void interpretInput(DateTime aDateTime) { String format = fFormat; for (String token : TOKENS) { Pattern pattern = Pattern.compile(token); Matcher matcher = pattern.matcher(format); while (matcher.find()) { InterpretedRange interpretedRange = new InterpretedRange(); interpretedRange.Start = matcher.start(); interpretedRange.End = matcher.end() - 1; if (!isInEscapedRange(interpretedRange)) { interpretedRange.Text = interpretThe(matcher.group(), aDateTime); fInterpretedRanges.add(interpretedRange); } } format = format.replace(token, withCharDenotingAlreadyInterpreted(token)); } } /** * Return a temp placeholder string used to identify sections of fFormat * that have already been interpreted. The returned string is a list of "@" * characters, whose length is the same as aToken. */ private String withCharDenotingAlreadyInterpreted(String aToken) { StringBuilder result = new StringBuilder(); for (int idx = 1; idx <= aToken.length(); ++idx) { // any character that isn't interpreted, or a special regex char, // will do here // the fact that it's interpreted at location x is stored elsewhere; // this is meant only to prevent multiple interpretations of the // same text result.append("@"); } return result.toString(); } /** * Render the final output returned to the caller. */ private String produceFinalOutput() { StringBuilder result = new StringBuilder(); int idx = 0; while (idx < fFormat.length()) { String letter = nextLetter(idx); InterpretedRange interpretation = getInterpretation(idx); if (interpretation != null) { result.append(interpretation.Text); idx = interpretation.End; } else { if (!ESCAPE_CHAR.equals(letter)) { result.append(letter); } } ++idx; } return result.toString(); } private InterpretedRange getInterpretation(int aIdx) { InterpretedRange result = null; for (InterpretedRange interpretedRange : fInterpretedRanges) { if (interpretedRange.Start == aIdx) { result = interpretedRange; } } return result; } private String nextLetter(int aIdx) { return fFormat.substring(aIdx, aIdx + 1); } private String interpretThe(String aCurrentToken, DateTime aDateTime) { String result = EMPTY_STRING; if (YYYY.equals(aCurrentToken)) { result = valueStr(aDateTime.getYear()); } else if (YY.equals(aCurrentToken)) { result = noCentury(valueStr(aDateTime.getYear())); } else if (MMMM.equals(aCurrentToken)) { int month = aDateTime.getMonth(); result = fullMonth(month); } else if (MMM.equals(aCurrentToken)) { int month = aDateTime.getMonth(); result = firstThreeChars(fullMonth(month)); } else if (MM.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getMonth())); } else if (M.equals(aCurrentToken)) { result = valueStr(aDateTime.getMonth()); } else if (DD.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getDay())); } else if (D.equals(aCurrentToken)) { result = valueStr(aDateTime.getDay()); } else if (WWWW.equals(aCurrentToken)) { int weekday = aDateTime.getWeekDay(); result = fullWeekday(weekday); } else if (WWW.equals(aCurrentToken)) { int weekday = aDateTime.getWeekDay(); result = firstThreeChars(fullWeekday(weekday)); } else if (hh.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getHour())); } else if (h.equals(aCurrentToken)) { result = valueStr(aDateTime.getHour()); } else if (h12.equals(aCurrentToken)) { result = valueStr(twelveHourStyle(aDateTime.getHour())); } else if (hh12.equals(aCurrentToken)) { result = addLeadingZero(valueStr(twelveHourStyle(aDateTime.getHour()))); } else if (a.equals(aCurrentToken)) { int hour = aDateTime.getHour(); result = amPmIndicator(hour); } else if (mm.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getMinute())); } else if (m.equals(aCurrentToken)) { result = valueStr(aDateTime.getMinute()); } else if (ss.equals(aCurrentToken)) { result = addLeadingZero(valueStr(aDateTime.getSecond())); } else if (s.equals(aCurrentToken)) { result = valueStr(aDateTime.getSecond()); } else if (aCurrentToken.startsWith("f")) { Matcher matcher = FRACTIONALS.matcher(aCurrentToken); if (matcher.matches()) { String nanos = nanosWithLeadingZeroes(aDateTime.getNanoseconds()); int numDecimalsToShow = aCurrentToken.length(); result = firstNChars(nanos, numDecimalsToShow); } else { throw new IllegalArgumentException("Unknown token in date formatting pattern: " + aCurrentToken); } } else { throw new IllegalArgumentException("Unknown token in date formatting pattern: " + aCurrentToken); } return result; } private String valueStr(Object aItem) { String result = EMPTY_STRING; if (aItem != null) { result = String.valueOf(aItem); } return result; } private String noCentury(String aItem) { String result = EMPTY_STRING; if (DateUtils.isNotBlank(aItem)) { result = aItem.substring(2); } return result; } private String nanosWithLeadingZeroes(Integer aNanos) { String result = valueStr(aNanos); while (result.length() < 9) { result = "0" + result; } return result; } /** * Pad 0..9 with a leading zero. */ private String addLeadingZero(String aTimePart) { String result = aTimePart; if (DateUtils.isNotBlank(aTimePart) && aTimePart.length() == 1) { result = "0" + result; } return result; } private String firstThreeChars(String aText) { String result = aText; if (DateUtils.isNotBlank(aText) && aText.length() >= 3) { result = aText.substring(0, 3); } return result; } private String fullMonth(Integer aMonth) { String result = ""; if (aMonth != null) { if (fCustomLocalization != null) { result = lookupCustomMonthFor(aMonth); } else if (fLocale != null) { result = lookupMonthFor(aMonth); } else { throw new IllegalArgumentException( "Your date pattern requires either a Locale, or your own custom localizations for text:" + DateUtils.quote(fFormat)); } } return result; } private String lookupCustomMonthFor(Integer aMonth) { return fCustomLocalization.Months.get(aMonth - 1); } private String lookupMonthFor(Integer aMonth) { String result; if (!fMonths.containsKey(fLocale)) { List<String> months = new ArrayList<String>(); SimpleDateFormat format = new SimpleDateFormat("MMMM", fLocale); for (int idx = Calendar.JANUARY; idx <= Calendar.DECEMBER; ++idx) { Calendar firstDayOfMonth = new GregorianCalendar(); firstDayOfMonth.set(Calendar.YEAR, 2000); firstDayOfMonth.set(Calendar.MONTH, idx); firstDayOfMonth.set(Calendar.DAY_OF_MONTH, 15); String monthText = format.format(firstDayOfMonth.getTime()); months.add(monthText); } fMonths.put(fLocale, months); } result = fMonths.get(fLocale).get(aMonth - 1); // list is 0-based return result; } private String fullWeekday(Integer aWeekday) { String result = ""; if (aWeekday != null) { if (fCustomLocalization != null) { result = lookupCustomWeekdayFor(aWeekday); } else if (fLocale != null) { result = lookupWeekdayFor(aWeekday); } else { throw new IllegalArgumentException( "Your date pattern requires either a Locale, or your own custom localizations for text:" + DateUtils.quote(fFormat)); } } return result; } private String lookupCustomWeekdayFor(Integer aWeekday) { return fCustomLocalization.Weekdays.get(aWeekday - 1); } private String lookupWeekdayFor(Integer aWeekday) { String result; if (!fWeekdays.containsKey(fLocale)) { List<String> weekdays = new ArrayList<String>(); SimpleDateFormat format = new SimpleDateFormat("EEEE", fLocale); // Feb 8, 2009..Feb 14, 2009 runs Sun..Sat for (int idx = 8; idx <= 14; ++idx) { Calendar firstDayOfWeek = new GregorianCalendar(); firstDayOfWeek.set(Calendar.YEAR, 2009); firstDayOfWeek.set(Calendar.MONTH, 1); // month is 0-based firstDayOfWeek.set(Calendar.DAY_OF_MONTH, idx); String weekdayText = format.format(firstDayOfWeek.getTime()); weekdays.add(weekdayText); } fWeekdays.put(fLocale, weekdays); } result = fWeekdays.get(fLocale).get(aWeekday - 1); // list is 0-based return result; } private String firstNChars(String aText, int aN) { String result = aText; if (DateUtils.isNotBlank(aText) && aText.length() >= aN) { result = aText.substring(0, aN); } return result; } /** * Coerce the hour to match the number used in the 12-hour style. */ private Integer twelveHourStyle(Integer aHour) { Integer result = aHour; if (aHour != null) { if (aHour == 0) { result = 12; // eg 12:30 am } else if (aHour > 12) { result = aHour - 12; // eg 14:00 -> 2:00 } } return result; } private String amPmIndicator(Integer aHour) { String result = ""; if (aHour != null) { if (fCustomLocalization != null) { result = lookupCustomAmPmFor(aHour); } else if (fLocale != null) { result = lookupAmPmFor(aHour); } else { throw new IllegalArgumentException( "Your date pattern requires either a Locale, or your own custom localizations for text:" + DateUtils.quote(fFormat)); } } return result; } private String lookupCustomAmPmFor(Integer aHour) { String result; if (aHour < 12) { result = fCustomLocalization.AmPmIndicators.get(AM); } else { result = fCustomLocalization.AmPmIndicators.get(PM); } return result; } private String lookupAmPmFor(Integer aHour) { String result; if (!fAmPm.containsKey(fLocale)) { List<String> indicators = new ArrayList<String>(); indicators.add(getAmPmTextFor(6)); indicators.add(getAmPmTextFor(18)); fAmPm.put(fLocale, indicators); } if (aHour < 12) { result = fAmPm.get(fLocale).get(AM); } else { result = fAmPm.get(fLocale).get(PM); } return result; } private String getAmPmTextFor(Integer aHour) { SimpleDateFormat format = new SimpleDateFormat("a", fLocale); Calendar someDay = new GregorianCalendar(); someDay.set(Calendar.YEAR, 2000); someDay.set(Calendar.MONTH, 6); someDay.set(Calendar.DAY_OF_MONTH, 15); someDay.set(Calendar.HOUR_OF_DAY, aHour); return format.format(someDay.getTime()); } private void validateState() { if (!DateUtils.isNotBlank(fFormat)) { throw new IllegalArgumentException("DateTime format has no content."); } } }
24,666
0.594543
0.588624
664
36.147591
26.860123
118
false
false
0
0
0
0
0
0
0.551205
false
false
3
f0d5cfe58e3d9caa72bf74e1455ee09d0dfabe1c
28,346,784,172,300
3c320d4633fb67a94a10408ab7cfa7147702d9ad
/app/src/main/java/studio/sanguine/wallyschedule/DrawerMenuItem.java
70fe140b747dbd6c8d6bd2fcaa18c92dd3005d69
[ "Apache-2.0" ]
permissive
klyushnik/WallySchedule
https://github.com/klyushnik/WallySchedule
d2c0e93a966922d37aa89838c5f25a0b365c8bb7
f5da583f90b3cff70703f8cecc3d91da6dea1d3c
refs/heads/master
2020-03-18T11:15:28.458000
2018-05-24T04:46:00
2018-05-24T04:46:00
134,660,187
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package studio.sanguine.wallyschedule; import android.content.Context; import android.content.res.Resources; /** * Created by mafia on 11/2/2017. */ public class DrawerMenuItem { String icon = ""; String text = ""; public DrawerMenuItem(int position, Context context){ switch (position){ case 0: text = context.getString(R.string.drawer_taxCalculator); icon = context.getString(R.string.fa_calculator); break; case 1: text = "Department List"; icon = context.getString(R.string.fa_list); break; case 2: text = context.getString(R.string.drawer_callIn); icon = context.getString(R.string.fa_ambulance); break; case 3: text = context.getString(R.string.drawer_settings); icon = context.getString(R.string.fa_gear); break; case 4: text = context.getString(R.string.drawer_about); icon = context.getString(R.string.fa_star); break; default: text = "Unknown"; icon = context.getString(R.string.fa_gear); break; } } }
UTF-8
Java
1,309
java
DrawerMenuItem.java
Java
[ { "context": " android.content.res.Resources;\n\n/**\n * Created by mafia on 11/2/2017.\n */\n\npublic class DrawerMenuItem {\n", "end": 134, "score": 0.9967196583747864, "start": 129, "tag": "USERNAME", "value": "mafia" } ]
null
[]
package studio.sanguine.wallyschedule; import android.content.Context; import android.content.res.Resources; /** * Created by mafia on 11/2/2017. */ public class DrawerMenuItem { String icon = ""; String text = ""; public DrawerMenuItem(int position, Context context){ switch (position){ case 0: text = context.getString(R.string.drawer_taxCalculator); icon = context.getString(R.string.fa_calculator); break; case 1: text = "Department List"; icon = context.getString(R.string.fa_list); break; case 2: text = context.getString(R.string.drawer_callIn); icon = context.getString(R.string.fa_ambulance); break; case 3: text = context.getString(R.string.drawer_settings); icon = context.getString(R.string.fa_gear); break; case 4: text = context.getString(R.string.drawer_about); icon = context.getString(R.string.fa_star); break; default: text = "Unknown"; icon = context.getString(R.string.fa_gear); break; } } }
1,309
0.522536
0.513369
41
30.926828
21.830154
72
false
false
0
0
0
0
0
0
0.585366
false
false
3
372a9e1720d3bf3891dd2545260249d4c60d2f03
28,346,784,168,790
73876d705fae3d66933dc173041d1ed9e4a57700
/src/main/java/Server/Server.java
ff4c94228f276883fb38ca99dfaed79cee88abac
[]
no_license
LuisDiego10/Build-A-Tree-
https://github.com/LuisDiego10/Build-A-Tree-
60d0b30909943fedc272914587fe34f6915016a7
181f9eceda50edcb6591df2873a744b6fb1a6b26
refs/heads/main
2023-01-30T08:23:55.712000
2020-12-10T07:10:19
2020-12-10T07:10:19
312,950,455
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Server; import AVL.AVL; import AVL.AVLNode; import BST.BST; import BST.NodeBST; import BTree.BTreeNode; import BTree.Btree; import Challenge.Challenge; import Challenge.Token; import SPLAY.SPLAYTree; import Socket.SocketServer; import com.fasterxml.jackson.core.JsonProcessingException; import guru.nidi.graphviz.attribute.Font; import guru.nidi.graphviz.attribute.Rank; import guru.nidi.graphviz.engine.Format; import guru.nidi.graphviz.engine.Graphviz; import guru.nidi.graphviz.model.Graph; import guru.nidi.graphviz.model.MutableGraph; import guru.nidi.graphviz.model.Node; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.File; import java.io.IOException; import java.util.Random; import static guru.nidi.graphviz.attribute.Rank.RankDir.TOP_TO_BOTTOM; import static guru.nidi.graphviz.model.Factory.*; public class Server { private static Logger logger = LogManager.getLogger("Server"); static BST playerOneTree; static BST playerTwoTree; static BST playerThreeTree; static BST playerfourthTree; static int playerOnePoints; static int playerTwoPoints; static int playerThreePoints; static int playerfourthPoints; static Token[] tokens= new Token[5]; static Challenge actualChallenge; public static SocketServer serverSocket ; public static void main(String[] args) throws IOException { serverSocket = new SocketServer(); randomChallenge(false); for (int i = 0; i < 5; i++) { tokens[i]= newToken(); serverSocket.sendMsg(Factory.Serializer(tokens[i])); try { Thread.sleep(25); } catch (InterruptedException e) { logger.error("Error waiting for tick"+e); } } serverSocket.sendMsg(Factory.Serializer(actualChallenge)); boolean running=true; while (running){ if(actualChallenge.timeleft<0){ randomChallenge(true); serverSocket.sendMsg(Factory.Serializer(actualChallenge)); } try { Thread.sleep(15); } catch (InterruptedException e) { logger.error("Error waiting for tick"+e); } actualChallenge.timeleft--; for (int i = 0; i < 5; i++) { if (tokens[i]==null){ tokens[i]= newToken(); serverSocket.sendMsg(Factory.Serializer(tokens[i])); } } } } public static void randomChallenge(boolean flag){ if(flag){ BST[] trees={playerOneTree,playerTwoTree,playerThreeTree,playerfourthTree}; int[] puntajes={playerOnePoints,playerTwoPoints,playerThreePoints,playerfourthPoints}; int goal=0; for(int x=0;x<3;x++){ if (trees[x]!=null&&trees[x+1]!=null){ if (trees[x].getClass()==Btree.class){ if(trees[x+1].getClass()==Btree.class) { if (((Btree) trees[x + 1]).root.n >= ((Btree) trees[x]).root.n) { goal = x + 1; } } else if(trees[x+1].getClass()==AVL.class){ if (((AVL)trees[x+1]).root.height >= ((Btree)trees[x]).root.n) { goal=x+1; } } else{ if ((trees[x+1].maxDepth(trees[x+1].root) >= ((Btree)trees[x]).root.n)) { goal=x+1; } } } else if(trees[x].getClass()==AVL.class){ if(trees[x+1].getClass()==Btree.class) { if (((Btree) trees[x + 1]).root.n >= ((AVL) trees[x]).root.height) { goal = x + 1; } } else if(trees[x+1].getClass()==AVL.class){ if (((AVL)trees[x+1]).root.height >= ((AVL)trees[x]).root.height) { goal=x+1; } } else{ if ((trees[x+1].maxDepth(trees[x+1].root) >= ((AVL)trees[x]).root.height)) { goal=x+1; } } } else { if(trees[x+1].getClass()==Btree.class) { if (((Btree) trees[x + 1]).root.n >= (trees[x].maxDepth(trees[x].root))) { goal = x + 1; } } else if(trees[x+1].getClass()==AVL.class){ if (((AVL)trees[x+1]).root.height >= (trees[x].maxDepth(trees[x].root))) { goal=x+1; } } else{ if ((trees[x+1].maxDepth(trees[x+1].root) >= (trees[x].maxDepth(trees[x].root)))) { goal=x+1; } } } } } if(goal==0){ playerOnePoints+=actualChallenge.reward; }else if (goal==1){ playerTwoPoints+=actualChallenge.reward; }else if(goal==2){ playerThreePoints+=actualChallenge.reward; }else{ playerfourthPoints+=actualChallenge.reward; } } Random randomizer= new Random(); actualChallenge= new Challenge(randomizer.nextInt(5),randomizer.nextInt(4),randomizer.nextInt(3)+3); } public static Token newToken(){ Random randomizer= new Random(); String type=""; switch(randomizer.nextInt(4)+1){ case 1: type= String.valueOf(BST.class.getSimpleName()); break; case 2: type= String.valueOf(AVL.class.getSimpleName()); break; case 3: type= String.valueOf(SPLAYTree.class.getSimpleName()); break; case 4: type= String.valueOf(Btree.class.getSimpleName()); break; } Token newToken=new Token(); newToken.type=type; newToken.value=randomizer.nextInt(40); return newToken; } public static void playToken(Token token){ switch (token.player){ case 1: playerOneTree=checkTree(playerOneTree,token); try{ if (playerOneTree!=null){ if (playerOneTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerOneTree).root.n & !((Btree)playerOneTree).root.leaf ) { playerOnePoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerOneTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerOneTree).root.height) { playerOnePoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerOneTree.maxDepth(playerOneTree.root)) { playerOnePoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree=playerOneTree; grafics.points=playerOnePoints; grafics.player ="playerOneTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; case 2: playerTwoTree=checkTree(playerTwoTree,token); try { if (playerTwoTree != null) { if (playerTwoTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerTwoTree).root.n & !((Btree)playerTwoTree).root.leaf ) { playerTwoPoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerThreeTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerTwoTree).root.height) { playerTwoPoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerTwoTree.maxDepth(playerTwoTree.root)) { playerTwoPoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree = playerTwoTree; grafics.points=playerTwoPoints; grafics.player = "playerTwoTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; case 3: playerThreeTree=checkTree(playerThreeTree,token); try { if (playerThreeTree != null) { if (playerThreeTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerThreeTree).root.n & !((Btree)playerThreeTree).root.leaf ) { playerThreePoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerThreeTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerThreeTree).root.height) { playerThreePoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerThreeTree.maxDepth(playerThreeTree.root)) { playerThreePoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree = playerThreeTree; grafics.points=playerThreePoints; grafics.player = "playerThreeTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; case 4: playerfourthTree=checkTree(playerfourthTree,token); try { if (playerfourthTree != null) { if (playerfourthTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerfourthTree).root.n & !((Btree)playerfourthTree).root.leaf ) { playerfourthPoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerfourthTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerfourthTree).root.height) { playerfourthPoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerfourthTree.maxDepth(playerfourthTree.root)) { playerfourthPoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree = playerfourthTree; grafics.points=playerfourthPoints; grafics.player = "playerFourthTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; } } public static BST checkTree(BST playerTree, Token token){ if (playerTree != null){ if (playerTree.getClass().getSimpleName().equals(token.type)) { if(playerTree.getClass()==BST.class){ playerTree.insert(token.value); }else if(playerTree.getClass()== Btree.class){ playerTree.insertB(token.value); }else if(playerTree.getClass()== AVL.class){ playerTree.insertAVL(token.value); }else{ playerTree.insertSplay(token.value); } }else{ playerTree=null; } }else{ if(token.type.equals(BST.class.getSimpleName())){ playerTree=new BST(); playerTree.insert(token.value); }else if(token.type.equals(Btree.class.getSimpleName())){ playerTree=new Btree(2); playerTree.insertB(token.value); }else if(token.type.equals(AVL.class.getSimpleName())){ playerTree=new AVL(); playerTree.insertAVL(token.value); }else{ playerTree=new SPLAYTree(token.value); } } deleteToken(token); return playerTree; } public static void deleteToken(Token token){ for (int a=0;a<5;a++) { if(tokens[a].value==token.value & tokens[a].type.equals(token.type)){ tokens[a]=newToken(); try { serverSocket.sendMsg(Factory.Serializer(tokens[a])); } catch (JsonProcessingException e) { logger.error("error serilizing a new token"+e); } } } } }
UTF-8
Java
15,015
java
Server.java
Java
[ { "context": ";\n grafics.player = \"playerTwoTree\";\n grafics.start();\n ", "end": 9691, "score": 0.9221923351287842, "start": 9684, "tag": "USERNAME", "value": "TwoTree" }, { "context": ";\n grafics.player = \"playerThreeTree\";\n grafics.start();\n ", "end": 11334, "score": 0.6028863191604614, "start": 11325, "tag": "USERNAME", "value": "ThreeTree" } ]
null
[]
package Server; import AVL.AVL; import AVL.AVLNode; import BST.BST; import BST.NodeBST; import BTree.BTreeNode; import BTree.Btree; import Challenge.Challenge; import Challenge.Token; import SPLAY.SPLAYTree; import Socket.SocketServer; import com.fasterxml.jackson.core.JsonProcessingException; import guru.nidi.graphviz.attribute.Font; import guru.nidi.graphviz.attribute.Rank; import guru.nidi.graphviz.engine.Format; import guru.nidi.graphviz.engine.Graphviz; import guru.nidi.graphviz.model.Graph; import guru.nidi.graphviz.model.MutableGraph; import guru.nidi.graphviz.model.Node; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.File; import java.io.IOException; import java.util.Random; import static guru.nidi.graphviz.attribute.Rank.RankDir.TOP_TO_BOTTOM; import static guru.nidi.graphviz.model.Factory.*; public class Server { private static Logger logger = LogManager.getLogger("Server"); static BST playerOneTree; static BST playerTwoTree; static BST playerThreeTree; static BST playerfourthTree; static int playerOnePoints; static int playerTwoPoints; static int playerThreePoints; static int playerfourthPoints; static Token[] tokens= new Token[5]; static Challenge actualChallenge; public static SocketServer serverSocket ; public static void main(String[] args) throws IOException { serverSocket = new SocketServer(); randomChallenge(false); for (int i = 0; i < 5; i++) { tokens[i]= newToken(); serverSocket.sendMsg(Factory.Serializer(tokens[i])); try { Thread.sleep(25); } catch (InterruptedException e) { logger.error("Error waiting for tick"+e); } } serverSocket.sendMsg(Factory.Serializer(actualChallenge)); boolean running=true; while (running){ if(actualChallenge.timeleft<0){ randomChallenge(true); serverSocket.sendMsg(Factory.Serializer(actualChallenge)); } try { Thread.sleep(15); } catch (InterruptedException e) { logger.error("Error waiting for tick"+e); } actualChallenge.timeleft--; for (int i = 0; i < 5; i++) { if (tokens[i]==null){ tokens[i]= newToken(); serverSocket.sendMsg(Factory.Serializer(tokens[i])); } } } } public static void randomChallenge(boolean flag){ if(flag){ BST[] trees={playerOneTree,playerTwoTree,playerThreeTree,playerfourthTree}; int[] puntajes={playerOnePoints,playerTwoPoints,playerThreePoints,playerfourthPoints}; int goal=0; for(int x=0;x<3;x++){ if (trees[x]!=null&&trees[x+1]!=null){ if (trees[x].getClass()==Btree.class){ if(trees[x+1].getClass()==Btree.class) { if (((Btree) trees[x + 1]).root.n >= ((Btree) trees[x]).root.n) { goal = x + 1; } } else if(trees[x+1].getClass()==AVL.class){ if (((AVL)trees[x+1]).root.height >= ((Btree)trees[x]).root.n) { goal=x+1; } } else{ if ((trees[x+1].maxDepth(trees[x+1].root) >= ((Btree)trees[x]).root.n)) { goal=x+1; } } } else if(trees[x].getClass()==AVL.class){ if(trees[x+1].getClass()==Btree.class) { if (((Btree) trees[x + 1]).root.n >= ((AVL) trees[x]).root.height) { goal = x + 1; } } else if(trees[x+1].getClass()==AVL.class){ if (((AVL)trees[x+1]).root.height >= ((AVL)trees[x]).root.height) { goal=x+1; } } else{ if ((trees[x+1].maxDepth(trees[x+1].root) >= ((AVL)trees[x]).root.height)) { goal=x+1; } } } else { if(trees[x+1].getClass()==Btree.class) { if (((Btree) trees[x + 1]).root.n >= (trees[x].maxDepth(trees[x].root))) { goal = x + 1; } } else if(trees[x+1].getClass()==AVL.class){ if (((AVL)trees[x+1]).root.height >= (trees[x].maxDepth(trees[x].root))) { goal=x+1; } } else{ if ((trees[x+1].maxDepth(trees[x+1].root) >= (trees[x].maxDepth(trees[x].root)))) { goal=x+1; } } } } } if(goal==0){ playerOnePoints+=actualChallenge.reward; }else if (goal==1){ playerTwoPoints+=actualChallenge.reward; }else if(goal==2){ playerThreePoints+=actualChallenge.reward; }else{ playerfourthPoints+=actualChallenge.reward; } } Random randomizer= new Random(); actualChallenge= new Challenge(randomizer.nextInt(5),randomizer.nextInt(4),randomizer.nextInt(3)+3); } public static Token newToken(){ Random randomizer= new Random(); String type=""; switch(randomizer.nextInt(4)+1){ case 1: type= String.valueOf(BST.class.getSimpleName()); break; case 2: type= String.valueOf(AVL.class.getSimpleName()); break; case 3: type= String.valueOf(SPLAYTree.class.getSimpleName()); break; case 4: type= String.valueOf(Btree.class.getSimpleName()); break; } Token newToken=new Token(); newToken.type=type; newToken.value=randomizer.nextInt(40); return newToken; } public static void playToken(Token token){ switch (token.player){ case 1: playerOneTree=checkTree(playerOneTree,token); try{ if (playerOneTree!=null){ if (playerOneTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerOneTree).root.n & !((Btree)playerOneTree).root.leaf ) { playerOnePoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerOneTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerOneTree).root.height) { playerOnePoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerOneTree.maxDepth(playerOneTree.root)) { playerOnePoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree=playerOneTree; grafics.points=playerOnePoints; grafics.player ="playerOneTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; case 2: playerTwoTree=checkTree(playerTwoTree,token); try { if (playerTwoTree != null) { if (playerTwoTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerTwoTree).root.n & !((Btree)playerTwoTree).root.leaf ) { playerTwoPoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerThreeTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerTwoTree).root.height) { playerTwoPoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerTwoTree.maxDepth(playerTwoTree.root)) { playerTwoPoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree = playerTwoTree; grafics.points=playerTwoPoints; grafics.player = "playerTwoTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; case 3: playerThreeTree=checkTree(playerThreeTree,token); try { if (playerThreeTree != null) { if (playerThreeTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerThreeTree).root.n & !((Btree)playerThreeTree).root.leaf ) { playerThreePoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerThreeTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerThreeTree).root.height) { playerThreePoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerThreeTree.maxDepth(playerThreeTree.root)) { playerThreePoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree = playerThreeTree; grafics.points=playerThreePoints; grafics.player = "playerThreeTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; case 4: playerfourthTree=checkTree(playerfourthTree,token); try { if (playerfourthTree != null) { if (playerfourthTree.getClass()==Btree.class){ if (actualChallenge.deep == ((Btree)playerfourthTree).root.n & !((Btree)playerfourthTree).root.leaf ) { playerfourthPoints = +actualChallenge.reward; randomChallenge(false); } }else if(playerfourthTree.getClass()==AVL.class){ if (actualChallenge.deep == ((AVL)playerfourthTree).root.height) { playerfourthPoints = +actualChallenge.reward; randomChallenge(false); } }else { if (actualChallenge.deep == playerfourthTree.maxDepth(playerfourthTree.root)) { playerfourthPoints = +actualChallenge.reward; randomChallenge(false); } } TestGrafics grafics= new TestGrafics(); grafics.playerTree = playerfourthTree; grafics.points=playerfourthPoints; grafics.player = "playerFourthTree"; grafics.start(); } } catch (Exception e) { logger.error("Error calling the grapich function"+e); } break; } } public static BST checkTree(BST playerTree, Token token){ if (playerTree != null){ if (playerTree.getClass().getSimpleName().equals(token.type)) { if(playerTree.getClass()==BST.class){ playerTree.insert(token.value); }else if(playerTree.getClass()== Btree.class){ playerTree.insertB(token.value); }else if(playerTree.getClass()== AVL.class){ playerTree.insertAVL(token.value); }else{ playerTree.insertSplay(token.value); } }else{ playerTree=null; } }else{ if(token.type.equals(BST.class.getSimpleName())){ playerTree=new BST(); playerTree.insert(token.value); }else if(token.type.equals(Btree.class.getSimpleName())){ playerTree=new Btree(2); playerTree.insertB(token.value); }else if(token.type.equals(AVL.class.getSimpleName())){ playerTree=new AVL(); playerTree.insertAVL(token.value); }else{ playerTree=new SPLAYTree(token.value); } } deleteToken(token); return playerTree; } public static void deleteToken(Token token){ for (int a=0;a<5;a++) { if(tokens[a].value==token.value & tokens[a].type.equals(token.type)){ tokens[a]=newToken(); try { serverSocket.sendMsg(Factory.Serializer(tokens[a])); } catch (JsonProcessingException e) { logger.error("error serilizing a new token"+e); } } } } }
15,015
0.462338
0.458009
354
41.415253
26.283976
131
false
false
0
0
0
0
0
0
0.50565
false
false
3
f37b4f196d71fa609c7b1769b8315b0d9165ad7f
11,321,533,815,912
213be82bec0d27f5d5bd3b2fc96789a9728787ae
/src/LeetCode/CompanyBased/Facebook/P_236_LowestCommonAncestorOfABinaryTree.java
8b63d613d32c5d0d3037663ae926e3f36de3d4d4
[]
no_license
nikhilbagde/HackerRank2017
https://github.com/nikhilbagde/HackerRank2017
e1a2a60f86ba85fe2f4281f4d71c0292003b2985
0465569593531e64d48370be4b8fd5fc9b43027d
refs/heads/master
2022-03-13T05:42:23.469000
2022-03-07T06:10:33
2022-03-07T06:10:33
79,274,108
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package LeetCode.CompanyBased.Facebook; import java.util.ArrayList; import java.util.List; public class P_236_LowestCommonAncestorOfABinaryTree { static List<TreeNode> pList; static List<TreeNode> qList; public static void main(String[] args) { /* _______3______ / \ ___5__ ___1__ / \ / \ 6 _2 0 8 / \ 7 4 */ TreeNode root = new TreeNode(3); root.left = new TreeNode(5); root.left.left = new TreeNode(6, null,null); root.left.right = new TreeNode(2, null,null); root.right = new TreeNode(1); root.right.left = new TreeNode(0, new TreeNode(7,null, null), new TreeNode(4, null, null)); root.right.right = new TreeNode(8, null, null); TreeNode result = lowestCommonAncestor_1( root, new TreeNode(7), new TreeNode(8)); } /** * The very simple idea is to see where the two values are compared with root: * * Both values are on the left, then LCA is on the left * Both values are on the right, then LCA is on the right * One on the left and one on the right means that LCA is the current root node. * * We may recognize that we should only need to search the entire tree once to find p and q. We should then * be able to "bubble up" the findings to earlier nodes in the stack. The basic logic is the same as the earlier * solution. * We recurse through the entire tree with a function called commonAncestor(TreeNode root, * TreeNode p, Tree Node q). This function returns values as follows: * Returns p, if root's subtree includes p (and not q). * Returns q, if root's subtree includes q (and not p). * Returns null, if neither p nor q are in root's subtree. * Else, returns the common ancestor of p and q. */ public static TreeNode lowestCommonAncestor_1(TreeNode root, TreeNode p, TreeNode q){ if(root==null) return null; if(root.val == p.val || root.val == q.val) return root; //how does TreeNode object equality works? should be .val == //above step can be combined as /* if(root ==null || root.val == p.val || root.val == q.val) return root; */ TreeNode left = lowestCommonAncestor_1(root.left, p, q); TreeNode right = lowestCommonAncestor_1(root.right, p, q); if(left == null && right == null){ return null; } else if( left!=null && right!=null){ return root; } else if( left==null && right!=null){ return right; } else { //left !=null && right==null return left; } } public static TreeNode lowestCommonAncestor_2(TreeNode root, TreeNode p, TreeNode q){ backtrack(root, p, q, new ArrayList<>()); for (int i = 0; i < Math.min(pList.size(), qList.size()) ; i++) { if(pList.get(i).val == qList.get(i).val) return pList.get(i); } return null; } public static void backtrack(TreeNode root, TreeNode p, TreeNode q, List<TreeNode> list){ if(root==null) return; list.add(root); if(root.val == p.val) pList = list; if(root.val == q.val) qList = list; backtrack(root.left, p, q, list); backtrack(root.right, p,q , list); } private static class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val = val; } TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left = left; this.right = right; } } }
UTF-8
Java
3,751
java
P_236_LowestCommonAncestorOfABinaryTree.java
Java
[]
null
[]
package LeetCode.CompanyBased.Facebook; import java.util.ArrayList; import java.util.List; public class P_236_LowestCommonAncestorOfABinaryTree { static List<TreeNode> pList; static List<TreeNode> qList; public static void main(String[] args) { /* _______3______ / \ ___5__ ___1__ / \ / \ 6 _2 0 8 / \ 7 4 */ TreeNode root = new TreeNode(3); root.left = new TreeNode(5); root.left.left = new TreeNode(6, null,null); root.left.right = new TreeNode(2, null,null); root.right = new TreeNode(1); root.right.left = new TreeNode(0, new TreeNode(7,null, null), new TreeNode(4, null, null)); root.right.right = new TreeNode(8, null, null); TreeNode result = lowestCommonAncestor_1( root, new TreeNode(7), new TreeNode(8)); } /** * The very simple idea is to see where the two values are compared with root: * * Both values are on the left, then LCA is on the left * Both values are on the right, then LCA is on the right * One on the left and one on the right means that LCA is the current root node. * * We may recognize that we should only need to search the entire tree once to find p and q. We should then * be able to "bubble up" the findings to earlier nodes in the stack. The basic logic is the same as the earlier * solution. * We recurse through the entire tree with a function called commonAncestor(TreeNode root, * TreeNode p, Tree Node q). This function returns values as follows: * Returns p, if root's subtree includes p (and not q). * Returns q, if root's subtree includes q (and not p). * Returns null, if neither p nor q are in root's subtree. * Else, returns the common ancestor of p and q. */ public static TreeNode lowestCommonAncestor_1(TreeNode root, TreeNode p, TreeNode q){ if(root==null) return null; if(root.val == p.val || root.val == q.val) return root; //how does TreeNode object equality works? should be .val == //above step can be combined as /* if(root ==null || root.val == p.val || root.val == q.val) return root; */ TreeNode left = lowestCommonAncestor_1(root.left, p, q); TreeNode right = lowestCommonAncestor_1(root.right, p, q); if(left == null && right == null){ return null; } else if( left!=null && right!=null){ return root; } else if( left==null && right!=null){ return right; } else { //left !=null && right==null return left; } } public static TreeNode lowestCommonAncestor_2(TreeNode root, TreeNode p, TreeNode q){ backtrack(root, p, q, new ArrayList<>()); for (int i = 0; i < Math.min(pList.size(), qList.size()) ; i++) { if(pList.get(i).val == qList.get(i).val) return pList.get(i); } return null; } public static void backtrack(TreeNode root, TreeNode p, TreeNode q, List<TreeNode> list){ if(root==null) return; list.add(root); if(root.val == p.val) pList = list; if(root.val == q.val) qList = list; backtrack(root.left, p, q, list); backtrack(root.right, p,q , list); } private static class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val = val; } TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left = left; this.right = right; } } }
3,751
0.571847
0.564116
103
35.407768
30.625973
140
false
false
0
0
0
0
0
0
0.883495
false
false
3
e0c097d1272cb93b75a922d14b892d9ada6e8483
30,872,224,937,247
800ecd5fe0bd61df22f955c96c3b350f4a03a657
/odata-core/src/main/java/bingo/odata/format/json/JsonComplexObjectReader.java
a3bac3b1270fab306b5c7f6f0b918a1419b73d02
[ "Apache-2.0" ]
permissive
vijayvani/bingo-odata
https://github.com/vijayvani/bingo-odata
86b3e8eaba3d0ad08d20ba07f93be0e97a4f50f7
7502a56152fb2aca2e7d515b15cf51ae985b8985
refs/heads/master
2020-05-16T08:40:22.753000
2013-08-30T07:05:13
2013-08-30T07:05:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package bingo.odata.format.json; import bingo.lang.exceptions.NotImplementedException; import bingo.lang.json.JSONObject; import bingo.odata.ODataReaderContext; import bingo.odata.format.ODataJsonReader; import bingo.odata.model.ODataComplexObject; public class JsonComplexObjectReader extends ODataJsonReader<ODataComplexObject> { @Override protected ODataComplexObject read(ODataReaderContext context, JSONObject json) { throw new NotImplementedException(); } }
UTF-8
Java
472
java
JsonComplexObjectReader.java
Java
[]
null
[]
package bingo.odata.format.json; import bingo.lang.exceptions.NotImplementedException; import bingo.lang.json.JSONObject; import bingo.odata.ODataReaderContext; import bingo.odata.format.ODataJsonReader; import bingo.odata.model.ODataComplexObject; public class JsonComplexObjectReader extends ODataJsonReader<ODataComplexObject> { @Override protected ODataComplexObject read(ODataReaderContext context, JSONObject json) { throw new NotImplementedException(); } }
472
0.841102
0.841102
15
30.466667
27.133907
82
false
false
0
0
0
0
0
0
0.866667
false
false
3
593392987b17da031fbcaac1d9b08e0e6dd58e77
15,925,738,754,110
b8108ba80e8cab81cae3958ee8ded2fd69e38701
/zhihuiduo-core/src/com/zwo/modules/ad/service/IAdPostionService.java
c54925cc33ce98965fc9c5fdd47633acca67903c
[]
no_license
huangjixin/zhiwo-mall
https://github.com/huangjixin/zhiwo-mall
585418b3efad818ebd572a1377566742bb22e927
3f8b8ff1445749fe06afc2dd45ef6b2524415cb6
refs/heads/master
2022-07-14T20:03:43.572000
2018-10-26T03:38:09
2018-10-26T03:38:09
94,043,571
0
4
null
false
2022-07-01T02:11:10
2017-06-12T01:31:47
2018-10-26T03:38:16
2018-10-26T03:38:14
55,825
0
3
2
Java
false
false
/** * */ package com.zwo.modules.ad.service; import com.zwo.modules.ad.domain.AdPostion; import com.zwotech.modules.core.service.IBaseService; /** * @author hjx * */ public interface IAdPostionService extends IBaseService<AdPostion> { }
UTF-8
Java
261
java
IAdPostionService.java
Java
[ { "context": "ules.core.service.IBaseService;\r\n\r\n/**\r\n * @author hjx\r\n *\r\n */\r\npublic interface IAdPostionService exte", "end": 175, "score": 0.999659538269043, "start": 172, "tag": "USERNAME", "value": "hjx" } ]
null
[]
/** * */ package com.zwo.modules.ad.service; import com.zwo.modules.ad.domain.AdPostion; import com.zwotech.modules.core.service.IBaseService; /** * @author hjx * */ public interface IAdPostionService extends IBaseService<AdPostion> { }
261
0.689655
0.689655
15
15.4
21.902206
68
false
false
0
0
0
0
0
0
0.2
false
false
3
df37da24c30f44f60674b9ccab9f91457e72e6a8
11,897,059,428,050
af94615e81acd6fe83f2eadadefbe01d6ee2e450
/src/com/hnqjxj/libd2s/CharacterClass.java
fb41a43d2e63b03d0df435c660f31d1f61ad667c
[]
no_license
inrg/libd2s
https://github.com/inrg/libd2s
d9c2fc51f6dd8944678749324f5292690770d58f
fae9a867a7ef4f8bd79202c771f3ff273757dc24
refs/heads/master
2020-06-14T04:31:40.503000
2018-09-07T08:48:16
2018-09-07T08:48:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hnqjxj.libd2s; public class CharacterClass { private int classCode; public CharacterClass(int classCode) { this.classCode = classCode; } public String getName() { switch (classCode) { case 0: return "Amazon"; case 1: return "Sorceress"; case 2: return "Necromancer"; case 3: return "Paladin"; case 4: return "Barbarian"; case 5: return "Druid"; case 6: return "Assassin"; default: return "unknown character class"; } } @Override public String toString() { return getName(); } }
UTF-8
Java
550
java
CharacterClass.java
Java
[]
null
[]
package com.hnqjxj.libd2s; public class CharacterClass { private int classCode; public CharacterClass(int classCode) { this.classCode = classCode; } public String getName() { switch (classCode) { case 0: return "Amazon"; case 1: return "Sorceress"; case 2: return "Necromancer"; case 3: return "Paladin"; case 4: return "Barbarian"; case 5: return "Druid"; case 6: return "Assassin"; default: return "unknown character class"; } } @Override public String toString() { return getName(); } }
550
0.656364
0.641818
35
14.714286
11.000186
39
false
false
0
0
0
0
0
0
1.942857
false
false
3
e8a297cf598483b29db45861c3ca6e4d87ba3e6d
11,458,972,773,784
b1a1fe02ae0c19bcf2d35ae8b5bc745ce76b3802
/org.erlide.ui/src/org/erlide/debug/ui/actions/ErlangTracingAction.java
8b055a64e32b1ca0bc5b8c41ba279e068b0cb566
[]
no_license
liubin66/erlide
https://github.com/liubin66/erlide
77d26069cd8df07cdb3916a18f6594ce07728ee6
25b8ea1c775c42e5c5dba4e792be146ce51ee8a9
refs/heads/master
2021-01-17T22:26:09.790000
2012-02-03T05:20:28
2012-02-03T05:20:28
3,363,877
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.erlide.debug.ui.actions; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IProcess; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.erlide.launch.debug.model.ErlangDebugElement; public class ErlangTracingAction implements IWorkbenchWindowActionDelegate { private ILaunch fLaunch; private ErlangTracingDialog fDialog; @Override public void dispose() { } @Override public void init(final IWorkbenchWindow window) { fDialog = new ErlangTracingDialog(window.getShell()); } @Override public void run(final IAction action) { if (fLaunch != null) { fDialog.initializeFrom(fLaunch); fDialog.open(); } } @Override public void selectionChanged(final IAction action, final ISelection selection) { fLaunch = null; if (selection instanceof IStructuredSelection) { final IStructuredSelection ss = (IStructuredSelection) selection; for (final Object o : ss.toArray()) { if (o instanceof ErlangDebugElement) { final ErlangDebugElement d = (ErlangDebugElement) o; fLaunch = d.getLaunch(); } else if (o instanceof ILaunch) { fLaunch = (ILaunch) o; } else if (o instanceof IProcess) { final IProcess p = (IProcess) o; fLaunch = p.getLaunch(); } } } } }
UTF-8
Java
1,718
java
ErlangTracingAction.java
Java
[]
null
[]
package org.erlide.debug.ui.actions; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IProcess; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.erlide.launch.debug.model.ErlangDebugElement; public class ErlangTracingAction implements IWorkbenchWindowActionDelegate { private ILaunch fLaunch; private ErlangTracingDialog fDialog; @Override public void dispose() { } @Override public void init(final IWorkbenchWindow window) { fDialog = new ErlangTracingDialog(window.getShell()); } @Override public void run(final IAction action) { if (fLaunch != null) { fDialog.initializeFrom(fLaunch); fDialog.open(); } } @Override public void selectionChanged(final IAction action, final ISelection selection) { fLaunch = null; if (selection instanceof IStructuredSelection) { final IStructuredSelection ss = (IStructuredSelection) selection; for (final Object o : ss.toArray()) { if (o instanceof ErlangDebugElement) { final ErlangDebugElement d = (ErlangDebugElement) o; fLaunch = d.getLaunch(); } else if (o instanceof ILaunch) { fLaunch = (ILaunch) o; } else if (o instanceof IProcess) { final IProcess p = (IProcess) o; fLaunch = p.getLaunch(); } } } } }
1,718
0.63213
0.63213
54
30.814816
22.677345
77
false
false
0
0
0
0
0
0
0.407407
false
false
3
db18b520a9579614b72688543be3d4da58fe142f
30,416,958,413,234
17eaef897d99260b689a32cb723484e4159b4813
/src/main/java/com/workflow/entity/CustomSpringConfigurator.java
645897c778b3120c97902b11a475fd8d4c31581c
[ "MIT" ]
permissive
grath10/Activiti-Modeller
https://github.com/grath10/Activiti-Modeller
b8e992fe53ab919ae9ed4cf4ef3765477cb141b2
5a56123fe40adeaab90ad36ca2d153a11bc14b7b
refs/heads/master
2022-10-01T05:58:21.601000
2022-09-07T01:00:51
2022-09-07T01:00:51
124,818,064
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.workflow.entity; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.ApplicationContextAware; import javax.websocket.server.ServerEndpointConfig; public class CustomSpringConfigurator extends ServerEndpointConfig.Configurator implements ApplicationContextAware { private static volatile BeanFactory context; @Override public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws BeansException { CustomSpringConfigurator.context = applicationContext; } @Override public <T> T getEndpointInstance(Class<T> clazz) throws InstantiationException { return context.getBean(clazz); } }
UTF-8
Java
773
java
CustomSpringConfigurator.java
Java
[]
null
[]
package com.workflow.entity; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.ApplicationContextAware; import javax.websocket.server.ServerEndpointConfig; public class CustomSpringConfigurator extends ServerEndpointConfig.Configurator implements ApplicationContextAware { private static volatile BeanFactory context; @Override public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws BeansException { CustomSpringConfigurator.context = applicationContext; } @Override public <T> T getEndpointInstance(Class<T> clazz) throws InstantiationException { return context.getBean(clazz); } }
773
0.812419
0.812419
21
35.809525
37.750584
128
false
false
0
0
0
0
0
0
0.380952
false
false
3
64844ed600a58f9a51128469e17bfd36048ea04a
17,128,329,592,350
56456387c8a2ff1062f34780b471712cc2a49b71
/com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener.java
18830b6c6c6b22ce37dcff1edf9c6028644a550f
[]
no_license
nendraharyo/presensimahasiswa-sourcecode
https://github.com/nendraharyo/presensimahasiswa-sourcecode
55d4b8e9f6968eaf71a2ea002e0e7f08d16c5a50
890fc86782e9b2b4748bdb9f3db946bfb830b252
refs/heads/master
2020-05-21T11:21:55.143000
2019-05-10T19:03:56
2019-05-10T19:03:56
186,022,425
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bumptech.glide.load.data.mediastore; import android.content.ContentResolver; import android.net.Uri; import android.text.TextUtils; import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.List; class ThumbnailStreamOpener { private static final FileService DEFAULT_SERVICE; private static final String TAG = "ThumbStreamOpener"; private final ArrayPool byteArrayPool; private final ContentResolver contentResolver; private final List parsers; private final ThumbnailQuery query; private final FileService service; static { FileService localFileService = new com/bumptech/glide/load/data/mediastore/FileService; localFileService.<init>(); DEFAULT_SERVICE = localFileService; } ThumbnailStreamOpener(List paramList, FileService paramFileService, ThumbnailQuery paramThumbnailQuery, ArrayPool paramArrayPool, ContentResolver paramContentResolver) { this.service = paramFileService; this.query = paramThumbnailQuery; this.byteArrayPool = paramArrayPool; this.contentResolver = paramContentResolver; this.parsers = paramList; } ThumbnailStreamOpener(List paramList, ThumbnailQuery paramThumbnailQuery, ArrayPool paramArrayPool, ContentResolver paramContentResolver) { this(paramList, localFileService, paramThumbnailQuery, paramArrayPool, paramContentResolver); } /* Error */ private String getPath(Uri paramUri) { // Byte code: // 0: aload_0 // 1: getfield 33 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:query Lcom/bumptech/glide/load/data/mediastore/ThumbnailQuery; // 4: astore_2 // 5: aload_2 // 6: aload_1 // 7: invokeinterface 47 2 0 // 12: astore_3 // 13: aload_3 // 14: ifnull +41 -> 55 // 17: aload_3 // 18: invokeinterface 53 1 0 // 23: istore 4 // 25: iload 4 // 27: ifeq +28 -> 55 // 30: iconst_0 // 31: istore 4 // 33: aconst_null // 34: astore_2 // 35: aload_3 // 36: iconst_0 // 37: invokeinterface 57 2 0 // 42: astore_2 // 43: aload_3 // 44: ifnull +9 -> 53 // 47: aload_3 // 48: invokeinterface 60 1 0 // 53: aload_2 // 54: areturn // 55: iconst_0 // 56: istore 4 // 58: aconst_null // 59: astore_2 // 60: aload_3 // 61: ifnull -8 -> 53 // 64: aload_3 // 65: invokeinterface 60 1 0 // 70: goto -17 -> 53 // 73: astore_2 // 74: aload_3 // 75: ifnull +9 -> 84 // 78: aload_3 // 79: invokeinterface 60 1 0 // 84: aload_2 // 85: athrow // Local variable table: // start length slot name signature // 0 86 0 this ThumbnailStreamOpener // 0 86 1 paramUri Uri // 4 56 2 localObject1 Object // 73 12 2 localObject2 Object // 12 67 3 localCursor android.database.Cursor // 23 34 4 bool boolean // Exception table: // from to target type // 17 23 73 finally // 36 42 73 finally } private boolean isValid(File paramFile) { FileService localFileService1 = this.service; boolean bool = localFileService1.exists(paramFile); if (bool) { long l1 = 0L; FileService localFileService2 = this.service; long l2 = localFileService2.length(paramFile); bool = l1 < l2; if (bool) { bool = true; } } for (;;) { return bool; bool = false; localFileService1 = null; } } /* Error */ int getOrientation(Uri paramUri) { // Byte code: // 0: aconst_null // 1: astore_2 // 2: aload_0 // 3: getfield 37 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:contentResolver Landroid/content/ContentResolver; // 6: astore_3 // 7: aload_3 // 8: aload_1 // 9: invokevirtual 75 android/content/ContentResolver:openInputStream (Landroid/net/Uri;)Ljava/io/InputStream; // 12: astore_2 // 13: aload_0 // 14: getfield 39 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:parsers Ljava/util/List; // 17: astore_3 // 18: aload_0 // 19: getfield 35 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:byteArrayPool Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool; // 22: astore 4 // 24: aload_3 // 25: aload_2 // 26: aload 4 // 28: invokestatic 81 com/bumptech/glide/load/ImageHeaderParserUtils:getOrientation (Ljava/util/List;Ljava/io/InputStream;Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool;)I // 31: istore 5 // 33: aload_2 // 34: ifnull +7 -> 41 // 37: aload_2 // 38: invokevirtual 84 java/io/InputStream:close ()V // 41: iload 5 // 43: ireturn // 44: astore_3 // 45: ldc 11 // 47: astore 4 // 49: iconst_3 // 50: istore 6 // 52: aload 4 // 54: iload 6 // 56: invokestatic 91 android/util/Log:isLoggable (Ljava/lang/String;I)Z // 59: istore 7 // 61: iload 7 // 63: ifeq +54 -> 117 // 66: ldc 11 // 68: astore 4 // 70: new 93 java/lang/StringBuilder // 73: astore 8 // 75: aload 8 // 77: invokespecial 94 java/lang/StringBuilder:<init> ()V // 80: ldc 96 // 82: astore 9 // 84: aload 8 // 86: aload 9 // 88: invokevirtual 100 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 91: astore 8 // 93: aload 8 // 95: aload_1 // 96: invokevirtual 103 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder; // 99: astore 8 // 101: aload 8 // 103: invokevirtual 107 java/lang/StringBuilder:toString ()Ljava/lang/String; // 106: astore 8 // 108: aload 4 // 110: aload 8 // 112: aload_3 // 113: invokestatic 111 android/util/Log:d (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I // 116: pop // 117: aload_2 // 118: ifnull +7 -> 125 // 121: aload_2 // 122: invokevirtual 84 java/io/InputStream:close ()V // 125: iconst_m1 // 126: istore 5 // 128: goto -87 -> 41 // 131: astore_3 // 132: aload_2 // 133: ifnull +7 -> 140 // 136: aload_2 // 137: invokevirtual 84 java/io/InputStream:close ()V // 140: aload_3 // 141: athrow // 142: astore_2 // 143: goto -102 -> 41 // 146: astore_3 // 147: goto -22 -> 125 // 150: astore_2 // 151: goto -11 -> 140 // 154: astore_3 // 155: goto -110 -> 45 // Local variable table: // start length slot name signature // 0 158 0 this ThumbnailStreamOpener // 0 158 1 paramUri Uri // 1 136 2 localInputStream InputStream // 142 1 2 localIOException1 java.io.IOException // 150 1 2 localIOException2 java.io.IOException // 6 19 3 localObject1 Object // 44 69 3 localNullPointerException NullPointerException // 131 10 3 localObject2 Object // 146 1 3 localIOException3 java.io.IOException // 154 1 3 localIOException4 java.io.IOException // 22 87 4 localObject3 Object // 31 96 5 i int // 50 5 6 j int // 59 3 7 bool boolean // 73 38 8 localObject4 Object // 82 5 9 str String // Exception table: // from to target type // 2 6 44 java/lang/NullPointerException // 8 12 44 java/lang/NullPointerException // 13 17 44 java/lang/NullPointerException // 18 22 44 java/lang/NullPointerException // 26 31 44 java/lang/NullPointerException // 2 6 131 finally // 8 12 131 finally // 13 17 131 finally // 18 22 131 finally // 26 31 131 finally // 54 59 131 finally // 70 73 131 finally // 75 80 131 finally // 86 91 131 finally // 95 99 131 finally // 101 106 131 finally // 112 117 131 finally // 37 41 142 java/io/IOException // 121 125 146 java/io/IOException // 136 140 150 java/io/IOException // 2 6 154 java/io/IOException // 8 12 154 java/io/IOException // 13 17 154 java/io/IOException // 18 22 154 java/io/IOException // 26 31 154 java/io/IOException } public InputStream open(Uri paramUri) { Object localObject1 = null; Object localObject2 = getPath(paramUri); boolean bool = TextUtils.isEmpty((CharSequence)localObject2); if (bool) {} for (;;) { return (InputStream)localObject1; Object localObject3 = this.service; localObject2 = ((FileService)localObject3).get((String)localObject2); bool = isValid((File)localObject2); if (!bool) { continue; } localObject2 = Uri.fromFile((File)localObject2); try { localObject1 = this.contentResolver; localObject1 = ((ContentResolver)localObject1).openInputStream((Uri)localObject2); } catch (NullPointerException localNullPointerException) { localObject3 = new java/io/FileNotFoundException; StringBuilder localStringBuilder = new java/lang/StringBuilder; localStringBuilder.<init>(); localObject2 = "NPE opening uri: " + paramUri + " -> " + localObject2; ((FileNotFoundException)localObject3).<init>((String)localObject2); throw ((FileNotFoundException)((FileNotFoundException)localObject3).initCause(localNullPointerException)); } } } } /* Location: C:\Users\haryo\Desktop\enjarify-master\presensi-enjarify.jar!\com\bumptech\glide\load\data\mediastore\ThumbnailStreamOpener.class * Java compiler version: 5 (49.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
9,843
java
ThumbnailStreamOpener.java
Java
[]
null
[]
package com.bumptech.glide.load.data.mediastore; import android.content.ContentResolver; import android.net.Uri; import android.text.TextUtils; import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.List; class ThumbnailStreamOpener { private static final FileService DEFAULT_SERVICE; private static final String TAG = "ThumbStreamOpener"; private final ArrayPool byteArrayPool; private final ContentResolver contentResolver; private final List parsers; private final ThumbnailQuery query; private final FileService service; static { FileService localFileService = new com/bumptech/glide/load/data/mediastore/FileService; localFileService.<init>(); DEFAULT_SERVICE = localFileService; } ThumbnailStreamOpener(List paramList, FileService paramFileService, ThumbnailQuery paramThumbnailQuery, ArrayPool paramArrayPool, ContentResolver paramContentResolver) { this.service = paramFileService; this.query = paramThumbnailQuery; this.byteArrayPool = paramArrayPool; this.contentResolver = paramContentResolver; this.parsers = paramList; } ThumbnailStreamOpener(List paramList, ThumbnailQuery paramThumbnailQuery, ArrayPool paramArrayPool, ContentResolver paramContentResolver) { this(paramList, localFileService, paramThumbnailQuery, paramArrayPool, paramContentResolver); } /* Error */ private String getPath(Uri paramUri) { // Byte code: // 0: aload_0 // 1: getfield 33 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:query Lcom/bumptech/glide/load/data/mediastore/ThumbnailQuery; // 4: astore_2 // 5: aload_2 // 6: aload_1 // 7: invokeinterface 47 2 0 // 12: astore_3 // 13: aload_3 // 14: ifnull +41 -> 55 // 17: aload_3 // 18: invokeinterface 53 1 0 // 23: istore 4 // 25: iload 4 // 27: ifeq +28 -> 55 // 30: iconst_0 // 31: istore 4 // 33: aconst_null // 34: astore_2 // 35: aload_3 // 36: iconst_0 // 37: invokeinterface 57 2 0 // 42: astore_2 // 43: aload_3 // 44: ifnull +9 -> 53 // 47: aload_3 // 48: invokeinterface 60 1 0 // 53: aload_2 // 54: areturn // 55: iconst_0 // 56: istore 4 // 58: aconst_null // 59: astore_2 // 60: aload_3 // 61: ifnull -8 -> 53 // 64: aload_3 // 65: invokeinterface 60 1 0 // 70: goto -17 -> 53 // 73: astore_2 // 74: aload_3 // 75: ifnull +9 -> 84 // 78: aload_3 // 79: invokeinterface 60 1 0 // 84: aload_2 // 85: athrow // Local variable table: // start length slot name signature // 0 86 0 this ThumbnailStreamOpener // 0 86 1 paramUri Uri // 4 56 2 localObject1 Object // 73 12 2 localObject2 Object // 12 67 3 localCursor android.database.Cursor // 23 34 4 bool boolean // Exception table: // from to target type // 17 23 73 finally // 36 42 73 finally } private boolean isValid(File paramFile) { FileService localFileService1 = this.service; boolean bool = localFileService1.exists(paramFile); if (bool) { long l1 = 0L; FileService localFileService2 = this.service; long l2 = localFileService2.length(paramFile); bool = l1 < l2; if (bool) { bool = true; } } for (;;) { return bool; bool = false; localFileService1 = null; } } /* Error */ int getOrientation(Uri paramUri) { // Byte code: // 0: aconst_null // 1: astore_2 // 2: aload_0 // 3: getfield 37 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:contentResolver Landroid/content/ContentResolver; // 6: astore_3 // 7: aload_3 // 8: aload_1 // 9: invokevirtual 75 android/content/ContentResolver:openInputStream (Landroid/net/Uri;)Ljava/io/InputStream; // 12: astore_2 // 13: aload_0 // 14: getfield 39 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:parsers Ljava/util/List; // 17: astore_3 // 18: aload_0 // 19: getfield 35 com/bumptech/glide/load/data/mediastore/ThumbnailStreamOpener:byteArrayPool Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool; // 22: astore 4 // 24: aload_3 // 25: aload_2 // 26: aload 4 // 28: invokestatic 81 com/bumptech/glide/load/ImageHeaderParserUtils:getOrientation (Ljava/util/List;Ljava/io/InputStream;Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool;)I // 31: istore 5 // 33: aload_2 // 34: ifnull +7 -> 41 // 37: aload_2 // 38: invokevirtual 84 java/io/InputStream:close ()V // 41: iload 5 // 43: ireturn // 44: astore_3 // 45: ldc 11 // 47: astore 4 // 49: iconst_3 // 50: istore 6 // 52: aload 4 // 54: iload 6 // 56: invokestatic 91 android/util/Log:isLoggable (Ljava/lang/String;I)Z // 59: istore 7 // 61: iload 7 // 63: ifeq +54 -> 117 // 66: ldc 11 // 68: astore 4 // 70: new 93 java/lang/StringBuilder // 73: astore 8 // 75: aload 8 // 77: invokespecial 94 java/lang/StringBuilder:<init> ()V // 80: ldc 96 // 82: astore 9 // 84: aload 8 // 86: aload 9 // 88: invokevirtual 100 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 91: astore 8 // 93: aload 8 // 95: aload_1 // 96: invokevirtual 103 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder; // 99: astore 8 // 101: aload 8 // 103: invokevirtual 107 java/lang/StringBuilder:toString ()Ljava/lang/String; // 106: astore 8 // 108: aload 4 // 110: aload 8 // 112: aload_3 // 113: invokestatic 111 android/util/Log:d (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I // 116: pop // 117: aload_2 // 118: ifnull +7 -> 125 // 121: aload_2 // 122: invokevirtual 84 java/io/InputStream:close ()V // 125: iconst_m1 // 126: istore 5 // 128: goto -87 -> 41 // 131: astore_3 // 132: aload_2 // 133: ifnull +7 -> 140 // 136: aload_2 // 137: invokevirtual 84 java/io/InputStream:close ()V // 140: aload_3 // 141: athrow // 142: astore_2 // 143: goto -102 -> 41 // 146: astore_3 // 147: goto -22 -> 125 // 150: astore_2 // 151: goto -11 -> 140 // 154: astore_3 // 155: goto -110 -> 45 // Local variable table: // start length slot name signature // 0 158 0 this ThumbnailStreamOpener // 0 158 1 paramUri Uri // 1 136 2 localInputStream InputStream // 142 1 2 localIOException1 java.io.IOException // 150 1 2 localIOException2 java.io.IOException // 6 19 3 localObject1 Object // 44 69 3 localNullPointerException NullPointerException // 131 10 3 localObject2 Object // 146 1 3 localIOException3 java.io.IOException // 154 1 3 localIOException4 java.io.IOException // 22 87 4 localObject3 Object // 31 96 5 i int // 50 5 6 j int // 59 3 7 bool boolean // 73 38 8 localObject4 Object // 82 5 9 str String // Exception table: // from to target type // 2 6 44 java/lang/NullPointerException // 8 12 44 java/lang/NullPointerException // 13 17 44 java/lang/NullPointerException // 18 22 44 java/lang/NullPointerException // 26 31 44 java/lang/NullPointerException // 2 6 131 finally // 8 12 131 finally // 13 17 131 finally // 18 22 131 finally // 26 31 131 finally // 54 59 131 finally // 70 73 131 finally // 75 80 131 finally // 86 91 131 finally // 95 99 131 finally // 101 106 131 finally // 112 117 131 finally // 37 41 142 java/io/IOException // 121 125 146 java/io/IOException // 136 140 150 java/io/IOException // 2 6 154 java/io/IOException // 8 12 154 java/io/IOException // 13 17 154 java/io/IOException // 18 22 154 java/io/IOException // 26 31 154 java/io/IOException } public InputStream open(Uri paramUri) { Object localObject1 = null; Object localObject2 = getPath(paramUri); boolean bool = TextUtils.isEmpty((CharSequence)localObject2); if (bool) {} for (;;) { return (InputStream)localObject1; Object localObject3 = this.service; localObject2 = ((FileService)localObject3).get((String)localObject2); bool = isValid((File)localObject2); if (!bool) { continue; } localObject2 = Uri.fromFile((File)localObject2); try { localObject1 = this.contentResolver; localObject1 = ((ContentResolver)localObject1).openInputStream((Uri)localObject2); } catch (NullPointerException localNullPointerException) { localObject3 = new java/io/FileNotFoundException; StringBuilder localStringBuilder = new java/lang/StringBuilder; localStringBuilder.<init>(); localObject2 = "NPE opening uri: " + paramUri + " -> " + localObject2; ((FileNotFoundException)localObject3).<init>((String)localObject2); throw ((FileNotFoundException)((FileNotFoundException)localObject3).initCause(localNullPointerException)); } } } } /* Location: C:\Users\haryo\Desktop\enjarify-master\presensi-enjarify.jar!\com\bumptech\glide\load\data\mediastore\ThumbnailStreamOpener.class * Java compiler version: 5 (49.0) * JD-Core Version: 0.7.1 */
9,843
0.618307
0.536117
299
31.923077
28.30373
188
false
false
0
0
0
0
0
0
1
false
false
3
07d09cbc58c3cfdebf79347189377f1f38e63fd7
17,128,329,590,643
d5fe83bad728d58d55ebdc0ed456ebefd2b34bb0
/app/src/main/java/com/example/spstore/BaseActivity.java
9413c33c0a71d42c8968c138b6fb4d95d02fd6ad
[]
no_license
minashokaran/sportstoreMvvm
https://github.com/minashokaran/sportstoreMvvm
bad35651e75977367026cc966bb779bef69691b3
0410061805b5174d1f5112eb92b4a7fb5ddf411c
refs/heads/master
2022-07-01T14:05:41.415000
2020-05-10T18:36:19
2020-05-10T18:36:19
262,838,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.spstore; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.snackbar.Snackbar; public abstract class BaseActivity extends AppCompatActivity { public abstract int getCoordinatorLayoutId(); public void showSnackBarMessage(String message) { Snackbar.make(findViewById(getCoordinatorLayoutId()), message, Snackbar.LENGTH_SHORT).show(); } }
UTF-8
Java
414
java
BaseActivity.java
Java
[]
null
[]
package com.example.spstore; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.snackbar.Snackbar; public abstract class BaseActivity extends AppCompatActivity { public abstract int getCoordinatorLayoutId(); public void showSnackBarMessage(String message) { Snackbar.make(findViewById(getCoordinatorLayoutId()), message, Snackbar.LENGTH_SHORT).show(); } }
414
0.785024
0.785024
14
28.571428
31.338507
101
false
false
0
0
0
0
0
0
0.5
false
false
3
63008779035b6fed0cf4bf170e831fdc4fb7b90b
28,887,950,087,111
dba3c4c8c9166d65fa9d9047d071b890ed7b4b71
/app/src/main/java/com/hacktx/bevobucksandroid/service/WearListenerService.java
84bae8f0b3369f542dd3dced68d80fdc85db9e43
[]
no_license
ThomasGaubert/BevoBucksAndroid
https://github.com/ThomasGaubert/BevoBucksAndroid
1088d758f816e44a97d1a71b65facc3f9e4893c3
adc1d959eae6dc18f8974787116a29a99f048da2
refs/heads/master
2018-05-14T01:41:49.273000
2014-10-19T15:42:04
2014-10-19T15:42:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hacktx.bevobucksandroid.service; import android.content.Intent; import com.google.android.gms.wearable.MessageEvent; import com.google.android.gms.wearable.WearableListenerService; import com.hacktx.bevobucksandroid.MainActivity; import com.hacktx.bevobucksandroid.wear.MessagePath; public class WearListenerService extends WearableListenerService { @Override public void onMessageReceived(MessageEvent messageEvent) { if(messageEvent.getPath().equals(MessagePath.OPEN_APP)) { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); stopSelf(); } } }
UTF-8
Java
774
java
WearListenerService.java
Java
[]
null
[]
package com.hacktx.bevobucksandroid.service; import android.content.Intent; import com.google.android.gms.wearable.MessageEvent; import com.google.android.gms.wearable.WearableListenerService; import com.hacktx.bevobucksandroid.MainActivity; import com.hacktx.bevobucksandroid.wear.MessagePath; public class WearListenerService extends WearableListenerService { @Override public void onMessageReceived(MessageEvent messageEvent) { if(messageEvent.getPath().equals(MessagePath.OPEN_APP)) { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); stopSelf(); } } }
774
0.73385
0.73385
22
34.18182
25.783428
66
false
false
0
0
0
0
0
0
0.545455
false
false
3
fdc79eb8b36cb90691247f8785a7b8ae92ab71e4
7,791,070,703,884
c0fe21b86f141256c85ab82c6ff3acc56b73d3db
/elite/src/main/java/com/jdcloud/sdk/service/elite/model/ReportOrderInfo.java
73373c768971a833bbe5220c30a346e0e9e9334e
[ "Apache-2.0" ]
permissive
jdcloud-api/jdcloud-sdk-java
https://github.com/jdcloud-api/jdcloud-sdk-java
3fec9cf552693520f07b43a1e445954de60e34a0
bcebe28306c4ccc5b2b793e1a5848b0aac21b910
refs/heads/master
2023-07-25T07:03:36.682000
2023-07-25T06:54:39
2023-07-25T06:54:39
126,275,669
47
61
Apache-2.0
false
2023-09-07T08:41:24
2018-03-22T03:41:41
2023-08-25T10:47:25
2023-09-07T08:41:23
11,438
39
45
8
Java
false
false
/* * Copyright 2018 JDCLOUD.COM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:#www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * * * * Contact: * * NOTE: This class is auto generated by the jdcloud code generator program. */ package com.jdcloud.sdk.service.elite.model; import com.jdcloud.sdk.annotation.Required; /** * reportOrderInfo */ public class ReportOrderInfo implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * 订单号 * Required:true */ @Required private String orderNumber; /** * 经销商账号 */ private String distributorAccount; /** * 经销商名称 */ private String distributorName; /** * 补充信息,填写当前订单的一些描述信息 */ private String extraInfo; /** * get 订单号 * * @return */ public String getOrderNumber() { return orderNumber; } /** * set 订单号 * * @param orderNumber */ public void setOrderNumber(String orderNumber) { this.orderNumber = orderNumber; } /** * get 经销商账号 * * @return */ public String getDistributorAccount() { return distributorAccount; } /** * set 经销商账号 * * @param distributorAccount */ public void setDistributorAccount(String distributorAccount) { this.distributorAccount = distributorAccount; } /** * get 经销商名称 * * @return */ public String getDistributorName() { return distributorName; } /** * set 经销商名称 * * @param distributorName */ public void setDistributorName(String distributorName) { this.distributorName = distributorName; } /** * get 补充信息,填写当前订单的一些描述信息 * * @return */ public String getExtraInfo() { return extraInfo; } /** * set 补充信息,填写当前订单的一些描述信息 * * @param extraInfo */ public void setExtraInfo(String extraInfo) { this.extraInfo = extraInfo; } /** * set 订单号 * * @param orderNumber */ public ReportOrderInfo orderNumber(String orderNumber) { this.orderNumber = orderNumber; return this; } /** * set 经销商账号 * * @param distributorAccount */ public ReportOrderInfo distributorAccount(String distributorAccount) { this.distributorAccount = distributorAccount; return this; } /** * set 经销商名称 * * @param distributorName */ public ReportOrderInfo distributorName(String distributorName) { this.distributorName = distributorName; return this; } /** * set 补充信息,填写当前订单的一些描述信息 * * @param extraInfo */ public ReportOrderInfo extraInfo(String extraInfo) { this.extraInfo = extraInfo; return this; } }
UTF-8
Java
3,590
java
ReportOrderInfo.java
Java
[]
null
[]
/* * Copyright 2018 JDCLOUD.COM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:#www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * * * * Contact: * * NOTE: This class is auto generated by the jdcloud code generator program. */ package com.jdcloud.sdk.service.elite.model; import com.jdcloud.sdk.annotation.Required; /** * reportOrderInfo */ public class ReportOrderInfo implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * 订单号 * Required:true */ @Required private String orderNumber; /** * 经销商账号 */ private String distributorAccount; /** * 经销商名称 */ private String distributorName; /** * 补充信息,填写当前订单的一些描述信息 */ private String extraInfo; /** * get 订单号 * * @return */ public String getOrderNumber() { return orderNumber; } /** * set 订单号 * * @param orderNumber */ public void setOrderNumber(String orderNumber) { this.orderNumber = orderNumber; } /** * get 经销商账号 * * @return */ public String getDistributorAccount() { return distributorAccount; } /** * set 经销商账号 * * @param distributorAccount */ public void setDistributorAccount(String distributorAccount) { this.distributorAccount = distributorAccount; } /** * get 经销商名称 * * @return */ public String getDistributorName() { return distributorName; } /** * set 经销商名称 * * @param distributorName */ public void setDistributorName(String distributorName) { this.distributorName = distributorName; } /** * get 补充信息,填写当前订单的一些描述信息 * * @return */ public String getExtraInfo() { return extraInfo; } /** * set 补充信息,填写当前订单的一些描述信息 * * @param extraInfo */ public void setExtraInfo(String extraInfo) { this.extraInfo = extraInfo; } /** * set 订单号 * * @param orderNumber */ public ReportOrderInfo orderNumber(String orderNumber) { this.orderNumber = orderNumber; return this; } /** * set 经销商账号 * * @param distributorAccount */ public ReportOrderInfo distributorAccount(String distributorAccount) { this.distributorAccount = distributorAccount; return this; } /** * set 经销商名称 * * @param distributorName */ public ReportOrderInfo distributorName(String distributorName) { this.distributorName = distributorName; return this; } /** * set 补充信息,填写当前订单的一些描述信息 * * @param extraInfo */ public ReportOrderInfo extraInfo(String extraInfo) { this.extraInfo = extraInfo; return this; } }
3,590
0.601436
0.598743
173
18.3237
20.060295
76
false
false
0
0
0
0
0
0
0.16185
false
false
3
503d3386931fcd3263b45c250796691a2eb1be48
3,272,765,125,403
d8e36ad5735670736cb92920d48390118937af97
/src/utils/ProcessaCSVtoTextFiles.java
0f9fa151142b4f01bbdc41b3d8dd8a9e03486828
[]
no_license
jeremypiercy/NLP
https://github.com/jeremypiercy/NLP
fccb9fb9b9fa3c770b4aa142411d90b80765a2b1
21b600b59c17f8591baaa8bd69518952efe8f23f
refs/heads/master
2021-05-28T15:16:42.606000
2014-01-09T19:54:54
2014-01-09T19:54:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package utils; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import utils.PreProcessaCorpus; import utils.ArquivoUtils; import utils.CSVReader; public class ProcessaCSVtoTextFiles { //private static String corpusTxtPath = "corpusTxt/"; private static String codificacao = "UTF-8"; //private static int minNumLinhas = 10; public static List<String> processCSVFile(Boolean removeStopWords, Boolean reduzStemme, String nomeCSV, String stopListNameFile, String corpusTxtPath) { File csvFile = new File(nomeCSV); return processCSVFile(removeStopWords, reduzStemme, csvFile, stopListNameFile, corpusTxtPath); } public static List<String> processCSVFile(Boolean removeStopWords, Boolean reduzStemme, File csvFile, String stopListNameFile, String corpusTxtPath) { List<String> outPut = new ArrayList<String>(); System.out.println("Processando arquivos: "+ csvFile.getName()); outPut.add("Processando arquivos: "+ csvFile.getName()); try { BufferedReader arq = new BufferedReader (new InputStreamReader (new FileInputStream(csvFile), codificacao)); CSVReader reader = new CSVReader(arq,';'); String[] linhas = reader.getLine(); int count=1; int bratLines = 0; //primeira linha é o cabecalho: id, content, ... while ((linhas= reader.getLine()) !=null ) { if (linhas.length>=4) bratLines += save(removeStopWords, reduzStemme, linhas[0], linhas[1], linhas[2],linhas[3], stopListNameFile, corpusTxtPath); else continue; count++; } System.out.println(bratLines+ " linhas em "+count+" arquivos extraidos."); outPut.add(bratLines+ " linhas em "+count+" arquivos extraidos."); } catch (IOException e) { System.err.printf("[ERROR] Erro ao abrir arquivo: " + csvFile.getAbsolutePath()); System.exit(-1); } return outPut; } /* public void exec(Boolean removeStopWords, Boolean reduzStemme, File orgDirPath) { boolean isEmpty = true; File[] csvFiles = orgDirPath.listFiles(); String localPath = ""; String stopListNameFile = "StopList.txt"; StemmerType stemmerType = StemmerType.ORENGO; Integer numSerie = 1; Integer minNumLinhas = 10; for (File csvFile:csvFiles) { String filename = csvFile.getName(); if (filename.contains(".csv")) { isEmpty = false; //String tgtDirPathName = tgtDirPath + File.separator + filename.replace(".csv", ""); processCSVFile(removeStopWords, reduzStemme, csvFile, localPath, stopListNameFile, stemmerType, numSerie, minNumLinhas); } } if (isEmpty) { try { System.out.println("Nao foram encontrados arquivos CSVs em " + orgDirPath.getCanonicalPath()); System.exit(-1); } catch(Exception e) { System.out.println("Nao foram encontrados arquivos CSVs." ); System.exit(-1); } } } */ private static int save(Boolean removeStopWords, Boolean reduzStemme, String id, String reutersFileName, String content, String category, String stopListNameFile, String corpusTxtPath) { List<String> linhas = new ArrayList<String>(); content = content.toLowerCase(); content = ContaPalavras.limpacaracteres(content); content = ContaPalavras.removeNumeros(content); content = PreProcessaCorpus.preProcessaLinha(content, removeStopWords, reduzStemme, stopListNameFile); String [] contents = content.split("[.!?] "); content = content.replace("? ","? \n"); content = content.replace("! ","! \n"); content = content.replace(". ",". \n"); linhas.add(content); String tipoPreprocessamento = getTipoPreprocessamento(reduzStemme,removeStopWords); String filename = corpusTxtPath + tipoPreprocessamento + "/" + category + "/" + id + "_" + reutersFileName + ".txt"; ArquivoUtils.salvaArquivo(linhas, filename); return contents.length; } private static String getTipoPreprocessamento(Boolean reduzStemme, Boolean removeStopWords) { String tipoPreProcessamento = ""; if (reduzStemme){ if (removeStopWords) tipoPreProcessamento = "StemmeStop"; else tipoPreProcessamento = "Steme"; } else { if (removeStopWords) tipoPreProcessamento = "Stop"; else tipoPreProcessamento = "Original"; } return tipoPreProcessamento; } }
WINDOWS-1252
Java
4,399
java
ProcessaCSVtoTextFiles.java
Java
[]
null
[]
package utils; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import utils.PreProcessaCorpus; import utils.ArquivoUtils; import utils.CSVReader; public class ProcessaCSVtoTextFiles { //private static String corpusTxtPath = "corpusTxt/"; private static String codificacao = "UTF-8"; //private static int minNumLinhas = 10; public static List<String> processCSVFile(Boolean removeStopWords, Boolean reduzStemme, String nomeCSV, String stopListNameFile, String corpusTxtPath) { File csvFile = new File(nomeCSV); return processCSVFile(removeStopWords, reduzStemme, csvFile, stopListNameFile, corpusTxtPath); } public static List<String> processCSVFile(Boolean removeStopWords, Boolean reduzStemme, File csvFile, String stopListNameFile, String corpusTxtPath) { List<String> outPut = new ArrayList<String>(); System.out.println("Processando arquivos: "+ csvFile.getName()); outPut.add("Processando arquivos: "+ csvFile.getName()); try { BufferedReader arq = new BufferedReader (new InputStreamReader (new FileInputStream(csvFile), codificacao)); CSVReader reader = new CSVReader(arq,';'); String[] linhas = reader.getLine(); int count=1; int bratLines = 0; //primeira linha é o cabecalho: id, content, ... while ((linhas= reader.getLine()) !=null ) { if (linhas.length>=4) bratLines += save(removeStopWords, reduzStemme, linhas[0], linhas[1], linhas[2],linhas[3], stopListNameFile, corpusTxtPath); else continue; count++; } System.out.println(bratLines+ " linhas em "+count+" arquivos extraidos."); outPut.add(bratLines+ " linhas em "+count+" arquivos extraidos."); } catch (IOException e) { System.err.printf("[ERROR] Erro ao abrir arquivo: " + csvFile.getAbsolutePath()); System.exit(-1); } return outPut; } /* public void exec(Boolean removeStopWords, Boolean reduzStemme, File orgDirPath) { boolean isEmpty = true; File[] csvFiles = orgDirPath.listFiles(); String localPath = ""; String stopListNameFile = "StopList.txt"; StemmerType stemmerType = StemmerType.ORENGO; Integer numSerie = 1; Integer minNumLinhas = 10; for (File csvFile:csvFiles) { String filename = csvFile.getName(); if (filename.contains(".csv")) { isEmpty = false; //String tgtDirPathName = tgtDirPath + File.separator + filename.replace(".csv", ""); processCSVFile(removeStopWords, reduzStemme, csvFile, localPath, stopListNameFile, stemmerType, numSerie, minNumLinhas); } } if (isEmpty) { try { System.out.println("Nao foram encontrados arquivos CSVs em " + orgDirPath.getCanonicalPath()); System.exit(-1); } catch(Exception e) { System.out.println("Nao foram encontrados arquivos CSVs." ); System.exit(-1); } } } */ private static int save(Boolean removeStopWords, Boolean reduzStemme, String id, String reutersFileName, String content, String category, String stopListNameFile, String corpusTxtPath) { List<String> linhas = new ArrayList<String>(); content = content.toLowerCase(); content = ContaPalavras.limpacaracteres(content); content = ContaPalavras.removeNumeros(content); content = PreProcessaCorpus.preProcessaLinha(content, removeStopWords, reduzStemme, stopListNameFile); String [] contents = content.split("[.!?] "); content = content.replace("? ","? \n"); content = content.replace("! ","! \n"); content = content.replace(". ",". \n"); linhas.add(content); String tipoPreprocessamento = getTipoPreprocessamento(reduzStemme,removeStopWords); String filename = corpusTxtPath + tipoPreprocessamento + "/" + category + "/" + id + "_" + reutersFileName + ".txt"; ArquivoUtils.salvaArquivo(linhas, filename); return contents.length; } private static String getTipoPreprocessamento(Boolean reduzStemme, Boolean removeStopWords) { String tipoPreProcessamento = ""; if (reduzStemme){ if (removeStopWords) tipoPreProcessamento = "StemmeStop"; else tipoPreProcessamento = "Steme"; } else { if (removeStopWords) tipoPreProcessamento = "Stop"; else tipoPreProcessamento = "Original"; } return tipoPreProcessamento; } }
4,399
0.704184
0.700546
135
31.585186
34.462944
153
false
false
0
0
0
0
0
0
2.577778
false
false
3
f0ae421cf4793780e49a44bb95f36f509f83cc34
8,778,913,206,372
673fc3fb003375ff4c1953b4ef37dc2fbee8a37d
/dakara.eclipse.commander.plugin/src/dakara/eclipse/plugin/command/eclipse/internal/LauncherElement.java
2c3899a9540dd1d3d4bc1d41ec8df7408d946990
[ "MIT" ]
permissive
d-akara/eclipse-plugin-commander
https://github.com/d-akara/eclipse-plugin-commander
58cab2a4f901375efe496ae124bad07874970e1c
8be0078cfda4496592ff337abff52df31ec48d9b
refs/heads/master
2022-04-06T02:50:25.169000
2020-02-27T20:23:41
2020-02-27T20:23:41
89,985,999
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dakara.eclipse.plugin.command.eclipse.internal; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.quickaccess.QuickAccessElement; public class LauncherElement extends QuickAccessElement { private final String name; private final String typeName; private final String id; private final LaunchProvider provider; public LauncherElement(LaunchProvider provider, String id, String name, String typeName) { this.provider = provider; this.id = id; this.name = name; this.typeName = typeName; } @Override public String getLabel() { return "Launch - " + typeName + ": " + name; } @Override public ImageDescriptor getImageDescriptor() { return null; } @Override public String getId() { return id; } @Override public void execute() { provider.execute(this); } @Override public boolean equals(Object obj) { if (!(obj instanceof LauncherElement)) return false; return id.equals(((LauncherElement)obj).id); } @Override public int hashCode() { return id.hashCode(); } }
UTF-8
Java
1,046
java
LauncherElement.java
Java
[]
null
[]
package dakara.eclipse.plugin.command.eclipse.internal; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.quickaccess.QuickAccessElement; public class LauncherElement extends QuickAccessElement { private final String name; private final String typeName; private final String id; private final LaunchProvider provider; public LauncherElement(LaunchProvider provider, String id, String name, String typeName) { this.provider = provider; this.id = id; this.name = name; this.typeName = typeName; } @Override public String getLabel() { return "Launch - " + typeName + ": " + name; } @Override public ImageDescriptor getImageDescriptor() { return null; } @Override public String getId() { return id; } @Override public void execute() { provider.execute(this); } @Override public boolean equals(Object obj) { if (!(obj instanceof LauncherElement)) return false; return id.equals(((LauncherElement)obj).id); } @Override public int hashCode() { return id.hashCode(); } }
1,046
0.731358
0.731358
50
19.92
20.517155
91
false
false
0
0
0
0
0
0
1.42
false
false
3
f82a66cf0d482f64ecc1f0459f8bc92b25257228
26,637,387,227,379
7cf3bebb990703f54ea8383de733920bf4e6c552
/src/main/java/com/github/lotsabackscatter/cesium/Billboard.java
7c57600e619931fd4dda50c993e57fb83408a52b
[ "Apache-2.0" ]
permissive
dylanwatsonsoftware/vaadin-cesium-component
https://github.com/dylanwatsonsoftware/vaadin-cesium-component
a5ac48eff29ccd239beff7387462d431834a5144
0bbe654bdaac7b51331e9f0f13cf820b5d4bdc12
refs/heads/master
2021-05-26T16:46:00.593000
2014-05-26T04:47:07
2014-05-26T04:47:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.lotsabackscatter.cesium; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import java.util.UUID; /** * A Cesium billboard. * * @author watsond */ public class Billboard { @Nonnull private final UUID id = UUID.randomUUID(); private double latitude; private double longitude; private double height; @CheckForNull private String name; @Nonnull private String imageUrl; public Billboard(@CheckForNull String name, double latitude, double longitude, double height, @Nonnull String imageUrl) { this.latitude = latitude; this.longitude = longitude; this.height = height; this.name = name; this.imageUrl = imageUrl; } public Billboard(@CheckForNull String name, double latitude, double longitude, @Nonnull String imageUrl) { this(name, latitude, longitude, 0, imageUrl); } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } @CheckForNull public String getName() { return name; } public void setName(String name) { this.name = name; } @Nonnull public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } @Nonnull public UUID getId() { return id; } }
UTF-8
Java
1,752
java
Billboard.java
Java
[ { "context": "package com.github.lotsabackscatter.cesium;\n\nimport javax.annotation.CheckForNull;\nim", "end": 35, "score": 0.8702638149261475, "start": 19, "tag": "USERNAME", "value": "lotsabackscatter" }, { "context": "il.UUID;\n\n/**\n * A Cesium billboard.\n *\n * @author watsond\n */\npublic class Billboard {\n\n @Nonnull\n pr", "end": 188, "score": 0.9997137188911438, "start": 181, "tag": "USERNAME", "value": "watsond" } ]
null
[]
package com.github.lotsabackscatter.cesium; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import java.util.UUID; /** * A Cesium billboard. * * @author watsond */ public class Billboard { @Nonnull private final UUID id = UUID.randomUUID(); private double latitude; private double longitude; private double height; @CheckForNull private String name; @Nonnull private String imageUrl; public Billboard(@CheckForNull String name, double latitude, double longitude, double height, @Nonnull String imageUrl) { this.latitude = latitude; this.longitude = longitude; this.height = height; this.name = name; this.imageUrl = imageUrl; } public Billboard(@CheckForNull String name, double latitude, double longitude, @Nonnull String imageUrl) { this(name, latitude, longitude, 0, imageUrl); } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } @CheckForNull public String getName() { return name; } public void setName(String name) { this.name = name; } @Nonnull public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } @Nonnull public UUID getId() { return id; } }
1,752
0.635274
0.634703
82
20.378048
21.55517
125
false
false
0
0
0
0
0
0
0.463415
false
false
3
bf6bf61059e05e4936b4a02a3c15ea0314b6e4dc
11,330,123,787,415
4e6260165004c708f101cb41dac2eca16cc0afb2
/upwork-app-restapi/src/main/java/com/upworkapp/model/Job.java
8aefb8c950397f47117e384f3304065db228f974
[]
no_license
Messaging24/springmicroservices
https://github.com/Messaging24/springmicroservices
d5282fd6ce7987c2315f83c38dcfca837487466a
33db0aa410fbd612d87e00845385a5da50ff6659
refs/heads/master
2022-04-18T02:24:28.959000
2020-04-16T17:09:32
2020-04-16T17:09:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.upworkapp.model; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity public class Job { private String title; @Id //@GeneratedValue(strategy = GenerationType.IDENTITY) // generator="jobseq") // @SequenceGenerator(name="jobseq",sequenceName="JOB_SEQ") private Integer jobId; private String description; private Integer cost; private String level; private String duration; @ManyToMany(fetch=FetchType.LAZY, cascade= { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable(name="jobs_skills", joinColumns= {@JoinColumn(name="JOB_ID")}, inverseJoinColumns= {@JoinColumn(name="SKILLS_ID")} ) @JsonIgnore private Set<Skills> skillSet = new HashSet<>(); public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Integer getJobId() { return jobId; } public void setJobId(Integer jobId) { this.jobId = jobId; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Integer getCost() { return cost; } public void setCost(Integer cost) { this.cost = cost; } public String getLevel() { return level; } public void setLevel(String level) { this.level = level; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } public Set<Skills> getSkillSet() { return skillSet; } public void setSkillSet(Set<Skills> skillSet) { this.skillSet = skillSet; } @Override public String toString() { return "Job [title=" + title + ", jobId=" + jobId + ", description=" + description + ", cost=" + cost + ", level=" + level + ", duration=" + duration + ", expertise=" + skillSet + "]"; } }
UTF-8
Java
2,231
java
Job.java
Java
[]
null
[]
package com.upworkapp.model; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity public class Job { private String title; @Id //@GeneratedValue(strategy = GenerationType.IDENTITY) // generator="jobseq") // @SequenceGenerator(name="jobseq",sequenceName="JOB_SEQ") private Integer jobId; private String description; private Integer cost; private String level; private String duration; @ManyToMany(fetch=FetchType.LAZY, cascade= { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable(name="jobs_skills", joinColumns= {@JoinColumn(name="JOB_ID")}, inverseJoinColumns= {@JoinColumn(name="SKILLS_ID")} ) @JsonIgnore private Set<Skills> skillSet = new HashSet<>(); public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Integer getJobId() { return jobId; } public void setJobId(Integer jobId) { this.jobId = jobId; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Integer getCost() { return cost; } public void setCost(Integer cost) { this.cost = cost; } public String getLevel() { return level; } public void setLevel(String level) { this.level = level; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } public Set<Skills> getSkillSet() { return skillSet; } public void setSkillSet(Set<Skills> skillSet) { this.skillSet = skillSet; } @Override public String toString() { return "Job [title=" + title + ", jobId=" + jobId + ", description=" + description + ", cost=" + cost + ", level=" + level + ", duration=" + duration + ", expertise=" + skillSet + "]"; } }
2,231
0.668758
0.668758
94
21.734043
19.507868
103
false
false
0
0
0
0
0
0
1.574468
false
false
3
eb162861dd86df0e14db1bd89e3f5e97a66f25f4
8,744,553,455,976
226c56384304068cd651e6125a0093610cba8f44
/src/main/java/nl/workingtalent/bieb/rest/AccountEndpoint.java
162f53d609cfdf7b7d7c422d063d4fd7293294ad
[]
no_license
smschlts/WTBieb
https://github.com/smschlts/WTBieb
2facf1b337fcd6fcb1beebfba9cd85be4bdfeb4e
4f1535d1f941190f11b76142df49e6bcbffab2d5
refs/heads/master
2022-12-16T23:11:07.081000
2020-09-01T07:24:23
2020-09-01T07:24:23
282,919,441
0
0
null
false
2020-09-01T07:24:24
2020-07-27T14:18:39
2020-09-01T07:10:45
2020-09-01T07:24:23
655
0
0
0
Java
false
false
package nl.workingtalent.bieb.rest; import nl.workingtalent.bieb.controller.AccountService; import nl.workingtalent.bieb.domein.Account; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController public class AccountEndpoint { @Autowired AccountService accountService; @GetMapping("/accounts") public List<Account> accountsAlles() { return accountService.ophalenAlleAccounts(); } @GetMapping("/accounts/{id}") public Account AccountEen(@PathVariable Long id) { return accountService.ophalenAccount(id); } @PostMapping("/accounts") public Account nieuwAccount(@Valid @RequestBody Account nieuwAccount) { return accountService.opslaan(nieuwAccount); } @DeleteMapping("/accounts/{id}") public void accountWeg(@PathVariable Long id) { accountService.verwijderAccount(id); } @PutMapping("/accounts/{id}") public Account updateAccount(@PathVariable Long id, @Valid @RequestBody Account nieuwAccount) { return accountService.updateAccount(id, nieuwAccount); } @PatchMapping("/accounts/{id}") public Account patchAccount(@PathVariable Long id, @RequestBody Account nieuwAccount) { return accountService.patchAccount(id, nieuwAccount); } }
UTF-8
Java
1,394
java
AccountEndpoint.java
Java
[]
null
[]
package nl.workingtalent.bieb.rest; import nl.workingtalent.bieb.controller.AccountService; import nl.workingtalent.bieb.domein.Account; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController public class AccountEndpoint { @Autowired AccountService accountService; @GetMapping("/accounts") public List<Account> accountsAlles() { return accountService.ophalenAlleAccounts(); } @GetMapping("/accounts/{id}") public Account AccountEen(@PathVariable Long id) { return accountService.ophalenAccount(id); } @PostMapping("/accounts") public Account nieuwAccount(@Valid @RequestBody Account nieuwAccount) { return accountService.opslaan(nieuwAccount); } @DeleteMapping("/accounts/{id}") public void accountWeg(@PathVariable Long id) { accountService.verwijderAccount(id); } @PutMapping("/accounts/{id}") public Account updateAccount(@PathVariable Long id, @Valid @RequestBody Account nieuwAccount) { return accountService.updateAccount(id, nieuwAccount); } @PatchMapping("/accounts/{id}") public Account patchAccount(@PathVariable Long id, @RequestBody Account nieuwAccount) { return accountService.patchAccount(id, nieuwAccount); } }
1,394
0.728838
0.728838
46
29.304348
26.256983
99
false
false
0
0
0
0
0
0
0.391304
false
false
3
8c34254eaf1201c69971c3cf2779d5883662480f
30,331,059,105,091
e66e556843efbb1f839e7dc4891be3323d151808
/web_maven/src/main/java/com/chr/controller/RedirectAndForward.java
83c2aacfddd18bc3b1b6255bfdc96937a849924d
[]
no_license
ChanghrSuper/theRepository
https://github.com/ChanghrSuper/theRepository
9956a59139be7c5cd21396c929e552fd8705e5f4
abfae3315f8c76e4b3b2dcad4205aa4e8ac42a07
refs/heads/master
2020-03-22T22:58:14.385000
2018-07-12T14:32:34
2018-07-12T14:32:34
140,781,942
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chr.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * 用来测试redirect跳转以及forward跳转 */ @Controller @RequestMapping("/redirectandforward") public class RedirectAndForward { //forward从controller跳转到controller @RequestMapping("test1") public String test1(){ System.out.println("forward---controller"); return "forward:/hello/hello"; } //redirect从controller跳转到jsp @RequestMapping("test2") public String test2(){ System.out.println("dedirect===jsp"); return "redirect:/index.jsp"; } //redirect从controller跳转到controller @RequestMapping("test3") public String test3(){ System.out.println("direct***controller"); return "redirect:/hello/hello"; } }
UTF-8
Java
876
java
RedirectAndForward.java
Java
[]
null
[]
package com.chr.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * 用来测试redirect跳转以及forward跳转 */ @Controller @RequestMapping("/redirectandforward") public class RedirectAndForward { //forward从controller跳转到controller @RequestMapping("test1") public String test1(){ System.out.println("forward---controller"); return "forward:/hello/hello"; } //redirect从controller跳转到jsp @RequestMapping("test2") public String test2(){ System.out.println("dedirect===jsp"); return "redirect:/index.jsp"; } //redirect从controller跳转到controller @RequestMapping("test3") public String test3(){ System.out.println("direct***controller"); return "redirect:/hello/hello"; } }
876
0.691106
0.683894
34
23.470589
18.303383
62
false
false
0
0
0
0
0
0
0.264706
false
false
3
f52c9bfed8cc78ae128fab22cb216d2205c068da
23,948,737,670,827
ab9fae0abd0fc1ccbca039d886c90eb8ad01670d
/app/src/main/java/com/speedata/control/MainActivity.java
1988ebef8f9c880f0e5c52b16ce7828f7bca6ca6
[]
no_license
yf956613/DeviceControlDemo
https://github.com/yf956613/DeviceControlDemo
4d9b36f52d8f5e8cedeb936d296ef2edf30d6081
cfd49b3c7f7fe4b9030d49fefe96f91965c01fa9
refs/heads/master
2020-03-12T13:57:21.465000
2017-08-17T19:13:40
2017-08-17T19:13:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.speedata.control; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.android.control.ControlManager; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private ControlManager mControlManager; private static final String TAG = "Reginer"; private EditText mEtPkg; private EditText mEtApk; private int apnId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); } private void initView() { mControlManager = ControlManager.getDeviceControl(this); Button mBtnReboot = (Button) findViewById(R.id.btn_reboot); Button mBtnShutdown = (Button) findViewById(R.id.btn_shutdown); Button mBtnRecovery = (Button) findViewById(R.id.btn_recovery); mBtnReboot.setOnClickListener(this); mBtnShutdown.setOnClickListener(this); mBtnRecovery.setOnClickListener(this); Button mBtnSetTime = (Button) findViewById(R.id.btn_set_time); mBtnSetTime.setOnClickListener(this); Button mBtnCreateApn = (Button) findViewById(R.id.btn_create_apn); mBtnCreateApn.setOnClickListener(this); findViewById(R.id.btn_set_apn).setOnClickListener(this); Button mBtnUninstall = (Button) findViewById(R.id.btn_uninstall); mBtnUninstall.setOnClickListener(this); Button mBtnInstall = (Button) findViewById(R.id.btn_install); mBtnInstall.setOnClickListener(this); mEtPkg = (EditText) findViewById(R.id.et_pkg); mEtApk = (EditText) findViewById(R.id.et_apk); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_reboot: mControlManager.rebootDevice(); break; case R.id.btn_shutdown: mControlManager.shutdownDevice(); break; case R.id.btn_recovery: mControlManager.recoveryDevice(); break; case R.id.btn_set_time: mControlManager.setSystemTime(1497369600); break; case R.id.btn_create_apn: apnId = mControlManager.createApn(createApn()); Log.d(TAG, "apnId is: " + apnId); break; case R.id.btn_set_apn: setDefaultApn(apnId); break; case R.id.btn_uninstall: submitPkg(); break; case R.id.btn_install: submitPath(); break; } } /** * 设置默认选中apn * @param apnId apnId * @return successful or failed */ public boolean setDefaultApn(int apnId) { final Uri CURRENT_APN_URI = Uri.parse("content://telephony/carriers/preferapn"); boolean res = false; ContentResolver resolver = getContentResolver(); ContentValues values = new ContentValues(); values.put("apn_id", apnId); try { resolver.update(CURRENT_APN_URI, values, null, null); Cursor c = resolver.query(CURRENT_APN_URI, new String[] { "name", "apn" }, "_id=" + apnId, null, null); if (c != null) { res = true; c.close(); } } catch (Exception e) { e.printStackTrace(); } return res; } private void submitPkg() { String pkg = mEtPkg.getText().toString().trim(); if (TextUtils.isEmpty(pkg)) { Toast.makeText(this, "content null", Toast.LENGTH_SHORT).show(); return; } boolean result = mControlManager.uninstallApp(pkg); Log.d(TAG, "result is:::: " + result); } private void submitPath() { String apk = mEtApk.getText().toString().trim(); if (TextUtils.isEmpty(apk)) { Toast.makeText(this, "content null", Toast.LENGTH_SHORT).show(); return; } boolean result = mControlManager.installApp(apk); Log.d(TAG, "result is:::: " + result); } private ContentValues createApn() { String numeric; TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); numeric = telephonyManager.getSimOperator(); ContentValues values = new ContentValues(); values.put("name", "speedata"); values.put("apn", "myapn"); values.put("type", "default,supl"); values.put("numeric", numeric); values.put("mcc", "460"); values.put("mnc", "01"); values.put("proxy", ""); values.put("port", ""); values.put("mmsproxy", ""); values.put("mmsport", ""); values.put("user", ""); values.put("server", ""); values.put("password", ""); values.put("mmsc", ""); return values; } }
UTF-8
Java
5,430
java
MainActivity.java
Java
[]
null
[]
package com.speedata.control; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.android.control.ControlManager; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private ControlManager mControlManager; private static final String TAG = "Reginer"; private EditText mEtPkg; private EditText mEtApk; private int apnId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); } private void initView() { mControlManager = ControlManager.getDeviceControl(this); Button mBtnReboot = (Button) findViewById(R.id.btn_reboot); Button mBtnShutdown = (Button) findViewById(R.id.btn_shutdown); Button mBtnRecovery = (Button) findViewById(R.id.btn_recovery); mBtnReboot.setOnClickListener(this); mBtnShutdown.setOnClickListener(this); mBtnRecovery.setOnClickListener(this); Button mBtnSetTime = (Button) findViewById(R.id.btn_set_time); mBtnSetTime.setOnClickListener(this); Button mBtnCreateApn = (Button) findViewById(R.id.btn_create_apn); mBtnCreateApn.setOnClickListener(this); findViewById(R.id.btn_set_apn).setOnClickListener(this); Button mBtnUninstall = (Button) findViewById(R.id.btn_uninstall); mBtnUninstall.setOnClickListener(this); Button mBtnInstall = (Button) findViewById(R.id.btn_install); mBtnInstall.setOnClickListener(this); mEtPkg = (EditText) findViewById(R.id.et_pkg); mEtApk = (EditText) findViewById(R.id.et_apk); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_reboot: mControlManager.rebootDevice(); break; case R.id.btn_shutdown: mControlManager.shutdownDevice(); break; case R.id.btn_recovery: mControlManager.recoveryDevice(); break; case R.id.btn_set_time: mControlManager.setSystemTime(1497369600); break; case R.id.btn_create_apn: apnId = mControlManager.createApn(createApn()); Log.d(TAG, "apnId is: " + apnId); break; case R.id.btn_set_apn: setDefaultApn(apnId); break; case R.id.btn_uninstall: submitPkg(); break; case R.id.btn_install: submitPath(); break; } } /** * 设置默认选中apn * @param apnId apnId * @return successful or failed */ public boolean setDefaultApn(int apnId) { final Uri CURRENT_APN_URI = Uri.parse("content://telephony/carriers/preferapn"); boolean res = false; ContentResolver resolver = getContentResolver(); ContentValues values = new ContentValues(); values.put("apn_id", apnId); try { resolver.update(CURRENT_APN_URI, values, null, null); Cursor c = resolver.query(CURRENT_APN_URI, new String[] { "name", "apn" }, "_id=" + apnId, null, null); if (c != null) { res = true; c.close(); } } catch (Exception e) { e.printStackTrace(); } return res; } private void submitPkg() { String pkg = mEtPkg.getText().toString().trim(); if (TextUtils.isEmpty(pkg)) { Toast.makeText(this, "content null", Toast.LENGTH_SHORT).show(); return; } boolean result = mControlManager.uninstallApp(pkg); Log.d(TAG, "result is:::: " + result); } private void submitPath() { String apk = mEtApk.getText().toString().trim(); if (TextUtils.isEmpty(apk)) { Toast.makeText(this, "content null", Toast.LENGTH_SHORT).show(); return; } boolean result = mControlManager.installApp(apk); Log.d(TAG, "result is:::: " + result); } private ContentValues createApn() { String numeric; TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); numeric = telephonyManager.getSimOperator(); ContentValues values = new ContentValues(); values.put("name", "speedata"); values.put("apn", "myapn"); values.put("type", "default,supl"); values.put("numeric", numeric); values.put("mcc", "460"); values.put("mnc", "01"); values.put("proxy", ""); values.put("port", ""); values.put("mmsproxy", ""); values.put("mmsport", ""); values.put("user", ""); values.put("server", ""); values.put("password", ""); values.put("mmsc", ""); return values; } }
5,430
0.596161
0.593208
158
33.291138
20.834278
89
false
false
0
0
0
0
0
0
0.822785
false
false
3
73f230579ad033ffa5b709b5515ea9257ed807e7
24,472,723,686,971
1115de6cad1835d2f9d4a6795d393e63764e3858
/Java/Hopfield/src/com/network/Network.java
b506553a01fd45e9de082a05303734820667ec8d
[]
no_license
sabstorm/neuralnetworks
https://github.com/sabstorm/neuralnetworks
2dea9cae3a2013278a53ca41dbf0e1f240248380
7ebce2eed5ce555deb11c7bf0461cf465e06e2d4
refs/heads/master
2016-08-08T02:43:40.394000
2014-11-05T20:15:14
2014-11-05T20:15:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.network; import com.util.*; /** * @author MarkVII * */ public class Network { private double[][] weightMatrix; private int neurons; private Util util; // CONSTRUCTOR public Network(int neurons) { this.weightMatrix = new double[neurons][neurons]; this.neurons = neurons; this.util = new Util(); } // PRESENT PATTERN FOR RECOGNITION public double[] presentPattern(boolean[] booleanPattern) { double[] pattern = util.convertPatternToArrayOfDouble(booleanPattern); double[] result = new double[this.neurons]; for (int i = 0; i < weightMatrix.length; i++) { double sum = 0.0; for (int j = 0; j < weightMatrix[0].length; j++) { sum += this.weightMatrix[i][j] * pattern[j]; } result[i] = bipolarActivationFunction(sum); } return result; } // PRESENT PATTERN TO THE NETWORK, WHICH WILL RETURN A WEIGHT MATRIX FOR THIS PATTERN public double[][] presentPatternForTraining(boolean[] booleanPattern) { double[][] transposedPattern = util.transposePatternToMultidimensionalArray(booleanPattern); double[][] pattern = util.convertPatternToMultidimensionalArray(booleanPattern); double[][] weightM = util.multiplyMatrices(transposedPattern, pattern); return weightM; } // TRAINING RELATED METHODS // Hebbian learning public void trainNetwork(int numberOfPatterns, boolean[][] patternsToTrain) { double[][] supportMatrix; double[][] finalMatrix = util.initializeMatrix(this.neurons, this.neurons); // Part1 = 1/N * (A*At + B*Bt + C*Ct + ...) for (int i = 0; i < numberOfPatterns; i++) { supportMatrix = presentPatternForTraining(patternsToTrain[i]); supportMatrix = util.multiplyNumberByMatrix((1.0 / (double)(this.neurons)), supportMatrix); finalMatrix = util.sumMatrices(supportMatrix, finalMatrix); } // Part2 = P/N * Identity supportMatrix = util.identityMatrix(patternsToTrain[0].length); supportMatrix = util.multiplyNumberByMatrix( ((double)(numberOfPatterns) /(double)(patternsToTrain[0].length)), supportMatrix); // W = Part1 - Part2 finalMatrix = util.subMatrices(finalMatrix, supportMatrix); setWeightMatrix(finalMatrix); } public double bipolarActivationFunction(double value) { if (value >= 0) return 1.0; else return -1.0; } // GETTERS AND SETTERS public int getNeurons() { return this.neurons; } public void setNeurons(int neurons) { this.neurons = neurons; } public double[][] getWeightMatrix() { return this.weightMatrix; } public void setWeightMatrix(double[][] matrix) { this.weightMatrix = matrix; } public Util getUtil() { return this.util; } public void setUtil(Util util) { this.util = util; } }
UTF-8
Java
3,133
java
Network.java
Java
[ { "context": "ge com.network;\nimport com.util.*;\n\n/**\n * @author MarkVII\n *\n */\npublic class Network {\n\tprivate double[][]", "end": 75, "score": 0.8898478150367737, "start": 68, "tag": "USERNAME", "value": "MarkVII" } ]
null
[]
/** * */ package com.network; import com.util.*; /** * @author MarkVII * */ public class Network { private double[][] weightMatrix; private int neurons; private Util util; // CONSTRUCTOR public Network(int neurons) { this.weightMatrix = new double[neurons][neurons]; this.neurons = neurons; this.util = new Util(); } // PRESENT PATTERN FOR RECOGNITION public double[] presentPattern(boolean[] booleanPattern) { double[] pattern = util.convertPatternToArrayOfDouble(booleanPattern); double[] result = new double[this.neurons]; for (int i = 0; i < weightMatrix.length; i++) { double sum = 0.0; for (int j = 0; j < weightMatrix[0].length; j++) { sum += this.weightMatrix[i][j] * pattern[j]; } result[i] = bipolarActivationFunction(sum); } return result; } // PRESENT PATTERN TO THE NETWORK, WHICH WILL RETURN A WEIGHT MATRIX FOR THIS PATTERN public double[][] presentPatternForTraining(boolean[] booleanPattern) { double[][] transposedPattern = util.transposePatternToMultidimensionalArray(booleanPattern); double[][] pattern = util.convertPatternToMultidimensionalArray(booleanPattern); double[][] weightM = util.multiplyMatrices(transposedPattern, pattern); return weightM; } // TRAINING RELATED METHODS // Hebbian learning public void trainNetwork(int numberOfPatterns, boolean[][] patternsToTrain) { double[][] supportMatrix; double[][] finalMatrix = util.initializeMatrix(this.neurons, this.neurons); // Part1 = 1/N * (A*At + B*Bt + C*Ct + ...) for (int i = 0; i < numberOfPatterns; i++) { supportMatrix = presentPatternForTraining(patternsToTrain[i]); supportMatrix = util.multiplyNumberByMatrix((1.0 / (double)(this.neurons)), supportMatrix); finalMatrix = util.sumMatrices(supportMatrix, finalMatrix); } // Part2 = P/N * Identity supportMatrix = util.identityMatrix(patternsToTrain[0].length); supportMatrix = util.multiplyNumberByMatrix( ((double)(numberOfPatterns) /(double)(patternsToTrain[0].length)), supportMatrix); // W = Part1 - Part2 finalMatrix = util.subMatrices(finalMatrix, supportMatrix); setWeightMatrix(finalMatrix); } public double bipolarActivationFunction(double value) { if (value >= 0) return 1.0; else return -1.0; } // GETTERS AND SETTERS public int getNeurons() { return this.neurons; } public void setNeurons(int neurons) { this.neurons = neurons; } public double[][] getWeightMatrix() { return this.weightMatrix; } public void setWeightMatrix(double[][] matrix) { this.weightMatrix = matrix; } public Util getUtil() { return this.util; } public void setUtil(Util util) { this.util = util; } }
3,133
0.601341
0.594957
123
24.479675
27.10574
103
false
false
0
0
0
0
0
0
0.406504
false
false
3
fcfc4f2abd346347be1b6a6d5d0d096908b4ae5c
24,472,723,689,422
515bb4a91fff8eb1188116d28c6dea6ac50f7760
/app/src/main/java/io/github/tadoya/din9talk/models/Chat.java
32de17176c2929bdb805b759b45a41683cd96881
[]
no_license
Tadoya/Din9talk
https://github.com/Tadoya/Din9talk
4e473f05f447ded611de613930725fa1575e4f0c
120120fa0ecd9be899155647dd7991c6750fde03
refs/heads/master
2021-01-20T19:57:19.531000
2017-09-05T06:43:09
2017-09-05T06:43:09
61,098,302
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.github.tadoya.din9talk.models; import io.realm.RealmObject; /** * Created by choiseongsik on 2016. 7. 11.. */ public class Chat extends RealmObject{ private String userName; private String message; private String currentTime; private String roomName; public Chat() { } public Chat(String userName, String message, String currentTime) { this.userName = userName; this.message = message; this.currentTime = currentTime; } public String getRoomName() {return roomName; } public String getUserName() { return userName; } public String getMessage() { return message; } public String getCurrentTime() { return currentTime; } public void setRoomName(String roomName) { this.roomName = roomName; } public void setUserName(String userName){ this.userName = userName; } public void setMessage(String message){ this.message = message; } public void setCurrentTime(String currentTime){ this.currentTime = currentTime; } }
UTF-8
Java
1,020
java
Chat.java
Java
[ { "context": "package io.github.tadoya.din9talk.models;\n\nimport io.realm.RealmObject;\n\n/", "end": 24, "score": 0.7984597682952881, "start": 18, "tag": "USERNAME", "value": "tadoya" }, { "context": ";\n\nimport io.realm.RealmObject;\n\n/**\n * Created by choiseongsik on 2016. 7. 11..\n */\n\npublic class Chat extends R", "end": 103, "score": 0.9996557235717773, "start": 91, "tag": "USERNAME", "value": "choiseongsik" }, { "context": "age, String currentTime) {\n this.userName = userName;\n this.message = message;\n this.cur", "end": 415, "score": 0.9982995390892029, "start": 407, "tag": "USERNAME", "value": "userName" }, { "context": "omName; }\n public String getUserName() { return userName; }\n public String getMessage() { return messag", "end": 598, "score": 0.9876465201377869, "start": 590, "tag": "USERNAME", "value": "userName" }, { "context": "void setUserName(String userName){ this.userName = userName; }\n public void setMessage(String message){ th", "end": 858, "score": 0.9986171722412109, "start": 850, "tag": "USERNAME", "value": "userName" } ]
null
[]
package io.github.tadoya.din9talk.models; import io.realm.RealmObject; /** * Created by choiseongsik on 2016. 7. 11.. */ public class Chat extends RealmObject{ private String userName; private String message; private String currentTime; private String roomName; public Chat() { } public Chat(String userName, String message, String currentTime) { this.userName = userName; this.message = message; this.currentTime = currentTime; } public String getRoomName() {return roomName; } public String getUserName() { return userName; } public String getMessage() { return message; } public String getCurrentTime() { return currentTime; } public void setRoomName(String roomName) { this.roomName = roomName; } public void setUserName(String userName){ this.userName = userName; } public void setMessage(String message){ this.message = message; } public void setCurrentTime(String currentTime){ this.currentTime = currentTime; } }
1,020
0.701961
0.694118
34
29
26.226391
85
false
false
0
0
0
0
0
0
0.558824
false
false
3
f595ef4f5933488051f8fa1ebdb3487eb491188b
26,147,760,946,947
1cb33e07447df5e06a03efaf1ce3c38512974ae7
/app/src/main/java/com/wajanasoontorn/a500pxapp/ui/FullscreenActivity.java
d98ab4070d8ecca8b6d4443d4cbb485f7e612630
[]
no_license
wajanasoontorn/A500pxApp
https://github.com/wajanasoontorn/A500pxApp
a98f1847a668e4fa58215da98760ada8c426ad6e
70e0cbfc4892228c59c41bed9a686bb6deff4517
refs/heads/master
2018-05-13T08:39:32.150000
2016-06-12T07:43:37
2016-06-12T07:43:37
60,777,897
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wajanasoontorn.a500pxapp.ui; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.wajanasoontorn.a500pxapp.R; import com.wajanasoontorn.a500pxapp.models.PhotoModel; import java.text.DateFormat; import java.util.Date; /** * An example full-screen activity that shows and hides the system UI (i.e. * status bar and navigation/system bar) with user interaction. */ public class FullscreenActivity extends AppCompatActivity { private ImageView mPhoto; private TextView mTitle; private TextView mAuthor; private TextView mUploadedDate; private PhotoModel mPhotoModel; private ProgressBar mProgressBar; /** * Some older devices needs a small delay between UI widget updates * and a change of the status and navigation bar. */ private static final int UI_ANIMATION_DELAY = 300; private final Handler mHideHandler = new Handler(); private final Runnable mHidePart2Runnable = new Runnable() { @SuppressLint("InlinedApi") @Override public void run() { // Delayed removal of status and navigation bar // Note that some of these constants are new as of API 16 (Jelly Bean) // and API 19 (KitKat). It is safe to use them, as they are inlined // at compile-time and do nothing on earlier devices. mPhoto.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } }; private View mControlsView; private final Runnable mShowPart2Runnable = new Runnable() { @Override public void run() { // Delayed display of UI elements ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.show(); } mControlsView.setVisibility(View.VISIBLE); } }; private boolean mVisible; private final Runnable mHideRunnable = new Runnable() { @Override public void run() { hide(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fullscreen); mVisible = true; mControlsView = findViewById(R.id.fullscreen_content_controls); mPhoto = (ImageView) findViewById(R.id.photo); mTitle = (TextView) findViewById(R.id.title); mAuthor = (TextView) findViewById(R.id.author); mUploadedDate = (TextView) findViewById(R.id.uploaded_date); mProgressBar = (ProgressBar) findViewById(R.id.progress_bar); // Set up the user interaction to manually show or hide the system UI. mPhoto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { toggle(); } }); Intent intent = getIntent(); if (intent != null) { String json = intent.getStringExtra(DetailActivity.PHOTO_KEY); if (json != null) { Gson gson = new GsonBuilder().create(); try { mPhotoModel = gson.fromJson(json, PhotoModel.class); } catch(Exception e) { Log.e("ERROR", "DetailActivity.onCreate: deserialize error "); } } } setupView(); } private void setupView() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true); if (mPhotoModel != null) { Picasso.with(this).load(mPhotoModel.getHisResPhotoUrl()).into(mPhoto, new Callback() { @Override public void onSuccess() { mProgressBar.setVisibility(View.GONE); } @Override public void onError() { mProgressBar.setVisibility(View.GONE); } }); mTitle.setText(mPhotoModel.name); mAuthor.setText(getResources().getString(R.string.author, mPhotoModel.user.fullname)); Date d = mPhotoModel.getCreatedAtDate(); String crateAt = null; if (d != null) crateAt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(d); if (crateAt != null) mUploadedDate.setText(getResources().getString(R.string.uploaded, crateAt)); else mUploadedDate.setText(""); if (actionBar != null) actionBar.setTitle(mPhotoModel.name); } } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Trigger the initial hide() shortly after the activity has been // created, to briefly hint to the user that UI controls // are available. delayedHide(100); } private void toggle() { if (mVisible) { hide(); } else { show(); } } private void hide() { // Hide UI first ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.hide(); } mControlsView.setVisibility(View.GONE); mVisible = false; // Schedule a runnable to remove the status and navigation bar after a delay mHideHandler.removeCallbacks(mShowPart2Runnable); mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY); } @SuppressLint("InlinedApi") private void show() { // Show the system bar mPhoto.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); mVisible = true; // Schedule a runnable to display UI elements after a delay mHideHandler.removeCallbacks(mHidePart2Runnable); mHideHandler.postDelayed(mShowPart2Runnable, UI_ANIMATION_DELAY); } /** * Schedules a call to hide() in [delay] milliseconds, canceling any * previously scheduled calls. */ private void delayedHide(int delayMillis) { mHideHandler.removeCallbacks(mHideRunnable); mHideHandler.postDelayed(mHideRunnable, delayMillis); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
7,351
java
FullscreenActivity.java
Java
[]
null
[]
package com.wajanasoontorn.a500pxapp.ui; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.wajanasoontorn.a500pxapp.R; import com.wajanasoontorn.a500pxapp.models.PhotoModel; import java.text.DateFormat; import java.util.Date; /** * An example full-screen activity that shows and hides the system UI (i.e. * status bar and navigation/system bar) with user interaction. */ public class FullscreenActivity extends AppCompatActivity { private ImageView mPhoto; private TextView mTitle; private TextView mAuthor; private TextView mUploadedDate; private PhotoModel mPhotoModel; private ProgressBar mProgressBar; /** * Some older devices needs a small delay between UI widget updates * and a change of the status and navigation bar. */ private static final int UI_ANIMATION_DELAY = 300; private final Handler mHideHandler = new Handler(); private final Runnable mHidePart2Runnable = new Runnable() { @SuppressLint("InlinedApi") @Override public void run() { // Delayed removal of status and navigation bar // Note that some of these constants are new as of API 16 (Jelly Bean) // and API 19 (KitKat). It is safe to use them, as they are inlined // at compile-time and do nothing on earlier devices. mPhoto.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } }; private View mControlsView; private final Runnable mShowPart2Runnable = new Runnable() { @Override public void run() { // Delayed display of UI elements ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.show(); } mControlsView.setVisibility(View.VISIBLE); } }; private boolean mVisible; private final Runnable mHideRunnable = new Runnable() { @Override public void run() { hide(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fullscreen); mVisible = true; mControlsView = findViewById(R.id.fullscreen_content_controls); mPhoto = (ImageView) findViewById(R.id.photo); mTitle = (TextView) findViewById(R.id.title); mAuthor = (TextView) findViewById(R.id.author); mUploadedDate = (TextView) findViewById(R.id.uploaded_date); mProgressBar = (ProgressBar) findViewById(R.id.progress_bar); // Set up the user interaction to manually show or hide the system UI. mPhoto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { toggle(); } }); Intent intent = getIntent(); if (intent != null) { String json = intent.getStringExtra(DetailActivity.PHOTO_KEY); if (json != null) { Gson gson = new GsonBuilder().create(); try { mPhotoModel = gson.fromJson(json, PhotoModel.class); } catch(Exception e) { Log.e("ERROR", "DetailActivity.onCreate: deserialize error "); } } } setupView(); } private void setupView() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true); if (mPhotoModel != null) { Picasso.with(this).load(mPhotoModel.getHisResPhotoUrl()).into(mPhoto, new Callback() { @Override public void onSuccess() { mProgressBar.setVisibility(View.GONE); } @Override public void onError() { mProgressBar.setVisibility(View.GONE); } }); mTitle.setText(mPhotoModel.name); mAuthor.setText(getResources().getString(R.string.author, mPhotoModel.user.fullname)); Date d = mPhotoModel.getCreatedAtDate(); String crateAt = null; if (d != null) crateAt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(d); if (crateAt != null) mUploadedDate.setText(getResources().getString(R.string.uploaded, crateAt)); else mUploadedDate.setText(""); if (actionBar != null) actionBar.setTitle(mPhotoModel.name); } } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Trigger the initial hide() shortly after the activity has been // created, to briefly hint to the user that UI controls // are available. delayedHide(100); } private void toggle() { if (mVisible) { hide(); } else { show(); } } private void hide() { // Hide UI first ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.hide(); } mControlsView.setVisibility(View.GONE); mVisible = false; // Schedule a runnable to remove the status and navigation bar after a delay mHideHandler.removeCallbacks(mShowPart2Runnable); mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY); } @SuppressLint("InlinedApi") private void show() { // Show the system bar mPhoto.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); mVisible = true; // Schedule a runnable to display UI elements after a delay mHideHandler.removeCallbacks(mHidePart2Runnable); mHideHandler.postDelayed(mShowPart2Runnable, UI_ANIMATION_DELAY); } /** * Schedules a call to hide() in [delay] milliseconds, canceling any * previously scheduled calls. */ private void delayedHide(int delayMillis) { mHideHandler.removeCallbacks(mHideRunnable); mHideHandler.postDelayed(mHideRunnable, delayMillis); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; } return super.onOptionsItemSelected(item); } }
7,351
0.616923
0.61325
215
33.195351
24.648958
105
false
false
0
0
0
0
0
0
0.493023
false
false
3
fff7f46f3ad49a99ddae76a3b094bb69e659cd6b
27,771,258,577,196
876172160bc52e2b1384a5f821f32c4b20cf87e4
/src/main/java/serverApp/Controller/PersonController.java
afb1c832bdc6df86eaa08b8328740608a7810259
[]
no_license
coyul/RestAPI-Spring-mongoDB-Maven-UserService
https://github.com/coyul/RestAPI-Spring-mongoDB-Maven-UserService
3f062a1fad5b68afcf1e764b09bc35c1ddedbf65
d1242e959334162bcc06de6f3c3de22086dfff32
refs/heads/master
2021-01-22T21:12:59.966000
2017-03-19T15:15:06
2017-03-19T15:15:06
85,405,415
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package serverApp.Controller; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import serverApp.Model.Person; import serverApp.Repository.PersonRepository; @RestController @RequestMapping("/person") public class PersonController { private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); @Autowired private PersonRepository personRepository; @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } // create new person with unique email and encrypted password @RequestMapping(method = RequestMethod.POST) public Map<String, Object> createPerson(@RequestBody Map<String, Object> personMap) throws ParseException { Person person = new Person(personMap.get("name").toString(), personMap.get("surname").toString(), dateFormat.parse(personMap.get("birthDate").toString()), personMap.get("email").toString(), personMap.get("password").toString()); Map<String, Object> response = new LinkedHashMap<String, Object>(); for (Person p : personRepository.findAll()) { if (p.getEmail().equals(person.getEmail())) { response.put("message", "Person with such email already exists"); return response; } } person.setPassword(bCryptPasswordEncoder().encode(person.getPassword())); response.put("message", "New person created successfully"); response.put("person", personRepository.save(person)); return response; } // get person by email @RequestMapping(method = RequestMethod.GET, value = "/email='{email}'") public Map<String, Object> getPerson(@PathVariable("email") String email) { String id = null; Map<String, Object> response = new LinkedHashMap<String, Object>(); for (Person person : personRepository.findAll()) { if (person.getEmail().equals(email)) id = person.getId(); } if (id != null) response.put("Person is found", personRepository.findOne(id)); else response.put("Person has not been found", null); return response; } // delete person by id @RequestMapping(method = RequestMethod.DELETE, value = "/{personId}") public Map<String, Object> deletePerson(@PathVariable("personId") String personId) { Map<String, Object> response = new HashMap<String, Object>(); if (personRepository.findOne(personId) == null) { response.put("message", "No person to delete"); return response; } else { personRepository.delete(personId); response.put("message", "Person deleted successfully"); return response; } } // getting by id // @RequestMapping(method = RequestMethod.GET, value = "/{personId}") // public Person getBookDetails(@PathVariable("personId") String personId) { // return personRepository.findOne(personId); // } // getting all persons // @RequestMapping(method = RequestMethod.GET) // public Map<String, Object> getAllPersons() { // List<Person> person = personRepository.findAll(); // Map<String, Object> response = new LinkedHashMap<String, Object>(); // response.put("totalPersons", person.size()); // response.put("persons", person); // return response; // } }
UTF-8
Java
3,746
java
PersonController.java
Java
[]
null
[]
package serverApp.Controller; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import serverApp.Model.Person; import serverApp.Repository.PersonRepository; @RestController @RequestMapping("/person") public class PersonController { private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); @Autowired private PersonRepository personRepository; @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } // create new person with unique email and encrypted password @RequestMapping(method = RequestMethod.POST) public Map<String, Object> createPerson(@RequestBody Map<String, Object> personMap) throws ParseException { Person person = new Person(personMap.get("name").toString(), personMap.get("surname").toString(), dateFormat.parse(personMap.get("birthDate").toString()), personMap.get("email").toString(), personMap.get("password").toString()); Map<String, Object> response = new LinkedHashMap<String, Object>(); for (Person p : personRepository.findAll()) { if (p.getEmail().equals(person.getEmail())) { response.put("message", "Person with such email already exists"); return response; } } person.setPassword(bCryptPasswordEncoder().encode(person.getPassword())); response.put("message", "New person created successfully"); response.put("person", personRepository.save(person)); return response; } // get person by email @RequestMapping(method = RequestMethod.GET, value = "/email='{email}'") public Map<String, Object> getPerson(@PathVariable("email") String email) { String id = null; Map<String, Object> response = new LinkedHashMap<String, Object>(); for (Person person : personRepository.findAll()) { if (person.getEmail().equals(email)) id = person.getId(); } if (id != null) response.put("Person is found", personRepository.findOne(id)); else response.put("Person has not been found", null); return response; } // delete person by id @RequestMapping(method = RequestMethod.DELETE, value = "/{personId}") public Map<String, Object> deletePerson(@PathVariable("personId") String personId) { Map<String, Object> response = new HashMap<String, Object>(); if (personRepository.findOne(personId) == null) { response.put("message", "No person to delete"); return response; } else { personRepository.delete(personId); response.put("message", "Person deleted successfully"); return response; } } // getting by id // @RequestMapping(method = RequestMethod.GET, value = "/{personId}") // public Person getBookDetails(@PathVariable("personId") String personId) { // return personRepository.findOne(personId); // } // getting all persons // @RequestMapping(method = RequestMethod.GET) // public Map<String, Object> getAllPersons() { // List<Person> person = personRepository.findAll(); // Map<String, Object> response = new LinkedHashMap<String, Object>(); // response.put("totalPersons", person.size()); // response.put("persons", person); // return response; // } }
3,746
0.72771
0.72771
100
35.459999
33.19109
230
false
false
0
0
0
0
0
0
1.88
false
false
3
e05935f361bcddc5c10c79cc0c87597824d3b387
33,578,054,320,661
0283fc9ce8958a01d37215f436134ff0d5f8c87a
/src/main/java/com/example/web/controller/GoodsController.java
a564d8a606648661879ce60d8e7ee4983c827474
[ "MIT" ]
permissive
wangjie-fourth/superShop-backEnd
https://github.com/wangjie-fourth/superShop-backEnd
d7c1df79ac10a6cfdd82e287bea8fc43fc1af054
083f0681001a082fb1cefee65969026fafd5a7f0
refs/heads/master
2021-07-13T05:16:32
2020-09-10T13:10:03
2020-09-10T13:10:03
196,962,623
0
0
MIT
false
2020-03-17T03:45:07
2019-07-15T08:58:51
2020-03-17T03:44:03
2020-03-17T03:45:06
1,120
0
0
1
Java
false
false
package com.example.web.controller; import com.example.domain.dataobject.Product; import com.example.domain.dataobject.ProductCategory; import com.example.enums.ProductCategoryStatusEnum; import com.example.enums.ProductStatusEnum; import com.example.service.DTO.ProductInfoDTO; import com.example.service.ProductService; import com.example.service.impl.ProductCategoryServiceImpl; import com.example.web.VO.ProductCategoryVO; import com.example.web.VO.ProductVO; import com.example.web.VO.ProductsVO; import com.example.web.VO.ResultVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; /** * Created by wangjie_fourth on 2019/4/14. */ @RestController @RequestMapping("/goods") //@CrossOrigin(origins = "http://127.0.0.1:3001", maxAge = 3600) //@CrossOrigin(origins = "http://supermarket.nat100.top", maxAge = 3600) @CrossOrigin(origins = "*", maxAge = 3600) public class GoodsController { @Autowired private ProductCategoryServiceImpl productCategoryServiceImpl; @Autowired private ProductService productService; // 获取商品列表左侧分类数据 @GetMapping("/getCategorys") public ResultVO<List<ProductCategoryVO>> getProductCategoryList() { // 获取在架的商品分类 List<ProductCategory> lists = productCategoryServiceImpl.getProductCategoryByCategoryExist(ProductCategoryStatusEnum.UP.getCode()); // 转换成前端所需要的数据 List<ProductCategoryVO> resultData = new ArrayList<>(); for (ProductCategory p : lists) { ProductCategoryVO vo = new ProductCategoryVO(); vo.setCategoryId(p.getCategoryId()); vo.setCategoryName(p.getCategoryName()); vo.setCategoryType(p.getCategoryType()); resultData.add(vo); } // 成功 ResultVO<List<ProductCategoryVO>> resultVO = new ResultVO(); resultVO.setCode(0); resultVO.setMsg("成功"); resultVO.setData(resultData); return resultVO; } // 根据指定分类编号获取其所有商品信息 @GetMapping("/getProducts") public ResultVO<ProductsVO> getProductsByCategoryType( @RequestParam(value = "type", defaultValue = "0") Integer type, @RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "size", defaultValue = "6") Integer size) { /* * 1、获取指定页面下的商品数据 * 2、转换成前端所需数据 * 对商品信息进行转换 * 判断该分类下是否还有数据 * 3、发送到前端 * */ // 1、根据编号获取商品 PageRequest pageRequest = new PageRequest(page, size); Page<Product> productPage = productService.getProductsByCategoryAndStatus(pageRequest, type, ProductStatusEnum.UP.getCode()); List<Product> productList = productPage.getContent(); // 2.1 转换成前端所需的商品数据 List<ProductVO> productVOList = new ArrayList<>(); for (Product p : productList) { ProductVO vo = new ProductVO(); vo.setProductId(p.getProductId()); vo.setProductName(p.getProductName()); vo.setProductPrice(p.getProductPrice()); vo.setCategoryType(p.getCategoryType()); vo.setProductIcon(p.getProductIcon()); vo.setProductStock(p.getProductStock()); productVOList.add(vo); } // 2.2 判断是否还有数据 Integer exist = 0; if (productPage.getTotalPages() >= page) { // 后续没有数据 exist = 0; } else { // 后台有数据 exist = 1; } // 2.3 拼接数据 ProductsVO productsVO = new ProductsVO(); productsVO.setExist(exist); productsVO.setProductVOList(productVOList); // 3、向前端发送数据 ResultVO<ProductsVO> resultVO = new ResultVO<>(); resultVO.setCode(0); resultVO.setMsg("成功"); resultVO.setData(productsVO); return resultVO; } // 根据商品id,获取该商品的详细信息 @GetMapping("/getProductById") public ResultVO<ProductVO> getProducyById( @RequestParam(value = "id", defaultValue = "1") String id ) { //获取信息 ProductInfoDTO p = productService.getProductById(id); // 转换成前端所需要的格式 ProductVO vo = new ProductVO(); vo.setProductId(p.getProductId()); vo.setProductName(p.getProductName()); vo.setProductPrice(p.getProductPrice()); vo.setCategoryType(p.getCategoryType()); vo.setProductIcon(p.getProductIcon()); vo.setProductStock(p.getProductStock()); vo.setRecommendList(p.getRecommendList()); // 向前端发送数据 ResultVO<ProductVO> resultVO = new ResultVO<>(); resultVO.setCode(0); resultVO.setMsg("成功"); resultVO.setData(vo); return resultVO; } }
UTF-8
Java
5,283
java
GoodsController.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by wangjie_fourth on 2019/4/14.\n */\n@RestController\n@RequestMapping", "end": 834, "score": 0.9995940923690796, "start": 820, "tag": "USERNAME", "value": "wangjie_fourth" } ]
null
[]
package com.example.web.controller; import com.example.domain.dataobject.Product; import com.example.domain.dataobject.ProductCategory; import com.example.enums.ProductCategoryStatusEnum; import com.example.enums.ProductStatusEnum; import com.example.service.DTO.ProductInfoDTO; import com.example.service.ProductService; import com.example.service.impl.ProductCategoryServiceImpl; import com.example.web.VO.ProductCategoryVO; import com.example.web.VO.ProductVO; import com.example.web.VO.ProductsVO; import com.example.web.VO.ResultVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; /** * Created by wangjie_fourth on 2019/4/14. */ @RestController @RequestMapping("/goods") //@CrossOrigin(origins = "http://127.0.0.1:3001", maxAge = 3600) //@CrossOrigin(origins = "http://supermarket.nat100.top", maxAge = 3600) @CrossOrigin(origins = "*", maxAge = 3600) public class GoodsController { @Autowired private ProductCategoryServiceImpl productCategoryServiceImpl; @Autowired private ProductService productService; // 获取商品列表左侧分类数据 @GetMapping("/getCategorys") public ResultVO<List<ProductCategoryVO>> getProductCategoryList() { // 获取在架的商品分类 List<ProductCategory> lists = productCategoryServiceImpl.getProductCategoryByCategoryExist(ProductCategoryStatusEnum.UP.getCode()); // 转换成前端所需要的数据 List<ProductCategoryVO> resultData = new ArrayList<>(); for (ProductCategory p : lists) { ProductCategoryVO vo = new ProductCategoryVO(); vo.setCategoryId(p.getCategoryId()); vo.setCategoryName(p.getCategoryName()); vo.setCategoryType(p.getCategoryType()); resultData.add(vo); } // 成功 ResultVO<List<ProductCategoryVO>> resultVO = new ResultVO(); resultVO.setCode(0); resultVO.setMsg("成功"); resultVO.setData(resultData); return resultVO; } // 根据指定分类编号获取其所有商品信息 @GetMapping("/getProducts") public ResultVO<ProductsVO> getProductsByCategoryType( @RequestParam(value = "type", defaultValue = "0") Integer type, @RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "size", defaultValue = "6") Integer size) { /* * 1、获取指定页面下的商品数据 * 2、转换成前端所需数据 * 对商品信息进行转换 * 判断该分类下是否还有数据 * 3、发送到前端 * */ // 1、根据编号获取商品 PageRequest pageRequest = new PageRequest(page, size); Page<Product> productPage = productService.getProductsByCategoryAndStatus(pageRequest, type, ProductStatusEnum.UP.getCode()); List<Product> productList = productPage.getContent(); // 2.1 转换成前端所需的商品数据 List<ProductVO> productVOList = new ArrayList<>(); for (Product p : productList) { ProductVO vo = new ProductVO(); vo.setProductId(p.getProductId()); vo.setProductName(p.getProductName()); vo.setProductPrice(p.getProductPrice()); vo.setCategoryType(p.getCategoryType()); vo.setProductIcon(p.getProductIcon()); vo.setProductStock(p.getProductStock()); productVOList.add(vo); } // 2.2 判断是否还有数据 Integer exist = 0; if (productPage.getTotalPages() >= page) { // 后续没有数据 exist = 0; } else { // 后台有数据 exist = 1; } // 2.3 拼接数据 ProductsVO productsVO = new ProductsVO(); productsVO.setExist(exist); productsVO.setProductVOList(productVOList); // 3、向前端发送数据 ResultVO<ProductsVO> resultVO = new ResultVO<>(); resultVO.setCode(0); resultVO.setMsg("成功"); resultVO.setData(productsVO); return resultVO; } // 根据商品id,获取该商品的详细信息 @GetMapping("/getProductById") public ResultVO<ProductVO> getProducyById( @RequestParam(value = "id", defaultValue = "1") String id ) { //获取信息 ProductInfoDTO p = productService.getProductById(id); // 转换成前端所需要的格式 ProductVO vo = new ProductVO(); vo.setProductId(p.getProductId()); vo.setProductName(p.getProductName()); vo.setProductPrice(p.getProductPrice()); vo.setCategoryType(p.getCategoryType()); vo.setProductIcon(p.getProductIcon()); vo.setProductStock(p.getProductStock()); vo.setRecommendList(p.getRecommendList()); // 向前端发送数据 ResultVO<ProductVO> resultVO = new ResultVO<>(); resultVO.setCode(0); resultVO.setMsg("成功"); resultVO.setData(vo); return resultVO; } }
5,283
0.648334
0.637497
144
32.965279
24.223328
139
false
false
0
0
0
0
0
0
0.5625
false
false
3
6050ff9e384a4ab622ebf0d8ad18b704c9637428
28,759,101,050,231
1fcd45038c93c61954ae4377bef30481a46d9a23
/app/src/test/java/com/example/lemon/TrackingFragmentTest.java
8da6a38563f0fc320a3e8b298ab3b4f2d915daf4
[]
no_license
Ballen7/Lemon
https://github.com/Ballen7/Lemon
458747c5143365f9bcb987754a6f00ad25f2bb4e
8e19d9a0ebcf4f41e4838aef2dda697d35629b4f
refs/heads/master
2020-09-29T01:08:38.951000
2019-12-09T19:58:50
2019-12-09T19:58:50
226,910,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.lemon; public class TrackingFragmentTest { }
UTF-8
Java
66
java
TrackingFragmentTest.java
Java
[]
null
[]
package com.example.lemon; public class TrackingFragmentTest { }
66
0.80303
0.80303
4
15.5
15.337862
35
false
false
0
0
0
0
0
0
0.25
false
false
3
bd4a1cb1e507ebbfdb009ac3b4a03eed2ccff204
8,864,812,555,491
b7abf30539bce1cdb8dc8883a7324a8afa344296
/tree/src/main/java/net/tree_3/resource/Resource.java
74b743b98b2cf5e2899a5e28e7c53d395eb002d7
[ "Apache-2.0" ]
permissive
tonels/dataFlower
https://github.com/tonels/dataFlower
aef9831d797f5b607032b070e03a362e98a0a667
f1172fe58b73eb6c9fbbe372e8fbd65182c4cc4e
refs/heads/master
2022-07-01T09:41:02.308000
2020-04-17T05:46:58
2020-04-17T05:46:58
220,606,519
0
0
Apache-2.0
false
2022-06-29T17:51:51
2019-11-09T07:21:06
2020-04-17T05:47:28
2022-06-29T17:51:48
18,276
0
0
17
Java
false
false
package net.tree_3.resource; import lombok.Data; import lombok.experimental.Accessors; import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; @Data @Accessors(chain = true) public class Resource implements Serializable { private static final long serialVersionUID = 23412515165L; /** * 主键ID */ private Long resourceId; /** * 资源级别 * 1:一级,2:二级,3:三级 */ private Integer level; /** * 父级ID */ private Long parentId; /** * 资源名称 */ private String name; /** * 描述 */ private String summary; /** * 权限标识 */ private String code; /** * 修改人 */ private String updateBy; /** * 修改时间 */ private LocalDateTime updateTime; /** * 创建人 */ private String createBy; /** * 创建时间 */ private LocalDateTime createTime; private List<Resource> children; }
UTF-8
Java
1,033
java
Resource.java
Java
[]
null
[]
package net.tree_3.resource; import lombok.Data; import lombok.experimental.Accessors; import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; @Data @Accessors(chain = true) public class Resource implements Serializable { private static final long serialVersionUID = 23412515165L; /** * 主键ID */ private Long resourceId; /** * 资源级别 * 1:一级,2:二级,3:三级 */ private Integer level; /** * 父级ID */ private Long parentId; /** * 资源名称 */ private String name; /** * 描述 */ private String summary; /** * 权限标识 */ private String code; /** * 修改人 */ private String updateBy; /** * 修改时间 */ private LocalDateTime updateTime; /** * 创建人 */ private String createBy; /** * 创建时间 */ private LocalDateTime createTime; private List<Resource> children; }
1,033
0.568875
0.553102
59
15.118644
13.070972
62
false
false
0
0
0
0
0
0
0.338983
false
false
3
686e0aa584db509e5e08de08e9cae150fc8f1e48
34,617,436,421,234
6fedee043c2466dded9ac19d1908553f1062186b
/src/main/java/com/zjw/yttj/service/YttjUserService.java
9f6b9c2695b86ab8677168b80e2ba430392d9f01
[]
no_license
Panicle/yttj1
https://github.com/Panicle/yttj1
4c5aadc84cc9ef2343e80dee19ca222afb09f58b
31c5eb47b5a20c44c0b21ef133c2f87154a64c8a
refs/heads/master
2022-06-26T01:08:27.325000
2020-04-04T03:23:26
2020-04-04T03:23:26
252,899,160
0
0
null
false
2022-06-17T03:01:25
2020-04-04T03:26:57
2020-04-04T03:29:03
2022-06-17T03:01:25
1,751
0
0
4
JavaScript
false
false
package com.zjw.yttj.service; import com.baomidou.mybatisplus.extension.service.IService; import com.zjw.yttj.entity.YttjUser; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; /** * 类目 * Created by Panicle * 2020/3/2 18:22 **/ public interface YttjUserService extends IService<YttjUser> { /*1.添加个人信息*/ String insertOne(YttjUser yttjUser); /*2.查询单个职工信息*/ YttjUser selectById(int id); /*3.查询全部用户*/ Page<YttjUser> findList(int id, Pageable pageable); /*4.删除单个用户*/ YttjUser deleteOne(YttjUser yttjUser); }
UTF-8
Java
643
java
YttjUserService.java
Java
[ { "context": "ork.data.domain.Pageable;\n\n/**\n * 类目\n * Created by Panicle\n * 2020/3/2 18:22\n **/\npublic interface YttjUserS", "end": 254, "score": 0.9994222521781921, "start": 247, "tag": "USERNAME", "value": "Panicle" } ]
null
[]
package com.zjw.yttj.service; import com.baomidou.mybatisplus.extension.service.IService; import com.zjw.yttj.entity.YttjUser; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; /** * 类目 * Created by Panicle * 2020/3/2 18:22 **/ public interface YttjUserService extends IService<YttjUser> { /*1.添加个人信息*/ String insertOne(YttjUser yttjUser); /*2.查询单个职工信息*/ YttjUser selectById(int id); /*3.查询全部用户*/ Page<YttjUser> findList(int id, Pageable pageable); /*4.删除单个用户*/ YttjUser deleteOne(YttjUser yttjUser); }
643
0.72402
0.70017
23
24.52174
19.908201
61
false
false
0
0
0
0
0
0
0.434783
false
false
3
931d6c17a82c7a36f9511a19988bda26d6014cda
20,031,727,529,973
e00bffaab5f79d783fed961697b2fbe13c57f8ef
/src/imop/ast/node/external/RelationalLEExpression.java
679641c67402fddbb266d42c598b2adbb344b64f
[ "MIT" ]
permissive
amannougrahiya/imop-compiler
https://github.com/amannougrahiya/imop-compiler
b8886a37e49f37ac09b8c8c83c6209b640198b94
31a840c13ecbec0790600a0b2511772e7d7eb5cc
refs/heads/master
2023-05-13T18:35:55.556000
2023-05-05T12:05:00
2023-05-05T12:05:00
242,248,042
16
2
MIT
false
2020-03-11T12:02:16
2020-02-21T23:24:38
2020-03-11T11:53:35
2020-03-11T12:00:41
6,455
2
1
1
SWIG
false
false
/* * Copyright (c) 2019 Aman Nougrahiya, V Krishna Nandivada, IIT Madras. * This file is a part of the project IMOP, licensed under the MIT license. * See LICENSE.md for the full text of the license. * * The above notice shall be included in all copies or substantial * portions of this file. */ // // Generated by JTB 1.3.2 // package imop.ast.node.external; /** * Grammar production: * f0 ::= "<=" * f1 ::= RelationalExpression() */ public class RelationalLEExpression extends RelationalExpression { { classId = 1039394; } public RelationalLEExpression() { } /** * */ private static final long serialVersionUID = 131343639316423700L; private NodeToken f0; private RelationalExpression f1; public RelationalLEExpression(NodeToken n0, RelationalExpression n1) { n0.setParent(this); n1.setParent(this); setF0(n0); setF1(n1); } public RelationalLEExpression(RelationalExpression n0) { n0.setParent(this); setF0(new NodeToken("<=")); getF0().setParent(this); setF1(n0); } @Override public void accept(imop.baseVisitor.Visitor v) { v.visit(this); } @Override public <R, A> R accept(imop.baseVisitor.GJVisitor<R, A> v, A argu) { return v.visit(this, argu); } @Override public <R> R accept(imop.baseVisitor.GJNoArguVisitor<R> v) { return v.visit(this); } @Override public <A> void accept(imop.baseVisitor.GJVoidVisitor<A> v, A argu) { v.visit(this, argu); } public NodeToken getF0() { return f0; } public void setF0(NodeToken f0) { f0.setParent(this); this.f0 = f0; } public RelationalExpression getF1() { return f1; } public void setF1(RelationalExpression f1) { f1.setParent(this); this.f1 = f1; } }
UTF-8
Java
1,697
java
RelationalLEExpression.java
Java
[ { "context": "/*\n * Copyright (c) 2019 Aman Nougrahiya, V Krishna Nandivada, IIT Madras.\n * This file is", "end": 40, "score": 0.9998905658721924, "start": 25, "tag": "NAME", "value": "Aman Nougrahiya" }, { "context": "/*\n * Copyright (c) 2019 Aman Nougrahiya, V Krishna Nandivada, IIT Madras.\n * This file is a part of the projec", "end": 61, "score": 0.9998669624328613, "start": 42, "tag": "NAME", "value": "V Krishna Nandivada" } ]
null
[]
/* * Copyright (c) 2019 <NAME>, <NAME>, IIT Madras. * This file is a part of the project IMOP, licensed under the MIT license. * See LICENSE.md for the full text of the license. * * The above notice shall be included in all copies or substantial * portions of this file. */ // // Generated by JTB 1.3.2 // package imop.ast.node.external; /** * Grammar production: * f0 ::= "<=" * f1 ::= RelationalExpression() */ public class RelationalLEExpression extends RelationalExpression { { classId = 1039394; } public RelationalLEExpression() { } /** * */ private static final long serialVersionUID = 131343639316423700L; private NodeToken f0; private RelationalExpression f1; public RelationalLEExpression(NodeToken n0, RelationalExpression n1) { n0.setParent(this); n1.setParent(this); setF0(n0); setF1(n1); } public RelationalLEExpression(RelationalExpression n0) { n0.setParent(this); setF0(new NodeToken("<=")); getF0().setParent(this); setF1(n0); } @Override public void accept(imop.baseVisitor.Visitor v) { v.visit(this); } @Override public <R, A> R accept(imop.baseVisitor.GJVisitor<R, A> v, A argu) { return v.visit(this, argu); } @Override public <R> R accept(imop.baseVisitor.GJNoArguVisitor<R> v) { return v.visit(this); } @Override public <A> void accept(imop.baseVisitor.GJVoidVisitor<A> v, A argu) { v.visit(this, argu); } public NodeToken getF0() { return f0; } public void setF0(NodeToken f0) { f0.setParent(this); this.f0 = f0; } public RelationalExpression getF1() { return f1; } public void setF1(RelationalExpression f1) { f1.setParent(this); this.f1 = f1; } }
1,675
0.691809
0.654095
86
18.732557
21.614716
75
true
false
0
0
0
0
0
0
1.22093
false
false
3
2ec7773378ffe369bcccc53fe8d35490614f8c3b
35,510,789,615,005
c5283b2e9b247407d4fe877d766bd41a8ff02410
/src/main/java/club/wadreamer/cloudlearning/mapper/custom/CourseReviewDao.java
b1c4af0a2d074e917da16265fb5a7f552f46faa3
[]
no_license
wadreamer/cloudlearning
https://github.com/wadreamer/cloudlearning
7da5c9143ca1cc318ce8c0eb20c7cee384173b87
a5602a0ec7d1ae26b5f92fd1ab0f0b2231eb668c
refs/heads/master
2022-11-11T08:55:46.886000
2020-06-26T02:44:58
2020-06-26T02:44:58
273,382,851
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package club.wadreamer.cloudlearning.mapper.custom; import club.wadreamer.cloudlearning.model.auto.Course; import club.wadreamer.cloudlearning.model.custom.CourseReviewLog; import java.util.List; public interface CourseReviewDao { List<Course> getUnreviewList(); List<CourseReviewLog> getUnpassList(); List<CourseReviewLog> getPassList(); }
UTF-8
Java
358
java
CourseReviewDao.java
Java
[]
null
[]
package club.wadreamer.cloudlearning.mapper.custom; import club.wadreamer.cloudlearning.model.auto.Course; import club.wadreamer.cloudlearning.model.custom.CourseReviewLog; import java.util.List; public interface CourseReviewDao { List<Course> getUnreviewList(); List<CourseReviewLog> getUnpassList(); List<CourseReviewLog> getPassList(); }
358
0.796089
0.796089
14
24.571428
23.175463
65
false
false
0
0
0
0
0
0
0.5
false
false
3
dcc96aaa5c9f45c385e08099f311493a479dc36e
34,729,105,579,188
bcae4d966b05aef14f4448127470a38916fad6cc
/app/src/main/java/com/vmax/android/ads/mediation/partners/FaceBookNative.java
3ded18dda771cbd6bb23a3f900c70dae354bc402
[]
no_license
trangneo/Vmax.Demo
https://github.com/trangneo/Vmax.Demo
00b263aa14e92d45e20fa82914f9b929b512990f
5c2e08fb62fe28b5465dc1793e81a4abc6da60c0
refs/heads/master
2021-01-19T04:40:42.153000
2016-09-30T06:15:53
2016-09-30T06:15:53
69,312,417
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Project : Advert * Filename : FaceBookNative.java * Author : narendrap * Comments : * Copyright : Copyright 2014, VSERV */ package com.vmax.android.ads.mediation.partners; import java.util.List; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; import android.content.Context; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.facebook.ads.Ad; import com.facebook.ads.AdChoicesView; import com.facebook.ads.AdError; import com.facebook.ads.AdListener; import com.facebook.ads.AdSettings; import com.facebook.ads.MediaView; import com.facebook.ads.NativeAd; import com.facebook.ads.NativeAd.Rating; import com.vmax.android.ads.mediation.partners.VmaxCustomAd; import com.vmax.android.ads.mediation.partners.VmaxCustomAdListener; import com.vmax.android.ads.mediation.partners.VmaxCustomNativeAdListener; import com.vmax.android.ads.nativeads.NativeAdConstants; import com.vmax.android.ads.util.Constants; /** * @author narendrap */ /* * Tested with facebook SDK 4.11.0 */ public class FaceBookNative extends VmaxCustomAd implements AdListener { private NativeAd nativeAd; private static final String PLACEMENT_ID_KEY = "placementid"; private VmaxCustomNativeAdListener mNativeAdListener; public boolean LOGS_ENABLED = true; private VmaxCustomAdListener vmaxCustomAdListener; private Context context; @Override public void loadAd(Context context, VmaxCustomAdListener vmaxCustomAdListener, Map<String, Object> localExtras, Map<String, Object> serverExtras) { try { if (LOGS_ENABLED) { Log.d("vmax", "Facebook loadAd ."); } this.context = context; this.vmaxCustomAdListener = vmaxCustomAdListener; final String placementId; if (localExtras != null) { if (localExtras.containsKey("nativeListener")) { if (LOGS_ENABLED) { Log.i("Log", "nativeListener in localextras "); } mNativeAdListener = (VmaxCustomNativeAdListener) localExtras.get("nativeListener"); } } if (extrasAreValid(serverExtras)) { placementId = serverExtras.get(PLACEMENT_ID_KEY).toString(); } else { if (mNativeAdListener != null) { mNativeAdListener.onAdFailed("Placement id missing"); } return; } if (localExtras != null) { if (localExtras.containsKey("test")) { String[] mTestAvdIds = (String[]) localExtras .get("test"); if (mTestAvdIds != null) { for (int i = 0; i < mTestAvdIds.length; i++) { if (LOGS_ENABLED) { Log.i("vmax", "test devices: " + mTestAvdIds[i]); } AdSettings.addTestDevice(mTestAvdIds[i]); if (LOGS_ENABLED) { Log.i("vmax", "Test mode: " + AdSettings.isTestMode(context)); } } } } } nativeAd = new NativeAd(context, placementId); // AdSettings.addTestDevice("a33fc28edcc10fa20ce0454b7a9a204a"); // put your test device id printed in logs when you make first request to facebook. AdSettings.setMediationService("VMAX"); nativeAd.setAdListener(this); nativeAd.loadAd(NativeAd.MediaCacheFlag.ALL); } catch (Exception e) { if (mNativeAdListener != null) { mNativeAdListener.onAdFailed(e.getMessage()); } e.printStackTrace(); return; } } /* (non-Javadoc) * @see com.facebook.com.vmax.android.ads.AdListener#onAdClicked(com.facebook.com.vmax.android.ads.Ad) */ @Override public void onAdClicked(Ad arg0) { Log.i("vmax", "fb onAdClicked"); if (vmaxCustomAdListener != null) { vmaxCustomAdListener.onAdClicked(); } if (vmaxCustomAdListener != null) { vmaxCustomAdListener.onLeaveApplication(); } } /* (non-Javadoc) * @see com.facebook.com.vmax.android.ads.AdListener#onAdLoaded(com.facebook.com.vmax.android.ads.Ad) */ @Override public void onAdLoaded(Ad ad) { try { String adChoiceIcon = null, adChoiceURl = null; int adChoiceIconHeight = 0; int adChoiceIconWidth = 0; String coverImageURL = null; int coverImageHeight = 0; int coverImageWidth = 0; String iconForAd = null; int iconAdWidth = 0; int iconAdHeight = 0; if (ad != nativeAd) { return; } nativeAd.unregisterView(); String titleForAd = nativeAd.getAdTitle(); if (nativeAd.getAdCoverImage() != null) { coverImageURL = nativeAd.getAdCoverImage().getUrl(); coverImageHeight = nativeAd.getAdCoverImage().getHeight(); coverImageWidth = nativeAd.getAdCoverImage().getWidth(); } if (nativeAd.getAdIcon() != null) { iconForAd = nativeAd.getAdIcon().getUrl(); iconAdHeight = nativeAd.getAdIcon().getHeight(); iconAdWidth = nativeAd.getAdIcon().getWidth(); } String socialContextForAd = nativeAd.getAdSocialContext(); String titleForAdButton = nativeAd.getAdCallToAction(); String textForAdBody = nativeAd.getAdBody(); if (nativeAd.getAdChoicesIcon() != null) { adChoiceIcon = nativeAd.getAdChoicesIcon().getUrl(); adChoiceIconHeight = nativeAd.getAdChoicesIcon().getWidth(); adChoiceIconWidth = nativeAd.getAdChoicesIcon().getHeight(); } if (nativeAd.getAdChoicesLinkUrl() != null) { adChoiceURl = nativeAd.getAdChoicesLinkUrl(); } MediaView nativeMediaView = new MediaView(context); nativeAd.setMediaViewAutoplay(true); nativeMediaView.setAutoplay(true); nativeMediaView.setNativeAd(nativeAd); AdChoicesView adChoicesView = new AdChoicesView(context, nativeAd, true); String appRatingForAd = ""; Double rating = getDoubleRating(nativeAd.getAdStarRating()); Log.d("vmax", "getAdStarRating : " + nativeAd.getAdStarRating()); if (rating != null) { appRatingForAd = Double.toString(rating); } if (LOGS_ENABLED) { Log.d("vmax", "Title for Ad : " + titleForAd); Log.d("vmax", "coverImage URL : " + coverImageURL); Log.d("vmax", "socialContextForAd : " + socialContextForAd); Log.d("vmax", "titleForAdButton : " + titleForAdButton); Log.d("vmax", "textForAdBody : " + textForAdBody); Log.d("vmax", "appRatingForAd : " + appRatingForAd); Log.d("vmax", "iconForAd : " + iconForAd); } JSONObject fbJSON = new JSONObject(); try { fbJSON.put(NativeAdConstants.NativeAd_TITLE, titleForAd); fbJSON.put(NativeAdConstants.NativeAd_CTA_TEXT, titleForAdButton); fbJSON.put(NativeAdConstants.NativeAd_RATING, appRatingForAd); fbJSON.put(NativeAdConstants.NativeAd_DESC, textForAdBody); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ICON, iconForAd); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ICON_WIDTH, "" + iconAdWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ICON_HEIGHT, "" + iconAdHeight); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MAIN, coverImageURL); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MAIN_WIDTH, "" + coverImageWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MAIN_HEIGHT, "" + coverImageHeight); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MEDIUM, coverImageURL); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MEDIUM_WIDTH, "" + coverImageWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MEDIUM_HEIGHT, "" + coverImageHeight); fbJSON.put(NativeAdConstants.NativeAd_MEDIA_VIEW, nativeMediaView); fbJSON.put(NativeAdConstants.NativeAd_ADCHOICE_VIEW, adChoicesView); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ADCHOICEICON, adChoiceIcon); fbJSON.put(NativeAdConstants.NativeAd_AD_CHOICCE_URL, adChoiceURl); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ADCHOICEICON_WIDTH, "" + adChoiceIconWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ADCHOICEICON_HEIGHT, "" + adChoiceIconHeight); fbJSON.put(NativeAdConstants.NativeAd_TYPE, Constants.NativeAdType.VMAX_FACEBOOK_MEDIA); Object[] objArray = new Object[]{fbJSON}; if (mNativeAdListener != null) { mNativeAdListener.onAdLoaded(objArray); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (Exception e) { } } /* (non-Javadoc) * @see com.facebook.com.vmax.android.ads.AdListener#onError(com.facebook.com.vmax.android.ads.Ad, com.facebook.com.vmax.android.ads.AdError) */ @Override public void onError(final Ad ad, final AdError error) { try { if (error != null) { if (LOGS_ENABLED) { Log.d("vmax", "Facebook native ad failed to load. error: " + error.getErrorCode()); } if (mNativeAdListener != null) { mNativeAdListener.onAdFailed(error.getErrorMessage()); } } else { if (mNativeAdListener != null) { mNativeAdListener.onAdFailed("No ad in inventory"); } } } catch (Exception e) { } } /* (non-Javadoc) * @see com.vmax.android.ads.mediation.partners.VmaxCustomAd#showAd() */ @Override public void showAd() { } /* (non-Javadoc) * @see com.vmax.android.ads.mediation.partners.VmaxCustomAd#onInvalidate() */ @Override public void onInvalidate() { if (LOGS_ENABLED) { Log.i("vmax", "onInvalidate fb native : "); } try { if (nativeAd != null) { nativeAd.unregisterView(); nativeAd.setAdListener(null); nativeAd.destroy(); nativeAd = null; if (LOGS_ENABLED) { Log.i("vmax", "onInvalidate fb native clear : "); } } } catch (Exception e) { e.printStackTrace(); } } private boolean extrasAreValid(final Map<String, Object> serverExtras) { final String placementId = serverExtras.get(PLACEMENT_ID_KEY) .toString(); return (placementId != null && placementId.length() > 0); } public void handleImpression(ViewGroup viewgroup, View view, List<View> listOfView) { try { if (LOGS_ENABLED) { Log.i("vmax", "handleImpressions fb: "); } // if (viewgroup != null && viewgroup.getTag() != null && viewgroup.getTag().toString().equals("Tile")) { // AdChoicesView adChoicesView; // adChoicesView = new AdChoicesView(this.context, nativeAd, true); // // ((LinearLayout) viewgroup.findViewById(context.getResources().getIdentifier("adChoicesView", "id", context.getPackageName()))).addView(adChoicesView, 1); // nativeAd.registerViewForInteraction(viewgroup); // } if (nativeAd != null) { // nativeAd.unregisterView(); if (listOfView != null) { if (LOGS_ENABLED) { Log.i("vmax", " registerViewForInteraction with list of views: " + listOfView.size()); } nativeAd.registerViewForInteraction(view, listOfView); } else if (view != null) { if (LOGS_ENABLED) { Log.i("vmax", " registerViewForInteraction with only view: "); } nativeAd.registerViewForInteraction(view); } } } catch (Exception e) { e.printStackTrace(); } } private Double getDoubleRating(final Rating rating) { if (rating == null) { return null; } return rating.getValue() / rating.getScale(); } public void onPause() { } public void onResume() { } public void onDestroy() { } }
UTF-8
Java
13,555
java
FaceBookNative.java
Java
[ { "context": "lename : FaceBookNative.java\n * Author : narendrap\n * Comments :\n * Copyright : Copyright 20", "end": 94, "score": 0.9992512464523315, "start": 85, "tag": "USERNAME", "value": "narendrap" }, { "context": "m.vmax.android.ads.util.Constants;\n\n/**\n * @author narendrap\n */\n\n/*\n * Tested with facebook SDK 4.11.0\n */\npu", "end": 1082, "score": 0.9992226958274841, "start": 1073, "tag": "USERNAME", "value": "narendrap" }, { "context": " private static final String PLACEMENT_ID_KEY = \"placementid\";\n private VmaxCustomNativeAdListener mNativeA", "end": 1298, "score": 0.6865469217300415, "start": 1287, "tag": "KEY", "value": "placementid" } ]
null
[]
/** * Project : Advert * Filename : FaceBookNative.java * Author : narendrap * Comments : * Copyright : Copyright 2014, VSERV */ package com.vmax.android.ads.mediation.partners; import java.util.List; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; import android.content.Context; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.facebook.ads.Ad; import com.facebook.ads.AdChoicesView; import com.facebook.ads.AdError; import com.facebook.ads.AdListener; import com.facebook.ads.AdSettings; import com.facebook.ads.MediaView; import com.facebook.ads.NativeAd; import com.facebook.ads.NativeAd.Rating; import com.vmax.android.ads.mediation.partners.VmaxCustomAd; import com.vmax.android.ads.mediation.partners.VmaxCustomAdListener; import com.vmax.android.ads.mediation.partners.VmaxCustomNativeAdListener; import com.vmax.android.ads.nativeads.NativeAdConstants; import com.vmax.android.ads.util.Constants; /** * @author narendrap */ /* * Tested with facebook SDK 4.11.0 */ public class FaceBookNative extends VmaxCustomAd implements AdListener { private NativeAd nativeAd; private static final String PLACEMENT_ID_KEY = "placementid"; private VmaxCustomNativeAdListener mNativeAdListener; public boolean LOGS_ENABLED = true; private VmaxCustomAdListener vmaxCustomAdListener; private Context context; @Override public void loadAd(Context context, VmaxCustomAdListener vmaxCustomAdListener, Map<String, Object> localExtras, Map<String, Object> serverExtras) { try { if (LOGS_ENABLED) { Log.d("vmax", "Facebook loadAd ."); } this.context = context; this.vmaxCustomAdListener = vmaxCustomAdListener; final String placementId; if (localExtras != null) { if (localExtras.containsKey("nativeListener")) { if (LOGS_ENABLED) { Log.i("Log", "nativeListener in localextras "); } mNativeAdListener = (VmaxCustomNativeAdListener) localExtras.get("nativeListener"); } } if (extrasAreValid(serverExtras)) { placementId = serverExtras.get(PLACEMENT_ID_KEY).toString(); } else { if (mNativeAdListener != null) { mNativeAdListener.onAdFailed("Placement id missing"); } return; } if (localExtras != null) { if (localExtras.containsKey("test")) { String[] mTestAvdIds = (String[]) localExtras .get("test"); if (mTestAvdIds != null) { for (int i = 0; i < mTestAvdIds.length; i++) { if (LOGS_ENABLED) { Log.i("vmax", "test devices: " + mTestAvdIds[i]); } AdSettings.addTestDevice(mTestAvdIds[i]); if (LOGS_ENABLED) { Log.i("vmax", "Test mode: " + AdSettings.isTestMode(context)); } } } } } nativeAd = new NativeAd(context, placementId); // AdSettings.addTestDevice("a33fc28edcc10fa20ce0454b7a9a204a"); // put your test device id printed in logs when you make first request to facebook. AdSettings.setMediationService("VMAX"); nativeAd.setAdListener(this); nativeAd.loadAd(NativeAd.MediaCacheFlag.ALL); } catch (Exception e) { if (mNativeAdListener != null) { mNativeAdListener.onAdFailed(e.getMessage()); } e.printStackTrace(); return; } } /* (non-Javadoc) * @see com.facebook.com.vmax.android.ads.AdListener#onAdClicked(com.facebook.com.vmax.android.ads.Ad) */ @Override public void onAdClicked(Ad arg0) { Log.i("vmax", "fb onAdClicked"); if (vmaxCustomAdListener != null) { vmaxCustomAdListener.onAdClicked(); } if (vmaxCustomAdListener != null) { vmaxCustomAdListener.onLeaveApplication(); } } /* (non-Javadoc) * @see com.facebook.com.vmax.android.ads.AdListener#onAdLoaded(com.facebook.com.vmax.android.ads.Ad) */ @Override public void onAdLoaded(Ad ad) { try { String adChoiceIcon = null, adChoiceURl = null; int adChoiceIconHeight = 0; int adChoiceIconWidth = 0; String coverImageURL = null; int coverImageHeight = 0; int coverImageWidth = 0; String iconForAd = null; int iconAdWidth = 0; int iconAdHeight = 0; if (ad != nativeAd) { return; } nativeAd.unregisterView(); String titleForAd = nativeAd.getAdTitle(); if (nativeAd.getAdCoverImage() != null) { coverImageURL = nativeAd.getAdCoverImage().getUrl(); coverImageHeight = nativeAd.getAdCoverImage().getHeight(); coverImageWidth = nativeAd.getAdCoverImage().getWidth(); } if (nativeAd.getAdIcon() != null) { iconForAd = nativeAd.getAdIcon().getUrl(); iconAdHeight = nativeAd.getAdIcon().getHeight(); iconAdWidth = nativeAd.getAdIcon().getWidth(); } String socialContextForAd = nativeAd.getAdSocialContext(); String titleForAdButton = nativeAd.getAdCallToAction(); String textForAdBody = nativeAd.getAdBody(); if (nativeAd.getAdChoicesIcon() != null) { adChoiceIcon = nativeAd.getAdChoicesIcon().getUrl(); adChoiceIconHeight = nativeAd.getAdChoicesIcon().getWidth(); adChoiceIconWidth = nativeAd.getAdChoicesIcon().getHeight(); } if (nativeAd.getAdChoicesLinkUrl() != null) { adChoiceURl = nativeAd.getAdChoicesLinkUrl(); } MediaView nativeMediaView = new MediaView(context); nativeAd.setMediaViewAutoplay(true); nativeMediaView.setAutoplay(true); nativeMediaView.setNativeAd(nativeAd); AdChoicesView adChoicesView = new AdChoicesView(context, nativeAd, true); String appRatingForAd = ""; Double rating = getDoubleRating(nativeAd.getAdStarRating()); Log.d("vmax", "getAdStarRating : " + nativeAd.getAdStarRating()); if (rating != null) { appRatingForAd = Double.toString(rating); } if (LOGS_ENABLED) { Log.d("vmax", "Title for Ad : " + titleForAd); Log.d("vmax", "coverImage URL : " + coverImageURL); Log.d("vmax", "socialContextForAd : " + socialContextForAd); Log.d("vmax", "titleForAdButton : " + titleForAdButton); Log.d("vmax", "textForAdBody : " + textForAdBody); Log.d("vmax", "appRatingForAd : " + appRatingForAd); Log.d("vmax", "iconForAd : " + iconForAd); } JSONObject fbJSON = new JSONObject(); try { fbJSON.put(NativeAdConstants.NativeAd_TITLE, titleForAd); fbJSON.put(NativeAdConstants.NativeAd_CTA_TEXT, titleForAdButton); fbJSON.put(NativeAdConstants.NativeAd_RATING, appRatingForAd); fbJSON.put(NativeAdConstants.NativeAd_DESC, textForAdBody); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ICON, iconForAd); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ICON_WIDTH, "" + iconAdWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ICON_HEIGHT, "" + iconAdHeight); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MAIN, coverImageURL); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MAIN_WIDTH, "" + coverImageWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MAIN_HEIGHT, "" + coverImageHeight); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MEDIUM, coverImageURL); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MEDIUM_WIDTH, "" + coverImageWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_MEDIUM_HEIGHT, "" + coverImageHeight); fbJSON.put(NativeAdConstants.NativeAd_MEDIA_VIEW, nativeMediaView); fbJSON.put(NativeAdConstants.NativeAd_ADCHOICE_VIEW, adChoicesView); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ADCHOICEICON, adChoiceIcon); fbJSON.put(NativeAdConstants.NativeAd_AD_CHOICCE_URL, adChoiceURl); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ADCHOICEICON_WIDTH, "" + adChoiceIconWidth); fbJSON.put(NativeAdConstants.NativeAd_IMAGE_ADCHOICEICON_HEIGHT, "" + adChoiceIconHeight); fbJSON.put(NativeAdConstants.NativeAd_TYPE, Constants.NativeAdType.VMAX_FACEBOOK_MEDIA); Object[] objArray = new Object[]{fbJSON}; if (mNativeAdListener != null) { mNativeAdListener.onAdLoaded(objArray); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (Exception e) { } } /* (non-Javadoc) * @see com.facebook.com.vmax.android.ads.AdListener#onError(com.facebook.com.vmax.android.ads.Ad, com.facebook.com.vmax.android.ads.AdError) */ @Override public void onError(final Ad ad, final AdError error) { try { if (error != null) { if (LOGS_ENABLED) { Log.d("vmax", "Facebook native ad failed to load. error: " + error.getErrorCode()); } if (mNativeAdListener != null) { mNativeAdListener.onAdFailed(error.getErrorMessage()); } } else { if (mNativeAdListener != null) { mNativeAdListener.onAdFailed("No ad in inventory"); } } } catch (Exception e) { } } /* (non-Javadoc) * @see com.vmax.android.ads.mediation.partners.VmaxCustomAd#showAd() */ @Override public void showAd() { } /* (non-Javadoc) * @see com.vmax.android.ads.mediation.partners.VmaxCustomAd#onInvalidate() */ @Override public void onInvalidate() { if (LOGS_ENABLED) { Log.i("vmax", "onInvalidate fb native : "); } try { if (nativeAd != null) { nativeAd.unregisterView(); nativeAd.setAdListener(null); nativeAd.destroy(); nativeAd = null; if (LOGS_ENABLED) { Log.i("vmax", "onInvalidate fb native clear : "); } } } catch (Exception e) { e.printStackTrace(); } } private boolean extrasAreValid(final Map<String, Object> serverExtras) { final String placementId = serverExtras.get(PLACEMENT_ID_KEY) .toString(); return (placementId != null && placementId.length() > 0); } public void handleImpression(ViewGroup viewgroup, View view, List<View> listOfView) { try { if (LOGS_ENABLED) { Log.i("vmax", "handleImpressions fb: "); } // if (viewgroup != null && viewgroup.getTag() != null && viewgroup.getTag().toString().equals("Tile")) { // AdChoicesView adChoicesView; // adChoicesView = new AdChoicesView(this.context, nativeAd, true); // // ((LinearLayout) viewgroup.findViewById(context.getResources().getIdentifier("adChoicesView", "id", context.getPackageName()))).addView(adChoicesView, 1); // nativeAd.registerViewForInteraction(viewgroup); // } if (nativeAd != null) { // nativeAd.unregisterView(); if (listOfView != null) { if (LOGS_ENABLED) { Log.i("vmax", " registerViewForInteraction with list of views: " + listOfView.size()); } nativeAd.registerViewForInteraction(view, listOfView); } else if (view != null) { if (LOGS_ENABLED) { Log.i("vmax", " registerViewForInteraction with only view: "); } nativeAd.registerViewForInteraction(view); } } } catch (Exception e) { e.printStackTrace(); } } private Double getDoubleRating(final Rating rating) { if (rating == null) { return null; } return rating.getValue() / rating.getScale(); } public void onPause() { } public void onResume() { } public void onDestroy() { } }
13,555
0.559056
0.556474
367
35.934605
30.708281
171
false
false
0
0
0
0
0
0
0.566758
false
false
3
025779fc03fdd95ef64fd1dfd0ac47a6656d50a1
1,391,569,433,582
5d94fe09bd52238e06d73ca1a7b09236acc170de
/final/finalproperty/25.java
7dccdfb0efbc5d34af824371669d0931585d8d8b
[]
no_license
IAMMOIZ/git_java
https://github.com/IAMMOIZ/git_java
c7d18b26dba9fa2ab481f51ce020327e755202ae
2171dd8b3dd26091e8f38d17775533035057410c
refs/heads/master
2020-08-24T11:45:39.329000
2020-01-20T09:49:50
2020-01-20T09:49:50
216,819,659
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class A { final static int i=10; static { i=0; } }
UTF-8
Java
50
java
25.java
Java
[]
null
[]
class A { final static int i=10; static { i=0; } }
50
0.62
0.56
8
5.375
6.688376
22
false
false
0
0
0
0
0
0
0.25
false
false
3
68ee7608d16bdd7be6cda129afa68e9cba34d04e
34,445,637,737,361
676f233ff544af59be18d69af3d2cff9e69b44c1
/src/baekjoon_0504/if_2753_Ex3.java
b467bc3cb68249a51f84f501b4c5d8e48afae6d0
[]
no_license
eunijoo/mystudy
https://github.com/eunijoo/mystudy
2d64f1f73e5d9436fb8547d0d49cf488fed2800d
cc1c6fa847c8a014a53a092eaf370fb09d5312c9
refs/heads/master
2022-06-29T17:01:55.611000
2020-05-13T12:28:53
2020-05-13T12:28:53
263,618,942
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package baekjoon_0504; import java.util.Scanner; public class if_2753_Ex3 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int year; System.out.println("년도입력?"); year=sc.nextInt(); if(year<1&&year>4000) { System.out.println("년도 다시 입력해주세요"); year=sc.nextInt(); } if(year%4==0&&year%100!=0||year%400==0) { System.out.println("윤년이다."); }else { System.out.println("윤년이 아니다."); } } }
UTF-8
Java
496
java
if_2753_Ex3.java
Java
[]
null
[]
package baekjoon_0504; import java.util.Scanner; public class if_2753_Ex3 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int year; System.out.println("년도입력?"); year=sc.nextInt(); if(year<1&&year>4000) { System.out.println("년도 다시 입력해주세요"); year=sc.nextInt(); } if(year%4==0&&year%100!=0||year%400==0) { System.out.println("윤년이다."); }else { System.out.println("윤년이 아니다."); } } }
496
0.627232
0.573661
24
17.666666
14.738461
43
false
false
0
0
0
0
0
0
1.958333
false
false
3
f2d257d249f5a1d9561a6ebd92af9a73861df99f
15,899,968,953,223
f838531310392d5669ef33967b3801e7c186ea3e
/commons/src/main/java/com/twt/wepeiyang/commons/network/RetrofitProvider.java
4cf13202b654f5cac57dc96a25e30949b3700ae2
[]
no_license
life2015/WePeiYangRD
https://github.com/life2015/WePeiYangRD
0beaed4aaf0770e4e9859446e14bbd0290e1b2e2
dff52d83d43e4f9b900bfd82cfbb939b6ea43f4e
refs/heads/master
2020-06-20T12:42:03.762000
2017-01-31T06:03:46
2017-01-31T06:03:46
74,864,456
5
3
null
false
2017-01-22T04:13:01
2016-11-27T03:19:25
2016-11-27T03:55:16
2017-01-22T04:13:01
535
1
1
0
Java
null
null
package com.twt.wepeiyang.commons.network; import com.orhanobut.logger.Logger; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; import okhttp3.internal.platform.Platform; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import static okhttp3.internal.platform.Platform.INFO; /** * Created by retrox on 2017/1/25. */ public class RetrofitProvider { private Retrofit mRetrofit; private RetrofitProvider() { HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(message -> { if (message.startsWith("{")){ Logger.json(message); }else { Platform.get().log(INFO, message, null); } }); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); SignInterceptor signInterceptor = new SignInterceptor(); OkHttpClient client = new OkHttpClient.Builder() .addInterceptor(loggingInterceptor) .addInterceptor(signInterceptor) .retryOnConnectionFailure(false) .connectTimeout(30, TimeUnit.SECONDS) .build(); mRetrofit = new Retrofit.Builder() .baseUrl("https://open.twtstudio.com/api/v1/") .client(client) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build(); } private static class SignletonHolder{ private static final RetrofitProvider INSTANCE = new RetrofitProvider(); } public static Retrofit getRetrofit(){ return SignletonHolder.INSTANCE.mRetrofit; } }
UTF-8
Java
1,825
java
RetrofitProvider.java
Java
[ { "context": "nternal.platform.Platform.INFO;\n\n/**\n * Created by retrox on 2017/1/25.\n */\n\npublic class RetrofitProvider ", "end": 459, "score": 0.9996640086174011, "start": 453, "tag": "USERNAME", "value": "retrox" } ]
null
[]
package com.twt.wepeiyang.commons.network; import com.orhanobut.logger.Logger; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; import okhttp3.internal.platform.Platform; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import static okhttp3.internal.platform.Platform.INFO; /** * Created by retrox on 2017/1/25. */ public class RetrofitProvider { private Retrofit mRetrofit; private RetrofitProvider() { HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(message -> { if (message.startsWith("{")){ Logger.json(message); }else { Platform.get().log(INFO, message, null); } }); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); SignInterceptor signInterceptor = new SignInterceptor(); OkHttpClient client = new OkHttpClient.Builder() .addInterceptor(loggingInterceptor) .addInterceptor(signInterceptor) .retryOnConnectionFailure(false) .connectTimeout(30, TimeUnit.SECONDS) .build(); mRetrofit = new Retrofit.Builder() .baseUrl("https://open.twtstudio.com/api/v1/") .client(client) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build(); } private static class SignletonHolder{ private static final RetrofitProvider INSTANCE = new RetrofitProvider(); } public static Retrofit getRetrofit(){ return SignletonHolder.INSTANCE.mRetrofit; } }
1,825
0.667397
0.658082
59
29.932203
25.148956
91
false
false
0
0
0
0
0
0
0.38983
false
false
3
79262ab351236a9229449bc11ca1153907943e9b
5,995,774,370,869
4ad8fc79f06adb2594fcbf14a427a642e398ef3a
/tests/webapp/src/main/java/com/wearezeta/auto/web/pages/AddEmailAddressPage.java
c41cf291440fdecdb29606657b7ab1ee4dd6693a
[]
no_license
sureshsinghbhandari/wairAvtomaciq
https://github.com/sureshsinghbhandari/wairAvtomaciq
e18c4ad47a14e760d868c9127f7d9bdadb8dec00
7eb77e44015c887f94fc6bb8e12e674c22e8ccbd
refs/heads/master
2021-12-12T18:18:22.487000
2017-02-14T14:12:14
2017-02-14T14:12:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wearezeta.auto.web.pages; import java.util.concurrent.Future; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import com.wearezeta.auto.common.driver.DriverUtils; import com.wearezeta.auto.common.driver.ZetaWebAppDriver; import com.wearezeta.auto.web.locators.WebAppLocators; public class AddEmailAddressPage extends WebPage { @FindBy(id = "wire-verify-account-email") private WebElement emailField; @FindBy(id = "wire-verify-account-password") private WebElement passwordField; @FindBy(id = "wire-verify-account") private WebElement addButton; @FindBy(css = WebAppLocators.AddEmailAddressPage.cssErrorMessage) private WebElement errorMessage; public AddEmailAddressPage(Future<ZetaWebAppDriver> lazyDriver) throws Exception { super(lazyDriver); } public AddEmailAddressPage(Future<ZetaWebAppDriver> lazyDriver, String url) throws Exception { super(lazyDriver, url); } public void setEmail(String email) throws Exception { DriverUtils.waitUntilElementClickable(getDriver(), emailField); emailField.click(); emailField.clear(); emailField.sendKeys(email); } public void setPassword(String password) throws Exception { passwordField.click(); passwordField.clear(); passwordField.sendKeys(password); } public void clickAddButton() { addButton.click(); } public String getErrorMessage() throws Exception { DriverUtils.waitUntilLocatorContainsText(getDriver(), By.cssSelector(WebAppLocators.AddEmailAddressPage.cssErrorMessage)); DriverUtils.waitUntilLocatorAppears(getDriver(), By.cssSelector(WebAppLocators.AddEmailAddressPage.cssErrorMessage)); return errorMessage.getText(); } public boolean isEmailFieldMarkedAsError() throws Exception { return DriverUtils.waitUntilLocatorIsDisplayed(getDriver(), By.cssSelector( WebAppLocators.AddEmailAddressPage.cssErrorMarkedEmailField)); } public boolean isPasswordFieldMarkedAsError() throws Exception { return DriverUtils.waitUntilLocatorIsDisplayed(getDriver(), By.cssSelector( WebAppLocators.AddEmailAddressPage.cssErrorMarkedPasswordField)); } }
UTF-8
Java
2,331
java
AddEmailAddressPage.java
Java
[]
null
[]
package com.wearezeta.auto.web.pages; import java.util.concurrent.Future; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import com.wearezeta.auto.common.driver.DriverUtils; import com.wearezeta.auto.common.driver.ZetaWebAppDriver; import com.wearezeta.auto.web.locators.WebAppLocators; public class AddEmailAddressPage extends WebPage { @FindBy(id = "wire-verify-account-email") private WebElement emailField; @FindBy(id = "wire-verify-account-password") private WebElement passwordField; @FindBy(id = "wire-verify-account") private WebElement addButton; @FindBy(css = WebAppLocators.AddEmailAddressPage.cssErrorMessage) private WebElement errorMessage; public AddEmailAddressPage(Future<ZetaWebAppDriver> lazyDriver) throws Exception { super(lazyDriver); } public AddEmailAddressPage(Future<ZetaWebAppDriver> lazyDriver, String url) throws Exception { super(lazyDriver, url); } public void setEmail(String email) throws Exception { DriverUtils.waitUntilElementClickable(getDriver(), emailField); emailField.click(); emailField.clear(); emailField.sendKeys(email); } public void setPassword(String password) throws Exception { passwordField.click(); passwordField.clear(); passwordField.sendKeys(password); } public void clickAddButton() { addButton.click(); } public String getErrorMessage() throws Exception { DriverUtils.waitUntilLocatorContainsText(getDriver(), By.cssSelector(WebAppLocators.AddEmailAddressPage.cssErrorMessage)); DriverUtils.waitUntilLocatorAppears(getDriver(), By.cssSelector(WebAppLocators.AddEmailAddressPage.cssErrorMessage)); return errorMessage.getText(); } public boolean isEmailFieldMarkedAsError() throws Exception { return DriverUtils.waitUntilLocatorIsDisplayed(getDriver(), By.cssSelector( WebAppLocators.AddEmailAddressPage.cssErrorMarkedEmailField)); } public boolean isPasswordFieldMarkedAsError() throws Exception { return DriverUtils.waitUntilLocatorIsDisplayed(getDriver(), By.cssSelector( WebAppLocators.AddEmailAddressPage.cssErrorMarkedPasswordField)); } }
2,331
0.740884
0.740884
67
33.791046
31.937223
130
false
false
0
0
0
0
0
0
0.507463
false
false
3
cb561332ae705b0a98a37cbc6bcac6180669dc3e
11,295,764,015,826
0f8ab121cb8eb831696f1afc842bf4ecc8fdc13b
/tsp_hillclimbing/src/tsp_hillclimbing/entities/Ciudad.java
5764ec6c91ee9cc6ec55253b33847569844a0e8a
[]
no_license
DiegoKraenau/IATB1
https://github.com/DiegoKraenau/IATB1
7eae664d4504082be77299e79e4e0443bc04e3d2
70ad7d6af2f10317bd86a8a34392c4b47d23af6e
refs/heads/master
2022-12-18T15:14:05.995000
2020-09-14T01:41:09
2020-09-14T01:41:09
293,939,694
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tsp_hillclimbing.entities; public class Ciudad { private static final double TIERRA_ECUATORIAL_RADIO=6378.1370D; private static final double CONVERTIR_GRADOS_RADIANES=Math.PI/180D; private static final double CONVERTIR_KM_MILES=0.621371; private double longitud; private double latitud; private String nombre; public Ciudad( String nombre,double latitud, double longitud) { this.longitud = longitud*CONVERTIR_GRADOS_RADIANES; this.latitud = latitud*CONVERTIR_GRADOS_RADIANES; this.nombre = nombre; } public double medidaDistancia(Ciudad ciudad) { double deltaLongitud= ciudad.getLongitud()-this.getLongitud(); double deltaLatitud= ciudad.getLatitud()-this.getLatitud(); double a=Math.pow(Math.sin(deltaLatitud/2D), 2D)+ Math.cos(this.getLatitud())*Math.cos(ciudad.getLatitud())*Math.pow(deltaLongitud/2D,2D); return CONVERTIR_KM_MILES*TIERRA_ECUATORIAL_RADIO*2D*Math.atan2(Math.sqrt(a), Math.sqrt(1D-a)); } public double getLongitud() { return longitud; } public void setLongitud(double longitud) { this.longitud = longitud; } public double getLatitud() { return latitud; } public void setLatitud(double latitud) { this.latitud = latitud; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String toString() { return this.nombre; } }
UTF-8
Java
1,388
java
Ciudad.java
Java
[]
null
[]
package tsp_hillclimbing.entities; public class Ciudad { private static final double TIERRA_ECUATORIAL_RADIO=6378.1370D; private static final double CONVERTIR_GRADOS_RADIANES=Math.PI/180D; private static final double CONVERTIR_KM_MILES=0.621371; private double longitud; private double latitud; private String nombre; public Ciudad( String nombre,double latitud, double longitud) { this.longitud = longitud*CONVERTIR_GRADOS_RADIANES; this.latitud = latitud*CONVERTIR_GRADOS_RADIANES; this.nombre = nombre; } public double medidaDistancia(Ciudad ciudad) { double deltaLongitud= ciudad.getLongitud()-this.getLongitud(); double deltaLatitud= ciudad.getLatitud()-this.getLatitud(); double a=Math.pow(Math.sin(deltaLatitud/2D), 2D)+ Math.cos(this.getLatitud())*Math.cos(ciudad.getLatitud())*Math.pow(deltaLongitud/2D,2D); return CONVERTIR_KM_MILES*TIERRA_ECUATORIAL_RADIO*2D*Math.atan2(Math.sqrt(a), Math.sqrt(1D-a)); } public double getLongitud() { return longitud; } public void setLongitud(double longitud) { this.longitud = longitud; } public double getLatitud() { return latitud; } public void setLatitud(double latitud) { this.latitud = latitud; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String toString() { return this.nombre; } }
1,388
0.739914
0.721902
53
25.150944
25.307465
97
false
false
0
0
0
0
0
0
1.735849
false
false
3
a46e03aaf95c432686e94e8cefb28d77a8a3a21f
1,073,741,844,695
b5e294388128106cf63fa58c755e4d4aaf9e12e8
/UMASchema15/src/UMASchema15/impl/WorkBreakdownElementImpl.java
7ee4df4935e62b3e2dc9380862e6c89bf7a4d80a
[]
no_license
google-code/automated-se
https://github.com/google-code/automated-se
9bb37e45e94d9095c1f019794992b0d498285a24
354190677127f188e5611f733a6a2e2e5b305d9f
refs/heads/master
2016-08-04T12:34:23.922000
2015-03-15T16:53:02
2015-03-15T16:53:02
32,272,101
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * <copyright> * </copyright> * * $Id$ */ package UMASchema15.impl; import UMASchema15.UMASchema15Package; import UMASchema15.WorkBreakdownElement; import UMASchema15.WorkOrder; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.BasicFeatureMap; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Work Breakdown Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#getGroup2 <em>Group2</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#getPredecessor <em>Predecessor</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#isIsEventDriven <em>Is Event Driven</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#isIsOngoing <em>Is Ongoing</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#isIsRepeatable <em>Is Repeatable</em>}</li> * </ul> * </p> * * @generated */ public class WorkBreakdownElementImpl extends BreakdownElementImpl implements WorkBreakdownElement { /** * The cached value of the '{@link #getGroup2() <em>Group2</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getGroup2() * @generated * @ordered */ protected FeatureMap group2; /** * The default value of the '{@link #isIsEventDriven() <em>Is Event Driven</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsEventDriven() * @generated * @ordered */ protected static final boolean IS_EVENT_DRIVEN_EDEFAULT = false; /** * The cached value of the '{@link #isIsEventDriven() <em>Is Event Driven</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsEventDriven() * @generated * @ordered */ protected boolean isEventDriven = IS_EVENT_DRIVEN_EDEFAULT; /** * This is true if the Is Event Driven attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean isEventDrivenESet; /** * The default value of the '{@link #isIsOngoing() <em>Is Ongoing</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOngoing() * @generated * @ordered */ protected static final boolean IS_ONGOING_EDEFAULT = false; /** * The cached value of the '{@link #isIsOngoing() <em>Is Ongoing</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOngoing() * @generated * @ordered */ protected boolean isOngoing = IS_ONGOING_EDEFAULT; /** * This is true if the Is Ongoing attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean isOngoingESet; /** * The default value of the '{@link #isIsRepeatable() <em>Is Repeatable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsRepeatable() * @generated * @ordered */ protected static final boolean IS_REPEATABLE_EDEFAULT = false; /** * The cached value of the '{@link #isIsRepeatable() <em>Is Repeatable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsRepeatable() * @generated * @ordered */ protected boolean isRepeatable = IS_REPEATABLE_EDEFAULT; /** * This is true if the Is Repeatable attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean isRepeatableESet; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected WorkBreakdownElementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UMASchema15Package.Literals.WORK_BREAKDOWN_ELEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FeatureMap getGroup2() { if (group2 == null) { group2 = new BasicFeatureMap(this, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2); } return group2; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<WorkOrder> getPredecessor() { return getGroup2().list(UMASchema15Package.Literals.WORK_BREAKDOWN_ELEMENT__PREDECESSOR); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsEventDriven() { return isEventDriven; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsEventDriven(boolean newIsEventDriven) { boolean oldIsEventDriven = isEventDriven; isEventDriven = newIsEventDriven; boolean oldIsEventDrivenESet = isEventDrivenESet; isEventDrivenESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN, oldIsEventDriven, isEventDriven, !oldIsEventDrivenESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetIsEventDriven() { boolean oldIsEventDriven = isEventDriven; boolean oldIsEventDrivenESet = isEventDrivenESet; isEventDriven = IS_EVENT_DRIVEN_EDEFAULT; isEventDrivenESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN, oldIsEventDriven, IS_EVENT_DRIVEN_EDEFAULT, oldIsEventDrivenESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetIsEventDriven() { return isEventDrivenESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsOngoing() { return isOngoing; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsOngoing(boolean newIsOngoing) { boolean oldIsOngoing = isOngoing; isOngoing = newIsOngoing; boolean oldIsOngoingESet = isOngoingESet; isOngoingESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING, oldIsOngoing, isOngoing, !oldIsOngoingESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetIsOngoing() { boolean oldIsOngoing = isOngoing; boolean oldIsOngoingESet = isOngoingESet; isOngoing = IS_ONGOING_EDEFAULT; isOngoingESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING, oldIsOngoing, IS_ONGOING_EDEFAULT, oldIsOngoingESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetIsOngoing() { return isOngoingESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsRepeatable() { return isRepeatable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsRepeatable(boolean newIsRepeatable) { boolean oldIsRepeatable = isRepeatable; isRepeatable = newIsRepeatable; boolean oldIsRepeatableESet = isRepeatableESet; isRepeatableESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE, oldIsRepeatable, isRepeatable, !oldIsRepeatableESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetIsRepeatable() { boolean oldIsRepeatable = isRepeatable; boolean oldIsRepeatableESet = isRepeatableESet; isRepeatable = IS_REPEATABLE_EDEFAULT; isRepeatableESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE, oldIsRepeatable, IS_REPEATABLE_EDEFAULT, oldIsRepeatableESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetIsRepeatable() { return isRepeatableESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: return ((InternalEList<?>)getGroup2()).basicRemove(otherEnd, msgs); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: return ((InternalEList<?>)getPredecessor()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: if (coreType) return getGroup2(); return ((FeatureMap.Internal)getGroup2()).getWrapper(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: return getPredecessor(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: return isIsEventDriven(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: return isIsOngoing(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: return isIsRepeatable(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: ((FeatureMap.Internal)getGroup2()).set(newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: getPredecessor().clear(); getPredecessor().addAll((Collection<? extends WorkOrder>)newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: setIsEventDriven((Boolean)newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: setIsOngoing((Boolean)newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: setIsRepeatable((Boolean)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: getGroup2().clear(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: getPredecessor().clear(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: unsetIsEventDriven(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: unsetIsOngoing(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: unsetIsRepeatable(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: return group2 != null && !group2.isEmpty(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: return !getPredecessor().isEmpty(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: return isSetIsEventDriven(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: return isSetIsOngoing(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: return isSetIsRepeatable(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (group2: "); result.append(group2); result.append(", isEventDriven: "); if (isEventDrivenESet) result.append(isEventDriven); else result.append("<unset>"); result.append(", isOngoing: "); if (isOngoingESet) result.append(isOngoing); else result.append("<unset>"); result.append(", isRepeatable: "); if (isRepeatableESet) result.append(isRepeatable); else result.append("<unset>"); result.append(')'); return result.toString(); } } //WorkBreakdownElementImpl
UTF-8
Java
13,256
java
WorkBreakdownElementImpl.java
Java
[]
null
[]
/** * <copyright> * </copyright> * * $Id$ */ package UMASchema15.impl; import UMASchema15.UMASchema15Package; import UMASchema15.WorkBreakdownElement; import UMASchema15.WorkOrder; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.BasicFeatureMap; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Work Breakdown Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#getGroup2 <em>Group2</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#getPredecessor <em>Predecessor</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#isIsEventDriven <em>Is Event Driven</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#isIsOngoing <em>Is Ongoing</em>}</li> * <li>{@link UMASchema15.impl.WorkBreakdownElementImpl#isIsRepeatable <em>Is Repeatable</em>}</li> * </ul> * </p> * * @generated */ public class WorkBreakdownElementImpl extends BreakdownElementImpl implements WorkBreakdownElement { /** * The cached value of the '{@link #getGroup2() <em>Group2</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getGroup2() * @generated * @ordered */ protected FeatureMap group2; /** * The default value of the '{@link #isIsEventDriven() <em>Is Event Driven</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsEventDriven() * @generated * @ordered */ protected static final boolean IS_EVENT_DRIVEN_EDEFAULT = false; /** * The cached value of the '{@link #isIsEventDriven() <em>Is Event Driven</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsEventDriven() * @generated * @ordered */ protected boolean isEventDriven = IS_EVENT_DRIVEN_EDEFAULT; /** * This is true if the Is Event Driven attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean isEventDrivenESet; /** * The default value of the '{@link #isIsOngoing() <em>Is Ongoing</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOngoing() * @generated * @ordered */ protected static final boolean IS_ONGOING_EDEFAULT = false; /** * The cached value of the '{@link #isIsOngoing() <em>Is Ongoing</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOngoing() * @generated * @ordered */ protected boolean isOngoing = IS_ONGOING_EDEFAULT; /** * This is true if the Is Ongoing attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean isOngoingESet; /** * The default value of the '{@link #isIsRepeatable() <em>Is Repeatable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsRepeatable() * @generated * @ordered */ protected static final boolean IS_REPEATABLE_EDEFAULT = false; /** * The cached value of the '{@link #isIsRepeatable() <em>Is Repeatable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsRepeatable() * @generated * @ordered */ protected boolean isRepeatable = IS_REPEATABLE_EDEFAULT; /** * This is true if the Is Repeatable attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean isRepeatableESet; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected WorkBreakdownElementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UMASchema15Package.Literals.WORK_BREAKDOWN_ELEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FeatureMap getGroup2() { if (group2 == null) { group2 = new BasicFeatureMap(this, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2); } return group2; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<WorkOrder> getPredecessor() { return getGroup2().list(UMASchema15Package.Literals.WORK_BREAKDOWN_ELEMENT__PREDECESSOR); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsEventDriven() { return isEventDriven; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsEventDriven(boolean newIsEventDriven) { boolean oldIsEventDriven = isEventDriven; isEventDriven = newIsEventDriven; boolean oldIsEventDrivenESet = isEventDrivenESet; isEventDrivenESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN, oldIsEventDriven, isEventDriven, !oldIsEventDrivenESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetIsEventDriven() { boolean oldIsEventDriven = isEventDriven; boolean oldIsEventDrivenESet = isEventDrivenESet; isEventDriven = IS_EVENT_DRIVEN_EDEFAULT; isEventDrivenESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN, oldIsEventDriven, IS_EVENT_DRIVEN_EDEFAULT, oldIsEventDrivenESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetIsEventDriven() { return isEventDrivenESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsOngoing() { return isOngoing; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsOngoing(boolean newIsOngoing) { boolean oldIsOngoing = isOngoing; isOngoing = newIsOngoing; boolean oldIsOngoingESet = isOngoingESet; isOngoingESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING, oldIsOngoing, isOngoing, !oldIsOngoingESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetIsOngoing() { boolean oldIsOngoing = isOngoing; boolean oldIsOngoingESet = isOngoingESet; isOngoing = IS_ONGOING_EDEFAULT; isOngoingESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING, oldIsOngoing, IS_ONGOING_EDEFAULT, oldIsOngoingESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetIsOngoing() { return isOngoingESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsRepeatable() { return isRepeatable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsRepeatable(boolean newIsRepeatable) { boolean oldIsRepeatable = isRepeatable; isRepeatable = newIsRepeatable; boolean oldIsRepeatableESet = isRepeatableESet; isRepeatableESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE, oldIsRepeatable, isRepeatable, !oldIsRepeatableESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetIsRepeatable() { boolean oldIsRepeatable = isRepeatable; boolean oldIsRepeatableESet = isRepeatableESet; isRepeatable = IS_REPEATABLE_EDEFAULT; isRepeatableESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE, oldIsRepeatable, IS_REPEATABLE_EDEFAULT, oldIsRepeatableESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetIsRepeatable() { return isRepeatableESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: return ((InternalEList<?>)getGroup2()).basicRemove(otherEnd, msgs); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: return ((InternalEList<?>)getPredecessor()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: if (coreType) return getGroup2(); return ((FeatureMap.Internal)getGroup2()).getWrapper(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: return getPredecessor(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: return isIsEventDriven(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: return isIsOngoing(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: return isIsRepeatable(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: ((FeatureMap.Internal)getGroup2()).set(newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: getPredecessor().clear(); getPredecessor().addAll((Collection<? extends WorkOrder>)newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: setIsEventDriven((Boolean)newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: setIsOngoing((Boolean)newValue); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: setIsRepeatable((Boolean)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: getGroup2().clear(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: getPredecessor().clear(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: unsetIsEventDriven(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: unsetIsOngoing(); return; case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: unsetIsRepeatable(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__GROUP2: return group2 != null && !group2.isEmpty(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__PREDECESSOR: return !getPredecessor().isEmpty(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_EVENT_DRIVEN: return isSetIsEventDriven(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_ONGOING: return isSetIsOngoing(); case UMASchema15Package.WORK_BREAKDOWN_ELEMENT__IS_REPEATABLE: return isSetIsRepeatable(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (group2: "); result.append(group2); result.append(", isEventDriven: "); if (isEventDrivenESet) result.append(isEventDriven); else result.append("<unset>"); result.append(", isOngoing: "); if (isOngoingESet) result.append(isOngoing); else result.append("<unset>"); result.append(", isRepeatable: "); if (isRepeatableESet) result.append(isRepeatable); else result.append("<unset>"); result.append(')'); return result.toString(); } } //WorkBreakdownElementImpl
13,256
0.656533
0.648386
461
26.754881
28.564775
186
false
false
0
0
0
0
0
0
1.681128
false
false
3
47df588d11b1ed39e0226fd57d15a64b7533014e
17,910,013,687,709
f2a76ae8927a3c1079e6988ae611a45df78403d4
/evaluacion/src/main/java/callcenter/simulador/exceptions/ConsumeCanceledException.java
6c6793da839e8810eee4d826c352da734e8ce085
[]
no_license
manueldvr/evaluaciones
https://github.com/manueldvr/evaluaciones
35e70b6e00897ff1ddd19f7dfe9929b5f7cf9e19
e85daf81ab3831f874216db0d5b3a9b344f5e98f
refs/heads/master
2020-03-08T15:15:42.004000
2018-04-12T20:05:41
2018-04-12T20:05:41
128,206,910
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package callcenter.simulador.exceptions; /** * Exception particular para activar la cancelacion en la produccion o consumo de llamadas. * * @author Manuel * */ public class ConsumeCanceledException extends Exception { private static final long serialVersionUID = 3018828512143293128L; public ConsumeCanceledException() { super(); } public ConsumeCanceledException(String message) { super(message); } }
UTF-8
Java
438
java
ConsumeCanceledException.java
Java
[ { "context": " produccion o consumo de llamadas.\n * \n * @author Manuel\n *\n */\npublic class ConsumeCanceledException exte", "end": 172, "score": 0.9994900226593018, "start": 166, "tag": "NAME", "value": "Manuel" } ]
null
[]
/** * */ package callcenter.simulador.exceptions; /** * Exception particular para activar la cancelacion en la produccion o consumo de llamadas. * * @author Manuel * */ public class ConsumeCanceledException extends Exception { private static final long serialVersionUID = 3018828512143293128L; public ConsumeCanceledException() { super(); } public ConsumeCanceledException(String message) { super(message); } }
438
0.73516
0.691781
24
17.25
25.023739
91
false
false
0
0
0
0
0
0
0.666667
false
false
3
bffc9e41f0658a42eba644ec60ddd2478bf11f4e
22,058,952,035,830
beabb1c398577f377120b6a4f10f1711f9a1e844
/src/java/org/openmarkov/core/gui/util/Utilities.java
75760055b73d872134c3cf00113d3e3dac53e634
[]
no_license
kkroo/OpenMarkov
https://github.com/kkroo/OpenMarkov
3051da32bde4bbe8a74a36c16d54e16d6090f2f6
8884f1eecd64d8ffb7c0be5b84c27ff0ab8a5275
refs/heads/master
2020-06-02T15:12:29.177000
2014-12-08T07:03:29
2014-12-08T07:03:29
26,507,704
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2011 CISIAD, UNED, Spain * * Licensed under the European Union Public Licence, version 1.1 (EUPL) * * Unless required by applicable law, this code is distributed * on an "AS IS" basis, WITHOUT WARRANTIES OF ANY KIND. */ package org.openmarkov.core.gui.util; import java.awt.Container; import java.awt.Window; import java.awt.event.MouseEvent; import javax.swing.JComponent; /** * This class implements various methods that are used by the rest of classes of * the application. * * @author jmendoza * @version 1.0 * @version 1.1 jlgozalo 25/06/09 function to set Text in components in a * container * @version 1.2 jlgozalo - 10/05/10 - set private constructor, remove functions * and fix warnings */ public class Utilities { /** * private constructor for a class with only static methods */ private Utilities () { } /** * Returns the window that owns the component. * * @param component * component whose top level window will be returned. * @return the top level ancestor of the component, if it exists and it is a * Window instance, of null if it isn't a window instance. */ public static Window getOwner(JComponent component) { Container ancestor = component.getTopLevelAncestor(); if (ancestor == null) { return null; } else if (ancestor instanceof Window) { return (Window) ancestor; } else { return null; } } /** * Checks if the mouse event hasn't key modifiers. * * @param e * mouse event information. * @return true if the mouse event hasn't modifiers; otherwise, false. */ public static boolean noMouseModifiers(MouseEvent e) { return ((e.getModifiers() & 0xF) == 0); } }
UTF-8
Java
1,797
java
Utilities.java
Java
[ { "context": "/*\n* Copyright 2011 CISIAD, UNED, Spain\n*\n* Licensed under the European Unio", "end": 26, "score": 0.9994790554046631, "start": 20, "tag": "NAME", "value": "CISIAD" }, { "context": "f classes of\r\n * the application.\r\n * \r\n * @author jmendoza\r\n * @version 1.0\r\n * @version 1.1 jlgozalo 25/06/", "end": 534, "score": 0.9036007523536682, "start": 526, "tag": "USERNAME", "value": "jmendoza" } ]
null
[]
/* * Copyright 2011 CISIAD, UNED, Spain * * Licensed under the European Union Public Licence, version 1.1 (EUPL) * * Unless required by applicable law, this code is distributed * on an "AS IS" basis, WITHOUT WARRANTIES OF ANY KIND. */ package org.openmarkov.core.gui.util; import java.awt.Container; import java.awt.Window; import java.awt.event.MouseEvent; import javax.swing.JComponent; /** * This class implements various methods that are used by the rest of classes of * the application. * * @author jmendoza * @version 1.0 * @version 1.1 jlgozalo 25/06/09 function to set Text in components in a * container * @version 1.2 jlgozalo - 10/05/10 - set private constructor, remove functions * and fix warnings */ public class Utilities { /** * private constructor for a class with only static methods */ private Utilities () { } /** * Returns the window that owns the component. * * @param component * component whose top level window will be returned. * @return the top level ancestor of the component, if it exists and it is a * Window instance, of null if it isn't a window instance. */ public static Window getOwner(JComponent component) { Container ancestor = component.getTopLevelAncestor(); if (ancestor == null) { return null; } else if (ancestor instanceof Window) { return (Window) ancestor; } else { return null; } } /** * Checks if the mouse event hasn't key modifiers. * * @param e * mouse event information. * @return true if the mouse event hasn't modifiers; otherwise, false. */ public static boolean noMouseModifiers(MouseEvent e) { return ((e.getModifiers() & 0xF) == 0); } }
1,797
0.654981
0.640512
79
20.936708
24.770512
80
false
false
0
0
0
0
0
0
0.886076
false
false
3
b66c8ad0670ebe497395b65edae9695fd34f37c5
2,774,548,884,239
45333b9bd4a695733930050a73ee138df403dbcb
/Templates/Main.java
85d329582a920b1253247b768ccddb97bc887bfa
[]
no_license
abatilo/CodeEval
https://github.com/abatilo/CodeEval
0338e2423bb91fd952da72e8e0457dab248648a1
ecd3aecb8bd0186d1732c496a6a3a8f9a135cf91
refs/heads/master
2016-09-09T23:03:30.040000
2015-04-11T20:03:59
2015-04-11T20:03:59
26,165,383
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; import java.io.*; public class Main { public static void main(String[] args) { Scanner scanner = null; try { scanner = new Scanner(new FileReader(args[0])); while (scanner.hasNextLine()) { String currentLine = scanner.nextLine(); System.out.println(currentLine); } } catch (FileNotFoundException e) { System.out.println("File not found"); } finally { scanner.close(); } } }
UTF-8
Java
480
java
Main.java
Java
[]
null
[]
import java.util.Scanner; import java.io.*; public class Main { public static void main(String[] args) { Scanner scanner = null; try { scanner = new Scanner(new FileReader(args[0])); while (scanner.hasNextLine()) { String currentLine = scanner.nextLine(); System.out.println(currentLine); } } catch (FileNotFoundException e) { System.out.println("File not found"); } finally { scanner.close(); } } }
480
0.604167
0.602083
22
20.818182
17.057753
53
false
false
0
0
0
0
0
0
0.363636
false
false
3
93db692179da88c6f3c8705985d632ef7697cf73
33,088,428,071,508
c6e78fa0793d00416bc6838a2037ac8bb32d91a9
/src/com/luv2code/springdemo/mvc/validation/CourseCode.java
a60d3e7f3325d8fe129d6f8628ba529395473206
[]
no_license
JavaRestSpringIntegrations/spring-mvc-demo
https://github.com/JavaRestSpringIntegrations/spring-mvc-demo
268af702dde962bc3e19dfc04a25d9d9df00f85d
d0b19304a82ce2e6da12ef1028b62ea604de4fea
refs/heads/master
2021-08-14T16:14:30.934000
2017-11-16T05:42:48
2017-11-16T05:42:48
110,923,762
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.luv2code.springdemo.mvc.validation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; @Constraint(validatedBy=CourseCodeConstraintValidator.class) @Target( {ElementType.METHOD, ElementType.FIELD} ) //this says where can we apply the method //How long the annotation will be stored or used @Retention(RetentionPolicy.RUNTIME) //Retain in byte code during runtime public @interface CourseCode { //define default course code public String value() default "LUV"; //define default error message public String message() default "must start with LUV"; //define default groups public Class<?>[] groups() default {}; // Groups can relate constraints //define default payloads public Class<? extends Payload>[] payload() default {}; //Payloads provide details about validation failure ( Severity level , error code etc ) }
UTF-8
Java
1,026
java
CourseCode.java
Java
[]
null
[]
package com.luv2code.springdemo.mvc.validation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; @Constraint(validatedBy=CourseCodeConstraintValidator.class) @Target( {ElementType.METHOD, ElementType.FIELD} ) //this says where can we apply the method //How long the annotation will be stored or used @Retention(RetentionPolicy.RUNTIME) //Retain in byte code during runtime public @interface CourseCode { //define default course code public String value() default "LUV"; //define default error message public String message() default "must start with LUV"; //define default groups public Class<?>[] groups() default {}; // Groups can relate constraints //define default payloads public Class<? extends Payload>[] payload() default {}; //Payloads provide details about validation failure ( Severity level , error code etc ) }
1,026
0.780702
0.779727
29
34.379311
26.567305
92
false
false
0
0
0
0
0
0
0.896552
false
false
3
73e63efe2ac9f2907cd4799ce71b916d23c1f969
8,048,768,764,401
1be2e4c544163bb4f798367cbac8ea781ae5992f
/ferrari/src/main/java/com/yue/app/web/ferrari/vo/diag/DiagFlowVO.java
d4d20e34321334eaa15c0045aa6a1a5e077dfa35
[]
no_license
RyanTech/yueji
https://github.com/RyanTech/yueji
1e7c31c5ecdd3f47b0cbf33060cff976fb73ff6a
41f205896ff7a1da27eba26ce60f6d50e233fc2a
refs/heads/master
2018-03-06T14:58:15.843000
2013-06-08T13:09:31
2013-06-08T13:09:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2011-2016 YueJi.com All right reserved. This software is the confidential and proprietary information of * YueJi.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into with YueJi.com. */ package com.yue.app.web.ferrari.vo.diag; import com.yue.scombiz.common.util.NumberUtil; /** * 流量UV,PV参数 * * @author zxc Dec 21, 2012 9:42:17 AM */ public class DiagFlowVO extends DiagVO { private Integer thirtyUV; private Integer thirtyPV; private Integer sevenUV; private Integer sevenPV; private Integer yesterdayUV; private Integer yesterdayPV; private Integer thirtyOrderCount; private Integer thirtyOrderAvgCount; private Integer sevenOrderCount; private Integer sevenOrderAvgCount; private Integer yesterdayOrderCount; private Integer yesterdayOrderAvgCount; private String thirtyConversionRate; private String sevenConversionRate; private String yesterdayConversionRate; private Integer thirtySalesCount; private Integer thirtyAvgSalesCount; private Integer sevenSalesCount; private Integer sevenAvgSalesCount; private Integer yesterdaySalesCount; private Integer yesterdayAvgSalesCount; public DiagFlowVO(Integer init) { if (NumberUtil.isEqual(0, init)) { this.thirtyUV = 0; this.thirtyPV = 0; this.sevenUV = 0; this.sevenPV = 0; this.yesterdayUV = 0; this.yesterdayPV = 0; this.thirtyOrderCount = 0; this.sevenOrderCount = 0; this.yesterdayOrderCount = 0; this.thirtyOrderAvgCount = 0; this.sevenOrderAvgCount = 0; this.yesterdayOrderAvgCount = 0; this.thirtyConversionRate = "0"; this.sevenConversionRate = "0"; this.yesterdayConversionRate = "0"; this.thirtySalesCount = 0; this.sevenSalesCount = 0; this.yesterdaySalesCount = 0; this.thirtyAvgSalesCount = 0; this.sevenAvgSalesCount = 0; this.yesterdayAvgSalesCount = 0; } } public Integer getThirtyOrderAvgCount() { return thirtyOrderAvgCount; } public void setThirtyOrderAvgCount(Integer thirtyOrderAvgCount) { this.thirtyOrderAvgCount = thirtyOrderAvgCount; } public Integer getSevenOrderAvgCount() { return sevenOrderAvgCount; } public void setSevenOrderAvgCount(Integer sevenOrderAvgCount) { this.sevenOrderAvgCount = sevenOrderAvgCount; } public Integer getYesterdayOrderAvgCount() { return yesterdayOrderAvgCount; } public void setYesterdayOrderAvgCount(Integer yesterdayOrderAvgCount) { this.yesterdayOrderAvgCount = yesterdayOrderAvgCount; } public Integer getThirtyAvgSalesCount() { return thirtyAvgSalesCount; } public void setThirtyAvgSalesCount(Integer thirtyAvgSalesCount) { this.thirtyAvgSalesCount = thirtyAvgSalesCount; } public Integer getSevenAvgSalesCount() { return sevenAvgSalesCount; } public void setSevenAvgSalesCount(Integer sevenAvgSalesCount) { this.sevenAvgSalesCount = sevenAvgSalesCount; } public Integer getYesterdayAvgSalesCount() { return yesterdayAvgSalesCount; } public void setYesterdayAvgSalesCount(Integer yesterdayAvgSalesCount) { this.yesterdayAvgSalesCount = yesterdayAvgSalesCount; } public Integer getThirtyUV() { return thirtyUV; } public void setThirtyUV(Integer thirtyUV) { this.thirtyUV = thirtyUV; } public Integer getThirtyPV() { return thirtyPV; } public void setThirtyPV(Integer thirtyPV) { this.thirtyPV = thirtyPV; } public Integer getSevenUV() { return sevenUV; } public void setSevenUV(Integer sevenUV) { this.sevenUV = sevenUV; } public Integer getSevenPV() { return sevenPV; } public void setSevenPV(Integer sevenPV) { this.sevenPV = sevenPV; } public Integer getYesterdayUV() { return yesterdayUV; } public void setYesterdayUV(Integer yesterdayUV) { this.yesterdayUV = yesterdayUV; } public Integer getYesterdayPV() { return yesterdayPV; } public void setYesterdayPV(Integer yesterdayPV) { this.yesterdayPV = yesterdayPV; } public Integer getThirtyOrderCount() { return thirtyOrderCount; } public void setThirtyOrderCount(Integer thirtyOrderCount) { this.thirtyOrderCount = thirtyOrderCount; } public Integer getSevenOrderCount() { return sevenOrderCount; } public void setSevenOrderCount(Integer sevenOrderCount) { this.sevenOrderCount = sevenOrderCount; } public Integer getYesterdayOrderCount() { return yesterdayOrderCount; } public void setYesterdayOrderCount(Integer yesterdayOrderCount) { this.yesterdayOrderCount = yesterdayOrderCount; } public String getThirtyConversionRate() { return thirtyConversionRate; } public void setThirtyConversionRate(String thirtyConversionRate) { this.thirtyConversionRate = thirtyConversionRate; } public String getSevenConversionRate() { return sevenConversionRate; } public void setSevenConversionRate(String sevenConversionRate) { this.sevenConversionRate = sevenConversionRate; } public String getYesterdayConversionRate() { return yesterdayConversionRate; } public void setYesterdayConversionRate(String yesterdayConversionRate) { this.yesterdayConversionRate = yesterdayConversionRate; } public Integer getThirtySalesCount() { return thirtySalesCount; } public void setThirtySalesCount(Integer thirtySalesCount) { this.thirtySalesCount = thirtySalesCount; } public Integer getSevenSalesCount() { return sevenSalesCount; } public void setSevenSalesCount(Integer sevenSalesCount) { this.sevenSalesCount = sevenSalesCount; } public Integer getYesterdaySalesCount() { return yesterdaySalesCount; } public void setYesterdaySalesCount(Integer yesterdaySalesCount) { this.yesterdaySalesCount = yesterdaySalesCount; } }
UTF-8
Java
6,510
java
DiagFlowVO.java
Java
[ { "context": ".util.NumberUtil;\n\n/**\n * 流量UV,PV参数\n * \n * @author zxc Dec 21, 2012 9:42:17 AM\n */\npublic class DiagFlow", "end": 458, "score": 0.999575138092041, "start": 455, "tag": "USERNAME", "value": "zxc" } ]
null
[]
/* * Copyright 2011-2016 YueJi.com All right reserved. This software is the confidential and proprietary information of * YueJi.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into with YueJi.com. */ package com.yue.app.web.ferrari.vo.diag; import com.yue.scombiz.common.util.NumberUtil; /** * 流量UV,PV参数 * * @author zxc Dec 21, 2012 9:42:17 AM */ public class DiagFlowVO extends DiagVO { private Integer thirtyUV; private Integer thirtyPV; private Integer sevenUV; private Integer sevenPV; private Integer yesterdayUV; private Integer yesterdayPV; private Integer thirtyOrderCount; private Integer thirtyOrderAvgCount; private Integer sevenOrderCount; private Integer sevenOrderAvgCount; private Integer yesterdayOrderCount; private Integer yesterdayOrderAvgCount; private String thirtyConversionRate; private String sevenConversionRate; private String yesterdayConversionRate; private Integer thirtySalesCount; private Integer thirtyAvgSalesCount; private Integer sevenSalesCount; private Integer sevenAvgSalesCount; private Integer yesterdaySalesCount; private Integer yesterdayAvgSalesCount; public DiagFlowVO(Integer init) { if (NumberUtil.isEqual(0, init)) { this.thirtyUV = 0; this.thirtyPV = 0; this.sevenUV = 0; this.sevenPV = 0; this.yesterdayUV = 0; this.yesterdayPV = 0; this.thirtyOrderCount = 0; this.sevenOrderCount = 0; this.yesterdayOrderCount = 0; this.thirtyOrderAvgCount = 0; this.sevenOrderAvgCount = 0; this.yesterdayOrderAvgCount = 0; this.thirtyConversionRate = "0"; this.sevenConversionRate = "0"; this.yesterdayConversionRate = "0"; this.thirtySalesCount = 0; this.sevenSalesCount = 0; this.yesterdaySalesCount = 0; this.thirtyAvgSalesCount = 0; this.sevenAvgSalesCount = 0; this.yesterdayAvgSalesCount = 0; } } public Integer getThirtyOrderAvgCount() { return thirtyOrderAvgCount; } public void setThirtyOrderAvgCount(Integer thirtyOrderAvgCount) { this.thirtyOrderAvgCount = thirtyOrderAvgCount; } public Integer getSevenOrderAvgCount() { return sevenOrderAvgCount; } public void setSevenOrderAvgCount(Integer sevenOrderAvgCount) { this.sevenOrderAvgCount = sevenOrderAvgCount; } public Integer getYesterdayOrderAvgCount() { return yesterdayOrderAvgCount; } public void setYesterdayOrderAvgCount(Integer yesterdayOrderAvgCount) { this.yesterdayOrderAvgCount = yesterdayOrderAvgCount; } public Integer getThirtyAvgSalesCount() { return thirtyAvgSalesCount; } public void setThirtyAvgSalesCount(Integer thirtyAvgSalesCount) { this.thirtyAvgSalesCount = thirtyAvgSalesCount; } public Integer getSevenAvgSalesCount() { return sevenAvgSalesCount; } public void setSevenAvgSalesCount(Integer sevenAvgSalesCount) { this.sevenAvgSalesCount = sevenAvgSalesCount; } public Integer getYesterdayAvgSalesCount() { return yesterdayAvgSalesCount; } public void setYesterdayAvgSalesCount(Integer yesterdayAvgSalesCount) { this.yesterdayAvgSalesCount = yesterdayAvgSalesCount; } public Integer getThirtyUV() { return thirtyUV; } public void setThirtyUV(Integer thirtyUV) { this.thirtyUV = thirtyUV; } public Integer getThirtyPV() { return thirtyPV; } public void setThirtyPV(Integer thirtyPV) { this.thirtyPV = thirtyPV; } public Integer getSevenUV() { return sevenUV; } public void setSevenUV(Integer sevenUV) { this.sevenUV = sevenUV; } public Integer getSevenPV() { return sevenPV; } public void setSevenPV(Integer sevenPV) { this.sevenPV = sevenPV; } public Integer getYesterdayUV() { return yesterdayUV; } public void setYesterdayUV(Integer yesterdayUV) { this.yesterdayUV = yesterdayUV; } public Integer getYesterdayPV() { return yesterdayPV; } public void setYesterdayPV(Integer yesterdayPV) { this.yesterdayPV = yesterdayPV; } public Integer getThirtyOrderCount() { return thirtyOrderCount; } public void setThirtyOrderCount(Integer thirtyOrderCount) { this.thirtyOrderCount = thirtyOrderCount; } public Integer getSevenOrderCount() { return sevenOrderCount; } public void setSevenOrderCount(Integer sevenOrderCount) { this.sevenOrderCount = sevenOrderCount; } public Integer getYesterdayOrderCount() { return yesterdayOrderCount; } public void setYesterdayOrderCount(Integer yesterdayOrderCount) { this.yesterdayOrderCount = yesterdayOrderCount; } public String getThirtyConversionRate() { return thirtyConversionRate; } public void setThirtyConversionRate(String thirtyConversionRate) { this.thirtyConversionRate = thirtyConversionRate; } public String getSevenConversionRate() { return sevenConversionRate; } public void setSevenConversionRate(String sevenConversionRate) { this.sevenConversionRate = sevenConversionRate; } public String getYesterdayConversionRate() { return yesterdayConversionRate; } public void setYesterdayConversionRate(String yesterdayConversionRate) { this.yesterdayConversionRate = yesterdayConversionRate; } public Integer getThirtySalesCount() { return thirtySalesCount; } public void setThirtySalesCount(Integer thirtySalesCount) { this.thirtySalesCount = thirtySalesCount; } public Integer getSevenSalesCount() { return sevenSalesCount; } public void setSevenSalesCount(Integer sevenSalesCount) { this.sevenSalesCount = sevenSalesCount; } public Integer getYesterdaySalesCount() { return yesterdaySalesCount; } public void setYesterdaySalesCount(Integer yesterdaySalesCount) { this.yesterdaySalesCount = yesterdaySalesCount; } }
6,510
0.686404
0.680098
236
26.550848
23.913544
120
false
false
0
0
0
0
0
0
0.377119
false
false
3
0569b008fee648d92d4a128ecd7ee4818d2238ce
6,150,393,230,057
74945198f8c5f59b8c44cbbbf5a0ca8924eb0b6b
/coidi-core/src/main/java/com/coroptis/coidi/core/message/AssociationRequest.java
95263f230a1a0b4026f730acb3e92caa2adcdfaf
[ "Apache-2.0" ]
permissive
jajir/coidi
https://github.com/jajir/coidi
0136ce6c1754f5a051c6bb7fd5fb13324bcfc015
648f4ee71e017bacd5b468cff7e5638cfe000a52
refs/heads/master
2021-01-21T04:47:45.001000
2017-06-18T16:38:58
2017-06-18T16:38:58
48,769,693
2
0
null
false
2016-01-31T10:02:27
2015-12-29T22:23:18
2016-01-29T20:52:24
2016-01-31T10:02:27
2,650
1
0
0
Java
null
null
/** * Copyright 2012 coroptis.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.coroptis.coidi.core.message; import java.math.BigInteger; import java.util.Map; import com.coroptis.coidi.op.entities.Association.AssociationType; import com.coroptis.coidi.op.entities.Association.SessionType; import com.google.common.base.MoreObjects; import com.google.common.base.Strings; public class AssociationRequest extends AbstractOpenIdRequest { public final static String ASSOCIATION_TYPE = "assoc_type"; public final static String SESSION_TYPE = "session_type"; public final static String DH_MODULUS = "dh_modulus"; public final static String DH_GENERATOR = "dh_gen"; public final static String DH_CONSUMER_PUBLIC = "dh_consumer_public"; public AssociationRequest() { super(); setUrl(false); setMode(MODE_ASSOCIATE); setNameSpace(OPENID_NS_20); } public AssociationRequest(final Map<String, String> map) { super(map); setUrl(false); setMode(MODE_ASSOCIATE); setNameSpace(OPENID_NS_20); } @Override public String toString() { if (SessionType.NO_ENCRYPTION.equals(getSessionType())) { return MoreObjects.toStringHelper(AssociationRequest.class).add(MODE, getMode()) .add(ASSOCIATION_TYPE, getAssociationType()) .add(SESSION_TYPE, getSessionType()).add(OPENID_NS, getNameSpace()).toString(); } else { return MoreObjects.toStringHelper(AssociationRequest.class).add(MODE, getMode()) .add(ASSOCIATION_TYPE, getAssociationType()) .add(SESSION_TYPE, getSessionType()).add(DH_MODULUS, getDhModulo()) .add(DH_CONSUMER_PUBLIC, getDhConsumerPublic()).add(DH_GENERATOR, getDhGen()) .add(OPENID_NS, getNameSpace()).toString(); } } /** * This provide map, because it have to be written in to HTTP post with * http-client which is not part of this module. */ @Override public Map<String, String> getMap() { return super.getMap(); } /** * @return the associationType */ public AssociationType getAssociationType() { return AssociationType.convert(get(ASSOCIATION_TYPE)); } /** * @param associationType * the associationType to set */ public void setAssociationType(final AssociationType associationType) { put(ASSOCIATION_TYPE, associationType.getName()); } /** * @return the sessionType */ public SessionType getSessionType() { return SessionType.convert(get(SESSION_TYPE)); } /** * @param sessionType * the sessionType to set */ public void setSessionType(final SessionType sessionType) { put(SESSION_TYPE, sessionType.getName()); } /** * @return the dhConsumerPublic */ public BigInteger getDhConsumerPublic() { return convertToBigIntegerFromString(get(DH_CONSUMER_PUBLIC)); } /** * @param dhConsumerPublic * the dhConsumerPublic to set */ public void setDhConsumerPublic(final BigInteger dhConsumerPublic) { put(DH_CONSUMER_PUBLIC, convertToString(dhConsumerPublic)); } /** * @return the dhGen */ public BigInteger getDhGen() { if (Strings.isNullOrEmpty(get(DH_GENERATOR))) { return null; } else { return convertToBigIntegerFromString(get(DH_GENERATOR)); } } /** * @param dhGen * the dhGen to set */ public void setDhGen(final BigInteger dhGen) { put(DH_GENERATOR, convertToString(dhGen)); } /** * @return the dhModulo */ public BigInteger getDhModulo() { if (Strings.isNullOrEmpty(get(DH_MODULUS))) { return null; } else { return convertToBigIntegerFromString(get(DH_MODULUS)); } } /** * @param dhModulo * the dhModulo to set */ public void setDhModulo(final BigInteger dhModulo) { put(DH_MODULUS, convertToString(dhModulo)); } }
UTF-8
Java
4,457
java
AssociationRequest.java
Java
[]
null
[]
/** * Copyright 2012 coroptis.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.coroptis.coidi.core.message; import java.math.BigInteger; import java.util.Map; import com.coroptis.coidi.op.entities.Association.AssociationType; import com.coroptis.coidi.op.entities.Association.SessionType; import com.google.common.base.MoreObjects; import com.google.common.base.Strings; public class AssociationRequest extends AbstractOpenIdRequest { public final static String ASSOCIATION_TYPE = "assoc_type"; public final static String SESSION_TYPE = "session_type"; public final static String DH_MODULUS = "dh_modulus"; public final static String DH_GENERATOR = "dh_gen"; public final static String DH_CONSUMER_PUBLIC = "dh_consumer_public"; public AssociationRequest() { super(); setUrl(false); setMode(MODE_ASSOCIATE); setNameSpace(OPENID_NS_20); } public AssociationRequest(final Map<String, String> map) { super(map); setUrl(false); setMode(MODE_ASSOCIATE); setNameSpace(OPENID_NS_20); } @Override public String toString() { if (SessionType.NO_ENCRYPTION.equals(getSessionType())) { return MoreObjects.toStringHelper(AssociationRequest.class).add(MODE, getMode()) .add(ASSOCIATION_TYPE, getAssociationType()) .add(SESSION_TYPE, getSessionType()).add(OPENID_NS, getNameSpace()).toString(); } else { return MoreObjects.toStringHelper(AssociationRequest.class).add(MODE, getMode()) .add(ASSOCIATION_TYPE, getAssociationType()) .add(SESSION_TYPE, getSessionType()).add(DH_MODULUS, getDhModulo()) .add(DH_CONSUMER_PUBLIC, getDhConsumerPublic()).add(DH_GENERATOR, getDhGen()) .add(OPENID_NS, getNameSpace()).toString(); } } /** * This provide map, because it have to be written in to HTTP post with * http-client which is not part of this module. */ @Override public Map<String, String> getMap() { return super.getMap(); } /** * @return the associationType */ public AssociationType getAssociationType() { return AssociationType.convert(get(ASSOCIATION_TYPE)); } /** * @param associationType * the associationType to set */ public void setAssociationType(final AssociationType associationType) { put(ASSOCIATION_TYPE, associationType.getName()); } /** * @return the sessionType */ public SessionType getSessionType() { return SessionType.convert(get(SESSION_TYPE)); } /** * @param sessionType * the sessionType to set */ public void setSessionType(final SessionType sessionType) { put(SESSION_TYPE, sessionType.getName()); } /** * @return the dhConsumerPublic */ public BigInteger getDhConsumerPublic() { return convertToBigIntegerFromString(get(DH_CONSUMER_PUBLIC)); } /** * @param dhConsumerPublic * the dhConsumerPublic to set */ public void setDhConsumerPublic(final BigInteger dhConsumerPublic) { put(DH_CONSUMER_PUBLIC, convertToString(dhConsumerPublic)); } /** * @return the dhGen */ public BigInteger getDhGen() { if (Strings.isNullOrEmpty(get(DH_GENERATOR))) { return null; } else { return convertToBigIntegerFromString(get(DH_GENERATOR)); } } /** * @param dhGen * the dhGen to set */ public void setDhGen(final BigInteger dhGen) { put(DH_GENERATOR, convertToString(dhGen)); } /** * @return the dhModulo */ public BigInteger getDhModulo() { if (Strings.isNullOrEmpty(get(DH_MODULUS))) { return null; } else { return convertToBigIntegerFromString(get(DH_MODULUS)); } } /** * @param dhModulo * the dhModulo to set */ public void setDhModulo(final BigInteger dhModulo) { put(DH_MODULUS, convertToString(dhModulo)); } }
4,457
0.674669
0.671977
155
27.754839
25.52907
85
false
false
0
0
0
0
0
0
0.664516
false
false
3
27670e89b567f0f8bde864c55241f68326c53165
24,120,536,335,045
4c383b6d7c7524c9f25d6f54c32f77ecde3e0032
/src/rml/IMAGE.java
32c570e102fecda112d05bcb705cfb1deff86b8e
[]
no_license
ansvistunov/Z
https://github.com/ansvistunov/Z
7926bf1e1f9f2136e5f8338126051103dd84fead
6985c0840c1bd385b856009353981fd2e5d6636e
refs/heads/master
2021-05-04T10:53:05.290000
2017-02-13T08:38:48
2017-02-13T08:38:48
51,204,730
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rml; import views.*; import java.util.*; public class IMAGE implements ParsedObject{ public Object doParsing(Proper prop,Hashtable aliases){ IMage im = new IMage(); String alias = (String)prop.get("ALIAS"); if (alias!=null){ aliases.put(alias.toUpperCase(),(Object)im); } im.init(prop); return (Object)im; } }
UTF-8
Java
337
java
IMAGE.java
Java
[]
null
[]
package rml; import views.*; import java.util.*; public class IMAGE implements ParsedObject{ public Object doParsing(Proper prop,Hashtable aliases){ IMage im = new IMage(); String alias = (String)prop.get("ALIAS"); if (alias!=null){ aliases.put(alias.toUpperCase(),(Object)im); } im.init(prop); return (Object)im; } }
337
0.691395
0.691395
16
20.0625
17.658102
56
false
false
0
0
0
0
0
0
1.6875
false
false
3
255c739d77764a6e22bd7a2990ac3c456f01a708
34,067,680,597,264
d83d2698f72b35268415f229b6c0fb529c084a17
/src/test/optional.java
050e8b06e68bcabb78eb288ce6a0df5e881f8453
[]
no_license
cocoMingyu/test
https://github.com/cocoMingyu/test
40f735b971aa1b5cad307c6c8094b5e126e09101
8ccff8ca36ad42158e9e1bc3dc9d609fadb18801
refs/heads/master
2020-05-24T15:44:21.056000
2019-08-14T01:48:38
2019-08-14T01:48:38
187,338,587
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import java.util.Hashtable; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import static java.util.stream.Collectors.toList; /** * @Author:lkn * @Description: * @Date:Created in 2018/11/15 10:02 * @Modified By: */ public class optional { static final Map<String,Object> map=new Hashtable<>(); public static void main(String[] args) { optional1(); } public static void optional1(){ map.put("name","jim"); map.put("name2","tom"); map.put("age",12); Optional<Map<String, Object>> map = Optional.ofNullable(optional.map); Optional<Object> nullvalue = Optional.ofNullable(null); if(map.isPresent()){ System.out.println(map.get()); System.out.println(map.get().get("name")); } map.ifPresent(System.out::println); try { Object o = nullvalue.get(); System.out.println(o); } catch (Exception e) { System.out.println(e.getMessage()); } map.ifPresent(a ->{ a.put("sex","man"); }); Optional<Object> name = map.map(a -> a.get("name")); System.out.println(name.orElse("kenan")); Optional<Object> name1 = map.flatMap(a -> Optional.ofNullable(a.get("name1"))); System.out.println(name1.orElse("mingyu")); Optional<Map<String, Object>> filtermap = map.filter(a -> a.get("age").equals(13)); System.out.println(filtermap.orElse(null)); } }
UTF-8
Java
1,541
java
optional.java
Java
[ { "context": "va.util.stream.Collectors.toList;\n\n/**\n * @Author:lkn\n * @Description:\n * @Date:Created in 2018/11/15 1", "end": 198, "score": 0.9996258020401001, "start": 195, "tag": "USERNAME", "value": "lkn" }, { "context": " static void optional1(){\n map.put(\"name\",\"jim\");\n map.put(\"name2\",\"tom\");\n map.pu", "end": 493, "score": 0.9787828922271729, "start": 490, "tag": "NAME", "value": "jim" }, { "context": " map.put(\"name\",\"jim\");\n map.put(\"name2\",\"tom\");\n map.put(\"age\",12);\n Optional<Ma", "end": 525, "score": 0.9975438714027405, "start": 522, "tag": "NAME", "value": "tom" } ]
null
[]
package test; import java.util.Hashtable; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import static java.util.stream.Collectors.toList; /** * @Author:lkn * @Description: * @Date:Created in 2018/11/15 10:02 * @Modified By: */ public class optional { static final Map<String,Object> map=new Hashtable<>(); public static void main(String[] args) { optional1(); } public static void optional1(){ map.put("name","jim"); map.put("name2","tom"); map.put("age",12); Optional<Map<String, Object>> map = Optional.ofNullable(optional.map); Optional<Object> nullvalue = Optional.ofNullable(null); if(map.isPresent()){ System.out.println(map.get()); System.out.println(map.get().get("name")); } map.ifPresent(System.out::println); try { Object o = nullvalue.get(); System.out.println(o); } catch (Exception e) { System.out.println(e.getMessage()); } map.ifPresent(a ->{ a.put("sex","man"); }); Optional<Object> name = map.map(a -> a.get("name")); System.out.println(name.orElse("kenan")); Optional<Object> name1 = map.flatMap(a -> Optional.ofNullable(a.get("name1"))); System.out.println(name1.orElse("mingyu")); Optional<Map<String, Object>> filtermap = map.filter(a -> a.get("age").equals(13)); System.out.println(filtermap.orElse(null)); } }
1,541
0.587281
0.573005
56
26.517857
23.426931
91
false
false
0
0
0
0
0
0
0.607143
false
false
3
cfd2eaca1345c95454f08df7ab7cc0699bd009c8
34,943,853,926,419
878a9cd79ecc85c1fe3e79a4fdae5ec0b4a770e3
/SpringLimitLoginFails/src/main/java/com/tirmizee/core/security/AuthenticationProviderImpl.java
8a12a7e5cba6c9c08002e655bde26db778982dd4
[]
no_license
tirmizee/SpringLimitLoginAndForgetPassword
https://github.com/tirmizee/SpringLimitLoginAndForgetPassword
26187d561cd1faacb573eb590252cb8f32f79dae
ef97cdbf8a69aead466b02d9af03cde93c47f2d3
refs/heads/master
2018-10-01T02:17:45.804000
2018-08-12T14:24:36
2018-08-12T14:24:36
136,276,189
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tirmizee.core.security; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AccountExpiredException; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.CredentialsExpiredException; import org.springframework.security.authentication.DisabledException; import org.springframework.security.authentication.LockedException; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.userdetails.UsernameNotFoundException; import com.tirmizee.backend.service.EnforceChangePasswordService; import com.tirmizee.backend.service.MemberAttemptService; import com.tirmizee.core.exception.IAccountExpiredException; import com.tirmizee.core.exception.IBadCredentialsException; import com.tirmizee.core.exception.ICredentialsExpiredException; import com.tirmizee.core.exception.ICredentialsFirstloginException; import com.tirmizee.core.exception.IDisabledException; import com.tirmizee.core.exception.ILockedException; import com.tirmizee.core.exception.IUsernameNotFoundException; /** * @author Pratya Yeekhaday * */ public class AuthenticationProviderImpl extends DaoAuthenticationProvider { public static final Logger LOG = Logger.getLogger(AuthenticationProviderImpl.class); @Autowired private MemberAttemptService memberAttemptService; @Autowired private EnforceChangePasswordService enforceChangePasswordService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { final String username = authentication.getName(); try{ Authentication authen = super.authenticate(authentication); UserProfile userProfile = (UserProfile) authen.getPrincipal(); if (userProfile.isInitialLogin()) { throw new ICredentialsFirstloginException( username, "Force password change"); } if (enforceChangePasswordService.isPasswordExpired(userProfile.getCredentialsExpiredDate())) { enforceChangePasswordService.updatePasswordExpired(username); throw new ICredentialsExpiredException(username, "User account credentials have expired"); } if (authen.isAuthenticated()) { memberAttemptService.resetMemberAttempt(username); } return authen; }catch (DisabledException e) { throw new IDisabledException(username , "User account is disabled"); }catch (AccountExpiredException e) { throw new IAccountExpiredException(username, "User account has expired"); }catch (UsernameNotFoundException e) { throw new IUsernameNotFoundException(username, "Username not found"); }catch (CredentialsExpiredException e) { throw new ICredentialsExpiredException(username, "User account credentials have expired"); }catch (LockedException e) { throw new ILockedException(username, "User account is locked"); }catch (BadCredentialsException e) { memberAttemptService.updateMemberAttempt(username); throw new IBadCredentialsException(username, "Credentials not valid"); } } }
UTF-8
Java
3,327
java
AuthenticationProviderImpl.java
Java
[ { "context": "n.IUsernameNotFoundException;\r\n\r\n\r\n/**\r\n * @author Pratya Yeekhaday\r\n *\r\n */\r\npublic class AuthenticationProviderImpl", "end": 1397, "score": 0.9998675584793091, "start": 1381, "tag": "NAME", "value": "Pratya Yeekhaday" } ]
null
[]
package com.tirmizee.core.security; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AccountExpiredException; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.CredentialsExpiredException; import org.springframework.security.authentication.DisabledException; import org.springframework.security.authentication.LockedException; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.userdetails.UsernameNotFoundException; import com.tirmizee.backend.service.EnforceChangePasswordService; import com.tirmizee.backend.service.MemberAttemptService; import com.tirmizee.core.exception.IAccountExpiredException; import com.tirmizee.core.exception.IBadCredentialsException; import com.tirmizee.core.exception.ICredentialsExpiredException; import com.tirmizee.core.exception.ICredentialsFirstloginException; import com.tirmizee.core.exception.IDisabledException; import com.tirmizee.core.exception.ILockedException; import com.tirmizee.core.exception.IUsernameNotFoundException; /** * @author <NAME> * */ public class AuthenticationProviderImpl extends DaoAuthenticationProvider { public static final Logger LOG = Logger.getLogger(AuthenticationProviderImpl.class); @Autowired private MemberAttemptService memberAttemptService; @Autowired private EnforceChangePasswordService enforceChangePasswordService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { final String username = authentication.getName(); try{ Authentication authen = super.authenticate(authentication); UserProfile userProfile = (UserProfile) authen.getPrincipal(); if (userProfile.isInitialLogin()) { throw new ICredentialsFirstloginException( username, "Force password change"); } if (enforceChangePasswordService.isPasswordExpired(userProfile.getCredentialsExpiredDate())) { enforceChangePasswordService.updatePasswordExpired(username); throw new ICredentialsExpiredException(username, "User account credentials have expired"); } if (authen.isAuthenticated()) { memberAttemptService.resetMemberAttempt(username); } return authen; }catch (DisabledException e) { throw new IDisabledException(username , "User account is disabled"); }catch (AccountExpiredException e) { throw new IAccountExpiredException(username, "User account has expired"); }catch (UsernameNotFoundException e) { throw new IUsernameNotFoundException(username, "Username not found"); }catch (CredentialsExpiredException e) { throw new ICredentialsExpiredException(username, "User account credentials have expired"); }catch (LockedException e) { throw new ILockedException(username, "User account is locked"); }catch (BadCredentialsException e) { memberAttemptService.updateMemberAttempt(username); throw new IBadCredentialsException(username, "Credentials not valid"); } } }
3,317
0.807033
0.806733
73
43.465752
30.944971
99
false
false
0
0
0
0
0
0
1.945205
false
false
3
c52eff613923f925ea097b5f6d9a4475b99f528d
10,204,842,308,200
3d5e749b8e3027fc785712c0ff6b019ec76a0ceb
/src/test/java/LitecartTesting.java
9782e6489ea74ffabea777ed48c5a6817d0dbea0
[]
no_license
Blackhoodie/parser
https://github.com/Blackhoodie/parser
bb5adf84ec87cc37cac3911cf4582d49e72a719f
18d967655c0b7f62aa89c41ba53f7742a4436536
refs/heads/master
2020-04-27T13:33:22.866000
2019-02-28T10:07:31
2019-02-28T10:07:31
174,374,240
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import org.junit.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.TimeUnit; public class LitecartTesting { static WebDriver driver; private String url = "http://localhost/litecart/admin"; private String login = "admin"; private String password = "admin"; //Initialization Chrome and login in litecart @Before public void driver_init() { try { ChromeOptions options = new ChromeOptions(); options.addArguments("start-maximized"); driver = new ChromeDriver(options); driver.get(url); System.out.println("Initialization success"); } catch (Exception e) { System.out.println("Can't initialization!"); return; } driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.name("username")).sendKeys(login); driver.findElement(By.name("password")).sendKeys(password); driver.findElement(By.name("login")).click(); } //Verifying that element is present on the page boolean isElementPresent(WebDriver driver, By locator) { try { driver.findElement(locator); return true; } catch (NoSuchElementException ex) { return false; } } //Test clicks all elements in side bar and verify that <h1> is present @Test public void checkAppearence() { String sidebarPath = "#sidebar ul#box-apps-menu"; By menuBlock = By.cssSelector(sidebarPath); int counterLi = driver.findElement(menuBlock).findElements(By.xpath("./li")).size(); By selectedItem = By.cssSelector("li.selected"); for(int menuItem = 1; menuItem < counterLi; menuItem++) { driver.findElement(menuBlock).findElement(By.xpath("./li[" + menuItem + "]")).click(); Assert.assertTrue("h1 element not found on the page", isElementPresent(driver, By.tagName("h1"))); int subMenusize = driver.findElement(menuBlock).findElement(selectedItem).findElements(By.cssSelector("li")).size(); if (subMenusize > 0) { for(int subMenuItem = 1; subMenuItem <= subMenusize; subMenuItem++) { driver.findElement(selectedItem).findElement(By.cssSelector("li:nth-of-type(" + subMenuItem + ")")).click(); Assert.assertTrue("h1 element not found on the page", isElementPresent(driver, By.tagName("h1"))); } } } } @After public void litecartTesting_cleanup () { driver.quit(); // quit } }
UTF-8
Java
2,906
java
LitecartTesting.java
Java
[ { "context": "host/litecart/admin\";\n private String login = \"admin\";\n private String password = \"admin\";\n\n //I", "end": 483, "score": 0.9959836602210999, "start": 478, "tag": "USERNAME", "value": "admin" }, { "context": "g login = \"admin\";\n private String password = \"admin\";\n\n //Initialization Chrome and login in litec", "end": 522, "score": 0.9993047714233398, "start": 517, "tag": "PASSWORD", "value": "admin" }, { "context": " driver.findElement(By.name(\"password\")).sendKeys(password);\n driver.findElement(By.name(\"login\")).cl", "end": 1201, "score": 0.9989084005355835, "start": 1193, "tag": "PASSWORD", "value": "password" } ]
null
[]
import org.junit.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.TimeUnit; public class LitecartTesting { static WebDriver driver; private String url = "http://localhost/litecart/admin"; private String login = "admin"; private String password = "<PASSWORD>"; //Initialization Chrome and login in litecart @Before public void driver_init() { try { ChromeOptions options = new ChromeOptions(); options.addArguments("start-maximized"); driver = new ChromeDriver(options); driver.get(url); System.out.println("Initialization success"); } catch (Exception e) { System.out.println("Can't initialization!"); return; } driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.name("username")).sendKeys(login); driver.findElement(By.name("password")).sendKeys(<PASSWORD>); driver.findElement(By.name("login")).click(); } //Verifying that element is present on the page boolean isElementPresent(WebDriver driver, By locator) { try { driver.findElement(locator); return true; } catch (NoSuchElementException ex) { return false; } } //Test clicks all elements in side bar and verify that <h1> is present @Test public void checkAppearence() { String sidebarPath = "#sidebar ul#box-apps-menu"; By menuBlock = By.cssSelector(sidebarPath); int counterLi = driver.findElement(menuBlock).findElements(By.xpath("./li")).size(); By selectedItem = By.cssSelector("li.selected"); for(int menuItem = 1; menuItem < counterLi; menuItem++) { driver.findElement(menuBlock).findElement(By.xpath("./li[" + menuItem + "]")).click(); Assert.assertTrue("h1 element not found on the page", isElementPresent(driver, By.tagName("h1"))); int subMenusize = driver.findElement(menuBlock).findElement(selectedItem).findElements(By.cssSelector("li")).size(); if (subMenusize > 0) { for(int subMenuItem = 1; subMenuItem <= subMenusize; subMenuItem++) { driver.findElement(selectedItem).findElement(By.cssSelector("li:nth-of-type(" + subMenuItem + ")")).click(); Assert.assertTrue("h1 element not found on the page", isElementPresent(driver, By.tagName("h1"))); } } } } @After public void litecartTesting_cleanup () { driver.quit(); // quit } }
2,913
0.622849
0.619408
82
34.439026
31.292521
128
false
false
0
0
0
0
0
0
0.573171
false
false
3
0294a7b83eed5423bfeb269ecf410c509da4e26b
24,249,385,362,743
f9b237383bfedf6dea64897f8a6210dc9300a9ee
/src/main/java/com/niuniu/shinetea/repository/BuyerCouponRepository.java
de916c138cec00e1ac58e65c146491b964a82bed
[]
no_license
niuniunn/shinetea
https://github.com/niuniunn/shinetea
524be777bb45e3267c2f4c71aa0e718d0479c981
f049ef56096b2026113c71519598b8dd55e17575
refs/heads/master
2023-05-10T03:35:15.352000
2021-06-07T14:37:17
2021-06-07T14:37:17
367,081,275
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.niuniu.shinetea.repository; import com.niuniu.shinetea.dataobject.BuyerCoupon; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface BuyerCouponRepository extends JpaRepository<BuyerCoupon, Integer> { List<BuyerCoupon> findByMemberId(Integer memberId); }
UTF-8
Java
322
java
BuyerCouponRepository.java
Java
[]
null
[]
package com.niuniu.shinetea.repository; import com.niuniu.shinetea.dataobject.BuyerCoupon; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface BuyerCouponRepository extends JpaRepository<BuyerCoupon, Integer> { List<BuyerCoupon> findByMemberId(Integer memberId); }
322
0.832298
0.832298
10
31.200001
29.28071
84
false
false
0
0
0
0
0
0
0.6
false
false
3
aae6f3176d47365cf95cd96996838d016beb1c41
5,695,126,651,971
55440c8a297c5aa9042fd0161654e38513f9bd22
/src/stackAndQueues/Q3_6.java
2c146a0db14805fe7f4f19456a337e6c33e2af0a
[]
no_license
vitruvianAnalogy/CrackingTheCode
https://github.com/vitruvianAnalogy/CrackingTheCode
e414a8f18945fa3699fa7789e978cc6c7e2da25f
8acfabe82271576ec69a530003c72e076ede4b1c
refs/heads/master
2021-01-10T01:29:33.781000
2015-12-28T20:32:38
2015-12-28T20:32:38
48,215,212
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package stackAndQueues; /*We need two stacks for this. We pop one element and then push it into another * stack, while simultaneously checking if it is GREATER than the element already * on top of it. We pop enough elements from this auxiliary stack as to have the larges * element at the bottom and smallest in the top. For that we pop elements from * the auxiliary stack if they are smaller than the element we are checking and push them * into our main stack in that order. After doing this we push our element in the * auxiliary stack and then put back all the elements in the auxiliary stack again*/ public class Q3_6 { public void sort(Stack myStack){ /* if(myStack.isEmpty()){ System.out.println("Stack is empty"); } Stack temp = new Stack(); while(myStack!=null){ Node data = myStack.pop(); if(temp.isEmpty()) temp.push(data); else { if(temp.peek().data<data.data){ swap(temp.pop().data, data.data); } } }*/ } }
UTF-8
Java
980
java
Q3_6.java
Java
[]
null
[]
package stackAndQueues; /*We need two stacks for this. We pop one element and then push it into another * stack, while simultaneously checking if it is GREATER than the element already * on top of it. We pop enough elements from this auxiliary stack as to have the larges * element at the bottom and smallest in the top. For that we pop elements from * the auxiliary stack if they are smaller than the element we are checking and push them * into our main stack in that order. After doing this we push our element in the * auxiliary stack and then put back all the elements in the auxiliary stack again*/ public class Q3_6 { public void sort(Stack myStack){ /* if(myStack.isEmpty()){ System.out.println("Stack is empty"); } Stack temp = new Stack(); while(myStack!=null){ Node data = myStack.pop(); if(temp.isEmpty()) temp.push(data); else { if(temp.peek().data<data.data){ swap(temp.pop().data, data.data); } } }*/ } }
980
0.697959
0.695918
31
30.612904
30.730543
89
false
false
0
0
0
0
0
0
1.870968
false
false
3
7007d5a313a4df62970e50145841bf173db320b9
412,316,876,813
82e2fa3b1128edc8abd2bd84ecfc01c932831bc0
/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/OptimizerStd.java
bb4c7aca031bcf80c8fda9af40669fd73e299fac
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
apache/jena
https://github.com/apache/jena
b64f6013582f2b5aa38d1c9972d7b14e55686316
fb41e79d97f065b8df9ebbc6c69b3f983b6cde04
refs/heads/main
2023-08-14T15:16:21.086000
2023-08-03T08:34:08
2023-08-03T08:34:08
7,437,073
966
760
Apache-2.0
false
2023-09-02T09:04:08
2013-01-04T08:00:32
2023-09-01T09:23:38
2023-09-02T09:04:07
456,635
982
625
53
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.sparql.algebra.optimize; import org.apache.jena.query.ARQ ; import org.apache.jena.sparql.ARQConstants ; import org.apache.jena.sparql.SystemARQ ; import org.apache.jena.sparql.algebra.* ; import org.apache.jena.sparql.algebra.op.OpLabel ; import org.apache.jena.sparql.util.Context ; import org.apache.jena.sparql.util.Symbol ; import org.slf4j.Logger ; import org.slf4j.LoggerFactory ; /** The standard optimization sequence. */ public class OptimizerStd implements Rewrite { static private Logger log = LoggerFactory.getLogger(Optimize.class) ; private final Context context ; public OptimizerStd(Context context) { this.context = context ; } /** Alternative name for compatibility only */ public static final Symbol filterPlacementOldName = SystemARQ.allocSymbol("filterPlacement") ; @Override public Op rewrite(Op op) { // Record optimizer if ( context.get(ARQConstants.sysOptimizer) == null ) context.set(ARQConstants.sysOptimizer, this) ; // Old name, new name fixup. if ( context.isDefined(filterPlacementOldName) ) { if ( context.isUndef(ARQ.optFilterPlacement) ) context.set(ARQ.optFilterPlacement, context.get(filterPlacementOldName)) ; } if ( false ) { // Removal of "group of one" join (AKA SPARQL "simplification") // is done during algebra generation in AlgebraGenerator op = apply("Simplify", new TransformSimplify(), op) ; op = apply("Delabel", new TransformRemoveLabels(), op) ; } // ** TransformScopeRename // This is a requirement for the linearization execution that the default // ARQ query engine uses where possible. // This transformation must be done (e.g. by QueryEngineBase) if no other optimization is done. op = TransformScopeRename.transform(op) ; // Prepare expressions. OpWalker.walk(op, new OpVisitorExprPrepare(context)) ; // Convert paths to triple patterns if possible. if ( context.isTrueOrUndef(ARQ.optPathFlatten) ) { if (context.isTrue(ARQ.optPathFlattenAlgebra)) { op = apply("Path flattening (algebra)", new TransformPathFlattenAlgebra(), op); } else { op = apply("Path flattening", new TransformPathFlatten(), op); } // and merge adjacent BGPs (part 1) if ( context.isTrueOrUndef(ARQ.optMergeBGPs) ) op = apply("Merge BGPs", new TransformMergeBGPs(), op) ; } // Having done the required transforms, specifically TransformScopeRename, // do each optimization via an overrideable method. Subclassing can modify the // transform performed. // Expression constant folding if ( context.isTrueOrUndef(ARQ.optExprConstantFolding) ) op = transformExprConstantFolding(op) ; if ( context.isTrueOrUndef(ARQ.propertyFunctions) ) op = transformPropertyFunctions(op) ; // Expand (A&&B) to two filter (A), (B) so that they can be placed independently. if ( context.isTrueOrUndef(ARQ.optFilterConjunction) ) op = transformFilterConjunction(op) ; // Expand IN and NOT IN which then allows other optimizations to be applied. if ( context.isTrueOrUndef(ARQ.optFilterExpandOneOf) ) op = transformFilterExpandOneOf(op) ; // Eliminate/Inline assignments where possible // Do this before we do some of the filter transformation work as inlining assignments // may give us more flexibility in optimizing the resulting filters if ( context.isTrue(ARQ.optInlineAssignments) ) op = transformInlineAssignments(op) ; // Apply some general purpose filter transformations if ( context.isTrueOrUndef(ARQ.optFilterImplicitJoin) ) op = transformFilterImplicitJoin(op) ; if ( context.isTrueOrUndef(ARQ.optImplicitLeftJoin) ) op = transformFilterImplicitLeftJoin(op) ; if ( context.isTrueOrUndef(ARQ.optFilterDisjunction) ) op = transformFilterDisjunction(op) ; // Some ORDER BY-LIMIT N queries can be done more efficiently by only recording // the top N items, so a full sort is not needed. if ( context.isTrueOrUndef(ARQ.optTopNSorting) ) op = transformTopNSorting(op) ; // ORDER BY+DISTINCT optimizations // We apply the one that changes evaluation order first since when it does apply it will give much // better performance than just transforming DISTINCT to REDUCED if ( context.isTrueOrUndef(ARQ.optOrderByDistinctApplication) ) op = transformOrderByDistinctApplication(op) ; // Transform some DISTINCT to REDUCED, slightly more liberal transform that ORDER BY+DISTINCT application // Reduces memory consumption. if ( context.isTrueOrUndef(ARQ.optDistinctToReduced) ) op = transformDistinctToReduced(op) ; // Find joins/leftJoin that can be done by index joins (generally preferred as fixed memory overhead). if ( context.isTrueOrUndef(ARQ.optIndexJoinStrategy) ) op = transformJoinStrategy(op) ; // Do a basic reordering so that triples with more defined terms go first. // 2022-11: This does not take into account values flowed into the BGP // (OpSequence, Lateral joins, EXISTS) so the default is not enabled. // Use "ARQ.getContext.set(ARQ.optReorderBGP, true)" to enable. //if ( context.isTrueOrUndef(ARQ.optReorderBGP) ) if ( context.isTrue(ARQ.optReorderBGP) ) op = transformReorder(op) ; // Place filters close to where their input variables are defined. // This prunes the output of that step as early as possible. // // This is done after BGP reordering because inserting the filters breaks up BGPs, // and would make transformReorder complicated, and also because a two-term triple pattern // is (probably) more specific than many filters. // // Filters in involving equality are done separately. // If done before TransformJoinStrategy, you can get two applications // of a filter in a (sequence) from each half of a (join). // This is harmless but it looks a bit odd. if ( context.isTrueOrUndef(ARQ.optFilterPlacement) ) op = transformFilterPlacement(op) ; // Replace suitable FILTER(?x = TERM) with (assign) and write the TERM for ?x in the pattern. // Apply (possible a second time) after FILTER placement as it can create new possibilities. // See JENA-616. if ( context.isTrueOrUndef(ARQ.optFilterEquality) ) op = transformFilterEquality(op) ; // Replace suitable FILTER(?x != TERM) with (minus (original) (table)) where the table contains // the candidate rows to be eliminated // Off by default due to minimal performance difference if ( context.isTrue(ARQ.optFilterInequality) ) op = transformFilterInequality(op) ; // Promote table empty as late as possible since this will only be produced by other // optimizations and never directly from algebra generation if ( context.isTrueOrUndef(ARQ.optPromoteTableEmpty) ) op = transformPromoteTableEmpty(op) ; // Merge adjacent BGPs if ( context.isTrueOrUndef(ARQ.optMergeBGPs) ) op = transformMergeBGPs(op) ; // Merge (extend) and (assign) stacks if ( context.isTrueOrUndef(ARQ.optMergeExtends) ) op = transformExtendCombine(op) ; // Mark if ( false ) op = OpLabel.create("Transformed", op) ; return op ; } protected Op transformExprConstantFolding(Op op) { return Transformer.transform(new TransformCopy(), new ExprTransformConstantFold(), op); } protected Op transformPropertyFunctions(Op op) { return apply("Property Functions", new TransformPropertyFunction(context), op) ; } protected Op transformFilterConjunction(Op op) { return apply("filter conjunctions to ExprLists", new TransformFilterConjunction(), op) ; } protected Op transformFilterExpandOneOf(Op op) { return apply("Break up IN and NOT IN", new TransformExpandOneOf(), op) ; } protected Op transformInlineAssignments(Op op) { return TransformEliminateAssignments.eliminate(op, context.isTrue(ARQ.optInlineAssignmentsAggressive)); } protected Op transformFilterImplicitJoin(Op op) { return apply("Filter Implicit Join", new TransformFilterImplicitJoin(), op); } protected Op transformFilterImplicitLeftJoin(Op op) { return apply("Implicit Left Join", new TransformImplicitLeftJoin(), op); } protected Op transformFilterDisjunction(Op op) { return apply("Filter Disjunction", new TransformFilterDisjunction(), op) ; } protected Op transformTopNSorting(Op op) { return apply("TopN Sorting", new TransformTopN(), op) ; } protected Op transformOrderByDistinctApplication(Op op) { return apply("Apply DISTINCT prior to ORDER BY where possible", new TransformOrderByDistinctApplication(), op); } protected Op transformDistinctToReduced(Op op) { return apply("Distinct replaced with reduced", new TransformDistinctToReduced(), op) ; } protected Op transformJoinStrategy(Op op) { return apply("Index Join strategy", new TransformJoinStrategy(), op) ; } protected Op transformFilterPlacement(Op op) { if ( context.isTrue(ARQ.optFilterPlacementConservative)) op = apply("Filter Placement (conservative)", new TransformFilterPlacementConservative(), op) ; else { // Whether to push into BGPs boolean b = context.isTrueOrUndef(ARQ.optFilterPlacementBGP) ; op = apply("Filter Placement", new TransformFilterPlacement(b), op) ; } return op ; } protected Op transformFilterEquality(Op op) { return apply("Filter Equality", new TransformFilterEquality(), op) ; } protected Op transformFilterInequality(Op op) { return apply("Filter Inequality", new TransformFilterInequality(), op); } protected Op transformPromoteTableEmpty(Op op) { return apply("Table Empty Promotion", new TransformPromoteTableEmpty(), op) ; } protected Op transformMergeBGPs(Op op) { return apply("Merge BGPs", new TransformMergeBGPs(), op) ; } protected Op transformReorder(Op op) { return apply("ReorderMerge BGPs", new TransformReorder(), op) ; } protected Op transformExtendCombine(Op op) { return apply("Combine BIND/LET", new TransformExtendCombine(), op) ; } public static Op apply(Transform transform, Op op) { Op op2 = Transformer.transformSkipService(transform, op) ; if ( op2 != op ) return op2 ; return op ; } private static final boolean debug = false ; private static final boolean printNoAction = false; public static Op apply(String label, Transform transform, Op op) { Op op2 = Transformer.transformSkipService(transform, op) ; if ( debug ) { if ( printNoAction && label != null ) log.info("Transform: " + label) ; if ( op == op2 ) { if ( printNoAction ) log.info("No change (==)") ; return op2 ; } if ( op.equals(op2) ) { if ( printNoAction ) log.info("No change (equals)") ; return op2 ; } if ( ! printNoAction && label != null ); log.info("Transform: " + label) ; log.info("\n" + op.toString()) ; log.info("\n" + op2.toString()) ; } return op2 ; } }
UTF-8
Java
12,902
java
OptimizerStd.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.sparql.algebra.optimize; import org.apache.jena.query.ARQ ; import org.apache.jena.sparql.ARQConstants ; import org.apache.jena.sparql.SystemARQ ; import org.apache.jena.sparql.algebra.* ; import org.apache.jena.sparql.algebra.op.OpLabel ; import org.apache.jena.sparql.util.Context ; import org.apache.jena.sparql.util.Symbol ; import org.slf4j.Logger ; import org.slf4j.LoggerFactory ; /** The standard optimization sequence. */ public class OptimizerStd implements Rewrite { static private Logger log = LoggerFactory.getLogger(Optimize.class) ; private final Context context ; public OptimizerStd(Context context) { this.context = context ; } /** Alternative name for compatibility only */ public static final Symbol filterPlacementOldName = SystemARQ.allocSymbol("filterPlacement") ; @Override public Op rewrite(Op op) { // Record optimizer if ( context.get(ARQConstants.sysOptimizer) == null ) context.set(ARQConstants.sysOptimizer, this) ; // Old name, new name fixup. if ( context.isDefined(filterPlacementOldName) ) { if ( context.isUndef(ARQ.optFilterPlacement) ) context.set(ARQ.optFilterPlacement, context.get(filterPlacementOldName)) ; } if ( false ) { // Removal of "group of one" join (AKA SPARQL "simplification") // is done during algebra generation in AlgebraGenerator op = apply("Simplify", new TransformSimplify(), op) ; op = apply("Delabel", new TransformRemoveLabels(), op) ; } // ** TransformScopeRename // This is a requirement for the linearization execution that the default // ARQ query engine uses where possible. // This transformation must be done (e.g. by QueryEngineBase) if no other optimization is done. op = TransformScopeRename.transform(op) ; // Prepare expressions. OpWalker.walk(op, new OpVisitorExprPrepare(context)) ; // Convert paths to triple patterns if possible. if ( context.isTrueOrUndef(ARQ.optPathFlatten) ) { if (context.isTrue(ARQ.optPathFlattenAlgebra)) { op = apply("Path flattening (algebra)", new TransformPathFlattenAlgebra(), op); } else { op = apply("Path flattening", new TransformPathFlatten(), op); } // and merge adjacent BGPs (part 1) if ( context.isTrueOrUndef(ARQ.optMergeBGPs) ) op = apply("Merge BGPs", new TransformMergeBGPs(), op) ; } // Having done the required transforms, specifically TransformScopeRename, // do each optimization via an overrideable method. Subclassing can modify the // transform performed. // Expression constant folding if ( context.isTrueOrUndef(ARQ.optExprConstantFolding) ) op = transformExprConstantFolding(op) ; if ( context.isTrueOrUndef(ARQ.propertyFunctions) ) op = transformPropertyFunctions(op) ; // Expand (A&&B) to two filter (A), (B) so that they can be placed independently. if ( context.isTrueOrUndef(ARQ.optFilterConjunction) ) op = transformFilterConjunction(op) ; // Expand IN and NOT IN which then allows other optimizations to be applied. if ( context.isTrueOrUndef(ARQ.optFilterExpandOneOf) ) op = transformFilterExpandOneOf(op) ; // Eliminate/Inline assignments where possible // Do this before we do some of the filter transformation work as inlining assignments // may give us more flexibility in optimizing the resulting filters if ( context.isTrue(ARQ.optInlineAssignments) ) op = transformInlineAssignments(op) ; // Apply some general purpose filter transformations if ( context.isTrueOrUndef(ARQ.optFilterImplicitJoin) ) op = transformFilterImplicitJoin(op) ; if ( context.isTrueOrUndef(ARQ.optImplicitLeftJoin) ) op = transformFilterImplicitLeftJoin(op) ; if ( context.isTrueOrUndef(ARQ.optFilterDisjunction) ) op = transformFilterDisjunction(op) ; // Some ORDER BY-LIMIT N queries can be done more efficiently by only recording // the top N items, so a full sort is not needed. if ( context.isTrueOrUndef(ARQ.optTopNSorting) ) op = transformTopNSorting(op) ; // ORDER BY+DISTINCT optimizations // We apply the one that changes evaluation order first since when it does apply it will give much // better performance than just transforming DISTINCT to REDUCED if ( context.isTrueOrUndef(ARQ.optOrderByDistinctApplication) ) op = transformOrderByDistinctApplication(op) ; // Transform some DISTINCT to REDUCED, slightly more liberal transform that ORDER BY+DISTINCT application // Reduces memory consumption. if ( context.isTrueOrUndef(ARQ.optDistinctToReduced) ) op = transformDistinctToReduced(op) ; // Find joins/leftJoin that can be done by index joins (generally preferred as fixed memory overhead). if ( context.isTrueOrUndef(ARQ.optIndexJoinStrategy) ) op = transformJoinStrategy(op) ; // Do a basic reordering so that triples with more defined terms go first. // 2022-11: This does not take into account values flowed into the BGP // (OpSequence, Lateral joins, EXISTS) so the default is not enabled. // Use "ARQ.getContext.set(ARQ.optReorderBGP, true)" to enable. //if ( context.isTrueOrUndef(ARQ.optReorderBGP) ) if ( context.isTrue(ARQ.optReorderBGP) ) op = transformReorder(op) ; // Place filters close to where their input variables are defined. // This prunes the output of that step as early as possible. // // This is done after BGP reordering because inserting the filters breaks up BGPs, // and would make transformReorder complicated, and also because a two-term triple pattern // is (probably) more specific than many filters. // // Filters in involving equality are done separately. // If done before TransformJoinStrategy, you can get two applications // of a filter in a (sequence) from each half of a (join). // This is harmless but it looks a bit odd. if ( context.isTrueOrUndef(ARQ.optFilterPlacement) ) op = transformFilterPlacement(op) ; // Replace suitable FILTER(?x = TERM) with (assign) and write the TERM for ?x in the pattern. // Apply (possible a second time) after FILTER placement as it can create new possibilities. // See JENA-616. if ( context.isTrueOrUndef(ARQ.optFilterEquality) ) op = transformFilterEquality(op) ; // Replace suitable FILTER(?x != TERM) with (minus (original) (table)) where the table contains // the candidate rows to be eliminated // Off by default due to minimal performance difference if ( context.isTrue(ARQ.optFilterInequality) ) op = transformFilterInequality(op) ; // Promote table empty as late as possible since this will only be produced by other // optimizations and never directly from algebra generation if ( context.isTrueOrUndef(ARQ.optPromoteTableEmpty) ) op = transformPromoteTableEmpty(op) ; // Merge adjacent BGPs if ( context.isTrueOrUndef(ARQ.optMergeBGPs) ) op = transformMergeBGPs(op) ; // Merge (extend) and (assign) stacks if ( context.isTrueOrUndef(ARQ.optMergeExtends) ) op = transformExtendCombine(op) ; // Mark if ( false ) op = OpLabel.create("Transformed", op) ; return op ; } protected Op transformExprConstantFolding(Op op) { return Transformer.transform(new TransformCopy(), new ExprTransformConstantFold(), op); } protected Op transformPropertyFunctions(Op op) { return apply("Property Functions", new TransformPropertyFunction(context), op) ; } protected Op transformFilterConjunction(Op op) { return apply("filter conjunctions to ExprLists", new TransformFilterConjunction(), op) ; } protected Op transformFilterExpandOneOf(Op op) { return apply("Break up IN and NOT IN", new TransformExpandOneOf(), op) ; } protected Op transformInlineAssignments(Op op) { return TransformEliminateAssignments.eliminate(op, context.isTrue(ARQ.optInlineAssignmentsAggressive)); } protected Op transformFilterImplicitJoin(Op op) { return apply("Filter Implicit Join", new TransformFilterImplicitJoin(), op); } protected Op transformFilterImplicitLeftJoin(Op op) { return apply("Implicit Left Join", new TransformImplicitLeftJoin(), op); } protected Op transformFilterDisjunction(Op op) { return apply("Filter Disjunction", new TransformFilterDisjunction(), op) ; } protected Op transformTopNSorting(Op op) { return apply("TopN Sorting", new TransformTopN(), op) ; } protected Op transformOrderByDistinctApplication(Op op) { return apply("Apply DISTINCT prior to ORDER BY where possible", new TransformOrderByDistinctApplication(), op); } protected Op transformDistinctToReduced(Op op) { return apply("Distinct replaced with reduced", new TransformDistinctToReduced(), op) ; } protected Op transformJoinStrategy(Op op) { return apply("Index Join strategy", new TransformJoinStrategy(), op) ; } protected Op transformFilterPlacement(Op op) { if ( context.isTrue(ARQ.optFilterPlacementConservative)) op = apply("Filter Placement (conservative)", new TransformFilterPlacementConservative(), op) ; else { // Whether to push into BGPs boolean b = context.isTrueOrUndef(ARQ.optFilterPlacementBGP) ; op = apply("Filter Placement", new TransformFilterPlacement(b), op) ; } return op ; } protected Op transformFilterEquality(Op op) { return apply("Filter Equality", new TransformFilterEquality(), op) ; } protected Op transformFilterInequality(Op op) { return apply("Filter Inequality", new TransformFilterInequality(), op); } protected Op transformPromoteTableEmpty(Op op) { return apply("Table Empty Promotion", new TransformPromoteTableEmpty(), op) ; } protected Op transformMergeBGPs(Op op) { return apply("Merge BGPs", new TransformMergeBGPs(), op) ; } protected Op transformReorder(Op op) { return apply("ReorderMerge BGPs", new TransformReorder(), op) ; } protected Op transformExtendCombine(Op op) { return apply("Combine BIND/LET", new TransformExtendCombine(), op) ; } public static Op apply(Transform transform, Op op) { Op op2 = Transformer.transformSkipService(transform, op) ; if ( op2 != op ) return op2 ; return op ; } private static final boolean debug = false ; private static final boolean printNoAction = false; public static Op apply(String label, Transform transform, Op op) { Op op2 = Transformer.transformSkipService(transform, op) ; if ( debug ) { if ( printNoAction && label != null ) log.info("Transform: " + label) ; if ( op == op2 ) { if ( printNoAction ) log.info("No change (==)") ; return op2 ; } if ( op.equals(op2) ) { if ( printNoAction ) log.info("No change (equals)") ; return op2 ; } if ( ! printNoAction && label != null ); log.info("Transform: " + label) ; log.info("\n" + op.toString()) ; log.info("\n" + op2.toString()) ; } return op2 ; } }
12,902
0.656255
0.65424
311
40.485531
31.227806
119
false
false
0
0
0
0
0
0
0.504823
false
false
3
0e23f14fa7543bf709ee0b281019a70024832c2c
8,770,323,232,796
64562ce467e2999b25e2c103a6fa290a1cc3bf14
/SD_P1_T3_G1/src/serverside/Proxy.java
10736d5b52256d8571da971e7834cb25090f5017
[]
no_license
LucasLemos1/Distributed-Systems-Course
https://github.com/LucasLemos1/Distributed-Systems-Course
732ecb60123260ff7bb4f727f7a19791b491c6ba
838ab0c1944b482a1d354d72672d86ef26d0c867
refs/heads/master
2016-08-04T14:35:27.232000
2015-09-03T09:17:30
2015-09-03T09:17:30
41,850,348
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package serverside; import interfaces.Register; import interfaces.repository.VectorClock; import java.rmi.NotBoundException; import java.rmi.RemoteException; import java.util.TreeMap; import java.util.concurrent.locks.Condition; /** * Classe abstracta com método auxiliar para uso do Lock. * * @author Lucas Lemos * @version 1.0 */ public abstract class Proxy { /** * Referência para o registro de objetos remotos. */ protected Register register; /** * String a que está feito o bind no registro remoto. */ protected String bindName; protected TreeMap<String, ClientInfo> clientInfo; /** * Boolean indicando se o sistema deve ser stressado. */ private static boolean STRESS_MODE = false; protected Proxy() { clientInfo = new TreeMap<String, ClientInfo>(); } /** * Método auxiliar para fazer await() de uma determinada condição do lock. * * @param condition Condição a ser usada para esperar. */ protected void waitForCondition(Condition condition) { try { if (STRESS_MODE) condition.awaitNanos(1); else condition.await(); } catch (InterruptedException e) { e.printStackTrace(); } } /** * Set do boolean do modo stress. * * @param stressMode Boolean que indica se modo stress deve ou não estar ativo. */ public static void setStressMode(boolean stressMode) { STRESS_MODE = stressMode; } /** * Unbind do servidor no Register. */ public void unbind() { try { register.unbind(bindName); } catch (RemoteException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } MainServer.entityEnded(); } protected synchronized boolean checkRepeteadClientCall(VectorClock clientVectorClock, String clientID) { boolean repeatedCall = false; ClientInfo info; if ((info = clientInfo.get(clientID)) != null && info.getVectorClock().equals(clientVectorClock)) repeatedCall = true; else clientInfo.put(clientID, new ClientInfo(clientVectorClock)); return repeatedCall; } protected synchronized void saveClientCall(String clientID, Object returnValue) { ClientInfo info = clientInfo.get(clientID); info.setReturnValue(returnValue); clientInfo.put(clientID, info); } protected synchronized Object getPreviousReturnValue(String clientID) { return clientInfo.get(clientID).getReturnValue(); } protected class ClientInfo { private VectorClock vectorClock; private Object returnValue; public ClientInfo(VectorClock vectorClock) { this.vectorClock = vectorClock; } public VectorClock getVectorClock() { return vectorClock; } public void setVectorClock(VectorClock vectorClock) { this.vectorClock = vectorClock; } public Object getReturnValue() { return returnValue; } public void setReturnValue(Object returnValue) { this.returnValue = returnValue; } } }
UTF-8
Java
3,098
java
Proxy.java
Java
[ { "context": "método auxiliar para uso do Lock.\r\n * \r\n * @author Lucas Lemos\r\n * @version 1.0\r\n */\r\npublic abstract class Prox", "end": 333, "score": 0.9998183846473694, "start": 322, "tag": "NAME", "value": "Lucas Lemos" } ]
null
[]
package serverside; import interfaces.Register; import interfaces.repository.VectorClock; import java.rmi.NotBoundException; import java.rmi.RemoteException; import java.util.TreeMap; import java.util.concurrent.locks.Condition; /** * Classe abstracta com método auxiliar para uso do Lock. * * @author <NAME> * @version 1.0 */ public abstract class Proxy { /** * Referência para o registro de objetos remotos. */ protected Register register; /** * String a que está feito o bind no registro remoto. */ protected String bindName; protected TreeMap<String, ClientInfo> clientInfo; /** * Boolean indicando se o sistema deve ser stressado. */ private static boolean STRESS_MODE = false; protected Proxy() { clientInfo = new TreeMap<String, ClientInfo>(); } /** * Método auxiliar para fazer await() de uma determinada condição do lock. * * @param condition Condição a ser usada para esperar. */ protected void waitForCondition(Condition condition) { try { if (STRESS_MODE) condition.awaitNanos(1); else condition.await(); } catch (InterruptedException e) { e.printStackTrace(); } } /** * Set do boolean do modo stress. * * @param stressMode Boolean que indica se modo stress deve ou não estar ativo. */ public static void setStressMode(boolean stressMode) { STRESS_MODE = stressMode; } /** * Unbind do servidor no Register. */ public void unbind() { try { register.unbind(bindName); } catch (RemoteException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } MainServer.entityEnded(); } protected synchronized boolean checkRepeteadClientCall(VectorClock clientVectorClock, String clientID) { boolean repeatedCall = false; ClientInfo info; if ((info = clientInfo.get(clientID)) != null && info.getVectorClock().equals(clientVectorClock)) repeatedCall = true; else clientInfo.put(clientID, new ClientInfo(clientVectorClock)); return repeatedCall; } protected synchronized void saveClientCall(String clientID, Object returnValue) { ClientInfo info = clientInfo.get(clientID); info.setReturnValue(returnValue); clientInfo.put(clientID, info); } protected synchronized Object getPreviousReturnValue(String clientID) { return clientInfo.get(clientID).getReturnValue(); } protected class ClientInfo { private VectorClock vectorClock; private Object returnValue; public ClientInfo(VectorClock vectorClock) { this.vectorClock = vectorClock; } public VectorClock getVectorClock() { return vectorClock; } public void setVectorClock(VectorClock vectorClock) { this.vectorClock = vectorClock; } public Object getReturnValue() { return returnValue; } public void setReturnValue(Object returnValue) { this.returnValue = returnValue; } } }
3,093
0.669796
0.668825
123
23.113821
23.37993
108
false
false
0
0
0
0
0
0
0.731707
false
false
3
ad6e01192e4db47126a4a85ba00d7569dcb94829
523,986,032,272
a6af8814d46baca2d4d539b3c55a76a04e4c02e0
/src/main/java/controller/DoctorController.java
0e7ce392dec36323808967d070f232daaf22df1f
[]
no_license
kdelgado1998/clinicaIdonto
https://github.com/kdelgado1998/clinicaIdonto
4469f2ce34f7d7ab45dce1606173d1cd2b7647e5
007bd1cc83cf53d0fc76af15d9609a144183534c
refs/heads/main
2023-07-16T00:21:28.255000
2021-08-28T05:43:39
2021-08-28T05:43:39
393,692,243
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import gestion.DoctorGestion; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import java.io.Serializable; import java.util.List; import model.Doctor; @Named(value = "doctorController") @SessionScoped public class DoctorController implements Serializable { public DoctorController() { } public List<Doctor> getDoctor(){ return DoctorGestion.getDoctor(); } }
UTF-8
Java
437
java
DoctorController.java
Java
[]
null
[]
package controller; import gestion.DoctorGestion; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import java.io.Serializable; import java.util.List; import model.Doctor; @Named(value = "doctorController") @SessionScoped public class DoctorController implements Serializable { public DoctorController() { } public List<Doctor> getDoctor(){ return DoctorGestion.getDoctor(); } }
437
0.750572
0.750572
20
20.799999
16.418282
55
false
false
0
0
0
0
0
0
0.4
false
false
3
f91a44ef9db2e85c07ad19c8d1e8fe88e39dfc51
18,966,575,598,048
b1ce7cc58ae3cb475afd4d10952cc6745c6b0449
/aa/Book.java
6248071dbaaca81e86524584dafac50ea23ca47e
[]
no_license
MSPets/Misc-College-Work
https://github.com/MSPets/Misc-College-Work
3577858acc07ac07e0dfeea8e44b5e41bc8ad1ea
d320f3cb72f3378f362f9b31db57c5d7a9f8a42f
refs/heads/main
2023-08-21T13:20:48.295000
2021-10-12T15:52:46
2021-10-12T15:52:46
416,400,294
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * A class that maintains information on a book. * This might form part of a larger application such * as a library system, for instance. * * @author (Insert your name here.) * @version (Insert today's date here.) */ class Book { // The fields. private String author; private String title; private int pages; /** * Set the author and title fields when this object * is constructed. */ public Book(String bookAuthor, String bookTitle, int amountOfPages) { author = bookAuthor; title = bookTitle; pages = amountOfPages; } public void printAuthor() { System.out.println("The author is: " + author); } public void printTitle() { System.out.println("The title is: " + title); } public void getPages() { System.out.println("It consists of " + pages + " pages"); } public void printDetails() { System.out.println("Title: " + title + " Author : " + author + " Pages: " + pages); } }
UTF-8
Java
1,042
java
Book.java
Java
[]
null
[]
/** * A class that maintains information on a book. * This might form part of a larger application such * as a library system, for instance. * * @author (Insert your name here.) * @version (Insert today's date here.) */ class Book { // The fields. private String author; private String title; private int pages; /** * Set the author and title fields when this object * is constructed. */ public Book(String bookAuthor, String bookTitle, int amountOfPages) { author = bookAuthor; title = bookTitle; pages = amountOfPages; } public void printAuthor() { System.out.println("The author is: " + author); } public void printTitle() { System.out.println("The title is: " + title); } public void getPages() { System.out.println("It consists of " + pages + " pages"); } public void printDetails() { System.out.println("Title: " + title + " Author : " + author + " Pages: " + pages); } }
1,042
0.590211
0.590211
43
23.232557
22.078968
91
false
false
0
0
0
0
0
0
0.302326
false
false
3
0ef34864a4572fb4e2da2d132b809a26f0ef2d55
31,799,937,874,189
d19ff84a59bd5906ddd4d36205046a6c49a3a6af
/server/cig-rs-backend/src/main/java/cn/com/cig/cigrsbackend/model/dobj/DownloadDO.java
ef8dd1e2c58a40e2f5377826d664826c41ff923b
[]
no_license
s-wukong/yxs
https://github.com/s-wukong/yxs
ceee428d854526d65c3e7c4dc11c5f40bfdded82
6f5664272245e900c0b00de19f2d0b02fad49eec
refs/heads/main
2023-02-05T17:31:12.883000
2020-12-21T08:08:06
2020-12-21T08:08:06
323,264,518
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.cig.cigrsbackend.model.dobj; import lombok.Data; import java.util.Objects; /** * @Description: app_report_download对应的实体类 * @Author: liushilei * @Version: 1.0 * @Date: 2020/10/12 */ @Data public class DownloadDO { private Long id; private Long userId; private Long reportId; private Long downloadTime; private String downloadUrl; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DownloadDO that = (DownloadDO) o; return Objects.equals(userId, that.userId) && Objects.equals(reportId, that.reportId); } @Override public int hashCode() { return Objects.hash(userId, reportId); } }
UTF-8
Java
791
java
DownloadDO.java
Java
[ { "context": "@Description: app_report_download对应的实体类\n* @Author: liushilei\n* @Version: 1.0\n* @Date: 2020/10/12\n*/\n@Data\npubl", "end": 159, "score": 0.9995169043540955, "start": 150, "tag": "USERNAME", "value": "liushilei" } ]
null
[]
package cn.com.cig.cigrsbackend.model.dobj; import lombok.Data; import java.util.Objects; /** * @Description: app_report_download对应的实体类 * @Author: liushilei * @Version: 1.0 * @Date: 2020/10/12 */ @Data public class DownloadDO { private Long id; private Long userId; private Long reportId; private Long downloadTime; private String downloadUrl; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DownloadDO that = (DownloadDO) o; return Objects.equals(userId, that.userId) && Objects.equals(reportId, that.reportId); } @Override public int hashCode() { return Objects.hash(userId, reportId); } }
791
0.640565
0.627728
34
21.941177
18.084673
66
false
false
0
0
0
0
0
0
0.529412
false
false
3
c1df1e0e4966b7f617c5ddd6ee4784259df58969
19,902,878,467,208
da25f5b79e9bf4785cf06d6ba56d838d347e8b0b
/src/main/java/mytown/api/events/BlockEvent.java
bcac10e594ea780e2db7d3a1a73634f6f8b11f61
[ "Unlicense" ]
permissive
James137137/MyTown2
https://github.com/James137137/MyTown2
2e6ee39a5d612a5d1b12b68f1a99d24adfbe300d
a3f6935fe26b22be9d0a2be8bcdb346d997b5868
refs/heads/master
2020-04-12T11:36:55.944000
2014-11-06T04:56:49
2014-11-06T04:56:49
26,253,896
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mytown.api.events; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; import mytown.entities.TownBlock; import net.minecraftforge.common.MinecraftForge; /** * @author Joe Goett */ public class BlockEvent extends Event { public TownBlock block = null; public BlockEvent(TownBlock block) { this.block = block; } @Cancelable public static class BlockCreateEvent extends BlockEvent { public BlockCreateEvent(TownBlock block) { super(block); } } @Cancelable public static class BlockDeleteEvent extends BlockEvent { public BlockDeleteEvent(TownBlock block) { super(block); } } public static boolean fire(BlockEvent ev) { return MinecraftForge.EVENT_BUS.post(ev); } }
UTF-8
Java
842
java
BlockEvent.java
Java
[ { "context": "ecraftforge.common.MinecraftForge;\n\n/**\n * @author Joe Goett\n */\npublic class BlockEvent extends Event {\n p", "end": 235, "score": 0.9998733997344971, "start": 226, "tag": "NAME", "value": "Joe Goett" } ]
null
[]
package mytown.api.events; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; import mytown.entities.TownBlock; import net.minecraftforge.common.MinecraftForge; /** * @author <NAME> */ public class BlockEvent extends Event { public TownBlock block = null; public BlockEvent(TownBlock block) { this.block = block; } @Cancelable public static class BlockCreateEvent extends BlockEvent { public BlockCreateEvent(TownBlock block) { super(block); } } @Cancelable public static class BlockDeleteEvent extends BlockEvent { public BlockDeleteEvent(TownBlock block) { super(block); } } public static boolean fire(BlockEvent ev) { return MinecraftForge.EVENT_BUS.post(ev); } }
839
0.680523
0.680523
35
23.057142
20.436583
61
false
false
0
0
0
0
0
0
0.285714
false
false
3
4dcd92dc2c2b1e0129f3ffb97cd0c1d5d13376a0
16,750,372,470,065
7542a7244644fb557cd5d133c4d31d99d02e8b98
/rest-service-basic/src/main/java/com/sudipcold/microservices/restservicebasic/service/UserService.java
dbd7d0eb008e4aad51ae0080884b0a590159d728
[]
no_license
sudipcold2/SpringMS-Cloud-learn
https://github.com/sudipcold2/SpringMS-Cloud-learn
ace4ae5f15b8c676909290b91fe2a87f07954e35
6725684b332371fc938a7d810dcbd4b0acddf78f
refs/heads/master
2023-04-23T22:16:07.827000
2021-05-06T06:13:02
2021-05-06T06:13:02
364,804,046
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sudipcold.microservices.restservicebasic.service; import com.sudipcold.microservices.restservicebasic.model.User; import java.util.List; public interface UserService { List<User> getAllUsers(); User getUserByID(int id); User saveUser(User user); User removeUser(int id); }
UTF-8
Java
309
java
UserService.java
Java
[]
null
[]
package com.sudipcold.microservices.restservicebasic.service; import com.sudipcold.microservices.restservicebasic.model.User; import java.util.List; public interface UserService { List<User> getAllUsers(); User getUserByID(int id); User saveUser(User user); User removeUser(int id); }
309
0.754045
0.754045
17
17.17647
20.816383
63
false
false
0
0
0
0
0
0
0.411765
false
false
3
60186a91fd6966a6f27e83eaac0adf6a970b4a5f
1,606,317,789,206
08e57533e9aaf30b00512530187993716cb75192
/src/main/java/CwiczenieWatki/Pierwsze/CurrentThreadDemo.java
2a7a72e25b9f3bad6536876c92414f85253279a4
[]
no_license
KamilOch/podstawy
https://github.com/KamilOch/podstawy
9f461b650d3a4a553a96d2eca57b3e8967239274
66ac44bfbe1f5e32c39f81d321855ff7e76beb31
refs/heads/master
2020-04-08T19:59:59.100000
2019-02-27T14:51:43
2019-02-27T14:51:43
159,679,769
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package CwiczenieWatki.Pierwsze; public class CurrentThreadDemo { public static void main(String[] args) { Thread t = Thread.currentThread(); System.out.println("Aktualny wątek: "+t); t.setName("Mój wątek"); System.out.println("Po zmianie nazwy: "+t); try{ for(int n = 5; n>0; n-- ){ System.out.println(n); Thread.sleep(1000); } } catch (InterruptedException e){ System.out.println("Przerwanie wątku"); } } }
UTF-8
Java
550
java
CurrentThreadDemo.java
Java
[ { "context": "intln(\"Aktualny wątek: \"+t);\n\n\n t.setName(\"Mój wątek\");\n System.out.println(\"Po zmianie nazwy: ", "end": 236, "score": 0.9998385906219482, "start": 227, "tag": "NAME", "value": "Mój wątek" } ]
null
[]
package CwiczenieWatki.Pierwsze; public class CurrentThreadDemo { public static void main(String[] args) { Thread t = Thread.currentThread(); System.out.println("Aktualny wątek: "+t); t.setName("<NAME>"); System.out.println("Po zmianie nazwy: "+t); try{ for(int n = 5; n>0; n-- ){ System.out.println(n); Thread.sleep(1000); } } catch (InterruptedException e){ System.out.println("Przerwanie wątku"); } } }
545
0.53663
0.525641
22
23.818182
19.123133
51
false
false
0
0
0
0
0
0
0.454545
false
false
3
5e6c429f8201d3f35d4a40c82dea753541ac6ee2
14,920,716,407,178
a9b7e3acc0a36ca9a5f1d5dd1798b61e4101312e
/BattleShip/src/ConstantData.java
aa3b39fc36d3beffd9dda815cc9deaa839ea44aa
[]
no_license
rob0229/Battleship
https://github.com/rob0229/Battleship
a442464faca229cc3573ddf1bb4f84f62cd64430
4200e79aa20c9b94250896f09efd3bbab48ee1c0
refs/heads/master
2021-01-22T23:26:43.006000
2014-12-29T14:25:33
2014-12-29T14:25:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** Battleship Copyright: Rob Close and Charlie Sun Created on: 03/01/2014 */ public class ConstantData { public static String BATTLESHIP = "img/Battleship.png"; public static String CARRIER = "img/Carrier.png"; public static String CRUISER = "img/Cruiser.png"; public static String DESTROYER = "img/Destroyer.png"; public static String SUBMARINE = "img/Submarine.png"; public static String BATTLESHIPVERT = "img/Battleship_r.png"; public static String CARRIERVERT = "img/Carrier_r.png"; public static String CRUISERVERT = "img/Cruiser_r.png"; public static String DESTROYERVERT = "img/Destroyer_r.png"; public static String SUBMARINEVERT = "img/Submarine_r.png"; public static String HITLABEL = "img/hitLabel.gif"; public static String MISSLABEL = "img/missLabel.jpg"; public static String INSTRUCTIONS = "Place your ships and then press the ready \nbutton. You must sink all the enemy \nships before they sink yours."; }
UTF-8
Java
971
java
ConstantData.java
Java
[ { "context": "/**\r\n Battleship\r\n Copyright: Rob Close and Charlie Sun\r\n Created on: 03/01/2014\r\n */\r\n\r\n", "end": 39, "score": 0.9998403787612915, "start": 30, "tag": "NAME", "value": "Rob Close" }, { "context": "/**\r\n Battleship\r\n Copyright: Rob Close and Charlie Sun\r\n Created on: 03/01/2014\r\n */\r\n\r\npublic class Con", "end": 55, "score": 0.9998395442962646, "start": 44, "tag": "NAME", "value": "Charlie Sun" } ]
null
[]
/** Battleship Copyright: <NAME> and <NAME> Created on: 03/01/2014 */ public class ConstantData { public static String BATTLESHIP = "img/Battleship.png"; public static String CARRIER = "img/Carrier.png"; public static String CRUISER = "img/Cruiser.png"; public static String DESTROYER = "img/Destroyer.png"; public static String SUBMARINE = "img/Submarine.png"; public static String BATTLESHIPVERT = "img/Battleship_r.png"; public static String CARRIERVERT = "img/Carrier_r.png"; public static String CRUISERVERT = "img/Cruiser_r.png"; public static String DESTROYERVERT = "img/Destroyer_r.png"; public static String SUBMARINEVERT = "img/Submarine_r.png"; public static String HITLABEL = "img/hitLabel.gif"; public static String MISSLABEL = "img/missLabel.jpg"; public static String INSTRUCTIONS = "Place your ships and then press the ready \nbutton. You must sink all the enemy \nships before they sink yours."; }
963
0.734295
0.726056
24
38.458332
33.527325
151
false
false
0
0
0
0
0
0
1.208333
false
false
3
5aaa407894e878fb5c488608ac5aa621ce0f0bd0
12,790,412,628,038
14c3e1c5d2c781d825c4a1fdb0296c8d7775add9
/coreprog/overriding/ChildClass.java
226e23db65855f175b1a2deeb01a2f05a22c471b
[]
no_license
mnarendra333/batch22
https://github.com/mnarendra333/batch22
a36038f20d455d022f266a7caf77122447c83cc0
cf5f3c58c1c57bb74637525f605bffbd9709e37b
refs/heads/master
2022-12-21T14:51:11.612000
2019-09-09T03:25:23
2019-09-09T03:25:23
169,957,756
3
1
null
false
2022-12-15T23:28:34
2019-02-10T08:30:54
2020-08-30T10:57:40
2022-12-15T23:28:33
5,578
1
1
28
Java
false
false
class ParentClass { int x = 10; int y = 20; public ParentClass() { System.out.println("i am from ParentClass=>DC"); } public void method1() { System.out.println(this.x+" "+this.y); } } class ChildClass { int x = 40; int y=60; public ChildClass() { super(); System.out.println("i am from ChildClass=>DC"); } public void method2() { super.method1(); int x = 110; int y=120; System.out.println(x+" "+y+" "+this.x+" "+this.y+" "+super.x+" "+super.y); } public static void main(String args[]) { ChildClass obj = new ChildClass(); obj.method2(); } }
UTF-8
Java
619
java
ChildClass.java
Java
[]
null
[]
class ParentClass { int x = 10; int y = 20; public ParentClass() { System.out.println("i am from ParentClass=>DC"); } public void method1() { System.out.println(this.x+" "+this.y); } } class ChildClass { int x = 40; int y=60; public ChildClass() { super(); System.out.println("i am from ChildClass=>DC"); } public void method2() { super.method1(); int x = 110; int y=120; System.out.println(x+" "+y+" "+this.x+" "+this.y+" "+super.x+" "+super.y); } public static void main(String args[]) { ChildClass obj = new ChildClass(); obj.method2(); } }
619
0.575121
0.546042
49
11.653061
16.149242
77
false
false
0
0
0
0
0
0
1.530612
false
false
3
a8ffd50b323d4232e991c1fd2b13fa73904aa352
26,749,056,341,535
13a8e4d30764197338ca9e2fb00f922ecdcdd4ce
/stock-core/src/main/java/cn/sisyphe/coffee/stock/domain/storage/StorageServiceImpl.java
88a494aa927f291b5ac1f20945ff51eaed287f15
[]
no_license
xieweig/loader
https://github.com/xieweig/loader
133fe735ae14e409277c6a39a9d76a8896f68d77
f88625377f57a98d6be40569f1c377b5cc7cb445
refs/heads/master
2021-01-25T13:06:24.515000
2018-03-02T03:16:30
2018-03-02T03:16:30
123,529,337
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.sisyphe.coffee.stock.domain.storage; import cn.sisyphe.coffee.stock.domain.shared.goods.cargo.Cargo; import cn.sisyphe.coffee.stock.domain.shared.goods.rawmaterial.RawMaterial; import cn.sisyphe.coffee.stock.domain.shared.station.Station; import cn.sisyphe.coffee.stock.domain.storage.model.StorageInventory; import cn.sisyphe.coffee.stock.infrastructure.storage.StorageInventoryRepository; import cn.sisyphe.coffee.stock.viewmodel.ConditionQueryStorage; import cn.sisyphe.framework.common.utils.StringUtil; import cn.sisyphe.framework.web.exception.DataException; import org.hibernate.SQLQuery; import org.hibernate.transform.Transformers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import javax.persistence.EntityManager; import javax.persistence.Query; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; /** * Created by heyong on 2018/1/30 11:07 * Description: * * @author heyong */ @Service public class StorageServiceImpl implements StorageService { @Autowired private StorageInventoryRepository storageInventoryRepository; @Autowired private EntityManager entityManager; /** * 更新库存 * * @param station * @param cargo * @param rawMaterial * @param amount */ @Override public void updateInventory(Station station, Cargo cargo, RawMaterial rawMaterial, int amount) { if (station == null || StringUtils.isEmpty(station.getStationCode()) || StringUtils.isEmpty(station.getStorageCode()) || cargo == null || StringUtils.isEmpty(cargo.getCargoCode())) { throw new DataException("200016", "库存更新失败"); } StorageInventory storageInventory = storageInventoryRepository.findByStationAndCargo(station, cargo); if (storageInventory != null) { storageInventory.setTotalAmount(amount); } else { storageInventory = new StorageInventory(); storageInventory.setStation(station); storageInventory.setCargo(cargo); storageInventory.setRawMaterial(rawMaterial); storageInventory.setTotalAmount(amount); } storageInventoryRepository.save(storageInventory); } /** * 多条件查询 * * @param conditionQuery * @return */ @Override public List<StorageInventory> findPageByCondition(ConditionQueryStorage conditionQuery) { StringBuffer stringBuffer = addParameters(conditionQuery); // 加上分页 String pageSql = withPage(stringBuffer, conditionQuery); System.err.println("拼接后的sql:" + pageSql); Query query = entityManager.createNativeQuery(pageSql); query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); List queryResultList = query.getResultList(); return inventoryMapper(queryResultList); } /** * 查询总数 * * @param conditionQuery * @return */ @Override public Long findTotalByCondition(ConditionQueryStorage conditionQuery) { StringBuffer stringBuffer = addParameters(conditionQuery); Query query = entityManager.createNativeQuery(stringBuffer.toString()); query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); List queryResultList = query.getResultList(); return new Long(inventoryMapper(queryResultList).size()); } /** * 拼接参数 * * @param conditionQuery * @return */ private StringBuffer addParameters(ConditionQueryStorage conditionQuery) { StringBuffer sql = new StringBuffer("select inventory_id,create_time,update_time,raw_material_code,cargo_code," + "station_code,storage_code,SUM(total_amount) as total_number from storage_inventory where 1=1 "); // 拼接货物编码 if (!StringUtil.isEmpty(conditionQuery.getCargoCode())) { sql.append(" and cargo_code like '"); sql.append(conditionQuery.getCargoCode() + "'"); } // 拼接多个货物编码 if (conditionQuery.getCargoCodeArray() != null && conditionQuery.getCargoCodeArray().size() > 0) { sql.append(" and cargo_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getCargoCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接原料编码 if (!StringUtil.isEmpty(conditionQuery.getMaterialCode())) { sql.append(" and raw_material_code like '"); sql.append(conditionQuery.getMaterialCode() + "'"); } // 拼接多个原料名称 if (conditionQuery.getMaterialCodeArray() != null && conditionQuery.getMaterialCodeArray().size() > 0) { sql.append(" and raw_material_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getMaterialCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接多个原料分类 if (conditionQuery.getMaterialTypeArray() != null && conditionQuery.getMaterialTypeArray().size() > 0) { sql.append(" and raw_material_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getMaterialCodes()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接站点 if (conditionQuery.getStationCodeArray() != null && conditionQuery.getStationCodeArray().size() > 0) { sql.append(" and station_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getStationCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接库位 if (conditionQuery.getStorageCodeArray() != null && conditionQuery.getStorageCodeArray().size() > 0) { sql.append(" and storage_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getStorageCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } String cargoOrMaterial = conditionQuery.getCargoOrMaterial(); if (cargoOrMaterial != null && conditionQuery.getStorageCodeArray() != null && conditionQuery.getStorageCodeArray().size() > 0) { sql.append(" GROUP BY station_code,storage_code,"); } else { sql.append(" GROUP BY station_code,"); } if ("cargo".equals(cargoOrMaterial)) { sql.append(" cargo_code"); } else { sql.append(" raw_material_code"); } return sql; } /** * 拼接分页信息 * * @param sql * @param conditionQuery * @return */ private String withPage(StringBuffer sql, ConditionQueryStorage conditionQuery) { sql.append(" limit "); sql.append(conditionQuery.getPage() * conditionQuery.getPageSize() - conditionQuery.getPageSize()); sql.append(","); sql.append(conditionQuery.getPageSize()); return sql.toString(); } /** * 映射对象属性 * * @param resultList * @return */ private List<StorageInventory> inventoryMapper(List resultList) { List<StorageInventory> inventoryArrayList = new ArrayList<>(); for (Object object : resultList) { Map map = (Map) object; StorageInventory inventory = new StorageInventory(); // ID inventory.setInventoryId(Long.valueOf(map.get("inventory_id").toString())); // 创建时间 inventory.setCreateTime((java.util.Date) map.get("create_time")); // 修改时间 inventory.setUpdateTime((Date) map.get("update_time")); // 原料编码 inventory.setRawMaterial(new RawMaterial(map.get("raw_material_code").toString())); // 货物编码 inventory.setCargo(new Cargo(map.get("cargo_code").toString())); // 站点编码和库位编码 inventory.setStation(new Station(map.get("station_code").toString(), map.get("storage_code").toString())); // 总数量 inventory.setTotalAmount(Integer.valueOf(map.get("total_number").toString())); inventoryArrayList.add(inventory); } return inventoryArrayList; } }
UTF-8
Java
9,578
java
StorageServiceImpl.java
Java
[ { "context": ".List;\nimport java.util.Map;\n\n/**\n * Created by heyong on 2018/1/30 11:07\n * Description:\n *\n * @auth", "end": 999, "score": 0.4732368588447571, "start": 998, "tag": "USERNAME", "value": "y" }, { "context": "g on 2018/1/30 11:07\n * Description:\n *\n * @author heyong\n */\n@Service\npublic class StorageServiceImpl impl", "end": 1058, "score": 0.9452775120735168, "start": 1052, "tag": "USERNAME", "value": "heyong" } ]
null
[]
package cn.sisyphe.coffee.stock.domain.storage; import cn.sisyphe.coffee.stock.domain.shared.goods.cargo.Cargo; import cn.sisyphe.coffee.stock.domain.shared.goods.rawmaterial.RawMaterial; import cn.sisyphe.coffee.stock.domain.shared.station.Station; import cn.sisyphe.coffee.stock.domain.storage.model.StorageInventory; import cn.sisyphe.coffee.stock.infrastructure.storage.StorageInventoryRepository; import cn.sisyphe.coffee.stock.viewmodel.ConditionQueryStorage; import cn.sisyphe.framework.common.utils.StringUtil; import cn.sisyphe.framework.web.exception.DataException; import org.hibernate.SQLQuery; import org.hibernate.transform.Transformers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import javax.persistence.EntityManager; import javax.persistence.Query; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; /** * Created by heyong on 2018/1/30 11:07 * Description: * * @author heyong */ @Service public class StorageServiceImpl implements StorageService { @Autowired private StorageInventoryRepository storageInventoryRepository; @Autowired private EntityManager entityManager; /** * 更新库存 * * @param station * @param cargo * @param rawMaterial * @param amount */ @Override public void updateInventory(Station station, Cargo cargo, RawMaterial rawMaterial, int amount) { if (station == null || StringUtils.isEmpty(station.getStationCode()) || StringUtils.isEmpty(station.getStorageCode()) || cargo == null || StringUtils.isEmpty(cargo.getCargoCode())) { throw new DataException("200016", "库存更新失败"); } StorageInventory storageInventory = storageInventoryRepository.findByStationAndCargo(station, cargo); if (storageInventory != null) { storageInventory.setTotalAmount(amount); } else { storageInventory = new StorageInventory(); storageInventory.setStation(station); storageInventory.setCargo(cargo); storageInventory.setRawMaterial(rawMaterial); storageInventory.setTotalAmount(amount); } storageInventoryRepository.save(storageInventory); } /** * 多条件查询 * * @param conditionQuery * @return */ @Override public List<StorageInventory> findPageByCondition(ConditionQueryStorage conditionQuery) { StringBuffer stringBuffer = addParameters(conditionQuery); // 加上分页 String pageSql = withPage(stringBuffer, conditionQuery); System.err.println("拼接后的sql:" + pageSql); Query query = entityManager.createNativeQuery(pageSql); query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); List queryResultList = query.getResultList(); return inventoryMapper(queryResultList); } /** * 查询总数 * * @param conditionQuery * @return */ @Override public Long findTotalByCondition(ConditionQueryStorage conditionQuery) { StringBuffer stringBuffer = addParameters(conditionQuery); Query query = entityManager.createNativeQuery(stringBuffer.toString()); query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); List queryResultList = query.getResultList(); return new Long(inventoryMapper(queryResultList).size()); } /** * 拼接参数 * * @param conditionQuery * @return */ private StringBuffer addParameters(ConditionQueryStorage conditionQuery) { StringBuffer sql = new StringBuffer("select inventory_id,create_time,update_time,raw_material_code,cargo_code," + "station_code,storage_code,SUM(total_amount) as total_number from storage_inventory where 1=1 "); // 拼接货物编码 if (!StringUtil.isEmpty(conditionQuery.getCargoCode())) { sql.append(" and cargo_code like '"); sql.append(conditionQuery.getCargoCode() + "'"); } // 拼接多个货物编码 if (conditionQuery.getCargoCodeArray() != null && conditionQuery.getCargoCodeArray().size() > 0) { sql.append(" and cargo_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getCargoCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接原料编码 if (!StringUtil.isEmpty(conditionQuery.getMaterialCode())) { sql.append(" and raw_material_code like '"); sql.append(conditionQuery.getMaterialCode() + "'"); } // 拼接多个原料名称 if (conditionQuery.getMaterialCodeArray() != null && conditionQuery.getMaterialCodeArray().size() > 0) { sql.append(" and raw_material_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getMaterialCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接多个原料分类 if (conditionQuery.getMaterialTypeArray() != null && conditionQuery.getMaterialTypeArray().size() > 0) { sql.append(" and raw_material_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getMaterialCodes()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接站点 if (conditionQuery.getStationCodeArray() != null && conditionQuery.getStationCodeArray().size() > 0) { sql.append(" and station_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getStationCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } // 拼接库位 if (conditionQuery.getStorageCodeArray() != null && conditionQuery.getStorageCodeArray().size() > 0) { sql.append(" and storage_code in ( "); StringBuffer sb = new StringBuffer(); for (String code : conditionQuery.getStorageCodeArray()) { sb.append("'"); sb.append(code); sb.append("',"); } String substring = sb.substring(0, sb.length() - 1); sql.append(substring); sql.append(" ) "); } String cargoOrMaterial = conditionQuery.getCargoOrMaterial(); if (cargoOrMaterial != null && conditionQuery.getStorageCodeArray() != null && conditionQuery.getStorageCodeArray().size() > 0) { sql.append(" GROUP BY station_code,storage_code,"); } else { sql.append(" GROUP BY station_code,"); } if ("cargo".equals(cargoOrMaterial)) { sql.append(" cargo_code"); } else { sql.append(" raw_material_code"); } return sql; } /** * 拼接分页信息 * * @param sql * @param conditionQuery * @return */ private String withPage(StringBuffer sql, ConditionQueryStorage conditionQuery) { sql.append(" limit "); sql.append(conditionQuery.getPage() * conditionQuery.getPageSize() - conditionQuery.getPageSize()); sql.append(","); sql.append(conditionQuery.getPageSize()); return sql.toString(); } /** * 映射对象属性 * * @param resultList * @return */ private List<StorageInventory> inventoryMapper(List resultList) { List<StorageInventory> inventoryArrayList = new ArrayList<>(); for (Object object : resultList) { Map map = (Map) object; StorageInventory inventory = new StorageInventory(); // ID inventory.setInventoryId(Long.valueOf(map.get("inventory_id").toString())); // 创建时间 inventory.setCreateTime((java.util.Date) map.get("create_time")); // 修改时间 inventory.setUpdateTime((Date) map.get("update_time")); // 原料编码 inventory.setRawMaterial(new RawMaterial(map.get("raw_material_code").toString())); // 货物编码 inventory.setCargo(new Cargo(map.get("cargo_code").toString())); // 站点编码和库位编码 inventory.setStation(new Station(map.get("station_code").toString(), map.get("storage_code").toString())); // 总数量 inventory.setTotalAmount(Integer.valueOf(map.get("total_number").toString())); inventoryArrayList.add(inventory); } return inventoryArrayList; } }
9,578
0.608472
0.604728
253
35.948616
30.15653
137
false
false
0
0
0
0
0
0
0.58498
false
false
3
504dc42636567f3a286a7aab41bc32cdd928da9c
31,542,239,874,250
ad45fdf4b06c4f8eaa29ca3244e7b2d571a4ed6c
/exam2/src/com/bitcamp/day7/Ex09_Oracle_CallableStatement.java
a949a8baf4109593c5dc60d7a7bee5e6d78edd0e
[]
no_license
esongi/practice-git
https://github.com/esongi/practice-git
4942795d48d9bc43cb3d1eb6d8fd06b6ec9bfbe3
6fd94b2a5bed63300e1dee7765d39ca290bb1aeb
refs/heads/master
2020-04-08T12:39:19.100000
2019-02-28T08:27:46
2019-02-28T08:27:46
159,356,129
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bitcamp.day7; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; public class Ex09_Oracle_CallableStatement { public static void main(String[] args) { Connection conn = null; ResultSet rs = null; CallableStatement cstmt = null; // oracle procedure 사용시 try { Class.forName("oracle.jdbc.OracleDriver"); // db 연결 conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "park", "1004"); // input, output 파라미터 2개 // usp_emplist(?,?) : 프로시저에 따라 이 구문만 바뀌면 됨 // 셀렉트한 메모리 주소값(아웃풋) String sql = "{call usp_emplist(?,?)}"; cstmt = conn.prepareCall(sql); // 커서라는 타입?? // 두번째 파라미터(메모리 주소값) // 물음표의 위치값, 타입 cstmt.setInt(1, 1000); //cstmt.registerOutParameter(2, OracleTypes.CURSOR); boolean result = cstmt.execute(); // 주소정보 얻어오기 rs = (ResultSet) cstmt.getObject(2); while (rs.next()) { System.out.println(rs.getInt(1) + "/" + rs.getString(2) + "/" + rs.getInt(3)); } } catch (Exception e) { System.out.println(e.getMessage()); } finally { if (rs != null) try { rs.close(); } catch (Exception e) { } if (cstmt != null) try { cstmt.close(); } catch (Exception e) { } if (conn != null) try { conn.close(); } catch (Exception e) { } } } }
UTF-8
Java
1,657
java
Ex09_Oracle_CallableStatement.java
Java
[]
null
[]
package com.bitcamp.day7; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; public class Ex09_Oracle_CallableStatement { public static void main(String[] args) { Connection conn = null; ResultSet rs = null; CallableStatement cstmt = null; // oracle procedure 사용시 try { Class.forName("oracle.jdbc.OracleDriver"); // db 연결 conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "park", "1004"); // input, output 파라미터 2개 // usp_emplist(?,?) : 프로시저에 따라 이 구문만 바뀌면 됨 // 셀렉트한 메모리 주소값(아웃풋) String sql = "{call usp_emplist(?,?)}"; cstmt = conn.prepareCall(sql); // 커서라는 타입?? // 두번째 파라미터(메모리 주소값) // 물음표의 위치값, 타입 cstmt.setInt(1, 1000); //cstmt.registerOutParameter(2, OracleTypes.CURSOR); boolean result = cstmt.execute(); // 주소정보 얻어오기 rs = (ResultSet) cstmt.getObject(2); while (rs.next()) { System.out.println(rs.getInt(1) + "/" + rs.getString(2) + "/" + rs.getInt(3)); } } catch (Exception e) { System.out.println(e.getMessage()); } finally { if (rs != null) try { rs.close(); } catch (Exception e) { } if (cstmt != null) try { cstmt.close(); } catch (Exception e) { } if (conn != null) try { conn.close(); } catch (Exception e) { } } } }
1,657
0.554672
0.540093
62
23.306452
19.901037
96
false
false
0
0
0
0
0
0
0.467742
false
false
3
53e2b5aa45fdf0995f19f5bc71a75b6c3581646a
8,589,934,636,899
3bacff32ad452b30e13083eb1ab7b757861d100f
/app/src/main/java/com/example/duynguyen/bakingapp_dtn9797/widgets/BakingAppWidget.java
f3dd1f19840e8bd143cbe143de4a55edb96f0cb2
[]
no_license
dtn9797/BakingApp-dtn9797
https://github.com/dtn9797/BakingApp-dtn9797
2d79bd0f0d7cd7f777ba2e90f7ee4d1986664346
93f70293c68b3ccdcebaa46e9d12e0abd0a82560
refs/heads/master
2020-03-21T21:14:07.884000
2018-07-22T01:29:24
2018-07-22T01:29:24
139,053,693
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.duynguyen.bakingapp_dtn9797.widgets; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.widget.RemoteViews; import com.example.duynguyen.bakingapp_dtn9797.DetailActivity; import com.example.duynguyen.bakingapp_dtn9797.R; import com.example.duynguyen.bakingapp_dtn9797.model.Recipe; /** * Implementation of App Widget functionality. */ public class BakingAppWidget extends AppWidgetProvider { static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { CharSequence widgetText = "Recipe Name"; Recipe recipe = WidgetDataModel.getRecipe(context); if (recipe !=null) { widgetText = recipe.getName(); } // Construct the RemoteViews object RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.baking_app_widget); views.setTextViewText(R.id.recipe_list_name, widgetText); Intent intentService = new Intent(context, ListViewWigetService.class); views.setRemoteAdapter(R.id.ingredients_list,intentService); Intent intent = new Intent(context, DetailActivity.class); intent.putExtra(DetailActivity.RECIPE_EXTRA,recipe); PendingIntent pendingIntent = PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT); if (!widgetText.equals("Recipe Name")) { views.setOnClickPendingIntent(R.id.recipe_list_name, pendingIntent); } Intent appIntent = new Intent(context, DetailActivity.class); PendingIntent appPendingIntent = PendingIntent.getActivity(context, 0, appIntent, PendingIntent.FLAG_UPDATE_CURRENT); views.setPendingIntentTemplate(R.id.ingredients_list, appPendingIntent); views.setEmptyView(R.id.ingredients_list,R.id.empty_view); // Instruct the widget manager to update the widget appWidgetManager.updateAppWidget(appWidgetId, views); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // There may be multiple widgets active, so update all of them WidgetUpdateService.startActionUpdateListView(context,null); } public static void updateAppWidgets (Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int appWidgetId : appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId); } } @Override public void onEnabled(Context context) { // Enter relevant functionality for when the first widget is created } @Override public void onDisabled(Context context) { // Enter relevant functionality for when the last widget is disabled } }
UTF-8
Java
2,911
java
BakingAppWidget.java
Java
[ { "context": "gapp_dtn9797.DetailActivity;\nimport com.example.duynguyen.bakingapp_dtn9797.R;\nimport com.example.duynguyen", "end": 369, "score": 0.7731558680534363, "start": 362, "tag": "USERNAME", "value": "ynguyen" } ]
null
[]
package com.example.duynguyen.bakingapp_dtn9797.widgets; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.widget.RemoteViews; import com.example.duynguyen.bakingapp_dtn9797.DetailActivity; import com.example.duynguyen.bakingapp_dtn9797.R; import com.example.duynguyen.bakingapp_dtn9797.model.Recipe; /** * Implementation of App Widget functionality. */ public class BakingAppWidget extends AppWidgetProvider { static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { CharSequence widgetText = "Recipe Name"; Recipe recipe = WidgetDataModel.getRecipe(context); if (recipe !=null) { widgetText = recipe.getName(); } // Construct the RemoteViews object RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.baking_app_widget); views.setTextViewText(R.id.recipe_list_name, widgetText); Intent intentService = new Intent(context, ListViewWigetService.class); views.setRemoteAdapter(R.id.ingredients_list,intentService); Intent intent = new Intent(context, DetailActivity.class); intent.putExtra(DetailActivity.RECIPE_EXTRA,recipe); PendingIntent pendingIntent = PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT); if (!widgetText.equals("Recipe Name")) { views.setOnClickPendingIntent(R.id.recipe_list_name, pendingIntent); } Intent appIntent = new Intent(context, DetailActivity.class); PendingIntent appPendingIntent = PendingIntent.getActivity(context, 0, appIntent, PendingIntent.FLAG_UPDATE_CURRENT); views.setPendingIntentTemplate(R.id.ingredients_list, appPendingIntent); views.setEmptyView(R.id.ingredients_list,R.id.empty_view); // Instruct the widget manager to update the widget appWidgetManager.updateAppWidget(appWidgetId, views); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // There may be multiple widgets active, so update all of them WidgetUpdateService.startActionUpdateListView(context,null); } public static void updateAppWidgets (Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int appWidgetId : appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId); } } @Override public void onEnabled(Context context) { // Enter relevant functionality for when the first widget is created } @Override public void onDisabled(Context context) { // Enter relevant functionality for when the last widget is disabled } }
2,911
0.723806
0.717623
72
39.416668
33.764606
125
false
false
0
0
0
0
0
0
0.763889
false
false
3
ea9e3914c3b847da6b0ed62c768966b2b9231fbf
27,582,280,021,492
d23b43c742816c6e6eec4b128a3f05a6e6ec3768
/taxiapp/app/src/main/java/com/taxi/app/Purpose.java
c61f68c3decc6e8e0aa9d3c48a77d349ae3db535
[]
no_license
mitosisX/Divala
https://github.com/mitosisX/Divala
1e45937b473856362cf02a62d1ca1ccc4f8912fe
ad5a6622a33716e48129472ba19adfb31fe56980
refs/heads/master
2023-05-31T06:41:51.174000
2021-06-05T17:34:20
2021-06-05T17:34:20
373,943,283
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.taxi.app; public enum Purpose { JOURNEYS, DRIVERS }
UTF-8
Java
73
java
Purpose.java
Java
[]
null
[]
package com.taxi.app; public enum Purpose { JOURNEYS, DRIVERS }
73
0.671233
0.671233
6
11.166667
8.414603
21
false
false
0
0
0
0
0
0
0.333333
false
false
3