blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
a098f15bea7b09a0e039731a2225a1f76307b38d
495570673c2bc12386fabf626feb085895059476
/Final_AEDProject/FinalProject/src/Business/Role/LabAssistantRole.java
829fb51d6d8d41fb22d681f9d15bdaf8fa12e7c3
[]
no_license
PriyankaM06091994/Application-Engineering-Development
b284d496d29db8f99598eb004632fd389937fe06
949458310dc7a0ab7997a42958dae2c500d27134
refs/heads/master
2022-09-04T01:49:07.687784
2020-05-18T23:40:07
2020-05-18T23:40:07
265,018,850
0
2
null
null
null
null
UTF-8
Java
false
false
755
java
/* * 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 Business.Role; import Business.Account.Account; import Business.EcoSystem; import Business.Enterprise.Enterprise; import Business.Organization.Organization; import userInterface.LabAssistantRole.LabWorkAreaJPanel; import javax.swing.JPanel; /** * * @author Priyanka */ public class LabAssistantRole extends Role{ @Override public JPanel createWorkArea(JPanel rightPanel, Account account, Organization organization, Enterprise enterprise, EcoSystem business) { return new LabWorkAreaJPanel(rightPanel, account, enterprise, business); } }
[ "malpekar.p@husky.neu.edu" ]
malpekar.p@husky.neu.edu
3a73f15c95a9e9a56518ad7bd3f97cec2a4b52be
81b0bb3cfb2e9501f53451e7f03ec072ee2b0e13
/src/com/google/android/gms/flags/impl/zzb.java
f8ea38e300cfbd339d7e537773794380606e3c04
[]
no_license
reverseengineeringer/me.lyft.android
48bb85e8693ce4dab50185424d2ec51debf5c243
8c26caeeb54ffbde0711d3ce8b187480d84968ef
refs/heads/master
2021-01-19T02:32:03.752176
2016-07-19T16:30:00
2016-07-19T16:30:00
63,710,356
3
0
null
null
null
null
UTF-8
Java
false
false
807
java
package com.google.android.gms.flags.impl; import android.content.Context; import android.content.SharedPreferences; import com.google.android.gms.internal.zzui; import java.util.concurrent.Callable; public class zzb { private static SharedPreferences QA = null; public static SharedPreferences zzn(Context paramContext) { try { if (QA == null) { QA = (SharedPreferences)zzui.zzb(new Callable() { public SharedPreferences zzbfv() { return getSharedPreferences("google_sdk_flags", 1); } }); } paramContext = QA; return paramContext; } finally {} } } /* Location: * Qualified Name: com.google.android.gms.flags.impl.zzb * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
6e8938c1c40a626cebc440a2c89e5343dc280ec9
8bdd68a4c79fa30b6f5f71aa3252ea9cbc8e834c
/OCPay_api/src/main/java/com/odwallet/common/util/AES.java
b116af1081249187990abc2d9a24d00fc77b470d
[]
no_license
OdysseyProtocol/OCPay
3d82c5312d5d9e806acf7f47d8101664c938baac
ead8192d4c1dc6e333ecd984fc3a2aad5c250392
refs/heads/master
2020-03-10T00:52:04.868526
2018-05-27T03:23:47
2018-05-27T03:23:47
129,093,497
12
3
null
null
null
null
UTF-8
Java
false
false
2,838
java
package com.odwallet.common.util; import org.apache.commons.codec.binary.Base64; import javax.crypto.*; import javax.crypto.spec.SecretKeySpec; import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.Key; import java.security.NoSuchAlgorithmException; /** * Created by zxb on 8/31/16. */ public class AES { private static final String ENCODING = "UTF-8"; private static final String KEY_ALGORITHM = "AES";//产生密钥的算法 private static final String CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";//加解密算法 格式:算法/工作模式/填充模式 注意:ECB不使用IV参数 public static final String DESKEY = "PIlpNkvKoNGyM4CCGBA2gQ=="; /** * 产生密钥 */ public static String getKey() throws NoSuchAlgorithmException { KeyGenerator keyGenerator = KeyGenerator.getInstance(KEY_ALGORITHM); keyGenerator.init(128);//初始化密钥长度,128,192,256(选用192和256的时候需要配置无政策限制权限文件--JDK6) SecretKey key = keyGenerator.generateKey();//产生密钥 return Base64.encodeBase64String(key.getEncoded()); } /** * 还原密钥:二进制字节数组转换为Java对象 */ public static Key toKey(byte[] keyByte) { return new SecretKeySpec(keyByte, KEY_ALGORITHM); } /** * AES加密 * * @param data 带加密数据 * @param base64Key base64加密后的密钥 */ public static String encrypt(String data, String base64Key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException { Key key = toKey(Base64.decodeBase64(base64Key));//还原密钥 Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);//JDK下用 cipher.init(Cipher.ENCRYPT_MODE, key);//设置加密模式并且初始化key byte[] encodedByte = cipher.doFinal(data.getBytes(ENCODING)); return Base64.encodeBase64String(encodedByte); } /** * AES解密 * @param data 待解密数据为字符串 * @param base64Key 密钥 */ public static String decrypt(String data, String base64Key) { try{ Key key = toKey(Base64.decodeBase64(base64Key));//还原密钥 Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);//JDK下用 cipher.init(Cipher.DECRYPT_MODE, key); byte[] encodedByte = cipher.doFinal(Base64.decodeBase64(data)); return new String(encodedByte); }catch (Exception e){ e.printStackTrace(); } return null; } }
[ "developer@ocoin.sg" ]
developer@ocoin.sg
84c57ac36589861bf0297daf3fe013b7f44b5237
ab95689342a5a1b3f662c1c3bfd78c1b8db5b723
/Homework 1/src/com/alvinquach/cs4551/homework1/models/quantization/QuantizationSegment.java
fd63e6f86e9a2a7a85fb90f60abf7cebc9a364f7
[]
no_license
alvinquach/cs4551
e6923470f3d418123b2a75bd152ebde454050eea
c8c23fd802fcdb6751d2c16767f91ea54476ddf3
refs/heads/master
2021-03-22T00:29:12.597742
2018-05-05T23:56:30
2018-05-05T23:56:30
119,875,810
0
0
null
null
null
null
UTF-8
Java
false
false
690
java
package com.alvinquach.cs4551.homework1.models.quantization; /** * @author Alvin Quach */ public class QuantizationSegment implements Comparable<QuantizationSegment> { private int max; private int value; public QuantizationSegment(int max, int value) { this.max = max; this.value = value; } public int getMax() { return max; } public void setMax(int max) { this.max = max; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } @Override public int compareTo(QuantizationSegment o) { return max - o.getMax(); } @Override public String toString() { return "Max: " + max + ", Value: " + value; } }
[ "alvinquach91@gmail.com" ]
alvinquach91@gmail.com
7419a1557e376491f62d9d38092c4e106cafaff7
dab75e798f3141495f38d9988927d83bebc5ad10
/app/src/main/java/com/vary/salaryandcash/modules/widget/ViewServer.java
bd838e0abccb212b8090ad49377b725f38094c97
[]
no_license
VaryAndOne/SalaryAndCash
bc2c87be933757b7b85a9d50dbf8cfded4bd127f
7342cec9126a75d48b6c04a6ecc4c2aa78bfbc8c
refs/heads/master
2021-01-22T11:28:54.504837
2017-07-15T10:28:14
2017-07-15T10:28:14
92,701,658
0
0
null
null
null
null
UTF-8
Java
false
false
27,652
java
/* * Copyright (C) 2011 The Android Open Source Project * * 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.vary.salaryandcash.modules.widget; import android.app.Activity; import android.content.Context; import android.content.pm.ApplicationInfo; import android.os.Build; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.ViewDebug; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.lang.reflect.Method; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.locks.ReentrantReadWriteLock; /** * Created by * * 温家才 * 性别 男 民族 汉 * 生日1993年9月7日 * 住址 吉林省农安县青山口乡柳条沟村乡约屯17组 * 公民身份证号 220122199309077010 * * on 2017-06-03. */ /** * <p>This class can be used to enable the use of HierarchyViewer inside an * application. HierarchyViewer is an Android SDK tool that can be used * to inspect and debug the user interface of running applications. For * security reasons, HierarchyViewer does not work on production builds * (for instance phones bought in store.) By using this class, you can * make HierarchyViewer work on any device. You must be very careful * however to only enable HierarchyViewer when debugging your * application.</p> * * <p>To use this view server, your application must require the INTERNET * permission.</p> * * <p>The recommended way to use this API is to register activities when * they are created, and to unregister them when they get destroyed:</p> * * <pre> * public class MyActivity extends Activity { * public void onCreate(Bundle savedInstanceState) { * super.onCreate(savedInstanceState); * // Set content view, etc. * ViewServer.get(this).addWindow(this); * } * * public void onDestroy() { * super.onDestroy(); * ViewServer.get(this).removeWindow(this); * } * * public void onResume() { * super.onResume(); * ViewServer.get(this).setFocusedWindow(this); * } * } * </pre> * * <p> * In a similar fashion, you can use this API with an InputMethodService: * </p> * * <pre> * public class MyInputMethodService extends InputMethodService { * public void onCreate() { * super.onCreate(); * View decorView = getWindow().getWindow().getDecorView(); * String name = "MyInputMethodService"; * ViewServer.get(this).addWindow(decorView, name); * } * * public void onDestroy() { * super.onDestroy(); * View decorView = getWindow().getWindow().getDecorView(); * ViewServer.get(this).removeWindow(decorView); * } * * public void onStartInput(EditorInfo attribute, boolean restarting) { * super.onStartInput(attribute, restarting); * View decorView = getWindow().getWindow().getDecorView(); * ViewServer.get(this).setFocusedWindow(decorView); * } * } * </pre> */ public class ViewServer implements Runnable { /** * The default port used to start view servers. */ private static final int VIEW_SERVER_DEFAULT_PORT = 4939; private static final int VIEW_SERVER_MAX_CONNECTIONS = 10; private static final String BUILD_TYPE_USER = "user"; // Debug facility private static final String LOG_TAG = "ViewServer"; private static final String VALUE_PROTOCOL_VERSION = "4"; private static final String VALUE_SERVER_VERSION = "4"; // Protocol commands // Returns the protocol version private static final String COMMAND_PROTOCOL_VERSION = "PROTOCOL"; // Returns the server version private static final String COMMAND_SERVER_VERSION = "SERVER"; // Lists all of the available windows in the system private static final String COMMAND_WINDOW_MANAGER_LIST = "LIST"; // Keeps a connection open and notifies when the list of windows changes private static final String COMMAND_WINDOW_MANAGER_AUTOLIST = "AUTOLIST"; // Returns the focused window private static final String COMMAND_WINDOW_MANAGER_GET_FOCUS = "GET_FOCUS"; private ServerSocket mServer; private final int mPort; private Thread mThread; private ExecutorService mThreadPool; private final List<WindowListener> mListeners = new CopyOnWriteArrayList<WindowListener>(); private final HashMap<View, String> mWindows = new HashMap<View, String>(); private final ReentrantReadWriteLock mWindowsLock = new ReentrantReadWriteLock(); private View mFocusedWindow; private final ReentrantReadWriteLock mFocusLock = new ReentrantReadWriteLock(); private static ViewServer sServer; /** * Returns a unique instance of the ViewServer. This method should only be * called from the main thread of your application. The server will have * the same lifetime as your process. * * If your application does not have the <code>android:debuggable</code> * flag set in its manifest, the server returned by this method will * be a dummy object that does not do anything. This allows you to use * the same code in debug and release versions of your application. * * @param context A Context used to check whether the application is * debuggable, this can be the application context */ public static ViewServer get(Context context) { ApplicationInfo info = context.getApplicationInfo(); if (BUILD_TYPE_USER.equals(Build.TYPE) && (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { if (sServer == null) { sServer = new ViewServer(ViewServer.VIEW_SERVER_DEFAULT_PORT); } if (!sServer.isRunning()) { try { sServer.start(); } catch (IOException e) { Log.d(LOG_TAG, "Error:", e); } } } else { sServer = new NoopViewServer(); } return sServer; } private ViewServer() { mPort = -1; } /** * Creates a new ViewServer associated with the specified window manager on the * specified local port. The server is not started by default. * * @param port The port for the server to listen to. * * @see #start() */ private ViewServer(int port) { mPort = port; } /** * Starts the server. * * @return True if the server was successfully created, or false if it already exists. * @throws IOException If the server cannot be created. * * @see #stop() * @see #isRunning() * @see WindowManagerService#startViewServer(int) */ public boolean start() throws IOException { if (mThread != null) { return false; } mThread = new Thread(this, "Local View Server [port=" + mPort + "]"); mThreadPool = Executors.newFixedThreadPool(VIEW_SERVER_MAX_CONNECTIONS); mThread.start(); return true; } /** * Stops the server. * * @return True if the server was stopped, false if an error occurred or if the * server wasn't started. * * @see #start() * @see #isRunning() * @see WindowManagerService#stopViewServer() */ public boolean stop() { if (mThread != null) { mThread.interrupt(); if (mThreadPool != null) { try { mThreadPool.shutdownNow(); } catch (SecurityException e) { Log.w(LOG_TAG, "Could not stop all view server threads"); } } mThreadPool = null; mThread = null; try { mServer.close(); mServer = null; return true; } catch (IOException e) { Log.w(LOG_TAG, "Could not close the view server"); } } mWindowsLock.writeLock().lock(); try { mWindows.clear(); } finally { mWindowsLock.writeLock().unlock(); } mFocusLock.writeLock().lock(); try { mFocusedWindow = null; } finally { mFocusLock.writeLock().unlock(); } return false; } /** * Indicates whether the server is currently running. * * @return True if the server is running, false otherwise. * * @see #start() * @see #stop() * @see WindowManagerService#isViewServerRunning() */ public boolean isRunning() { return mThread != null && mThread.isAlive(); } /** * Invoke this method to register a new view hierarchy. * * @param activity The activity whose view hierarchy/window to register * * @see #addWindow(View, String) * @see #removeWindow(Activity) */ public void addWindow(Activity activity) { String name = activity.getTitle().toString(); if (TextUtils.isEmpty(name)) { name = activity.getClass().getCanonicalName() + "/0x" + System.identityHashCode(activity); } else { name += "(" + activity.getClass().getCanonicalName() + ")"; } addWindow(activity.getWindow().getDecorView(), name); } /** * Invoke this method to unregister a view hierarchy. * * @param activity The activity whose view hierarchy/window to unregister * * @see #addWindow(Activity) * @see #removeWindow(View) */ public void removeWindow(Activity activity) { removeWindow(activity.getWindow().getDecorView()); } /** * Invoke this method to register a new view hierarchy. * * @param view A view that belongs to the view hierarchy/window to register * @name name The name of the view hierarchy/window to register * * @see #removeWindow(View) */ public void addWindow(View view, String name) { mWindowsLock.writeLock().lock(); try { mWindows.put(view.getRootView(), name); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); } /** * Invoke this method to unregister a view hierarchy. * * @param view A view that belongs to the view hierarchy/window to unregister * * @see #addWindow(View, String) */ public void removeWindow(View view) { View rootView; mWindowsLock.writeLock().lock(); try { rootView = view.getRootView(); mWindows.remove(rootView); } finally { mWindowsLock.writeLock().unlock(); } mFocusLock.writeLock().lock(); try { if (mFocusedWindow == rootView) { mFocusedWindow = null; } } finally { mFocusLock.writeLock().unlock(); } fireWindowsChangedEvent(); } /** * Invoke this method to change the currently focused window. * * @param activity The activity whose view hierarchy/window hasfocus, * or null to remove focus */ public void setFocusedWindow(Activity activity) { setFocusedWindow(activity.getWindow().getDecorView()); } /** * Invoke this method to change the currently focused window. * * @param view A view that belongs to the view hierarchy/window that has focus, * or null to remove focus */ public void setFocusedWindow(View view) { mFocusLock.writeLock().lock(); try { mFocusedWindow = view == null ? null : view.getRootView(); } finally { mFocusLock.writeLock().unlock(); } fireFocusChangedEvent(); } /** * Main server loop. */ public void run() { try { mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost()); } catch (Exception e) { Log.w(LOG_TAG, "Starting ServerSocket error: ", e); } while (mServer != null && Thread.currentThread() == mThread) { // Any uncaught exception will crash the system process try { Socket client = mServer.accept(); if (mThreadPool != null) { mThreadPool.submit(new ViewServerWorker(client)); } else { try { client.close(); } catch (IOException e) { e.printStackTrace(); } } } catch (Exception e) { Log.w(LOG_TAG, "Connection error: ", e); } } } private static boolean writeValue(Socket client, String value) { boolean result; BufferedWriter out = null; try { OutputStream clientStream = client.getOutputStream(); out = new BufferedWriter(new OutputStreamWriter(clientStream), 8 * 1024); out.write(value); out.write("\n"); out.flush(); result = true; } catch (Exception e) { result = false; } finally { if (out != null) { try { out.close(); } catch (IOException e) { result = false; } } } return result; } private void fireWindowsChangedEvent() { for (WindowListener listener : mListeners) { listener.windowsChanged(); } } private void fireFocusChangedEvent() { for (WindowListener listener : mListeners) { listener.focusChanged(); } } private void addWindowListener(WindowListener listener) { if (!mListeners.contains(listener)) { mListeners.add(listener); } } private void removeWindowListener(WindowListener listener) { mListeners.remove(listener); } private interface WindowListener { void windowsChanged(); void focusChanged(); } private static class UncloseableOutputStream extends OutputStream { private final OutputStream mStream; UncloseableOutputStream(OutputStream stream) { mStream = stream; } public void close() throws IOException { // Don't close the stream } public boolean equals(Object o) { return mStream.equals(o); } public void flush() throws IOException { mStream.flush(); } public int hashCode() { return mStream.hashCode(); } public String toString() { return mStream.toString(); } public void write(byte[] buffer, int offset, int count) throws IOException { mStream.write(buffer, offset, count); } public void write(byte[] buffer) throws IOException { mStream.write(buffer); } public void write(int oneByte) throws IOException { mStream.write(oneByte); } } private static class NoopViewServer extends ViewServer { private NoopViewServer() { } @Override public boolean start() throws IOException { return false; } @Override public boolean stop() { return false; } @Override public boolean isRunning() { return false; } @Override public void addWindow(Activity activity) { } @Override public void removeWindow(Activity activity) { } @Override public void addWindow(View view, String name) { } @Override public void removeWindow(View view) { } @Override public void setFocusedWindow(Activity activity) { } @Override public void setFocusedWindow(View view) { } @Override public void run() { } } private class ViewServerWorker implements Runnable, WindowListener { private Socket mClient; private boolean mNeedWindowListUpdate; private boolean mNeedFocusedWindowUpdate; private final Object[] mLock = new Object[0]; public ViewServerWorker(Socket client) { mClient = client; mNeedWindowListUpdate = false; mNeedFocusedWindowUpdate = false; } public void run() { BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(mClient.getInputStream()), 1024); final String request = in.readLine(); String command; String parameters; int index = request.indexOf(' '); if (index == -1) { command = request; parameters = ""; } else { command = request.substring(0, index); parameters = request.substring(index + 1); } boolean result; if (COMMAND_PROTOCOL_VERSION.equalsIgnoreCase(command)) { result = writeValue(mClient, VALUE_PROTOCOL_VERSION); } else if (COMMAND_SERVER_VERSION.equalsIgnoreCase(command)) { result = writeValue(mClient, VALUE_SERVER_VERSION); } else if (COMMAND_WINDOW_MANAGER_LIST.equalsIgnoreCase(command)) { result = listWindows(mClient); } else if (COMMAND_WINDOW_MANAGER_GET_FOCUS.equalsIgnoreCase(command)) { result = getFocusedWindow(mClient); } else if (COMMAND_WINDOW_MANAGER_AUTOLIST.equalsIgnoreCase(command)) { result = windowManagerAutolistLoop(); } else { result = windowCommand(mClient, command, parameters); } if (!result) { Log.w(LOG_TAG, "An error occurred with the command: " + command); } } catch(IOException e) { Log.w(LOG_TAG, "Connection error: ", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } if (mClient != null) { try { mClient.close(); } catch (IOException e) { e.printStackTrace(); } } } } private boolean windowCommand(Socket client, String command, String parameters) { boolean success = true; BufferedWriter out = null; try { // Find the hash code of the window int index = parameters.indexOf(' '); if (index == -1) { index = parameters.length(); } final String code = parameters.substring(0, index); int hashCode = (int) Long.parseLong(code, 16); // Extract the command's parameter after the window description if (index < parameters.length()) { parameters = parameters.substring(index + 1); } else { parameters = ""; } final View window = findWindow(hashCode); if (window == null) { return false; } // call stuff final Method dispatch = ViewDebug.class.getDeclaredMethod("dispatchCommand", View.class, String.class, String.class, OutputStream.class); dispatch.setAccessible(true); dispatch.invoke(null, window, command, parameters, new UncloseableOutputStream(client.getOutputStream())); if (!client.isOutputShutdown()) { out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream())); out.write("DONE\n"); out.flush(); } } catch (Exception e) { Log.w(LOG_TAG, "Could not send command " + command + " with parameters " + parameters, e); success = false; } finally { if (out != null) { try { out.close(); } catch (IOException e) { success = false; } } } return success; } private View findWindow(int hashCode) { if (hashCode == -1) { View window = null; mWindowsLock.readLock().lock(); try { window = mFocusedWindow; } finally { mWindowsLock.readLock().unlock(); } return window; } mWindowsLock.readLock().lock(); try { for (Entry<View, String> entry : mWindows.entrySet()) { if (System.identityHashCode(entry.getKey()) == hashCode) { return entry.getKey(); } } } finally { mWindowsLock.readLock().unlock(); } return null; } private boolean listWindows(Socket client) { boolean result = true; BufferedWriter out = null; try { mWindowsLock.readLock().lock(); OutputStream clientStream = client.getOutputStream(); out = new BufferedWriter(new OutputStreamWriter(clientStream), 8 * 1024); for (Entry<View, String> entry : mWindows.entrySet()) { out.write(Integer.toHexString(System.identityHashCode(entry.getKey()))); out.write(' '); out.append(entry.getValue()); out.write('\n'); } out.write("DONE.\n"); out.flush(); } catch (Exception e) { result = false; } finally { mWindowsLock.readLock().unlock(); if (out != null) { try { out.close(); } catch (IOException e) { result = false; } } } return result; } private boolean getFocusedWindow(Socket client) { boolean result = true; String focusName = null; BufferedWriter out = null; try { OutputStream clientStream = client.getOutputStream(); out = new BufferedWriter(new OutputStreamWriter(clientStream), 8 * 1024); View focusedWindow = null; mFocusLock.readLock().lock(); try { focusedWindow = mFocusedWindow; } finally { mFocusLock.readLock().unlock(); } if (focusedWindow != null) { mWindowsLock.readLock().lock(); try { focusName = mWindows.get(mFocusedWindow); } finally { mWindowsLock.readLock().unlock(); } out.write(Integer.toHexString(System.identityHashCode(focusedWindow))); out.write(' '); out.append(focusName); } out.write('\n'); out.flush(); } catch (Exception e) { result = false; } finally { if (out != null) { try { out.close(); } catch (IOException e) { result = false; } } } return result; } public void windowsChanged() { synchronized (mLock) { mNeedWindowListUpdate = true; mLock.notifyAll(); } } public void focusChanged() { synchronized (mLock) { mNeedFocusedWindowUpdate = true; mLock.notifyAll(); } } private boolean windowManagerAutolistLoop() { addWindowListener(this); BufferedWriter out = null; try { out = new BufferedWriter(new OutputStreamWriter(mClient.getOutputStream())); while (!Thread.interrupted()) { boolean needWindowListUpdate = false; boolean needFocusedWindowUpdate = false; synchronized (mLock) { while (!mNeedWindowListUpdate && !mNeedFocusedWindowUpdate) { mLock.wait(); } if (mNeedWindowListUpdate) { mNeedWindowListUpdate = false; needWindowListUpdate = true; } if (mNeedFocusedWindowUpdate) { mNeedFocusedWindowUpdate = false; needFocusedWindowUpdate = true; } } if (needWindowListUpdate) { out.write("LIST UPDATE\n"); out.flush(); } if (needFocusedWindowUpdate) { out.write("FOCUS UPDATE\n"); out.flush(); } } } catch (Exception e) { Log.w(LOG_TAG, "Connection error: ", e); } finally { if (out != null) { try { out.close(); } catch (IOException e) { // Ignore } } removeWindowListener(this); } return true; } } }
[ "VaryAndOne@163.com" ]
VaryAndOne@163.com
3408dc663fda3f92ef68e9dacb8e27436fd11b24
17ecbe782e4bb465ee70f4a43c6d774ab62953e3
/source/ocotillo/graph/rendering/HeatMap.java
72860d474e31c511db13c2c819b7fc0b1b40c79c
[ "Apache-2.0" ]
permissive
EngAAlex/MultiDynNos
fbde77ccb837abdbe6bffb765bb7ca33748c2c04
068aa79680b7d670d2338493bc9c88f4ffbd3db6
refs/heads/master
2022-11-22T10:54:50.625173
2022-10-03T10:11:11
2022-10-03T10:11:11
355,105,161
0
0
null
null
null
null
UTF-8
Java
false
false
14,865
java
/** * Copyright © 2014-2016 Paolo Simonetto * * 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 ocotillo.graph.rendering; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; import ocotillo.geometry.Box; import ocotillo.geometry.Coordinates; import ocotillo.geometry.Geom; import ocotillo.graph.Element; import ocotillo.graph.Graph; import ocotillo.graph.Node; import ocotillo.graph.NodeAttribute; import ocotillo.graph.Observer; import ocotillo.graph.StdAttribute; import ocotillo.graph.layout.Layout2D; /** * HeatMap on graph nodes. */ public class HeatMap { private static final int hotSpotRadius = 60; private static final int pixelFactor = 10; private Gradient gradient = new Gradient(Arrays.asList(new Color(255, 0, 0, 0), new Color(255, 0, 0, 200)), 200); private Double coldestHeatValue = null; private Double hottestHeatValue = null; private Graph graph; private Box graphBox; private double[][] pixelHeat; private Image image; private boolean needHeatRecomputing = true; private boolean needImageRecomputing = true; private final List<Observer> observers = new ArrayList<>(); /** * Set the heat value corresponding to the coldest gradient colour. * * @param coldestHeatValue the heat value of the coldest colour. */ public void setColdestHeatValue(double coldestHeatValue) { this.coldestHeatValue = coldestHeatValue; this.needImageRecomputing = true; } /** * Set the heat value corresponding to the hottest gradient colour. * * @param hottestHeatValue the heat value of the hottest colour. */ public void setHottestHeatValue(double hottestHeatValue) { this.hottestHeatValue = hottestHeatValue; this.needImageRecomputing = true; } /** * Indicates to compute the heat value of the coldest colour as the minimum * heat value in the graph. */ public void setDynamicColdest() { this.coldestHeatValue = null; this.needImageRecomputing = true; } /** * Indicates to compute the heat value of the hottest colour as the maximum * heat value in the graph. */ public void setDynamicHottest() { this.hottestHeatValue = null; this.needImageRecomputing = true; } /** * Sets the gradient to be used. * * @param gradient the gradient. */ public void setGradient(Gradient gradient) { this.gradient = gradient; this.needImageRecomputing = true; } /** * Returns the heat map image for the graph. * * @param graph the graph. * @return the heat map image. */ public Image getImage(Graph graph) { if (needHeatRecomputing || this.graph != graph) { recompute(graph); needHeatRecomputing = false; needImageRecomputing = false; } else if (needImageRecomputing) { image = recomputeImage(pixelHeat, graph, gradient, coldestHeatValue, hottestHeatValue); needImageRecomputing = false; } return image; } /** * Returns the box of the image. * * @return the image box. */ public Box getImageBox() { double margin = (double) hotSpotRadius / pixelFactor; return graphBox.expand(new Coordinates(margin, margin)); } /** * Completely recompute the heat map for a given graph. * * @param graph the graph. */ public void recompute(Graph graph) { for (Observer observer : observers) { observer.unregister(); } this.graph = graph; this.graphBox = Layout2D.graphBox(graph); pixelHeat = recomputePixelHeat(graph, graphBox); image = recomputeImage(pixelHeat, graph, gradient, coldestHeatValue, hottestHeatValue); registerGraphObserver(); registerPositionObserver(); registerHeatObserver(); } /** * Registers a graph observer to be notified of node insertions and * removals. */ private void registerGraphObserver() { observers.add(new Observer.GraphElements(graph) { @Override public void theseElementsChanged(Collection<Element> changedElements) { for (Element element : changedElements) { if (element instanceof Node) { needHeatRecomputing = true; } } } }); } /** * Registers a node position observer to be notified of changes in node * positions. */ private void registerPositionObserver() { observers.add(new Observer.ElementAttributeChanges<Node>(graph.nodeAttribute(StdAttribute.nodePosition)) { @Override public void update(Collection<Node> changedElements) { needHeatRecomputing = true; } @Override public void updateAll() { needHeatRecomputing = true; } }); } /** * Registers a node heat observer to be notified of changes in node heat. */ private void registerHeatObserver() { observers.add(new Observer.ElementAttributeChanges<Node>(graph.nodeAttribute(StdAttribute.nodeHeat)) { @Override public void update(Collection<Node> changedElements) { needHeatRecomputing = true; } @Override public void updateAll() { needHeatRecomputing = true; } }); } /** * Closes the HeatMap and detach the observers. */ public void close() { for (Observer observer : observers) { observer.unregister(); } } /** * Recompute the heat of each heat map pixel. * * @param graph the graph. * @param graphBox the graph box. * @return */ private static double[][] recomputePixelHeat(Graph graph, Box graphBox) { int width = (int) graphBox.width() * pixelFactor + 2 * hotSpotRadius + 10; int height = (int) graphBox.height() * pixelFactor + 2 * hotSpotRadius + 10; double[][] pixelHeat = new double[width][height]; NodeAttribute<Coordinates> positions = graph.nodeAttribute(StdAttribute.nodePosition); NodeAttribute<Double> heatValues = graph.nodeAttribute(StdAttribute.nodeHeat); for (Node node : graph.nodes()) { double nodeHeat = heatValues.get(node); if (!Geom.eXD.almostZero(nodeHeat)) { Coordinates relativePos = positions.get(node).minus(new Coordinates(graphBox.left(), graphBox.bottom())); int x = (int) (relativePos.x() * pixelFactor + hotSpotRadius + 5); int y = (int) (relativePos.y() * pixelFactor + hotSpotRadius + 5); fillHotSpot(pixelHeat, x, y, heatValues.get(node)); } } return pixelHeat; } /** * Fills the pixels of an hot spot. * * @param pixelHeat the pixel heat matrix. * @param x the x pixel index. * @param y the y pixel index. * @param maxHeat the heat of the central pixel. */ private static void fillHotSpot(double[][] pixelHeat, int x, int y, double maxHeat) { for (int i = -hotSpotRadius; i <= hotSpotRadius; i++) { for (int j = -hotSpotRadius; j <= hotSpotRadius; j++) { double radiusXComp = ((double) i) / hotSpotRadius; double radiusYComp = ((double) j) / hotSpotRadius; double radius = Math.sqrt(radiusXComp * radiusXComp + radiusYComp * radiusYComp); double distanceFactor = Math.pow(Math.max(0, 1 - radius), 2); double heat = maxHeat * distanceFactor; pixelHeat[x + i][y + j] = Math.max(pixelHeat[x + i][y + j], heat); } } } /** * Recomputes the heat map image. * * @param pixelHeat the pixel heat matrix. * @param graph the graph. * @param gradient the gradient. * @param coldestHeatValue the set value of the coldest color, null if * dynamic. * @param hottestHeatValue the set value of the hottest color, null if * dynamic. * @return */ private static Image recomputeImage(double[][] pixelHeat, Graph graph, Gradient gradient, Double coldestHeatValue, Double hottestHeatValue) { if (pixelHeat == null) { return null; } BufferedImage image = new BufferedImage(pixelHeat.length, pixelHeat[0].length, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = image.createGraphics(); double[] heatRange = getHeatRange(graph, coldestHeatValue, hottestHeatValue); for (int i = 0; i < pixelHeat.length; i++) { for (int j = 0; j < pixelHeat[0].length; j++) { double normalizedHeat = (pixelHeat[i][j] - heatRange[0]) / (heatRange[1] - heatRange[0]); normalizedHeat = Math.max(0, normalizedHeat); normalizedHeat = Math.min(1, normalizedHeat); Color pixelColor = gradient.get(normalizedHeat); if (pixelColor.getAlpha() > 0) { graphics.setColor(pixelColor); int transformedJ = pixelHeat[0].length - 1 - j; // Java uses reverse coordinates for the y axis graphics.fillRect(i, transformedJ, 1, 1); } } } return image; } /** * Computes the heat values corresponding to the coldest and hottest colors * for a given graph. * * @param graph the graph. * @param coldestHeatValue the set value of the coldest color, null if * dynamic. * @param hottestHeatValue the set value of the hottest color, null if * dynamic. * @return the heat range. */ private static double[] getHeatRange(Graph graph, Double coldestHeatValue, Double hottestHeatValue) { NodeAttribute<Double> heatValues = graph.nodeAttribute(StdAttribute.nodeHeat); double graphColdest = Double.POSITIVE_INFINITY; double graphHottest = Double.NEGATIVE_INFINITY; if (coldestHeatValue == null || hottestHeatValue == null) { for (Node node : graph.nodes()) { double value = heatValues.get(node); graphColdest = Math.min(value, graphColdest); graphHottest = Math.max(value, graphHottest); } } double coldest = coldestHeatValue != null ? coldestHeatValue : graphColdest; double hottest = hottestHeatValue != null ? hottestHeatValue : graphHottest; return new double[]{coldest, hottest}; } /** * Provides a gradient as a discrete list of colors. */ public static class Gradient implements Iterable<Color> { private final List<Color> colors = new ArrayList<>(); /** * Generates a gradient given a list of seed colors and the number of * gradient colors to be generated. * * @param seedColors the seeds colors. * @param gradientSize the number of gradient colors to be generated. */ public Gradient(List<Color> seedColors, int gradientSize) { assert (seedColors.size() >= 2) : "The gradient requires at least two seed colors."; colors.add(seedColors.get(0)); for (int i = 0; i < seedColors.size() - 1; i++) { Color left = seedColors.get(i); Color right = seedColors.get(i + 1); int emptyColors = gradientSize - colors.size(); int colorsToAppend = emptyColors / (seedColors.size() - 1 - i); appendGradientColors(left, right, colorsToAppend); } } /** * Generates and appends gradient colors. The function appends the right * color, but not the left one. * * @param left the first seed color. * @param right the second seed color. * @param colorsToAppend the number of colors to append. */ private void appendGradientColors(Color left, Color right, int colorsToAppend) { for (int i = 1; i <= colorsToAppend; i++) { double interpolationValue = (double) i / colorsToAppend; int red = interpolate(left.getRed(), right.getRed(), interpolationValue); int green = interpolate(left.getGreen(), right.getGreen(), interpolationValue); int blue = interpolate(left.getBlue(), right.getBlue(), interpolationValue); int alpha = interpolate(left.getAlpha(), right.getAlpha(), interpolationValue); colors.add(new Color(red, green, blue, alpha)); } } /** * Interpolates a color value between the left value and the right one. * * @param left the left tone value. * @param right the right tone value. * @param interpolationValue the value indicating the distance from the * extremities, where 0 is left and 1 is right. * @return the interpolated value for the tone. */ private static int interpolate(int left, int right, double interpolationValue) { return (int) (left + (right - left) * interpolationValue); } /** * Returns the gradient color with given normalized ratio. * * @param ratio the normalized ration in the range [0,1]. * @return the color. */ public Color get(double ratio) { int index = (int) (ratio * colors.size()); index = Math.max(0, index); index = Math.min(colors.size() - 1, index); return colors.get(index); } @Override public Iterator<Color> iterator() { return colors.iterator(); } /** * Returns the number of colors in the gradient. * * @return the number of gradient colors. */ public int size() { return colors.size(); } } }
[ "Alessio@wien" ]
Alessio@wien
8f8a414068ea3dc596cf1e3c589ab75ef384ff73
e897c446fc3bf5e8838c3c0d29a1d4f21507f87b
/shared/root/java/core/com/deepsky/lang/plsql/psi/utils/PlSqlUtil.java
c06352e6fb6ca3683a9804f85208f120a1072efe
[]
no_license
gustavocaraciolo/SQL-Code-Assistant-
f9c7401077f31c35b9743f5fd90730cfa1decbea
db4d7107177b66e28456e565cc143d5e0d19d9db
refs/heads/master
2020-05-04T17:44:06.851841
2012-04-06T05:50:06
2012-04-06T05:50:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,758
java
/* * Copyright (c) 2009,2010 Serhiy Kulyk * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * SQL CODE ASSISTANT PLUG-IN FOR INTELLIJ IDEA IS PROVIDED BY SERHIY KULYK * "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 SERHIY KULYK 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.deepsky.lang.plsql.psi.utils; import com.deepsky.database.ora.DbUrl; import com.deepsky.lang.common.PlSqlFile; import com.deepsky.lang.common.PlSqlTokenTypes; import com.deepsky.lang.plsql.ConfigurationException; import com.deepsky.lang.plsql.psi.spices.CompilableObject; import com.deepsky.lang.plsql.resolver.index.IndexTree; import com.deepsky.lang.plsql.resolver.utils.ContextPathUtil; import com.deepsky.lang.plsql.sqlIndex.*; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.lang.ASTNode; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiManager; import com.intellij.psi.TokenType; import com.intellij.psi.impl.source.tree.CompositeElement; import com.intellij.psi.impl.source.tree.LeafElement; import org.jetbrains.annotations.NotNull; import java.io.IOException; public class PlSqlUtil { public static void iterateOver(@NotNull ASTNode node, @NotNull ASTNodeProcessor processor){ ASTNode curr = node.getFirstChildNode(); while(curr != null){ processor.process(curr); iterateOver(curr, processor); curr = curr.getTreeNext(); } } public static boolean iterateOver(@NotNull ASTNode node, @NotNull ASTNodeProcessorBreakable processor){ ASTNode curr = node.getFirstChildNode(); while(curr != null){ processor.process(curr); if(!iterateOver(curr, processor)){ return false; } curr = curr.getTreeNext(); } return true; } public static interface ASTNodeProcessor { void process(ASTNode node); } public static interface ASTNodeProcessorBreakable { boolean process(ASTNode node); } public static boolean moveToOffset(@NotNull PlSqlFile plSqlFile, int offset) { Project project = plSqlFile.getProject(); final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); OpenFileDescriptor desc = new OpenFileDescriptor(project, plSqlFile.getVirtualFile(), offset); return fileEditorManager.openTextEditor(desc, true) != null; } public static void verifyDbOriginatedFilesInEditor(Project project, AbstractSchema schema) { final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); for (VirtualFile v : fileEditorManager.getOpenFiles()) { if (v instanceof DbDumpedSqlFile) { DbUrl dbUrl = ((DbDumpedSqlFile) v).getDbUrl(); if (dbUrl.equals(schema.getDbUrl())) { // validate object timestamp DbDumpedSqlFile ff = (DbDumpedSqlFile) v; String fileName = ff.getOriginFileName(); long timestamp = v.getModificationStamp(); String _timestamp = schema.getIndexTree().getFileAttribute(fileName, IndexTree.TIMESTAMP_ATTR); if (_timestamp != null) { try { long ts = Long.parseLong(_timestamp); if(ts != timestamp){ // reload text in the editor Document doc = FileDocumentManager.getInstance().getDocument(v); //String text = schema.getSourceText(ff.getEncodedFilePathCtx()); try { VirtualFile vf = schema.getSourceFile(ff.getEncodedFilePathCtx()); byte[] content = vf.contentsToByteArray(); String text = new String(content, vf.getCharset()); // String text = (String) schema.getSourceFile(ff.getEncodedFilePathCtx()).getContent(); emulateInsertion(doc, project, text); } catch (IOException e) { e.printStackTrace(); } } } catch (NumberFormatException e) { } } else { // looks like object was deleted, close the editor fileEditorManager.closeFile(v); } } } } } public static void closeEditorsForSchema(Project project, AbstractSchema schema) { final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); for (VirtualFile v : fileEditorManager.getOpenFiles()) { if(checkUrl(v, schema.getDbUrl())){ fileEditorManager.closeFile(v); } } } private static boolean checkUrl(VirtualFile file, DbUrl dbUrl1) { if (file instanceof DbDumpedSqlFile) { // SQL file from DbSchemaIndex DbUrl dbUrl = ((DbDumpedSqlFile) file).getDbUrl(); if (dbUrl1.equals(dbUrl)) { return true; } } else if (file instanceof FSSqlFile) { // SQL file from FSIndex if (dbUrl1.equals(IndexManager.FS_URL)) { return true; } } else if (file instanceof SysSqlFile) { // SQL file from Sys const DbUrl dbUrl = ((SysSqlFile) file).getDbUrl(); if (dbUrl1.equals(dbUrl)) { return true; } } else { // SQL file from FSIndex if (dbUrl1.equals(IndexManager.FS_URL)) { return true; } } return false; } private static void emulateInsertion(final Document doc, final Project project, final String text) { ApplicationManager.getApplication().runWriteAction(new Runnable(){ public void run() { Editor[] editors = EditorFactory.getInstance().getEditors(doc, project); final Editor editor = editors[0]; final Document document = editor.getDocument(); //final String lookupString = item.getLookupString(); int curetOffset = editor.getCaretModel().getOffset(); if( text.length() < curetOffset){ curetOffset = text.length()-1; } document.setText(text);//insertString(offset, lookupString); editor.getCaretModel().moveToOffset(curetOffset); PsiDocumentManager.getInstance(project).commitDocument(document); } }); } public static String completeCreateScript(CompilableObject co) { final StringBuilder sb = new StringBuilder(); final String stopMarker = co.getObjectType(); try { iterateLeafsFromBeggining(co.getNode(), new HandleLeafElement() { public void handle(ASTNode elem) { if (elem.getText().equalsIgnoreCase(stopMarker)) { throw new BreakIteration(); } else if (elem.getText().equalsIgnoreCase("CREATE")) { sb.append("CREATE"); } else if (elem.getText().equalsIgnoreCase("OR")) { sb.append("OR"); } else if (elem.getText().equalsIgnoreCase("REPLACE")) { sb.append("REPLACE"); } } }); } catch (BreakIteration ignored) { } String prefix = ""; if (sb.length() == 0) { prefix = "CREATE OR REPLACE "; } final String[] endingSemi = {""}; try { iterateLeafsFromEnd(co.getNode(), new HandleLeafElement() { public void handle(ASTNode elem) { if (elem.getElementType() == TokenType.WHITE_SPACE) { } else if (elem.getElementType() == PlSqlTokenTypes.WS) { } else if (elem.getElementType() == PlSqlTokenTypes.ML_COMMENT) { } else if (elem.getElementType() == PlSqlTokenTypes.BAD_ML_COMMENT) { } else if (elem.getElementType() == PlSqlTokenTypes.SEMI) { // appending of SEMI no need throw new BreakIteration(); } else { endingSemi[0] = ";\n"; throw new BreakIteration(); } } }); } catch (BreakIteration ignored) { } return prefix + co.getText() + endingSemi[0]; } public static void iterateLeafsFromBeggining(ASTNode node, HandleLeafElement elem) { ASTNode current = node.getFirstChildNode(); do { if(current.getFirstChildNode() != null){ iterateLeafsFromBeggining(current, elem); } else { // handle leaf elem.handle( current); } /* if (current instanceof CompositeElement) { iterateLeafsFromBeggining(current, elem); } else if (current instanceof LeafElement) { // handle leaf elem.handle((LeafElement) current); } else { throw new ConfigurationException("Not supported type: " + current.getClass()); } */ current = current.getTreeNext(); } while (current != null); } public static void iterateLeafsFromEnd(ASTNode node, HandleLeafElement elem) { ASTNode current = node.getLastChildNode(); do { if(current.getFirstChildNode() != null){ iterateLeafsFromEnd(current, elem); } else { // handle leaf elem.handle( current); } /* if (current instanceof CompositeElement) { iterateLeafsFromEnd(current, elem); } else if (current instanceof LeafElement) { // handle leaf elem.handle((LeafElement) current); } else { throw new ConfigurationException("Not supported type: " + current.getClass()); } */ current = current.getTreePrev(); } while (current != null); } public static interface HandleLeafElement { void handle(ASTNode elem); } private static class BreakIteration extends Error { } }
[ "sky@.(none)" ]
sky@.(none)
304130eeaa4a22c6af35d5c04a84a62b45575de7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_ff895c9cffa87ac1e29d403a6c107d1d85634596/RDFGenerator/8_ff895c9cffa87ac1e29d403a6c107d1d85634596_RDFGenerator_s.java
fc6b65cde7454b01f291c75ff4d0419e7cfe5292
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
11,558
java
package org.isa2rdf.cli; import java.util.Hashtable; import net.toxbank.client.io.rdf.TOXBANK; import org.isatools.tablib.utils.BIIObjectStore; import uk.ac.ebi.bioinvindex.model.Accessible; import uk.ac.ebi.bioinvindex.model.Contact; import uk.ac.ebi.bioinvindex.model.Data; import uk.ac.ebi.bioinvindex.model.Identifiable; import uk.ac.ebi.bioinvindex.model.Investigation; import uk.ac.ebi.bioinvindex.model.Material; import uk.ac.ebi.bioinvindex.model.Protocol; import uk.ac.ebi.bioinvindex.model.Study; import uk.ac.ebi.bioinvindex.model.processing.Assay; import uk.ac.ebi.bioinvindex.model.processing.DataAcquisition; import uk.ac.ebi.bioinvindex.model.processing.DataNode; import uk.ac.ebi.bioinvindex.model.processing.DataProcessing; import uk.ac.ebi.bioinvindex.model.processing.GraphElement; import uk.ac.ebi.bioinvindex.model.processing.MaterialNode; import uk.ac.ebi.bioinvindex.model.processing.MaterialProcessing; import uk.ac.ebi.bioinvindex.model.processing.ProtocolApplication; import uk.ac.ebi.bioinvindex.model.term.Characteristic; import uk.ac.ebi.bioinvindex.model.term.CharacteristicValue; import uk.ac.ebi.bioinvindex.model.term.Factor; import uk.ac.ebi.bioinvindex.model.term.FactorValue; import uk.ac.ebi.bioinvindex.model.term.OntologyEntry; import uk.ac.ebi.bioinvindex.model.term.OntologyTerm; import uk.ac.ebi.bioinvindex.model.term.ParameterValue; import uk.ac.ebi.bioinvindex.model.term.Property; import uk.ac.ebi.bioinvindex.model.term.PropertyValue; import uk.ac.ebi.bioinvindex.model.xref.ReferenceSource; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.sparql.vocabulary.FOAF; import com.hp.hpl.jena.vocabulary.DCTerms; import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDFS; public abstract class RDFGenerator<NODE extends Identifiable,MODEL extends Model> { protected Hashtable<String,Resource> affiliations = new Hashtable<String,Resource>(); protected BIIObjectStore store; private MODEL model; protected String prefix; protected long tempIdCounter=1; public long getTempIdCounter() { return tempIdCounter; } public void setTempIdCounter(long tempIdCounter) { this.tempIdCounter = tempIdCounter; } public MODEL getModel() { return model; } public void setModel(MODEL model) { this.model = model; } public RDFGenerator ( String prefix, BIIObjectStore store , MODEL model) { this.store = store; this.prefix = prefix; setModel(model); } public abstract MODEL createGraph () throws Exception; public MODEL createGraph ( String fileName ) throws Exception { return createGraph(); } protected String getURI(Identifiable node) throws Exception { String p = "ISA_"; if ( node instanceof MaterialNode ) p = "MN"; else if ( node instanceof DataNode) p = "DN"; else if ( node instanceof MaterialProcessing ) p = "MN"; else if ( node instanceof DataAcquisition ) p = "DAN"; else if ( node instanceof DataProcessing ) p = "DPN"; else if ( node instanceof Material ) p = "M"; else if ( node instanceof Data ) p = "D"; else if ( node instanceof Protocol ) p = "P_"; else if ( node instanceof ProtocolApplication ) p = "PA"; else if ( node instanceof Study ) p = "S"; else if ( node instanceof Assay ) p = "A"; else if ( node instanceof Investigation ) p = "I"; else if ( node instanceof ParameterValue ) p = "PMV"; else if ( node instanceof FactorValue ) p = "FV"; else if ( node instanceof CharacteristicValue ) p = "CV"; else if ( node instanceof PropertyValue ) p = "PV"; else if ( node instanceof OntologyTerm ) p = "OT"; else if ( node instanceof OntologyEntry ) p = "OE"; else if ( node instanceof Factor ) p = "F"; else if ( node instanceof Characteristic ) p = "C"; else if ( node instanceof Property ) p = "PR"; else if ( node instanceof ReferenceSource ) p = "RS"; else { //System.err.println(node.getClass().getName()); } if (node.getId()==null) { node.setId(tempIdCounter); tempIdCounter++; } return String.format("%s/%s%d",prefix,p,node.getId()); } protected Resource getResourceID(Identifiable node,Resource clazz) throws Exception { if (node==null) return null; return model.createResource(getURI(node), clazz); } protected Resource getResource(Identifiable node,Resource clazz) throws Exception { Resource resource = getResourceID(node, clazz); if (node==null) return null; //Accessible if ((node instanceof Accessible) && ((Accessible) node).getAcc()!=null) { resource.addProperty(ISA.hasAccessionID, ((Accessible) node).getAcc()); } if (node instanceof Property) { //factor/char/params are descendant //TODO } if (node instanceof PropertyValue) { //TODO PropertyValue pv = (PropertyValue) node; if (pv.getOntologyTerms()!=null) for (Object ot: pv.getOntologyTerms()) { Resource xot = getResourceID((OntologyTerm)ot, ISA.OntologyTerm); if (xot!=null) getModel().add(resource,ISA.HASONTOLOGYTERM,xot); } Resource r = node instanceof FactorValue?ISA.Factor:node instanceof ParameterValue?ISA.Parameter:ISA.Property; com.hp.hpl.jena.rdf.model.Property p = node instanceof FactorValue?ISA.HASFACTOR:node instanceof ParameterValue?ISA.HASPARAMETER:ISA.HASPROPERTY; if (pv.getValue()!=null) getModel().add(resource,ISA.HASVALUE,pv.getValue()); if (pv.getType()!=null) { Resource xt = getResourceID(pv.getType(),r); getModel().add(resource,p,xt); } } if (node instanceof OntologyTerm) { //TODO } if (node instanceof OntologyEntry) { //TODO } //Data if (node instanceof Data) { //System.out.println(node); Data data = (Data) node; //if (data.getUrl()!=null) resource.addProperty(RDFS.isDefinedBy, data.getUrl()); if (data.getName()!=null) resource.addProperty(DCTerms.title, data.getName()); if (data.getDataMatrixUrl()!=null) resource.addProperty(RDFS.seeAlso, data.getUrl()); if (data.getType()!=null) { //ontlogy entry Resource oe = getResourceID(data.getType(), ISA.OntologyEntry); } //if (data.getSubmissionTs()!=null) resource.addProperty(DCTerms.created, data.getSubmissionTs().toGMTString()); if (data.getFactorValues()!=null) for (FactorValue fv : data.getFactorValues()) { Resource xfv = getResourceID(fv, ISA.FactorValue); logger(xfv); getModel().add(resource,ISA.HASFACTORVALUE,xfv); } } //GraphElement if (node instanceof GraphElement) { if (((GraphElement) node).getStudy()!=null) resource.addProperty(ISA.HASSTUDY, getResourceID(((GraphElement) node).getStudy(),ISA.Study)); } //GraphElement if (node instanceof Study) { Study study = (Study) node; if (study.getTitle()!=null) resource.addProperty(DCTerms.title,study.getTitle()); if (study.getDescription()!=null) resource.addProperty(DCTerms.description,study.getDescription()); if (study.getSubmissionDate()!=null) resource.addProperty(DCTerms.created,study.getSubmissionDate().toGMTString()); if (study.getObjective()!=null) resource.addProperty(DCTerms.abstract_,study.getObjective()); /* for (AssayResult ar : study.getAssayResults()) { System.out.println(ar); } */ } /** * Persons , defined in the investigation file Contact{ #3975, 'Stephen' ('G') 'Oliver' <null> Roles: { 'NULL-ACCESSION' ( 'corresponding author' ) } Phone: 'null', Fax: 'null' Affiliation: 'Faculty of Life Sciences, Michael Smith Building, University of Manchester', URL: <null>, owner: Investigation: { #2225, 'BII-I-1', 'Growth control of the eukaryote cell: a systems biology study in yeast' } } */ if (node instanceof Contact) { Contact contact = (Contact) node; getModel().add(resource, RDF.type, FOAF.Person); getModel().add(resource, RDF.type, TOXBANK.USER); //also could be a ToxBank user if (contact.getFirstName() != null) resource.addLiteral(FOAF.givenname, contact.getFirstName()); if (contact.getLastName() != null) resource.addLiteral(FOAF.family_name, contact.getLastName()); //TODO affiliations if (contact.getAffiliation()!=null) { Resource affiliation = affiliations.get(contact.getAffiliation()); if (affiliation==null) { //don't want to assign URI affiliation = getModel().createResource(); getModel().add(affiliation, RDF.type, TOXBANK.ORGANIZATION); affiliation.addLiteral(DCTerms.title, contact.getAffiliation()); affiliations.put(contact.getAffiliation(), affiliation); } affiliation.addProperty(TOXBANK.HASMEMBER, resource); } } //GraphElement if (node instanceof Investigation) { Investigation inv = (Investigation) node; if (inv.getTitle()!=null) resource.addProperty(DCTerms.title,inv.getTitle()); if (inv.getDescription()!=null) resource.addProperty(DCTerms.abstract_,inv.getDescription()); if (inv.getSubmissionDate()!=null) resource.addProperty(DCTerms.created,inv.getSubmissionDate().toGMTString()); if (inv.getReleaseDate()!=null) resource.addProperty(DCTerms.issued,inv.getSubmissionDate().toGMTString()); //if (study.getPublications()!=null) //resource.addProperty(DCTerms.abstract_,study.getObjective()); //if (study.getContacts()!=null) //resource.addProperty(DCTerms.abstract_,study.getObjective()); for (Contact contact: inv.getContacts()) { Resource contactResource = getResource(contact,ISA.Contact); getModel().add(resource,ISA.HASOWNER,contactResource); } if (inv.getStudies()!=null) for (Study study : inv.getStudies()) { Resource studyResource = getResourceID(study,ISA.Study); //Studies are already added, but not their details for (Protocol protocol : study.getProtocols()) { getModel().add(studyResource,ISA.HASPROTOCOL,getResourceID(protocol,ISA.Protocol)); } for (Contact contact: study.getContacts()) { Resource contactResource = getResource(contact,ISA.Contact); getModel().add(studyResource,ISA.HASOWNER,contactResource); } } /* for (AssayResult ar : study.getAssayResults()) { System.out.println(ar); } */ } //Node /**FIXME something is wrong, owl gets broken ... perhaps consider assayfields as resources not literals if (node instanceof Node) { if (((Node) node).getSampleFileId()!=null) resource.addProperty(ISA.HASSAMPLEFIELD,((Node) node).getSampleFileId() ); if (((Node) node).getAssayFileIds()!=null) { Iterator assayFields = ((Node) node).getAssayFileIds().iterator(); while (assayFields.hasNext()) { String assayField = assayFields.next().toString(); resource.addLiteral(ISA.HASASSAYFIELD,assayField); System.out.println(node.getClass().getName() + " " + resource.getURI() + " "+ assayField); } } } */ return resource; } public void logger(Object object) { //System.err.println(object!=null?object.toString():""); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
aefbcf296cc408e5ae700628f828037bf98aa3f7
5dc69078a47a2a1a643172b42feee55d993028d2
/app/src/androidTest/java/com/example/pt12_martin_pol/ExampleInstrumentedTest.java
093c24024686eb5edf22c10dc9bf8bedb0d2371b
[]
no_license
PolMartin1/PT12_Martin_Pol
79528948ed573f6003b95846fd49188d819c48e1
0e0ea56e81a72c825e180d40236eef7247f3e4a4
refs/heads/master
2020-08-27T10:41:05.341306
2019-10-24T15:56:03
2019-10-24T15:56:03
217,337,852
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package com.example.pt12_martin_pol; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.pt12_martin_pol", appContext.getPackageName()); } }
[ "iam39443911@i03.informatica.escoladeltreball.org" ]
iam39443911@i03.informatica.escoladeltreball.org
fb2a94934851a30424c6e3bb30d3ed29ac0b8ab4
900236b07bb9e9a7d019e69ae1a1fd65e32139c1
/src/main/java/de/cynapsys/metier/UtilisateurMetier.java
e08541637571cb463d4108ba6b6923c2ecbc2978
[]
no_license
adminCynapsys/CynapsysDemo
6897bc7e99348efac1602b4efb2612be0376412b
e1f6827b9b2396f048bb9855b3b418e9e846be76
refs/heads/master
2020-03-15T13:25:02.830720
2018-05-25T09:26:05
2018-05-25T09:26:05
132,165,983
0
0
null
null
null
null
UTF-8
Java
false
false
472
java
package de.cynapsys.metier; import java.util.List; import java.util.Optional; import de.cynapsys.entities.Utilisateur; public interface UtilisateurMetier { public List<Utilisateur> listUtilisateurs(); public Optional<Utilisateur> getUtilisateur(Long id); public Utilisateur saveUtilisateur(Utilisateur u); public Utilisateur updateUtilisateur(Utilisateur u , Long id); public void deleteUtilisateur (Long id); public Utilisateur login(Utilisateur utilisateur); }
[ "a.chaari@cynapsys.de" ]
a.chaari@cynapsys.de
2211bd9241c92babb043c7ee280c5489ef2ea06d
159c1499f0fdfd40d007114cc8e02d390f088312
/src/us/lcec/frc/ultimateascent/LegoLightSensor.java
c1bffd9139e1e55989264acd620f90ac497f1e92
[]
no_license
FRC-2429/UltimateAscent
a24c4082ce41fcb940f5ffa461ec58d27b94be1f
b77e7b24a5ce4aca8486298dbd78e3b993723081
refs/heads/master
2021-01-19T18:10:35.573924
2013-03-08T23:04:15
2013-03-08T23:04:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package us.lcec.frc.ultimateascent; import edu.wpi.first.wpilibj.AnalogChannel; public class LegoLightSensor { AnalogChannel an; public LegoLightSensor( int analogPort) { an = new AnalogChannel(analogPort); } boolean isWhite() { return an.getAverageValue() == 2; } }
[ "Administrator@fancydualcore" ]
Administrator@fancydualcore
3428c7cb2b830de7555eaf568aaa0b0a154cae18
f9e49e3f8bf53fd8f2952207b67dd231ff5267fe
/WEB-INF/src/PeriodList.java
ad0bc7fac7716f33ed77f1404bf9bbe1e1ab6b27
[]
no_license
sarathgalimelu/OntologyWebsite
572a5ff9dd088e94eaa3753b209b099cd0ce869a
07e061e4c29e0623ae6014e7c9a378c19601d4ea
refs/heads/master
2020-02-26T15:18:37.459615
2016-09-18T05:49:10
2016-09-18T05:49:10
68,467,094
0
0
null
null
null
null
UTF-8
Java
false
false
2,885
java
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.tdb.TDBFactory; public class PeriodList extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); try { //PREFIX table: <http://www.daml.org/2003/01/periodictable/PeriodicTable#> ; String prefix1 = "PREFIX table: <http://www.daml.org/2003/01/periodictable/PeriodicTable#> "; String prefix2 = "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "; String prefix3 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "; String prefix = prefix1; String queryString = prefix+ "SELECT DISTINCT ?name {?element table:period ?name. ?element table:atomicNumber ?number. ?element table:symbol ?symbol.} ORDER BY ?name"; String directory = "/student/vgalimelu1/PERIODIC" ; Dataset ds = TDBFactory.createDataset(directory) ; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, ds) ; try { ResultSet rs = qe.execSelect() ; out.println("<HTML>"); out.println("<HEAD>"); out.println("<TITLE>TDB Query Servlet</TITLE>"); out.println("</HEAD>"); out.println("<BODY ALIGN=\"CENTER\" BGCOLOR=\"#FFFFFF\" >"); out.println("<h3>Periodic Table Blocks</h3>"); out.println("<table border=\"1\" align=\"center\">"); while(rs.hasNext()){ QuerySolution qs = rs.nextSolution(); String name = qs.getResource("?name").toString(); name=name.substring(name.lastIndexOf('#')+1,name.length()); /* name=name.substring(0,name.indexOf("^")); symbol=symbol.substring(0,symbol.indexOf("^")); */ out.println("<P><tr><td><a href=\"http://tinman.cs.gsu.edu:8080/vgalimelu1/servlet/PeriodDetails?val="+name+" \">"+name+"</a></tr></td>"); } out.println("</table>"); out.println("</BODY>"); out.println("</HTML>"); } finally { qe.close() ; } }catch (Exception e) { e.printStackTrace(); } } }
[ "gvsarathkumar@gmail.com" ]
gvsarathkumar@gmail.com
3aa3f5adbe233c4a8738023c2ab81c5103acf35c
7265794006aeb866d25bc708129d2d51067fc01a
/Boxing/src/BankingApplication/Bank.java
bb32b63d534156cd1dccd7d8b1a962588be0bed3
[]
no_license
adamaclp92/JavaLearning
4102b89b2180e3bc6316fa0a03416c4d757a087f
c2e5eaa95032ada0b6d2e5eb1827b7841d312e43
refs/heads/main
2023-08-23T04:45:21.617101
2021-10-24T20:22:32
2021-10-24T20:22:32
374,442,753
0
0
null
null
null
null
UTF-8
Java
false
false
3,075
java
package BankingApplication; import java.util.ArrayList; public class Bank { private String name; private ArrayList<Branch> branches; public Bank(String name) { this.name = name; this.branches = new ArrayList<Branch>(); } //ha nem talál a paraméterben megadott név alapján fiókot, akkor hozzáadja, különben pedig false public boolean addBranch(String branchName){ if(findBranch(branchName) == null){ this.branches.add(new Branch(branchName)); System.out.println(branchName + " fiók sikeresen hozzáadva " + this.name + " bankhoz."); return true; } System.out.println("Már létezik " + branchName + " nevű fiók."); return false; } //ha a paraméteben átadott fióknév létezik, akkor Branch osztály newCustomer public boolean addCustomer(String branchName, String customerName, double transaction){ Branch branch = findBranch(branchName); if(branch != null) return branch.newCustomer(customerName,transaction); return false; } //a paraméterben átadott fióknév nem létezik, akkor Branch osztály addCustomerTransaction public boolean addCustomerTransaction(String branchName, String customerName, double transaction){ Branch branch = findBranch(branchName); if(branch != null) return branch.addCustomerTransaction(customerName,transaction); return false; } //az i-edik branch-el tér vissza, ha a branch arraylist neve megegyezik a paraméterben átadott névvel private Branch findBranch(String branchName){ for (int i = 0; i < this.branches.size(); i++) { Branch branch = this.branches.get(i); if(branch.getName().equals(branchName)) return branch; } return null; } //Ha létezik a paraméterben átadott fiók, akkor végigmegyünk a fiókhoz tartozó vevőkön, és kiírjuk a neveiket //*ha a paraméter igaz, akkor a az adott ve3vőhöz tartozó tranzakciókon is végigmegyünk public boolean listCustomers(String branchName, boolean showTransactions) { Branch branch = findBranch(branchName); if(branch != null) { ArrayList<Customer> branchCustomers = branch.getCustomers(); for(int i=0; i<branchCustomers.size(); i++) { Customer branchCustomer = branchCustomers.get(i); System.out.println("Vevő: " + branchCustomer.getName() + "[" + (i+1) + "]"); if(showTransactions) { System.out.println("Tranzakciók:"); ArrayList<Double> transactions = branchCustomer.getTransactions(); for(int j=0; j<transactions.size(); j++) { System.out.println("[" + (j+1) + "] Érték " + transactions.get(j)); } System.out.println(); } } return true; } else { return false; } } }
[ "adamaclp92@gmail.com" ]
adamaclp92@gmail.com
fed10cb8e19759a685f80afccab9f3d7b91da3d5
03b062fdc2279b83824377a73bddaaf0b75c20db
/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusinessRateServiceImpl.java
41685c038f72c9695dc707a2882d03f4754da7b0
[ "MIT" ]
permissive
AnnieRabbit/Business
d9b6915c5057a310dffa3caa2a264fcf3c6c1603
de91564044d2a9e0bb7ccc0492a9e83931ab872c
refs/heads/master
2023-02-07T02:08:41.972884
2020-12-29T05:57:20
2020-12-29T05:57:20
312,145,985
0
0
null
null
null
null
UTF-8
Java
false
false
3,348
java
package com.ruoyi.business.service.impl; import com.ruoyi.business.domain.BusinessRate; import com.ruoyi.business.mapper.BusinessRateMapper; import com.ruoyi.business.service.IBusinessRateService; import com.ruoyi.common.core.text.Convert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * 返点比例表Service业务层处理 * * @author ruoyi * @date 2020-11-05 */ @Service public class BusinessRateServiceImpl implements IBusinessRateService { @Autowired private BusinessRateMapper businessRateMapper; /** * 查询返点比例表 * * @param id 返点比例表ID * @return 返点比例表 */ @Override public BusinessRate selectBusinessRateById(Long id) { return businessRateMapper.selectBusinessRateById(id); } /** * 查询返点比例表列表 * * @param businessRate 返点比例表 * @return 返点比例表 */ @Override public List<BusinessRate> selectBusinessRateList(BusinessRate businessRate) { return businessRateMapper.selectBusinessRateList(businessRate); } /** * 新增返点比例表 * * @param businessRate 返点比例表 * @return 结果 */ @Override public int insertBusinessRate(BusinessRate businessRate) { int exist=businessRateMapper.selectMemberRateIfExist(businessRate); if(exist>0){ return -1; }else{ return businessRateMapper.insertBusinessRate(businessRate); } } /** * 修改返点比例表 * * @param businessRate 返点比例表 * @return 结果 */ @Override public int updateBusinessRate(BusinessRate businessRate) { return businessRateMapper.updateBusinessRate(businessRate); } /** * 删除返点比例表对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteBusinessRateByIds(String ids) { return businessRateMapper.deleteBusinessRateByIds(Convert.toStrArray(ids)); } /** * 删除返点比例表信息 * * @param id 返点比例表ID * @return 结果 */ @Override public int deleteBusinessRateById(Long id) { return businessRateMapper.deleteBusinessRateById(id); } //导出excel @Override public List<List<String>> changeExcel(List<BusinessRate> lists) { List<List<String>> excelData = new ArrayList<List<String>>(); List<String> head = new ArrayList<>(); head.add("集团名称"); head.add("集团比例"); excelData.add(head); for (int i = 0; i < lists.size(); i++) { List<String> data = new ArrayList<>(); data.add(lists.get(i).getMembership().equals("")?"":lists.get(i).getMembership()); data.add(lists.get(i).getMemberRate().equals("")?"":lists.get(i).getMemberRate()); excelData.add(data); } return excelData; } //导出list @Override public List<BusinessRate> selectExportBusinessRateList(BusinessRate businessRate) { return businessRateMapper.selectExportBusinessRateList(businessRate); } }
[ "anni1224015320@126.com" ]
anni1224015320@126.com
97866d80d6febe0ca7195652f14632f19e63722d
7b2083f44fa6618cab5fa816ed899793d2249f2b
/ISA-Backend/src/main/java/com/example/ISABackend/repository/ReportRepository.java
e2713d3ab27acc9feb17992dd5905ff3f10c1a9b
[]
no_license
milanovicn/ISA
0107a945a8e3fdc08f132ace8d0ed716759b54dd
8d0442953e1d084101f1ac902a8bfacf913762bd
refs/heads/master
2023-06-05T09:23:45.298538
2021-02-12T20:32:44
2021-02-12T20:32:44
311,666,569
1
0
null
2021-02-12T20:32:45
2020-11-10T13:27:26
Java
UTF-8
Java
false
false
227
java
package com.example.ISABackend.repository; import com.example.ISABackend.model.Report; import org.springframework.data.jpa.repository.JpaRepository; public interface ReportRepository extends JpaRepository<Report, Long> { }
[ "matejak997@gmail.com" ]
matejak997@gmail.com
65bf5a8278b95ef39ea9cd8cd5c7235667394ee8
93683fadda63eaf3e12853376f67f1f4d114d802
/src/test/java/com/exercise/steps/LoginSteps.java
a971340e5753cf518c8cb511736f404b08405dec
[]
no_license
ellepri/java-selenium-BDD-example
3f070c01bec1150c041371b696ea36b8a073dd7a
236a51da9c5aa668ed7e61e24178a63f00e70590
refs/heads/main
2023-08-30T22:56:42.119552
2021-09-09T13:35:14
2021-09-09T13:35:14
404,735,164
1
0
null
null
null
null
UTF-8
Java
false
false
1,097
java
package com.exercise.steps; import io.cucumber.datatable.DataTable; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import com.exercise.support.PageObjectManager; import com.exercise.support.World; import java.util.List; public class LoginSteps { private final World world; private final PageObjectManager pageObjectManager; public LoginSteps (World world) { this.world = world; this.pageObjectManager = new PageObjectManager(world.getDriver()); } @When("I login in with details") public void iEnterUserDetails (DataTable table) { List<List<String>> rows = table.asLists(String.class); for (List<String> columns : rows) { pageObjectManager.getSignInPage().login(columns.get(0), columns.get(1)); } } @Then("user is signed in") public void userIsSignedIn () { // pageObjectManager.getMyAccountPage().isMyAccountPageDisplayed(); } @When("I navigate to login page") public void iNavigateToLoginPage () { pageObjectManager.getIndexPage().clickSignIn(); } }
[ "elle.prilling@gmail.com" ]
elle.prilling@gmail.com
c70b54503f0c69e2747a6c77ac2f78e68afa43d1
a218bb55b62e97a9548e3fa725289d2da1e037d6
/ds-cache/src/main/java/com/ds/cache/service/impl/RedisServiceImpl.java
1c6e8dedeea16256ec80302e928114e23cdd4d57
[]
no_license
jpdslmj/ds-security
bf121af35ae40019c3f240f21da334a729da5791
5546bcddcaab4e2c99a853dd60e7c216ae43cca9
refs/heads/master
2020-05-01T05:00:01.163324
2019-03-24T11:16:02
2019-03-24T11:16:02
177,288,919
0
0
null
null
null
null
UTF-8
Java
false
false
30,717
java
package com.ds.cache.service.impl; import com.ds.cache.service.IRedisService; import org.apache.log4j.Logger; import org.joda.time.DateTime; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import redis.clients.jedis.BinaryClient.LIST_POSITION; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import java.util.*; @Service public class RedisServiceImpl implements IRedisService { private static final Logger LOGGER = Logger.getLogger(RedisServiceImpl.class); @Autowired private JedisPool pool; @Override public String get(String key) { Jedis jedis = null; String value = null; try { jedis = pool.getResource(); value = jedis.get(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return value; } @Override public Set<String> getByPre(String pre) { Jedis jedis = null; Set<String> value = null; try { jedis = pool.getResource(); value = jedis.keys(pre + "*"); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return value; } @Override public String set(String key, String value) { Jedis jedis = null; try { jedis = pool.getResource(); return jedis.set(key, value); } catch (Exception e) { LOGGER.error(e.getMessage()); return "0"; } finally { returnResource(pool, jedis); } } @Override public String set(String key, String value, int expire) { Jedis jedis = null; try { jedis = pool.getResource(); int time = jedis.ttl(key).intValue() + expire; String result = jedis.set(key, value); jedis.expire(key, time); return result; } catch (Exception e) { LOGGER.error(e.getMessage()); return "0"; } finally { returnResource(pool, jedis); } } @Override public Long delPre(String key) { Jedis jedis = null; try { jedis = pool.getResource(); Set<String> set = jedis.keys(key + "*"); int result = set.size(); Iterator<String> it = set.iterator(); while (it.hasNext()) { String keyStr = it.next(); jedis.del(keyStr); } return new Long(result); } catch (Exception e) { LOGGER.error(e.getMessage()); return 0L; } finally { returnResource(pool, jedis); } } @Override public Long del(String... keys) { Jedis jedis = null; try { jedis = pool.getResource(); return jedis.del(keys); } catch (Exception e) { LOGGER.error(e.getMessage()); return 0L; } finally { returnResource(pool, jedis); } } @Override public Long append(String key, String str) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.append(key, str); } catch (Exception e) { LOGGER.error(e.getMessage()); return 0L; } finally { returnResource(pool, jedis); } return res; } @Override public Boolean exists(String key) { Jedis jedis = null; try { jedis = pool.getResource(); return jedis.exists(key); } catch (Exception e) { LOGGER.error(e.getMessage()); return false; } finally { returnResource(pool, jedis); } } @Override public Long setnx(String key, String value) { Jedis jedis = null; try { jedis = pool.getResource(); return jedis.setnx(key, value); } catch (Exception e) { LOGGER.error(e.getMessage()); return 0L; } finally { returnResource(pool, jedis); } } @Override public String setex(String key, String value, int seconds) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.setex(key, seconds, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long setrange(String key, String str, int offset) { Jedis jedis = null; try { jedis = pool.getResource(); return jedis.setrange(key, offset, str); } catch (Exception e) { LOGGER.error(e.getMessage()); return 0L; } finally { returnResource(pool, jedis); } } @Override public List<String> mget(String... keys) { Jedis jedis = null; List<String> values = null; try { jedis = pool.getResource(); values = jedis.mget(keys); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return values; } @Override public String mset(String... keysvalues) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.mset(keysvalues); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long msetnx(String... keysvalues) { Jedis jedis = null; Long res = 0L; try { jedis = pool.getResource(); res = jedis.msetnx(keysvalues); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String getset(String key, String value) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.getSet(key, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String getrange(String key, int startOffset, int endOffset) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.getrange(key, startOffset, endOffset); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long incr(String key) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.incr(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long incrBy(String key, Long integer) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.incrBy(key, integer); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long decr(String key) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.decr(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long decrBy(String key, Long integer) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.decrBy(key, integer); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long serlen(String key) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.strlen(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long hset(String key, String field, String value) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.hset(key, field, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long hsetnx(String key, String field, String value) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.hsetnx(key, field, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String hmset(String key, Map<String, String> hash) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.hmset(key, hash); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String hget(String key, String field) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.hget(key, field); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public List<String> hmget(String key, String... fields) { Jedis jedis = null; List<String> res = null; try { jedis = pool.getResource(); res = jedis.hmget(key, fields); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long hincrby(String key, String field, Long value) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.hincrBy(key, field, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Boolean hexists(String key, String field) { Jedis jedis = null; Boolean res = false; try { jedis = pool.getResource(); res = jedis.hexists(key, field); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long hlen(String key) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.hlen(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long hdel(String key, String... fields) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.hdel(key, fields); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> hkeys(String key) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.hkeys(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public List<String> hvals(String key) { Jedis jedis = null; List<String> res = null; try { jedis = pool.getResource(); res = jedis.hvals(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Map<String, String> hgetall(String key) { Jedis jedis = null; Map<String, String> res = null; try { jedis = pool.getResource(); res = jedis.hgetAll(key); } catch (Exception e) { // TODO } finally { returnResource(pool, jedis); } return res; } @Override public Long lpush(String key, String... strs) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.lpush(key, strs); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long rpush(String key, String... strs) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.rpush(key, strs); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long linsert(String key, LIST_POSITION where, String pivot, String value) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.linsert(key, where, pivot, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String lset(String key, Long index, String value) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.lset(key, index, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long lrem(String key, long count, String value) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.lrem(key, count, value); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String ltrim(String key, long start, long end) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.ltrim(key, start, end); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override synchronized public String lpop(String key) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.lpop(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override synchronized public String rpop(String key) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.rpop(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String rpoplpush(String srckey, String dstkey) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.rpoplpush(srckey, dstkey); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String lindex(String key, long index) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.lindex(key, index); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long llen(String key) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.llen(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public List<String> lrange(String key, long start, long end) { Jedis jedis = null; List<String> res = null; try { jedis = pool.getResource(); res = jedis.lrange(key, start, end); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long sadd(String key, String... members) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.sadd(key, members); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long srem(String key, String... members) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.srem(key, members); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String spop(String key) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.spop(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> sdiff(String... keys) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.sdiff(keys); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long sdiffstore(String dstkey, String... keys) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.sdiffstore(dstkey, keys); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> sinter(String... keys) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.sinter(keys); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long sinterstore(String dstkey, String... keys) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.sinterstore(dstkey, keys); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> sunion(String... keys) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.sunion(keys); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long sunionstore(String dstkey, String... keys) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.sunionstore(dstkey, keys); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long smove(String srckey, String dstkey, String member) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.smove(srckey, dstkey, member); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long scard(String key) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.scard(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Boolean sismember(String key, String member) { Jedis jedis = null; Boolean res = null; try { jedis = pool.getResource(); res = jedis.sismember(key, member); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String srandmember(String key) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.srandmember(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> smembers(String key) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.smembers(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zadd(String key, double score, String member) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zadd(key, score, member); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zrem(String key, String... members) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zrem(key, members); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Double zincrby(String key, double score, String member) { Jedis jedis = null; Double res = null; try { jedis = pool.getResource(); res = jedis.zincrby(key, score, member); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zrank(String key, String member) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zrank(key, member); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zrevrank(String key, String member) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zrevrank(key, member); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> zrevrange(String key, long start, long end) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.zrevrange(key, start, end); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> zrangebyscore(String key, String max, String min) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.zrevrangeByScore(key, max, min); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> zrangeByScore(String key, double max, double min) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.zrevrangeByScore(key, max, min); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zcount(String key, String min, String max) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zcount(key, min, max); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zcard(String key) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zcard(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Double zscore(String key, String member) { Jedis jedis = null; Double res = null; try { jedis = pool.getResource(); res = jedis.zscore(key, member); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zremrangeByRank(String key, long start, long end) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zremrangeByRank(key, start, end); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Long zremrangeByScore(String key, double start, double end) { Jedis jedis = null; Long res = null; try { jedis = pool.getResource(); res = jedis.zremrangeByScore(key, start, end); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public Set<String> keys(String pattern) { Jedis jedis = null; Set<String> res = null; try { jedis = pool.getResource(); res = jedis.keys(pattern); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } @Override public String type(String key) { Jedis jedis = null; String res = null; try { jedis = pool.getResource(); res = jedis.type(key); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } /** * 返还到连接池 * * @param pool * @param jedis */ private static void returnResource(JedisPool pool, Jedis jedis) { if (jedis != null) { jedis.close(); } } @Override public Date getExpireDate(String key) { Jedis jedis = null; Date res = new Date(); try { jedis = pool.getResource(); res = new DateTime().plusSeconds(jedis.ttl(key).intValue()).toDate(); } catch (Exception e) { LOGGER.error(e.getMessage()); } finally { returnResource(pool, jedis); } return res; } }
[ "jpds_lmj@outlook.com" ]
jpds_lmj@outlook.com
6700d0d70aca65bff447f52b630ba22336fa62e2
3e31cd0b8fe706802335cc1010ba5e6b2a3df299
/menuprograma/src/principal.java
21f20cc7f834bc47d0e3e8da39822dc72ceae6a2
[]
no_license
NandoHAlti/Java
5abb8ae49185bbf0124863f88824c0c27ea98e85
ec2a88578cad4a35849486825d1c814f53f7ef07
refs/heads/master
2021-05-29T22:16:46.148132
2015-09-12T17:39:30
2015-09-12T17:39:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,144
java
import java.util.ArrayList; import java.util.List; public class principal { /** * @param args */ public static boolean esmenor (int a, int b) { boolean menor; if (a <= b) { menor = true; } else { menor = false; } return menor; } public static boolean sube (List<Integer> lista) { boolean sube = false; boolean salgo = false; int i = 0; do { if (esmenor(lista.get(i), lista.get(i+1))) { i++; } else { salgo = true; } }while (i < lista.size() - 1 && !salgo); if (i == lista.size() - 1) { sube = true; } return sube; } public static boolean hay(List<Integer> lista, int i) { boolean esta = false; if (i <= lista.size() - 1) { esta = true; } return esta; } public static void main(String[] args) { // TODO Auto-generated method stub int opcion; List <Integer> lista = new ArrayList<Integer>(); do{ System.out.println("1- Insertar elemento"); System.out.println("2- Borrar elemento"); System.out.println("3- Despliega lista y cantidad de elementos"); System.out.println("4- Salir"); System.out.println("5- Verificar orden de lista"); System.out.println("6- Busca un elemento en la lista"); System.out.print("Seleccione su opcion: "); opcion = Teclado.LeerEntero(); switch (opcion) { case 1: int elem = 0; System.out.println(""); System.out.print("Ingrese elemento: "); elem = Teclado.LeerEntero(); System.out.println(""); lista.add(elem); System.out.println("Elemento insertado con exito"); break; case 2: if (lista.size() == 0) { System.out.println("La lista esta vacia"); } else { System.out.println(""); System.out.print("Ingrese el lugar que desea borrar: "); System.out.println(""); int point = Teclado.LeerEntero(); if (point <= lista.size() - 1) { lista.remove(point); System.out.println("Elemento removido con exito"); } else { System.out.println("No existe el elemento"); } } break; case 3: System.out.println(""); if (lista.size() == 0) { System.out.println("Lista vacia"); } else { System.out.println("Total: " + lista.size() + " elementos"); for (int i = 0; i < lista.size(); i++) { System.out.println("Posicion(" + i + "): " + lista.get(i)); } } System.out.println(""); break; case 4: break; case 5: boolean orden = sube(lista); if (orden) { System.out.println(""); System.out.println("Lista ordenada"); System.out.println(""); } else { System.out.println(""); System.out.println("Lista no ordenada"); System.out.println(""); } break; case 6: System.out.println("Ingrese lugar a buscar: "); int i = Teclado.LeerEntero(); if (hay(lista, i)) { System.out.print("El elemento es: " + lista.get(i)); } else { System.out.println("No hay elementos en esa posicion"); } break; default: System.out.println(""); System.out.println("Debe ingresar 1, 2, 3, 4, 5 o 6 segun la opcion"); System.out.println(""); } }while (opcion != 4); } }
[ "hemmanuel44@gmail.com" ]
hemmanuel44@gmail.com
68861cf254646e4f8ab442ab5279988c1899d09b
2b719a26f8e8b86df0afc4737cd564a01be9c196
/swingUI/src/main/java/com/soflod/agenda/swingui/PannelloRegistrazione.java
eb19dc948ba850624d828e1d5fda81e79cf9539d
[]
no_license
loryDivo/Sofload_Agenda
17a46f7171c95d006af6cf8569eeba513b859e4f
26caa91940f746e9897bee62c974e04eba51be4f
refs/heads/master
2021-09-24T16:08:54.502540
2018-10-11T15:30:52
2018-10-11T15:30:52
87,449,164
0
0
null
null
null
null
UTF-8
Java
false
false
6,159
java
package com.soflod.agenda.swingui; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Arrays; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import com.j256.ormlite.logger.Logger; import com.j256.ormlite.logger.LoggerFactory; import com.soflod.agenda.swingui.exception.UtenteNonValidoException; public class PannelloRegistrazione extends JPanel { private JLabel labelNome; private JTextField campoTestoNome; private JPasswordField campoPassword; private JLabel labelPassword; private JPasswordField confermaPassword; private JLabel labelConfermaPassword; private JLabel labelPasswordNonCoincidente; private JLabel labelNomeUtenteNonDiposinibile; private JButton btnRegistrazione; private transient LoginUtility loginUtility; private transient Logger logger = LoggerFactory.getLogger(PannelloRegistrazione.class); public PannelloRegistrazione(LoginUtility loginUtility) { this.loginUtility = loginUtility; labelNome = new JLabel("Nome utente:"); campoTestoNome = new JTextField(); campoTestoNome.setText("Inserisci il tuo nome utente."); campoTestoNome.setColumns(40); labelNomeUtenteNonDiposinibile = new JLabel("Nome utente non disponibile"); labelNomeUtenteNonDiposinibile.setForeground(Color.red); labelNomeUtenteNonDiposinibile.setVisible(false); labelPassword = new JLabel("Password:"); campoPassword = new JPasswordField(); campoPassword.setColumns(40); labelConfermaPassword = new JLabel("Conferma password:"); confermaPassword = new JPasswordField(); confermaPassword.setColumns(40); labelPasswordNonCoincidente = new JLabel("Le password non coincidono"); labelPasswordNonCoincidente.setForeground(Color.RED); labelPasswordNonCoincidente.setVisible(false); btnRegistrazione = new JButton("Registrati"); setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); gc.gridx = 0; gc.gridy = 0; gc.anchor = GridBagConstraints.WEST; add(labelNome, gc); gc.gridx = 0; gc.gridy = 1; add(campoTestoNome, gc); gc.gridx = 1; gc.gridy = 1; add(labelNomeUtenteNonDiposinibile, gc); gc.gridx = 0; gc.gridy = 2; gc.anchor = GridBagConstraints.WEST; add(labelPassword, gc); gc.gridx = 0; gc.gridy = 3; add(campoPassword, gc); gc.gridx = 0; gc.gridy = 4; gc.anchor = GridBagConstraints.WEST; add(labelConfermaPassword, gc); gc.gridx = 0; gc.gridy = 5; add(confermaPassword, gc); gc.gridx = 1; gc.gridy = 5; add(labelPasswordNonCoincidente, gc); gc.gridx = 0; gc.gridy = 6; add(btnRegistrazione, gc); /** * Al click del mouse sul button registra verranno effettuati * vari controlli prima di procedere all'effettiva registrazione * dell'utente */ btnRegistrazione.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { registrati(campoTestoNome.getText(), campoPassword.getPassword()); } }); /** * Se clicco con il mouse si disattiva la label di informazione * relativa alla password non coincidente */ this.confermaPassword.addMouseListener(new MouseListener() { public void mouseExited(MouseEvent e) { // evento non usato } public void mouseClicked(MouseEvent e) { labelPasswordNonCoincidente.setVisible(false); adattaDimensioniDialog(); } public void mouseReleased(MouseEvent e) { // evento non usato } public void mouseEntered(MouseEvent e) { // evento non usato } public void mousePressed(MouseEvent e) { // evento non usato } }); /** * Se clicco con il mouse si disattiva la label di informazione * relativa all'utente non disponibile per la registrazione */ this.campoTestoNome.addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent e) { // evento non usato } public void mousePressed(MouseEvent e) { labelNomeUtenteNonDiposinibile.setVisible(false); adattaDimensioniDialog(); } public void mouseExited(MouseEvent e) { // evento non usato } public void mouseEntered(MouseEvent e) { // evento non usato } public void mouseClicked(MouseEvent e) { // evento non usato } }); } private void registrati(String nomeUtente, char[] password){ if (!loginUtility.verificaNomeUtenteUsato(nomeUtente)) { if (!loginUtility.verificaCoincidenzaPassword(campoPassword.getPassword(), confermaPassword.getPassword())) { if (!labelPasswordNonCoincidente.isVisible()) labelPasswordNonCoincidente.setVisible(true); adattaDimensioniDialog(); } else { try { loginUtility.registrazioneNuovoUtente(nomeUtente, password); } catch (UtenteNonValidoException e) { logger.info(e, e.getMessage()); // Non gestito, controllo gia effettuato } registrati(nomeUtente, password); JDialog dialogParent = (JDialog) getRootPane().getParent(); dialogParent.dispose(); } } else { if (!labelNomeUtenteNonDiposinibile.isVisible()) { labelNomeUtenteNonDiposinibile.setVisible(true); JDialog dialogParent = (JDialog) getRootPane().getParent(); dialogParent.pack(); } } } public String getTextnome() { return this.campoTestoNome.getText(); } public String getPassword() { char[] tmp = this.campoPassword.getPassword(); return Arrays.toString(tmp); } public String getConfermaPassword() { char[] tmp = this.confermaPassword.getPassword(); return Arrays.toString(tmp); } private void adattaDimensioniDialog() { ((JDialog) this.getRootPane().getParent()).pack(); } }
[ "Lorenzo@DESKTOP-TBKV20O.homenet.telecomitalia.it" ]
Lorenzo@DESKTOP-TBKV20O.homenet.telecomitalia.it
a19590a2945be2b5f6162ec71107ef7d20f197c5
612858a168e79e4e1a43a5646168e2c7419b6a30
/light/light/com/easyctrl/iface/ProcesInstructImpl.java
a7884e9a41b2840a6f0235f58eed3fc27a5d1a4a
[ "Apache-2.0" ]
permissive
cansou/mtool
a36841d6eeafd7f851520a09e346e7c758c4bdc3
06e26d013f85cc5c534a3fb5a8561866cac9ff69
refs/heads/master
2022-02-24T09:19:49.238728
2019-11-20T02:13:29
2019-11-20T02:13:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package com.easyctrl.iface; public interface ProcesInstructImpl { void ammingProce(int i, int i2, int i3); void lampProce(int i, int i2, int i3); void loginApp(int i); void loginSettingProce(int i); }
[ "15297886277@163.com" ]
15297886277@163.com
73e8b2770ad4c6d837aadc5f3c569db577685760
2e1705f77e0fd58c7164fe3035e83e640bfecab6
/app/src/main/java/mvvm/steelkiwi/com/moviefinder/base/mvvm/RecyclerBindingAdapter.java
fe0f020838fbf0dde26aa15a023c411a8c32f6f7
[ "Apache-2.0" ]
permissive
BohdanSamusko/MovieFinderMVVM
550e4cf6fc90cd31bf792c5ff346eb945b952ca0
3c473517517f58c738b6fd17b014d92f091c5243
refs/heads/master
2021-01-23T05:04:33.977087
2017-05-31T15:26:48
2017-05-31T15:26:48
92,954,095
0
0
null
null
null
null
UTF-8
Java
false
false
2,762
java
package mvvm.steelkiwi.com.moviefinder.base.mvvm; import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.AbstractList; import java.util.ArrayList; public class RecyclerBindingAdapter<T> extends RecyclerView.Adapter<RecyclerBindingAdapter.BindingHolder> { private int holderLayout, variableId; private AbstractList<T> items = new ArrayList<>(); private OnItemClickListener<T> onItemClickListener; private PaginationListener<T> paginationListener; public RecyclerBindingAdapter(int holderLayout, int variableId, AbstractList<T> items) { this.holderLayout = holderLayout; this.variableId = variableId; this.items = items; } @Override public RecyclerBindingAdapter.BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()) .inflate(holderLayout, parent, false); return new BindingHolder(v); } @Override public void onBindViewHolder(RecyclerBindingAdapter.BindingHolder holder, final int position) { final T item = items.get(position); holder.getBinding().getRoot().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (onItemClickListener != null) onItemClickListener.onItemClick(position, item); } }); // checking for last item (pagination) if (paginationListener != null && position == items.size() - 1) { paginationListener.atTheEndOfList(position, item); } holder.getBinding().setVariable(variableId, item); } @Override public int getItemCount() { return items.size(); } public void setOnItemClickListener(OnItemClickListener<T> onItemClickListener) { this.onItemClickListener = onItemClickListener; } public void setPaginationListener(PaginationListener<T> paginationListener) { this.paginationListener = paginationListener; } public interface OnItemClickListener<T> { void onItemClick(int position, T item); } public interface PaginationListener<T> { void atTheEndOfList(int position, T item); } public static class BindingHolder extends RecyclerView.ViewHolder { private ViewDataBinding binding; public BindingHolder(View v) { super(v); binding = DataBindingUtil.bind(v); } public ViewDataBinding getBinding() { return binding; } } }
[ "samusko@steelkiwi.com" ]
samusko@steelkiwi.com
515c7389edf6c34e8f12c699407ba00faf91493e
501bea37673d94df48de89ffd96f43fd42ca64ab
/Q20.java
0966309f9b2b09f64cec87ac31ab28b11c7cdaf8
[]
no_license
cuizhouying95/jizhioffer
7150a18806092ced1783b605a2694645905f9633
341f2b773b270b4308e8fc71837f53b302a918ef
refs/heads/master
2020-06-12T15:55:06.771955
2019-07-13T12:13:59
2019-07-13T12:13:59
194,352,974
0
0
null
null
null
null
GB18030
Java
false
false
858
java
package jianzhioffer; import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; //从上往下打印出二叉树的每个节点,同层节点从左至右打印。 public class Q20 { public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; } } public ArrayList<Integer> PrintFromTopToBottom(TreeNode root){ ArrayList<Integer> list=new ArrayList<Integer>(); if(root==null) { return list; } Queue<TreeNode> queue=new LinkedList<TreeNode>(); queue.offer(root); while(!queue.isEmpty()) { TreeNode tmp=queue.poll(); if(tmp.left!=null) { queue.offer(tmp.left); } if(tmp.right!=null) { queue.offer(tmp.right); } list.add(tmp.val); } return list; } }
[ "noreply@github.com" ]
noreply@github.com
c620e733bc1cc1b8bc5680c2fbf55600ff5347b6
6cce5b27eee839549bad980046173ec7e7ceeec7
/src/main/java/com/abcft/system/privilege/PrivilegeDao.java
e49e18466dded6cca2f5a7232f11105ceb2015b0
[]
no_license
lrhcyh/maven
4cd36c8af1c57975c05ade4093ba74c8be6b0dae
d10fadec9b4cbfb5e0668a70a95b1ae89f4e5ade
refs/heads/master
2021-05-05T05:56:27.661968
2018-01-25T09:24:14
2018-01-25T09:24:14
118,719,043
0
0
null
null
null
null
UTF-8
Java
false
false
5,900
java
package com.abcft.system.privilege; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Repository; import com.abcft.common.base.BaseDao; import com.abcft.common.base.EntityMapper; /** * 权限操作 * * @author Administrator * */ @Repository public class PrivilegeDao extends BaseDao { /** * 查询菜单 * * @return */ public List<Functions> getFunctions() { String sql = "SELECT Id,Parent_Id,Create_Time,Function_Name,Description,Url,IsLeaf,sortnum,isShow from backend_functions order by sortnum"; return createQuery(sql, Functions.class).getResultList(); } /** * 插入节点 * * @param function */ public Long insertFunction(Functions function) { String sql = " insert into backend_functions (parent_id,function_name,description,url,isLeaf,create_time,isShow) values (?,?,?,?,?,now(),?);" + " "; List<Object> list = new ArrayList<Object>(); list.add(function.getParentid()); list.add(function.getFunctionName()); list.add(null); list.add(function.getUrl()); list.add("1"); list.add("1"); getJdbcTemplate().update(sql.toString(), list.toArray()); String sql4 = "UPDATE backend_functions SET sortnum=@@IDENTITY WHERE ID=@@IDENTITY;"; getJdbcTemplate().update(sql4.toString()); // 将父节点的isLeaf设置为0 String sql2 = "update backend_functions set isLeaf=0 where id=" + function.getParentid(); getJdbcTemplate().update(sql2.toString()); // 返回id String sql3 = "SELECT ID FROM backend_functions WHERE ID=@@IDENTITY"; return getJdbcTemplate().queryForLong(sql3); } /** * 修改节点 * * @param function */ public void updateFunction(Functions function) { String sql = " update backend_functions set function_name=?,description=?,url=?,isLeaf=?,create_time=now() where id=? "; List<Object> list = new ArrayList<Object>(); list.add(function.getFunctionName()); list.add(null); list.add(function.getUrl()); list.add("1"); list.add(function.getId()); getJdbcTemplate().update(sql.toString(), list.toArray()); } /** * 根据父节点找到孩子节点 * * @return */ public List<Functions> getFunctionsParent(Integer roleId, Integer id) { String sql = "SELECT distinct tf.id,tf.parent_id,tf.create_time,tf.function_name,tf.description,tf.url,tf.isLeaf,sortnum from backend_functions tf join backend_roleright tr on tf.id=tr.function_id where tf.isShow=1 "; List<Object> params = new ArrayList<Object>(); if (id != null) { sql += " and tf.parent_id=?"; params.add(id); } if (roleId != null && roleId!= 0 ) { sql += " and tr.role_id= ?"; params.add(roleId); } sql += " order by sortnum"; return getJdbcTemplate().query(sql, new EntityMapper(Functions.class), params.toArray()); } /** * 根据父节点找到孩子节点 * * @return */ public List<Functions> getFunctionsParent(int parentId) { String sql = "SELECT t.id,t.parent_id,t.create_time,t.function_name,t.description,t.url,t.isLeaf from backend_functions t where parent_id=" + parentId + " and isShow=1 order by sortnum"; return createQuery(sql, Functions.class).getResultList(); } /** * 拖拽菜单节点 根据id交换两个节点的排序位置 * * @param sourceId * @param targetId * @param sourceNum * @param targetNum */ public void dragNode(Long sourceId, Long targetId, Long sourceNum, Long targetNum) { String sql = " update backend_functions set sortnum=? where id=? "; List<Object> list = new ArrayList<Object>(); list.add(targetNum); list.add(sourceId); getJdbcTemplate().update(sql.toString(), list.toArray()); String sql2 = " update backend_functions set sortnum=? where id=? "; List<Object> list2 = new ArrayList<Object>(); list2.add(sourceNum); list2.add(targetId); getJdbcTemplate().update(sql2.toString(), list2.toArray()); } public void deleteFunction(Long id) { String sql1 = "select isLeaf from backend_functions where id=" + id; // 非叶子节点,不进行任何操作 if (getJdbcTemplate().queryForInt(sql1) == 0) { return; } // 删除节点以前判断其父节点是否还有子节点 Integer pid = getJdbcTemplate().queryForInt("SELECT PARENT_ID FROM backend_functions WHERE ID=" + id); String sql2 = " SELECT COUNT(*) FROM backend_functions WHERE PARENT_ID=" + pid; Integer count = getJdbcTemplate().queryForInt(sql2); if (count == null || count == 1) { String sql3 = "UPDATE backend_functions SET ISLEAF=1 WHERE ID = " + pid; getJdbcTemplate().update(sql3); } String sql = "delete from backend_functions where id= " + id; getJdbcTemplate().update(sql); } /** * 修改节点是否显示 * * @param id * @param isShow */ public void updateIsShow(Long id, Integer isShow) { String sql = "update backend_functions set isShow=" + isShow + " where id=" + id; getJdbcTemplate().update(sql); } /** * 判断节点能否隐藏 * * @param id * @return */ public int nodeCanHide(Long id) { String sql = "select count(*) from backend_functions where parent_id=" + id + " and isShow=1"; return getJdbcTemplate().queryForInt(sql); } /** * 根据角色id获得对应的url * @param integer * @return */ public List<String> getRoleUrls(Integer roleid) { String sql = "select URL from backend_functions f join backend_roleright r on f.id = r.function_id where r.role_id = ? "; List<Object> params = new ArrayList<Object>(); params.add(roleid); return getJdbcTemplate().queryForList(sql,params.toArray(), String.class); } public List<String> getModulesByRoleId(Integer roleid) { String sql = "select function_id from backend_functions f join backend_roleright r on f.id = r.function_id where r.role_id = ? "; List<Object> params = new ArrayList<Object>(); params.add(roleid); return getJdbcTemplate().queryForList(sql,params.toArray(), String.class); } }
[ "lrhcyh@163.com" ]
lrhcyh@163.com
0b407f2cd699e78c87eb0797aec400837312901d
543bed52a2fa6abad9d03c89dbb5b7b5d2389c5d
/src/main/java/com/sizzlebae/projectseptium/blocks/BlockCrystal.java
442aaffb70799e8b57b980b68ac06bd46ad55283
[]
no_license
SizzleBae/project-septium_1.15
bb342ba28b7402a2b648451441f1cd212d9c6f98
7f45d97102f2ccba33dc3c2ecac834e9f16e3e7f
refs/heads/master
2023-01-06T03:08:27.417959
2020-10-27T01:54:59
2020-10-27T01:54:59
297,730,234
0
0
null
null
null
null
UTF-8
Java
false
false
1,644
java
package com.sizzlebae.projectseptium.blocks; import com.sizzlebae.projectseptium.capabilities.AetherType; import com.sizzlebae.projectseptium.tileentity.ModTileEntities; import com.sizzlebae.projectseptium.utils.IAetherTypeHolder; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.DirectionalBlock; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.StateContainer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.world.IBlockReader; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class BlockCrystal extends DirectionalBlock implements IAetherTypeHolder { final AetherType aetherType; public BlockCrystal(AetherType aetherType) { super(Block.Properties.create(Material.ROCK).notSolid()); this.aetherType = aetherType; } protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(FACING); } @Override public BlockState getStateForPlacement(@Nonnull BlockItemUseContext context) { return this.getDefaultState().with(FACING, Direction.random(context.getWorld().getRandom())); } @Override public boolean hasTileEntity(BlockState state) { return true; } @Nullable @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return ModTileEntities.AETHER_CONTAINER.create(); } @Override public AetherType getAetherType() { return aetherType; } }
[ "eragongreat@outlook.com" ]
eragongreat@outlook.com
7dc43f7b6f17e6290e7d5ff83c5cb3387ed3314d
e9ab4113b355b247555f3fb2edd0ab2c66f5a224
/src/top/zhyee/java/leetcode/simple/PascalTriangleII.java
b3bccfe002d41296d4a1ab020ba8d0e5dbdedfe9
[]
no_license
yanyzy/leetcode
015b3860e06c99884c8cea54a33afb6eaf1e2c67
09bdb10b4cb20783dd9c3b1bfb9f6ae1d62a6e3b
refs/heads/master
2021-07-05T08:59:06.380305
2020-07-21T08:48:24
2020-07-21T08:48:24
128,915,448
1
0
null
null
null
null
UTF-8
Java
false
false
1,178
java
package top.zhyee.java.leetcode.simple; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * @author zhyee * @date 2019/4/7 下午11:27 */ /** * 给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行。 * <p> * <p> * <p> * 在杨辉三角中,每个数是它左上方和右上方的数的和。 * <p> * 示例: * <p> * 输入: 3 * 输出: [1,3,3,1] */ public class PascalTriangleII { public List<Integer> getRow(int rowIndex) { List<List<Integer>> lists = new ArrayList<>(); for (int i = 1; i <= rowIndex + 1; i++) { if (lists.size() == 0) { lists.add(Collections.singletonList(1)); } else { List<Integer> list = new ArrayList<>(); for (int j = 1; j <= i; j++) { if (j == 1 || j == i) { list.add(1); } else { list.add(lists.get(i - 2).get(j - 2) + lists.get(i - 2).get(j - 1)); } } lists.add(list); } } return lists.get(rowIndex); } }
[ "1181862765@qq.com" ]
1181862765@qq.com
44dc9959711a3c505e85f8b64f4f685fdf94b947
2914b25ae11ebf6d213f4234e87a84e632794286
/app/src/main/java/com/arexperiments/justaline/view/PairButton.java
d980b9fd90a34f17d2d883d1a3670babe8e633ee
[ "Apache-2.0" ]
permissive
msk4862/justaline-android
6e3307f6b9c2760b63beab06c87a35d531c27c8d
aa22920236ee995c69633a298d24323967c8d298
refs/heads/master
2020-06-16T11:19:22.844488
2019-07-19T10:33:54
2019-07-19T10:33:54
195,553,022
1
0
Apache-2.0
2019-07-06T15:11:52
2019-07-06T15:11:52
null
UTF-8
Java
false
false
2,030
java
// Copyright 2018 Google LLC // // 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.arexperiments.justaline.view; import android.content.Context; import android.support.constraint.ConstraintLayout; import android.util.AttributeSet; import android.widget.ImageView; import com.arexperiments.justaline.PairSessionManager; import com.arexperiments.justaline.R; /** * Created by Kat on 3/29/18. */ public class PairButton extends ConstraintLayout implements PairSessionManager.PartnerUpdateListener { private ImageView mIcon; public PairButton(Context context) { super(context); init(); } public PairButton(Context context, AttributeSet attrs) { super(context, attrs); init(); } public PairButton(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init() { inflate(getContext(), R.layout.view_pair_button, this); mIcon = findViewById(R.id.icon); } private void setCount(int count) { if (count < 2) { mIcon.setActivated(false); } else { mIcon.setActivated(true); } } @Override public void onPartnerCountChanged(int partnerCount) { setCount(partnerCount); } @Override public void onConnectedToSession() { mIcon.setSelected(true); } @Override public void onDisconnectedFromSession() { mIcon.setSelected(false); } }
[ "jongejan@google.com" ]
jongejan@google.com
f70b77c3ba3f6f180bbed827b5dcb74ab6d4cba2
ea08265d7690aa6456ae1c9144018e1dc8a17a93
/src/main/java/com/mzl/interfaces/AttemptToUseBasic.java
184fc9a1322dc026078277d9f8a6b2c9113a040f
[]
no_license
huagenlike/java8
eb97b455f60cc22fb0eefac41e5f21c28470fce5
c76531e807a634ea33bb961dad0638b65393384e
refs/heads/master
2023-02-27T19:38:01.279679
2021-02-09T09:10:22
2021-02-09T09:10:22
277,754,815
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
package com.mzl.interfaces; /** * @ClassName: AttemptToUseBasic * @Description: * @author:lhg * @data:2020/11/17 10:17 * @Version:1.0 * 抽象类是不完整的,当试图创建这个类的时候,会得到编译器的错误提示 **/ public class AttemptToUseBasic { // error: Basic is abstract; cannot be instantiated // Basic b = new Basic(); }
[ "34886711@qq.com" ]
34886711@qq.com
00dc397c4741a00a5886e680ebe1ed180c2d0645
cba71c4c85b6de2d5778d24ba0912b8515c8c9dc
/GeoBook/app/src/main/java/com/katriel/geobook/bl/entities/User.java
fb99cde6a65684bfa2b1134311735e642c1edb97
[]
no_license
shlomikatriel/GeoBook
c393b692cb3df38e0286e90816be56cad8830139
8665c5e0100e82a0bc6d25c3f587a048ac158621
refs/heads/master
2021-03-16T07:35:00.861922
2017-10-03T03:21:09
2017-10-03T03:21:09
98,641,072
0
1
null
null
null
null
UTF-8
Java
false
false
1,000
java
package com.katriel.geobook.bl.entities; public class User { private String uid; private String email; private String displayName; public User(String uid, String email, String displayName) { this.uid = uid; this.email = email; this.displayName = displayName; } public User(User other) { this.uid = other.getUid(); this.email = other.getEmail(); this.displayName = other.getDisplayName(); } public String getUid() { return uid; } public String getEmail() { return email; } public String getDisplayName() { return displayName; } @Override public String toString() { return displayName; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; return uid != null ? uid.equals(user.uid) : user.uid == null; } @Override public int hashCode() { return uid != null ? uid.hashCode() : 0; } }
[ "shlomikatriel@gmail.com" ]
shlomikatriel@gmail.com
1f078a4cd310ec6f88784492544c6d4c52592329
c07f6b3ade42c83fcd66ade5b51a2845256635be
/app/src/main/java/org/testapp/window/TestWindowActivity.java
435327d8ad1cd72f48e9133a78f496fbc43017aa
[]
no_license
dyf505776897/TestApp
af7d6af9d7ca383e3d81afc38f7592497e9c7b3a
53b2e9d02fe1f276c738c061d5ea31a716fc5561
refs/heads/master
2021-01-21T21:26:19.783763
2016-06-29T09:24:07
2016-06-29T09:24:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,124
java
package org.testapp.window; import android.graphics.PixelFormat; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.widget.Button; /** * @author 赵树豪 * @version 1.0 */ public class TestWindowActivity extends AppCompatActivity { private WindowManager mWindowManager; private WindowManager.LayoutParams mLayoutParams; private Button mWindowButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWindowWidth = getWindowManager().getDefaultDisplay().getWidth(); } private int mWindowWidth; @Override protected void onResume() { super.onResume(); mWindowButton = new Button(this); mWindowButton.setText("测试"); mWindowButton.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int rawX = (int) event.getRawX(); int rawY = (int) event.getRawY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: setWindowPosition(rawX, rawY); break; case MotionEvent.ACTION_MOVE: setWindowPosition(rawX, rawY); break; case MotionEvent.ACTION_UP: if (rawX <= mWindowWidth / 2) { rawX = 0; } else { rawX = mWindowWidth; } setWindowPosition(rawX, rawY); break; default: break; } return false; } }); mWindowManager = getWindowManager(); mLayoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, 0, PixelFormat.TRANSPARENT); mLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; mLayoutParams.gravity = Gravity.LEFT | Gravity.TOP; mLayoutParams.x = 0; mLayoutParams.y = 0; mWindowManager.addView(mWindowButton, mLayoutParams); } private void setWindowPosition(int rawX, int rawY) { int btnWidht = mWindowButton.getLayoutParams().width; int btnHeight = mWindowButton.getLayoutParams().height; // TODO: 2016/6/29 解决滑动时中心点的问题 mLayoutParams.x = rawX; mLayoutParams.y = rawY; mWindowManager.updateViewLayout(mWindowButton, mLayoutParams); } @Override public void onContentChanged() { super.onContentChanged(); } }
[ "3104517435@qq.com" ]
3104517435@qq.com
db18604ca0830bf5ced95e173e385f204aa052a0
88a270802e748ff9ab5aa382d58d981a2660c04d
/app/src/main/java/jenny/kaist/ac/kr/kaisttaxi/SoundService.java
8b02574c5a1d11cdeb069935f42f49fc6c923020
[]
no_license
missty/KaistTaxi
0b4077817a494c564079d2e8453f5843d58d4882
07cdf9042204d624816707ee9c5ec728ce270f35
refs/heads/master
2021-05-02T14:46:10.017848
2019-07-22T18:16:48
2019-07-22T18:16:48
120,725,368
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package jenny.kaist.ac.kr.kaisttaxi; import android.app.Service; import android.content.Intent; import android.media.MediaPlayer; import android.os.IBinder; public class SoundService extends Service { MediaPlayer player; @Override public IBinder onBind(Intent intent) { return null; } public void onCreate() { player = MediaPlayer.create(this, R.raw.hello); //select music file player.setLooping(false); //set looping } public int onStartCommand(Intent intent, int flags, int startId) { player.start(); return Service.START_NOT_STICKY; } public void onDestroy() { player.stop(); player.release(); stopSelf(); super.onDestroy(); } }
[ "missty82@gmail.com" ]
missty82@gmail.com
1c5885dcdd72d9afbe88fe44edf11f429711b7ba
7503a163f8428394f66605d015822b0fac2b9ee4
/app/src/main/java/nrega/worker/Adapters/NamesAdapter.java
7f413daeea2b0be604775f9ca3d0ea3db7c40c97
[]
no_license
hkoolwal34/worker
34a01926a16522da66f10278969be69a5d1d7c07
f7f5e3b2c0d9dc76d7e2a3db42d798520b4baf24
refs/heads/master
2021-05-12T19:01:42.253895
2018-04-08T07:47:56
2018-04-08T07:47:56
117,080,232
0
1
null
2018-02-19T17:52:28
2018-01-11T09:40:52
Java
UTF-8
Java
false
false
3,365
java
package nrega.worker.Adapters; import android.content.Context; import android.graphics.Color; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.androidquery.AQuery; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.jar.Attributes; import nrega.worker.R; /** * Created by dell-pc on 3/27/2017. */ public class NamesAdapter extends RecyclerView.Adapter<NamesAdapter.ProductViewHolder>{ Context appContext; public ArrayList<JSONObject> data; public Map<Integer,Integer> params = new HashMap <Integer, Integer>(); public NamesAdapter(Context context,ArrayList<JSONObject> array){ appContext=context; data=array; } @Override public ProductViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.name_layout_list, parent, false); ProductViewHolder productViewHolder = new ProductViewHolder(view); return productViewHolder; } @Override public void onBindViewHolder(final ProductViewHolder holder, int position) { try { JSONObject jsonObject = data.get(position); new AQuery(appContext).id(holder.name).text(jsonObject.getString("workerName")); new AQuery(appContext).id(holder.gender).text(jsonObject.getString("gender")); new AQuery(appContext).id(holder.age).text(jsonObject.getString("age")); //new AQuery(appContext).id(holder.gender).text(jsonObject.getString("name3")); } catch (JSONException e) { e.printStackTrace(); Toast.makeText(appContext, e.toString(), Toast.LENGTH_SHORT).show(); } } @Override public int getItemCount() { return data.size(); } public class ProductViewHolder extends RecyclerView.ViewHolder { TextView name; TextView gender; TextView age; CardView cv; int count; public ProductViewHolder(final View itemView) { super(itemView); name = (TextView) itemView.findViewById(R.id.name); gender = (TextView) itemView.findViewById(R.id.gender); age = (TextView) itemView.findViewById(R.id.age); cv = (CardView) itemView.findViewById(R.id.View_card2); count =0; for(int i=0;i<data.size();i++){ params.put(i,0); } cv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(count ==0) { cv.setBackgroundColor(Color.parseColor("#58EF61")); count =1; params.put(getAdapterPosition(),1); } else { cv.setBackgroundColor(Color.parseColor("#F4F4F4")); count=0; params.put(getAdapterPosition(),0); } } }); } } }
[ "shreyanshnawlakha@gmail.com" ]
shreyanshnawlakha@gmail.com
9526ade1d22b798fb03670d58f8e36d36d2fe628
1ef55a11969605b868d6d192341d7f65591c7075
/src/Test.java
41a5ac70dd4cce506acd7e1c29d2e6823852bfb9
[]
no_license
LamaBarri/SHOPP
6c52bcaa12e9c8da0ca4751b6c24929f212f3645
2cf2abbe41e07b014663c6efed1624beef6547ab
refs/heads/master
2020-04-25T06:38:02.089045
2019-02-25T21:37:14
2019-02-25T21:37:14
172,587,440
0
0
null
null
null
null
UTF-8
Java
false
false
1,342
java
import static org.junit.Assert.*; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; public class Test { static ShoppingCart cart ; @BeforeClass public static void setUpBeforeClass() throws Exception { cart= new ShoppingCart(); } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @org.junit.Test public void test1() { int expCount1=0; int actuaCountl=cart.getCount(); assertEquals(actuaCountl,expCount1); } @org.junit.Test public void test2() { Book book = new Book("Java Book", 127); cart.addBook(book); int expCount2=1; int expTotalPrice=127; int actualCount2=cart.getCount(); assertEquals(actualCount2,expCount2); int actualTotal= cart.totalprice(); assertEquals(actualTotal,expTotalPrice); } @org.junit.Test public void test3() { Book book2=new Book("Web design Book",100); cart.addBook(book2); int expCount3=2; int expTotalPrice2=227; int actualCount3=cart.getCount(); assertEquals(actualCount3,expCount3); int actualTotal2= cart.totalprice(); assertEquals(actualTotal2,expTotalPrice2); } }
[ "hp@DESKTOP-7FL2RPQ" ]
hp@DESKTOP-7FL2RPQ
ac582a7bc88c3f020dc4fbad4e1a568a901bf84f
6189ef7bf6e5c3d1cfc960d5f9aaeb31cc7a2ffc
/exception/StackTraceTest.java
b39b690b0fdbe6ed5909a14fa0e60c5594928317
[]
no_license
ZhangYiBoEE/Java-Core-v1
dbefe92eea02fdc818e4fe205642b817324d5a6a
8f4d2e9b20b3a8a03ee952142ca68ac21f544c22
refs/heads/master
2020-04-18T02:05:04.882842
2019-01-23T11:42:37
2019-01-23T11:42:37
167,146,602
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
package exception; import java.util.Scanner; public class StackTraceTest { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter n: "); int n = in.nextInt(); factorial(n); } public static int factorial(int n) { System.out.println("factorial(" + n + "):"); Throwable stack = new Throwable(); StackTraceElement[] frames = stack.getStackTrace(); for (StackTraceElement s : frames) { System.out.println(s); } int r; if (n <= 1) { r = 1; } else { r = n * factorial(n-1); } System.out.println("return " + r); return r; } }
[ "zhangyibo_ee@163.com" ]
zhangyibo_ee@163.com
0d3d723d29873d31a81361368c6754dd927ed42d
b4ff19bae9cbb1ba773aceb4ec263d6d4bc98cd9
/vucAndroid/app/src/main/java/dk/lundogbendsen/vuc/diverse/DiverseIO.java
e8ac6a33a58e1bca2dba0812b5212ba6ea85e6ef
[]
no_license
elek90/VUC-app
df769c889be4ae18d6bb9de01a5cfddb8eb03310
5d50a96e4e3d608504cce8a1a5e9d3998f756dc1
refs/heads/master
2021-01-18T07:04:09.243892
2016-02-09T20:36:54
2016-02-09T20:36:54
51,397,462
0
0
null
2016-02-09T20:30:50
2016-02-09T20:30:49
null
UTF-8
Java
false
false
5,556
java
package dk.lundogbendsen.vuc.diverse; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import dk.lundogbendsen.vuc.App; public class DiverseIO { /** * Tjek for om vi er på et netværk der kræver login eller lignende. * Se 'Handling Network Sign-On' i http://developer.android.com/reference/java/net/HttpURLConnection.html */ private static void tjekOmdirigering(URL u, HttpURLConnection urlConnection) throws IOException { URL u2 = urlConnection.getURL(); if (!u.getHost().equals(u2.getHost())) { // Vi blev omdirigeret Log.d("tjekOmdirigering " + u); Log.d("tjekOmdirigering " + u2); //Log.rapporterFejl(omdirigeringsfejl); throw new UnknownHostException("Der blev omdirigeret fra " + u.getHost() + " til " + u2.getHost()); } } public static String læsStreng(InputStream is) throws IOException, UnsupportedEncodingException { // Det kan være nødvendigt at hoppe over BOM mark - se http://android.forums.wordpress.org/topic/xml-pull-error?replies=2 //is.read(); is.read(); is.read(); // - dette virker kun hvis der ALTID er en BOM // Hop over BOM - hvis den er der! is = new BufferedInputStream(is); // bl.a. FileInputStream understøtter ikke mark, så brug BufferedInputStream is.mark(1); // vi har faktisk kun brug for at søge én byte tilbage if (is.read() == 0xef) { is.read(); is.read(); } // Der var en BOM! Læs de sidste 2 byte else is.reset(); // Der var ingen BOM - hop tilbage til start final char[] buffer = new char[0x3000]; StringBuilder out = new StringBuilder(); Reader in = new InputStreamReader(is, "UTF-8"); int read; do { read = in.read(buffer, 0, buffer.length); if (read > 0) { out.append(buffer, 0, read); } } while (read >= 0); in.close(); return out.toString(); } public static ArrayList<String> jsonArrayTilArrayListString(JSONArray j) throws JSONException { int n = j.length(); ArrayList<String> res = new ArrayList<String>(n); for (int i = 0; i < n; i++) { res.add(j.getString(i)); } return res; } public static String hentUrlSomStreng(String url) throws IOException { Log.d("hentUrlSomStreng lgd=" + url.length() + " " + url); URL u = new URL(url); HttpURLConnection urlConnection = (HttpURLConnection) u.openConnection(); urlConnection.setConnectTimeout(15000); urlConnection.setReadTimeout(90 * 1000); // 1 1/2 minut urlConnection.connect(); // http://stackoverflow.com/questions/8179658/urlconnection-getcontent-return-null InputStream is = urlConnection.getInputStream(); Log.d("åbnGETURLConnection url.length()=" + url.length() + " is=" + is + " is.available()=" + is.available()); if (urlConnection.getResponseCode() != 200) throw new IOException("HTTP-svar var " + urlConnection.getResponseCode() + " " + urlConnection.getResponseMessage() + " for " + u); tjekOmdirigering(u, urlConnection); return læsStreng(is); } public static JSONObject postJson(String url, String data) throws IOException, JSONException { //Log.d("postJson " + url+" med data="+data); URL u = new URL(url); HttpURLConnection urlConnection = (HttpURLConnection) u.openConnection(); urlConnection.setConnectTimeout(15000); urlConnection.setReadTimeout(90 * 1000); // 1 1/2 minut urlConnection.setRequestProperty("Content-Type", "application/json"); urlConnection.setDoOutput(true); urlConnection.connect(); // http://stackoverflow.com/questions/8179658/urlconnection-getcontent-return-null OutputStream os = urlConnection.getOutputStream(); os.write(data.getBytes()); os.close(); InputStream is = urlConnection.getInputStream(); if (urlConnection.getResponseCode() != 200) throw new IOException("HTTP-svar var " + urlConnection.getResponseCode() + " " + urlConnection.getResponseMessage() + " for " + u); tjekOmdirigering(u, urlConnection); return new JSONObject(læsStreng(is)); } public static int sletFilerÆldreEnd(File mappe, long tidsstempel) { int antalByteDerBlevSlettet = 0; int antalFilerDerBlevSlettet = 0; File[] files = mappe.listFiles(); if (files != null) { for (File file : files) { if (file.lastModified() < tidsstempel) { antalByteDerBlevSlettet += file.length(); antalFilerDerBlevSlettet++; file.delete(); } } } Log.d("sletFilerÆldreEnd: " + mappe.getName() + ": " + antalFilerDerBlevSlettet + " filer blev slettet, og " + antalByteDerBlevSlettet / 1000 + " kb frigivet"); return antalByteDerBlevSlettet; } public static File opretUnikFil(String filnavn, String endelse) { String tidsstempel = new SimpleDateFormat("MMdd_HHmm").format(new Date()); int n = 0; File fil; do { // lav unikt filnavn fil = new File(App.fillager, filnavn+"_"+tidsstempel+(n++==0?"":"_"+n) + endelse); Log.d("opretUnikFil "+fil); } while (fil.exists()); fil.getParentFile().mkdirs(); return fil; } }
[ "jacob.nordfalk@gmail.com" ]
jacob.nordfalk@gmail.com
3e831343a833788e81fdd9504f7469149bdf3b23
cba49fa30ad45cf11e94cb362894f689add59a14
/l09_Exam Prepartions/testmostwantedexam/src/main/java/mostwantedtest/domain/dtos/xml/BankAccountXml.java
d1869dce90c8a52695c3bc363255c5bbcecdd842
[]
no_license
AleksandarPetkov/JavaDB-Frameworks---Hibernate-Spring-Data
a730aa6ba14d1fcb21abf630291cba2acb1e5754
771c922f4fa97b745babba88ac3075ded36e0229
refs/heads/master
2020-04-02T16:32:04.567287
2019-01-11T09:08:22
2019-01-11T09:08:22
154,616,572
2
0
null
null
null
null
UTF-8
Java
false
false
1,080
java
package mostwantedtest.domain.dtos.xml; //<bank-account client="Elyn Grimditch"> //<account-number>84999053-X</account-number> //<balance>439216.96</balance> //</bank-account> import javax.xml.bind.annotation.*; import java.math.BigDecimal; @XmlRootElement(name = "bank-account") @XmlAccessorType(XmlAccessType.FIELD) public class BankAccountXml { @XmlAttribute(name = "client") private String client; @XmlElement(name = "account-number") private String accountNumber; @XmlElement(name = "balance") private BigDecimal balance; public BankAccountXml() { } public String getClient() { return client; } public void setClient(String client) { this.client = client; } public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public BigDecimal getBalance() { return balance; } public void setBalance(BigDecimal balance) { this.balance = balance; } }
[ "A.PetkovPetkov@gmail.com" ]
A.PetkovPetkov@gmail.com
086b7f9e2ed89c60e0064538528797fe8a4c4ee2
a4bb0f0c0dedb970bcda4b719f4e492f73484e5a
/trabalho1/src/main/java/br/ufla/enums/Types.java
32dc294b4fbb19baa7057bda6b9bbd138f6e8825
[]
no_license
FabricioRNGuimaraes/recuperacaoInformacao
c501608fcffb35c0b9cc5e6e39ec83b21dc98f3c
09aed59f98d7267fabb9da734084173d51c643d5
refs/heads/master
2020-05-30T10:52:12.624646
2013-03-12T02:10:23
2013-03-12T02:10:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
151
java
package br.ufla.enums; public enum Types { AB, AN, AU, CT, EX, MJ, MN, PN, RF, RN, SO, TI, NR, QN, QU, RD }
[ "fa1985@gmail.com" ]
fa1985@gmail.com
459bd1fd05573dd53e8465cceddfde7a023f2976
180e78725121de49801e34de358c32cf7148b0a2
/dataset/protocol1/yauaa/learning/3920/MatcherRequireAction.java
a84a2ee20bc2429c4ef67bfe82bea7d5625feee2
[]
no_license
ASSERT-KTH/synthetic-checkstyle-error-dataset
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
40c057e1669584bfc6fecf789b5b2854660222f3
refs/heads/master
2023-03-18T12:50:55.410343
2019-01-25T09:54:39
2019-01-25T09:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,450
java
/* * Yet Another UserAgent Analyzer * Copyright (C) 2013-2018 Niels Basjes * * 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 * * https://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 nl.basjes.parse.useragent.analyze; import nl.basjes.parse.useragent.analyze.treewalker.steps.WalkList.WalkResult; import nl.basjes.parse.useragent.parser.UserAgentTreeWalkerParser; import org.antlr.v4.runtime.ParserRuleContext;import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MatcherRequireAction extends MatcherAction { private static final Logger LOG = LoggerFactory.getLogger(MatcherRequireAction.class); public MatcherRequireAction(String config, Matcher matcher) { init(config, matcher); } protected ParserRuleContext parseWalkerExpression(UserAgentTreeWalkerParser parser) { return parser.matcherRequire(); } @Override public void initialize() { super.initialize(); evaluator.pruneTrailingStepsThatCannotFail(); } protected void setFixedValue(String fixedValue) { throw new InvalidParserConfigurationException( "It is useless to put a fixed value \"" + fixedValue + "\" in the require section."); } private boolean foundRequiredValue = false; @Override public void inform(String key, WalkResult foundValue) { foundRequiredValue = true; if (verbose) { LOG.info("Info REQUIRE: {}", key); LOG.info("NEED REQUIRE: {}", getMatchExpression()); LOG.info("KEPT REQUIRE: {}", key); } } @Override public boolean obtainResult() { if (isValidIsNull()) { foundRequiredValue = true; } processInformedMatches(); return foundRequiredValue; } @Override public void reset() { super.reset(); foundRequiredValue = false; } @Override public String toString() { return "Require: " + getMatchExpression(); } }
[ "bloriot97@gmail.com" ]
bloriot97@gmail.com
225b3d9eef94f6ac647f3cb142abc4a6a3ea2cef
2758aef4c3a38075667c429ee7bb7b172b9aa5af
/JavaSE(API)_Demo/src/IO/OutputStreamWriterDemo.java
5032f4f129315d3efadd2a6a1063ef197d6baf5f
[ "MIT" ]
permissive
Paranoidzhou/Java
676c00ef17e5fddbbebe8eb566a879d9bf3bb7a2
92d0e3e83860085d5212d0b788cebc3ab920dac6
refs/heads/master
2020-03-17T04:52:52.306829
2018-07-22T15:05:56
2018-07-22T15:05:56
133,292,350
0
0
null
null
null
null
UTF-8
Java
false
false
1,683
java
package IO; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; /* * 字符流: * java将流按照读写单位划分为字节流与字符流。 * InputStream合OutputStream是所有字节流父类,而java.io.Reader和java.io.Writer * 是字符流的父类。 * * 字符流只是方便我们读写字符,底层本质还是读写字节,只是字节与字符的转换工作交给了字符流来完成。 * 【字符流只能写纯文本文件】 * * 转换流: * java.io.InputStreamReader * java.io.OutputStreamWriter * * * * java提供的其他高级字符流都有一个特点就是只能连在其他字符流上,但是通常低级流都是字节 * 流,这就导致字符流不能直接搭配字节流使用,但是转换流例外,它们本身就是字符流,而它们又可 * 以连接字节流,所以在实际开发中当我们使用高级的字符流时通常与字节流连接时要使用转换流,它 * 起到“ * 将字符流转换字节”的功能、承上启下。 */ public class OutputStreamWriterDemo { public static void main(String[] args) throws IOException { FileOutputStream fos = new FileOutputStream("osw.txt"); OutputStreamWriter osw = new OutputStreamWriter(fos,"UTF-8"); osw.write("我是一只小小小小鸟,想要飞呀飞,却飞呀飞不高!"); osw.write("\n"); //换行 osw.write("我寻寻觅觅,寻寻觅觅一个温暖的怀抱,这样的要求算不算太高!"); System.out.println("写出完毕!"); osw.close(); //关闭流 } }
[ "1565413124@qq.com" ]
1565413124@qq.com
7a8a948e44aebb68a1e430d75e4fbdccb3530694
53b95b8940411003fb4fa82f920c91326656fea0
/release/1.4.2/java/proj/zoie/impl/indexing/internal/DiskSearchIndex.java
e1d2129426ec6acc337efb0907d9fe638819f561
[]
no_license
BGCX261/zoie-svn-to-git
a8a9c272a952e96490e159f56e9d901885760e23
092ccdb992d57872337420ba9f7218b73e7118c5
refs/heads/master
2016-08-04T22:19:45.459439
2015-08-25T15:35:52
2015-08-25T15:35:52
41,485,815
0
0
null
null
null
null
UTF-8
Java
false
false
6,052
java
package proj.zoie.impl.indexing.internal; import java.io.File; import java.io.IOException; import java.nio.channels.ReadableByteChannel; import org.apache.log4j.Logger; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.MergePolicy; import org.apache.lucene.index.SerialMergeScheduler; import org.apache.lucene.index.IndexWriter.MaxFieldLength; import org.apache.lucene.search.Similarity; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.NIOFSDirectory; import proj.zoie.api.ZoieIndexReader; import proj.zoie.api.indexing.IndexReaderDecorator; public class DiskSearchIndex extends BaseSearchIndex{ private final File _location; private final IndexReaderDispenser _dispenser; private MergePolicy _mergePolicy; private ZoieIndexDeletionPolicy _deletionPolicy; public static final Logger log = Logger.getLogger(DiskSearchIndex.class); DiskSearchIndex(File location, IndexReaderDecorator<?> decorator, MergePolicy mergePolicy) { _location = location; _dispenser = new IndexReaderDispenser(_location, decorator); _mergePolicy = mergePolicy; _mergeScheduler = new SerialMergeScheduler(); _deletionPolicy = new ZoieIndexDeletionPolicy(); } public long getVersion() { return _dispenser.getCurrentVersion(); } /** * Gets the number of docs in the current loaded index * @return number of docs */ public int getNumdocs() { IndexReader reader=_dispenser.getIndexReader(); if (reader!=null) { return reader.numDocs(); } else { return 0; } } /** * Close and releases dispenser and clean up */ public void close() { super.close(); // close the dispenser if (_dispenser != null) { _dispenser.close(); } } /** * Refreshes the index reader. Actual creation of a new index reader is deferred */ public void refresh() { _dispenser.closeReader(); } @Override protected void finalize() { close(); } public static FSDirectory getIndexDir(File location) throws IOException { IndexSignature sig = null; if (location.exists()) { sig = IndexReaderDispenser.getCurrentIndexSignature(location); } if (sig == null) { File directoryFile = new File(location, IndexReaderDispenser.INDEX_DIRECTORY); sig = new IndexSignature(IndexReaderDispenser.INDEX_DIR_NAME, 0L); try { sig.save(directoryFile); } catch (IOException e) { throw e; } } File idxDir = new File(location, sig.getIndexPath()); FSDirectory directory = NIOFSDirectory.getDirectory(idxDir); return directory; } /** * Opens an index modifier. * @param analyzer Analyzer * @return IndexModifer instance */ public IndexWriter openIndexWriter(Analyzer analyzer,Similarity similarity) throws IOException { // create the parent directory _location.mkdirs(); FSDirectory directory = getIndexDir(_location); log.info("opening index writer at: "+directory.getFile().getAbsolutePath()); // create a new modifier to the index, assuming at most one instance is running at any given time boolean create = !IndexReader.indexExists(directory); IndexWriter idxWriter = new IndexWriter(directory, analyzer, create, _deletionPolicy, MaxFieldLength.UNLIMITED); idxWriter.setMergeScheduler(_mergeScheduler); idxWriter.setMergePolicy(_mergePolicy); idxWriter.setRAMBufferSizeMB(5); if (similarity != null) { idxWriter.setSimilarity(similarity); } return idxWriter; } /** * Gets the current reader */ public ZoieIndexReader openIndexReader() throws IOException { // use dispenser to get the reader return _dispenser.getIndexReader(); } @Override protected IndexReader openIndexReaderForDelete() throws IOException { _location.mkdirs(); FSDirectory directory = getIndexDir(_location); if (IndexReader.indexExists(directory)){ return IndexReader.open(directory,false); } else{ return null; } } /** * Gets a new reader, force a reader refresh * @return * @throws IOException */ public ZoieIndexReader getNewReader() throws IOException { return _dispenser.getNewReader(); } /** * Writes the current version/SCN to the disk */ public void setVersion(long version) throws IOException { // update new index file File directoryFile = new File(_location, IndexReaderDispenser.INDEX_DIRECTORY); IndexSignature sig = IndexSignature.read(directoryFile); sig.updateVersion(version); try { // make sure atomicity of the index publication File tmpFile = new File(_location, IndexReaderDispenser.INDEX_DIRECTORY + ".new"); sig.save(tmpFile); File tmpFile2 = new File(_location, IndexReaderDispenser.INDEX_DIRECTORY + ".tmp"); directoryFile.renameTo(tmpFile2); tmpFile.renameTo(directoryFile); tmpFile2.delete(); } catch (IOException e) { throw e; } } public DiskIndexSnapshot getSnapshot() { IndexSignature sig = IndexReaderDispenser.getCurrentIndexSignature(_location); if(sig != null) { ZoieIndexDeletionPolicy.Snapshot snapshot = _deletionPolicy.getSnapshot(); if(snapshot != null) { return new DiskIndexSnapshot(sig, snapshot); } } return null; } public void importSnapshot(ReadableByteChannel channel) throws IOException { File idxDir = new File(_location, IndexReaderDispenser.INDEX_DIR_NAME); idxDir.mkdirs(); DiskIndexSnapshot.readSnapshot(channel, _location); } }
[ "you@example.com" ]
you@example.com
abe7bd687d47212b63dde02c4ddae1cc576ae711
da445101204b70a6ff0bcfb2a5840ab411b415bc
/RoyalBattle-EJB/ejbModule/exceptions/PasswordIsNullException.java
e4a2767fa4716821cc8470d03178e8cb04a42099
[ "BSD-3-Clause" ]
permissive
ReforgedDream/royal_battle
017023c117c873e7e0d44d7e10499ba935048897
38383a0e505a6aea3c442f9dda247a841ed448de
refs/heads/master
2021-05-11T15:05:37.343380
2018-01-31T19:30:23
2018-01-31T19:30:23
117,716,975
0
0
null
null
null
null
UTF-8
Java
false
false
590
java
package exceptions; public class PasswordIsNullException extends Exception { private static final long serialVersionUID = 1L; public PasswordIsNullException() { super("Password should not be null"); } public PasswordIsNullException(String arg0) { super(arg0); } public PasswordIsNullException(Throwable arg0) { super(arg0); } public PasswordIsNullException(String arg0, Throwable arg1) { super(arg0, arg1); } public PasswordIsNullException(String arg0, Throwable arg1, boolean arg2, boolean arg3) { super(arg0, arg1, arg2, arg3); } }
[ "reforgeddream@gmail.com" ]
reforgeddream@gmail.com
13d8400456bcf642fc8a4fc1f206462e12e23000
eb9fc1f75ac25297061609514dadb3b664fcd26c
/src/main/java/com/qing/netty/five/MyServer.java
ba82bc0adaafec18ff20dfd65cb3a9197ed8df2d
[]
no_license
qing7454/netty_lecture
6e394abaa97907c22309f1dcf400a3c2bf770608
c73ba4c9e6b62df0a7e56f28a1d7e831ff57cf34
refs/heads/master
2021-05-14T13:53:49.244812
2018-06-25T05:20:31
2018-06-25T05:20:31
115,959,988
0
0
null
null
null
null
UTF-8
Java
false
false
1,632
java
package com.qing.netty.five; import com.qing.netty.fourth.MyServerInitializer; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; /** * <p>****************************************************************************</p> * <p><b>Copyright © 2010-2017 Sanfangda team All Rights Reserved<b></p> * <ul style="margin:15px;"> * <li>@description : com.qing.netty.five</li> * <li>@version : 1.0</li> * <li>@creation : 2018年01月21日</li> * <li>@author : fanrenqing</li> * </ul> * <p>****************************************************************************</p> */ public class MyServer { public static void main(String[] args) throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap serverBootstrap = new ServerBootstrap(); serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new WebSocketInitializer()); ChannelFuture channelFuture = serverBootstrap.bind(9090).sync(); channelFuture.channel().closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } } }
[ "qing7454@163.com" ]
qing7454@163.com
f6e7424e0c94690c5f5327c26f08e21d0cc9c74c
c577f5380b4799b4db54722749cc33f9346eacc1
/BugSwarm/stagemonitor-stagemonitor-296847746/buggy_files/stagemonitor-web-servlet/src/test/java/org/stagemonitor/web/servlet/widget/SpanServletTest.java
a09eeb16f6e0902766c294aadd13e626838d07d2
[]
no_license
tdurieux/BugSwarm-dissection
55db683fd95f071ff818f9ca5c7e79013744b27b
ee6b57cfef2119523a083e82d902a6024e0d995a
refs/heads/master
2020-04-30T17:11:52.050337
2019-05-09T13:42:03
2019-05-09T13:42:03
176,972,414
1
0
null
null
null
null
UTF-8
Java
false
false
9,744
java
package org.stagemonitor.web.servlet.widget; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.ConfigurationRegistry; import org.stagemonitor.core.CorePlugin; import org.stagemonitor.core.metrics.metrics2.Metric2Registry; import org.stagemonitor.core.util.JsonUtils; import org.stagemonitor.tracing.GlobalTracerTestHelper; import org.stagemonitor.tracing.RequestMonitor; import org.stagemonitor.tracing.TracingPlugin; import org.stagemonitor.tracing.reporter.ReportingSpanEventListener; import org.stagemonitor.tracing.sampling.SamplePriorityDeterminingSpanEventListener; import org.stagemonitor.tracing.tracing.B3Propagator; import org.stagemonitor.tracing.utils.SpanUtils; import org.stagemonitor.tracing.wrapper.SpanEventListenerFactory; import org.stagemonitor.util.StringUtils; import org.stagemonitor.web.servlet.MonitoredHttpRequest; import org.stagemonitor.web.servlet.ServletPlugin; import org.stagemonitor.web.servlet.filter.StagemonitorSecurityFilter; import org.stagemonitor.web.servlet.filter.StatusExposingByteCountingServletResponse; import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.Collections; import java.util.ServiceLoader; import java.util.UUID; import java.util.concurrent.ExecutorService; import javax.servlet.http.HttpServletRequest; import io.opentracing.Span; import io.opentracing.Tracer; import io.opentracing.mock.MockTracer; import io.opentracing.util.ThreadLocalScopeManager; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class SpanServletTest { private SpanServlet spanServlet; private String connectionId; private ServletPlugin servletPlugin; private ConfigurationRegistry configuration; private Span span; @Before public void setUp() throws Exception { configuration = mock(ConfigurationRegistry.class); TracingPlugin tracingPlugin = mock(TracingPlugin.class); when(tracingPlugin.getRequestMonitor()).thenReturn(mock(RequestMonitor.class)); when(tracingPlugin.getProfilerRateLimitPerMinuteOption()).thenReturn(mock(ConfigurationOption.class)); when(configuration.getConfig(TracingPlugin.class)).thenReturn(tracingPlugin); servletPlugin = mock(ServletPlugin.class); when(servletPlugin.isWidgetAndStagemonitorEndpointsAllowed(any(HttpServletRequest.class), any(ConfigurationRegistry.class))).thenReturn(Boolean.TRUE); when(configuration.getConfig(ServletPlugin.class)).thenReturn(servletPlugin); final CorePlugin corePlugin = mock(CorePlugin.class); when(corePlugin.getThreadPoolQueueCapacityLimit()).thenReturn(1000); when(configuration.getConfig(CorePlugin.class)).thenReturn(corePlugin); WidgetAjaxSpanReporter reporter = new WidgetAjaxSpanReporter(); spanServlet = new SpanServlet(configuration, reporter, 1500); spanServlet.init(); connectionId = UUID.randomUUID().toString(); final SamplePriorityDeterminingSpanEventListener samplePriorityDeterminingSpanInterceptor = mock(SamplePriorityDeterminingSpanEventListener.class); when(samplePriorityDeterminingSpanInterceptor.onSetTag(anyString(), anyString())).then(invocation -> invocation.getArgument(1)); when(samplePriorityDeterminingSpanInterceptor.onSetTag(anyString(), anyBoolean())).then(invocation -> invocation.getArgument(1)); when(samplePriorityDeterminingSpanInterceptor.onSetTag(anyString(), any(Number.class))).then(invocation -> invocation.getArgument(1)); final ReportingSpanEventListener reportingSpanEventListener = new ReportingSpanEventListener(configuration); reportingSpanEventListener.addReporter(reporter); Tracer tracer = TracingPlugin.createSpanWrappingTracer(new MockTracer(new ThreadLocalScopeManager(), new B3Propagator()), configuration, new Metric2Registry(), ServiceLoader.load(SpanEventListenerFactory.class), samplePriorityDeterminingSpanInterceptor, reportingSpanEventListener); GlobalTracerTestHelper.override(tracer); when(tracingPlugin.getTracer()).thenReturn(tracer); } @After public void tearDown() throws Exception { GlobalTracerTestHelper.resetGlobalTracer(); } private void reportSpan() { final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/test"); request.addHeader(WidgetAjaxSpanReporter.CONNECTION_ID, connectionId); final MonitoredHttpRequest monitoredHttpRequest = new MonitoredHttpRequest(request, mock(StatusExposingByteCountingServletResponse.class), new MockFilterChain(), configuration, mock(ExecutorService.class)); span = monitoredHttpRequest.createScope().span(); span.setOperationName("test"); span.finish(); } @Test public void testSpanBeforeRequest() throws Exception { reportSpan(); MockHttpServletRequest request = new MockHttpServletRequest("GET", "/stagemonitor/spans"); request.addParameter("connectionId", connectionId); MockHttpServletResponse response = new MockHttpServletResponse(); spanServlet.service(request, response); Assert.assertEquals(spanAsJsonArray(), response.getContentAsString()); Assert.assertEquals("application/json;charset=UTF-8", response.getHeader("content-type")); } @Test public void testTwoSpanBeforeRequest() throws Exception { reportSpan(); final String span1 = spanAsJson(); reportSpan(); final String span2 = spanAsJson(); MockHttpServletRequest request = new MockHttpServletRequest("GET", "/stagemonitor/spans"); request.addParameter("connectionId", connectionId); MockHttpServletResponse response = new MockHttpServletResponse(); spanServlet.service(request, response); Assert.assertEquals(Arrays.asList(span1, span2).toString(), response.getContentAsString()); Assert.assertEquals("application/json;charset=UTF-8", response.getHeader("content-type")); } private String spanAsJsonArray() { return Collections.singletonList(spanAsJson()).toString(); } private String spanAsJson() { return JsonUtils.toJson(span, SpanUtils.CALL_TREE_ASCII); } private void performNonBlockingRequest(final HttpServletRequest request, final MockHttpServletResponse response) throws Exception { final Object lock = new Object(); synchronized (lock) { new Thread(new Runnable() { @Override public void run() { try { synchronized (lock) { lock.notifyAll(); } spanServlet.service(request, response); } catch (Exception e) { e.printStackTrace(); } } }).start(); lock.wait(); } // Thread.sleep(100); } private void waitForResponse(MockHttpServletResponse response) throws UnsupportedEncodingException, InterruptedException { final int maxWait = 2_000; int wait = 0; while (StringUtils.isEmpty(response.getContentAsString()) && wait <= maxWait) { wait += 10; Thread.sleep(10); } } @Test public void testSpanAfterRequest() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/stagemonitor/spans"); request.addParameter("connectionId", connectionId); request.setAsyncSupported(false); final MockHttpServletResponse response = new MockHttpServletResponse(); performNonBlockingRequest(request, response); reportSpan(); waitForResponse(response); Assert.assertEquals(spanAsJsonArray(), response.getContentAsString()); Assert.assertEquals("application/json;charset=UTF-8", response.getHeader("content-type")); } @Test public void testSpanAfterRequestDifferentConnection() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/stagemonitor/spans"); request.addParameter("connectionId", UUID.randomUUID().toString()); request.setAsyncSupported(true); MockHttpServletResponse response = new MockHttpServletResponse(); performNonBlockingRequest(request, response); reportSpan(); waitForResponse(response); Assert.assertEquals("[]", response.getContentAsString()); } @Test public void testMissingConnectionId() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/stagemonitor/spans"); MockHttpServletResponse response = new MockHttpServletResponse(); spanServlet.service(request, response); Assert.assertEquals(400, response.getStatus()); } @Test public void testInvalidConnectionId() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/stagemonitor/spans"); request.addParameter("connectionId", ""); MockHttpServletResponse response = new MockHttpServletResponse(); spanServlet.service(request, response); Assert.assertEquals(400, response.getStatus()); } @Test public void testWidgetDeactivated() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/stagemonitor/spans"); request.addParameter("connectionId", ""); MockHttpServletResponse response = new MockHttpServletResponse(); Mockito.when(servletPlugin.isWidgetAndStagemonitorEndpointsAllowed(eq(request), any(ConfigurationRegistry.class))).thenReturn(Boolean.FALSE); ConfigurationRegistry configuration = mock(ConfigurationRegistry.class); when(configuration.getConfig(ServletPlugin.class)).thenReturn(servletPlugin); new MockFilterChain(spanServlet, new StagemonitorSecurityFilter(configuration)).doFilter(request, response); Assert.assertEquals(404, response.getStatus()); } }
[ "durieuxthomas@hotmail.com" ]
durieuxthomas@hotmail.com
339e4d6d0fc9c2e2c6f37b190757ac672c019fc3
d637afa5b786c0c51c63ee40dff1f3b9679bbf8d
/src/main/java/com/example/demo/service/TownServiceImpl.java
46dba80bd669ef6354ba45f9731ef592bc8df2ce
[]
no_license
itsonev13/NeedForSpeedUnderground2
08d20585326be63d32ce4f7a9a076d8231a6faa5
664b51f604bb427c08e17b9b74bd77e718955456
refs/heads/main
2023-01-31T23:20:01.159527
2020-12-18T06:57:05
2020-12-18T06:57:05
318,983,935
0
0
null
null
null
null
UTF-8
Java
false
false
2,833
java
package com.example.demo.service; import java.io.IOException; import java.util.Arrays; import java.util.List; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.example.demo.common.Constants; import com.example.demo.domain.dtos.TownImportDto; import com.example.demo.domain.entities.Town; import com.example.demo.repository.TownRepository; import com.example.demo.util.FileUtil; import com.example.demo.util.ValidationUtil; import com.google.gson.Gson; @Service public class TownServiceImpl implements TownService { private final static String TOWNS_JSON_FILE_PATH = System.getProperty("user.dir") + "//src//main//resources//files//towns.json"; private TownRepository townRepository; private FileUtil fileUtil; private final Gson gson; private final ValidationUtil validation; private final ModelMapper modelMapper; @Autowired public TownServiceImpl(TownRepository townRepository, FileUtil fileUtil, Gson gson, ValidationUtil validation, ModelMapper modelMapper) { super(); this.townRepository = townRepository; this.fileUtil = fileUtil; this.gson = gson; this.validation = validation; this.modelMapper = modelMapper; } @Override public Boolean townsAreImported() { return this.townRepository.count() > 0; } @Override public String readTownsJsonFile() { try { return this.fileUtil.readFile(TOWNS_JSON_FILE_PATH); } catch (IOException e) { e.printStackTrace(); } return null; } @Override public String importTowns(String townsFileContent) { StringBuilder importResult = new StringBuilder(); TownImportDto[] towns = gson.fromJson(townsFileContent, TownImportDto[].class); Arrays.stream(towns).forEach(townImportDto -> { Town townEntity = this.townRepository.findByName(townImportDto.getName()).orElse(null); if (townEntity != null) { importResult.append(Constants.DUPLICATE_DATA_MESSAGE).append(System.lineSeparator()); return; } if (!(this.validation.isValid(townImportDto))) { importResult.append(Constants.INCORRECT_DATA_MESSAGE).append(System.lineSeparator()); return; } townEntity = this.modelMapper.map(townImportDto, Town.class); this.townRepository.saveAndFlush(townEntity); importResult.append((String.format(Constants.SUCCESSFUL_IMPORT_MESSAGE, townEntity.getClass().getSimpleName(), townEntity.getName()))).append(System.lineSeparator()); }); return importResult.toString().trim(); } @Override public String exportRacingTowns() { StringBuilder builder = new StringBuilder(); List<Town> towns = this.townRepository.exportTowns(); for (Town town : towns) { builder.append("Name: " + town.getName() + "\n" + "Racers: " + town.getRacers().size() + "\n"); } return builder.toString(); } }
[ "i_tsonev@abv.bg" ]
i_tsonev@abv.bg
3115a0e206ce0ba03d3ea022f962e3f897596df0
28e00282a250265eb774c4473596d4cd408c4976
/src/main/java/designpattern/creational/factorymethod/Transport/Plane.java
4c6b0aaf3945017714b36c5c997977c34d702d54
[]
no_license
VladimirXIV/design-patterns-gof
e8540bab2ca93285f120f1cae03de77a62caa388
9003ab99aac8185f19f6f6ece490d8c9dbe2f50f
refs/heads/master
2022-02-05T23:31:30.879234
2019-07-21T16:56:36
2019-07-21T16:56:36
198,082,410
0
0
null
null
null
null
UTF-8
Java
false
false
203
java
package designpattern.creational.factorymethod.Transport; public class Plane extends Transport { public Integer deliver() { System.out.println("Plane delivery!"); return 2; } }
[ "RadioactiveLoveXIV@gmail.com" ]
RadioactiveLoveXIV@gmail.com
6f4b89e80c87f0034e7062259744e9aad633b5b2
4688d19282b2b3b46fc7911d5d67eac0e87bbe24
/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/transform/GetGroupCertificateAuthorityRequestMarshaller.java
104a9a3d56e20d36daf0e4ed8a02f3859f8e567d
[ "Apache-2.0" ]
permissive
emilva/aws-sdk-java
c123009b816963a8dc86469405b7e687602579ba
8fdbdbacdb289fdc0ede057015722b8f7a0d89dc
refs/heads/master
2021-05-13T17:39:35.101322
2018-12-12T13:11:42
2018-12-12T13:11:42
116,821,450
1
0
Apache-2.0
2018-09-19T04:17:41
2018-01-09T13:45:39
Java
UTF-8
Java
false
false
2,508
java
/* * Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.greengrass.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.greengrass.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * GetGroupCertificateAuthorityRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class GetGroupCertificateAuthorityRequestMarshaller { private static final MarshallingInfo<String> CERTIFICATEAUTHORITYID_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PATH).marshallLocationName("CertificateAuthorityId").build(); private static final MarshallingInfo<String> GROUPID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH) .marshallLocationName("GroupId").build(); private static final GetGroupCertificateAuthorityRequestMarshaller instance = new GetGroupCertificateAuthorityRequestMarshaller(); public static GetGroupCertificateAuthorityRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(GetGroupCertificateAuthorityRequest getGroupCertificateAuthorityRequest, ProtocolMarshaller protocolMarshaller) { if (getGroupCertificateAuthorityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getGroupCertificateAuthorityRequest.getCertificateAuthorityId(), CERTIFICATEAUTHORITYID_BINDING); protocolMarshaller.marshall(getGroupCertificateAuthorityRequest.getGroupId(), GROUPID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
47e0f5c77e9640faedd4539f6d6ca188711bddc3
f08f38498e5bb8e00ac8ffa1a697d30db0d573c3
/icecapSDKForMultiProcessor/src/devices/NXT/C64Font.java
e654b05ab70fd0dc68d61d6d56f40733abcdd373
[]
no_license
zs673/Multiprocessor-icecap-SCJ-RTE
d519f2779ea5fb69d83601c78a4398ff89e0b64e
9aa020ad8919ccb82c6e83f2f6568cbd4c3d2471
refs/heads/master
2020-06-04T14:40:01.045581
2017-08-28T21:28:30
2017-08-28T21:28:30
35,604,058
0
0
null
null
null
null
UTF-8
Java
false
false
7,238
java
package devices.NXT; // C64 font: http://www.dafont.com/commodore-64-pixelized.font?text=D // Binary to Hexadecimal Converter: // http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html public class C64Font { static byte[][] fonts = { /*0: end mark */ { 0x00, (byte) 0x7e, (byte) 0x42, (byte) 0x42, (byte) 0x42, (byte) 0x42, (byte) 0x7e, 0x00 }, /*1: A */{ 0x00, (byte) 0xf8, (byte) 0xfc, (byte) 0x16, (byte) 0x16, (byte) 0xfc, (byte) 0xf8, 0x00 }, /*2: B */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x92, (byte) 0x92, (byte) 0xfe, (byte) 0x6c, 0x00 }, /* C */{ 0x00, (byte) 0x7c, (byte) 0xfe, (byte) 0x82, (byte) 0x82, (byte) 0xc6, (byte) 0x44, 0x00 }, /* D */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x82, (byte) 0xc6, (byte) 0x7c, (byte) 0x38, 0x00 }, /* E */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x92, (byte) 0x92, (byte) 0x82, (byte) 0x82, 0x00 }, /* F */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x12, (byte) 0x12, (byte) 0x02, (byte) 0x02, 0x00 }, /* G */{ 0x00, (byte) 0x7c, (byte) 0xfe, (byte) 0x82, (byte) 0x92, (byte) 0xf6, (byte) 0x74, 0x00 }, /* H */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x10, (byte) 0x10, (byte) 0xfe, (byte) 0xfe, 0x00 }, /* I */{ 0x00, (byte) 0x00, (byte) 0x82, (byte) 0xfe, (byte) 0xfe, (byte) 0x82, (byte) 0x00, 0x00 }, /* J */{ 0x00, (byte) 0x40, (byte) 0xc0, (byte) 0x82, (byte) 0xfe, (byte) 0x7e, (byte) 0x02, 0x00 }, /* K */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x38, (byte) 0x6c, (byte) 0xc6, (byte) 0x82, 0x00 }, /* L */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x80, (byte) 0x80, (byte) 0x80, (byte) 0x80, 0x00 }, /* M */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x0c, (byte) 0x18, (byte) 0x0c, (byte) 0xfe, (byte) 0xfe }, /* N */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x1c, (byte) 0x38, (byte) 0xfe, (byte) 0xfe, 0x00 }, /* O */{ 0x00, (byte) 0x7c, (byte) 0xfe, (byte) 0x82, (byte) 0x82, (byte) 0xfe, (byte) 0x7c, 0x00 }, /* P */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x12, (byte) 0x12, (byte) 0x1e, (byte) 0x0c, 0x00 }, /* Q */{ 0x00, (byte) 0x3c, (byte) 0x7e, (byte) 0x42, (byte) 0xc2, (byte) 0xfe, (byte) 0xbc, 0x00 }, /* R */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x32, (byte) 0x72, (byte) 0xde, (byte) 0x8c, 0x00 }, /* S */{ 0x00, (byte) 0x4c, (byte) 0xde, (byte) 0x92, (byte) 0x92, (byte) 0xf6, (byte) 0x64, 0x00 }, /* T */{ 0x00, (byte) 0x02, (byte) 0x02, (byte) 0xfe, (byte) 0xfe, (byte) 0x02, (byte) 0x02, 0x00 }, /* U */{ 0x00, (byte) 0x7e, (byte) 0xfe, (byte) 0x80, (byte) 0x80, (byte) 0xfe, (byte) 0x7e, 0x00 }, /* V */{ 0x00, (byte) 0x3e, (byte) 0x7e, (byte) 0xc0, (byte) 0xc0, (byte) 0x7e, (byte) 0x3e, 0x00 }, /* W */{ 0x00, (byte) 0xfe, (byte) 0xfe, (byte) 0x60, (byte) 0x30, (byte) 0x60, (byte) 0xfe, (byte) 0xfe }, /* X */{ 0x00, (byte) 0xc6, (byte) 0xee, (byte) 0x38, (byte) 0x38, (byte) 0xee, (byte) 0xc6, 0x00 }, /* Y */{ 0x00, (byte) 0x0e, (byte) 0x1e, (byte) 0xf0, (byte) 0xf0, (byte) 0x1e, (byte) 0x0e, 0x00 }, /*26: Z */{ 0x00, (byte) 0xc2, (byte) 0xe2, (byte) 0xb2, (byte) 0x9a, (byte) 0x8e, (byte) 0x86, 0x00 }, /*27: 0 */{ 0x00, (byte) 0x7c, (byte) 0xfe, (byte) 0x92, (byte) 0x8a, (byte) 0xfe, (byte) 0x7c, 0x00 }, /* 1 */{ 0x00, (byte) 0x80, (byte) 0x88, (byte) 0xfe, (byte) 0xfe, (byte) 0x80, (byte) 0x80, 0x00 }, /* 2 */{ 0x00, (byte) 0xc4, (byte) 0xe6, (byte) 0xa2, (byte) 0x92, (byte) 0x9e, (byte) 0x8c, 0x00 }, /* 3 */{ 0x00, (byte) 0x44, (byte) 0xc6, (byte) 0x92, (byte) 0x92, (byte) 0xfe, (byte) 0x6c, 0x00 }, /* 4 */{ 0x00, (byte) 0x30, (byte) 0x38, (byte) 0x2c, (byte) 0xfe, (byte) 0xfe, (byte) 0x20, 0x00 }, /* 5 */{ 0x00, (byte) 0x4e, (byte) 0xce, (byte) 0x8a, (byte) 0x8a, (byte) 0xfa, (byte) 0x72, 0x00 }, /* 6 */{ 0x00, (byte) 0x7c, (byte) 0xfe, (byte) 0x92, (byte) 0x92, (byte) 0xf6, (byte) 0x64, 0x00 }, /* 7 */{ 0x00, (byte) 0x02, (byte) 0x02, (byte) 0xf2, (byte) 0xfa, (byte) 0x0e, (byte) 0x06, 0x00 }, /* 8 */{ 0x00, (byte) 0x6c, (byte) 0xfe, (byte) 0x92, (byte) 0x92, (byte) 0xfe, (byte) 0x6c, 0x00 }, /*36: 9 */{ 0x00, (byte) 0x4c, (byte) 0xde, (byte) 0x92, (byte) 0x92, (byte) 0xfe, (byte) 0x7c, 0x00 }, /*37: + */{ 0x00, (byte) 0x10, (byte) 0x10, (byte) 0x7c, (byte) 0x7c, (byte) 0x10, (byte) 0x10, 0x00 }, /* , */{ 0x00, (byte) 0x00, (byte) 0x80, (byte) 0xe0, (byte) 0x60, (byte) 0x00, (byte) 0x00, 0x00 }, /* - */{ 0x00, (byte) 0x10, (byte) 0x10, (byte) 0x10, (byte) 0x10, (byte) 0x10, (byte) 0x10, 0x00 }, /* . */{ 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x60, (byte) 0x60, (byte) 0x00, (byte) 0x00, 0x00 }, /*41: / */{ 0x00, (byte) 0x80, (byte) 0xc0, (byte) 0x60, (byte) 0x30, (byte) 0x18, (byte) 0x0c, 0x04 }, /*42 : */{ 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x6c, (byte) 0x6c, (byte) 0x00, (byte) 0x00, 0x00 }, /* ; */{ 0x00, (byte) 0x00, (byte) 0x80, (byte) 0xec, (byte) 0xec, (byte) 0x00, (byte) 0x00, 0x00 }, /* < */{ 0x00, (byte) 0x10, (byte) 0x38, (byte) 0x6c, (byte) 0xc6, (byte) 0x82, (byte) 0x82, 0x00 }, /* = */{ 0x00, (byte) 0x00, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x00, 0x00 }, /*46 > */{ 0x00, (byte) 0x82, (byte) 0x82, (byte) 0xc6, (byte) 0x6c, (byte) 0x38, (byte) 0x10, 0x00 }, /*47 ? */{ 0x00, (byte) 0x04, (byte) 0x06, (byte) 0xa2, (byte) 0xb2, (byte) 0x1e, (byte) 0x0c, 0x00 }, /*48 SPACE */ { 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 0x00 } }; static final byte SPACE = 32; static final byte PLUS = 43; static final byte COMMA = 44; static final byte MINUS = 45; static final byte FULLSTOP = 46; static final byte SLASH = 47; static final byte COLON = 58; static final byte SEMICOLON = 59; static final byte LESS_THAN = 60; static final byte EQUALS_SIGN = 61; static final byte GREATER_THAN = 62; static final byte QUESTION_MARK = 63; public static byte[] get(char c) { if (isDigit(c)) { return fonts[(byte) (c - '0' + 27)]; } else if (isLowerCase(c)) { return fonts[(byte) (c - 'A' - 32 + 1)]; } else if (isUpperCase(c)) { return fonts[(byte) (c - 'A' + 1)]; } else { switch (c) { case PLUS: return fonts[37]; case COMMA: return fonts[38]; case MINUS: return fonts[39]; case FULLSTOP: return fonts[40]; case SLASH: return fonts[41]; case COLON: return fonts[42]; case SEMICOLON: return fonts[43]; case LESS_THAN: return fonts[44]; case EQUALS_SIGN: return fonts[45]; case GREATER_THAN: return fonts[46]; case QUESTION_MARK: return fonts[47]; case SPACE: return fonts[48]; default: return fonts[0]; } } } public static boolean isDigit(char c) { if (48 <= c && c <= 57) return true; return false; } public static boolean isLowerCase(char c) { if (97 <= c && c <= 122) return true; return false; } public static boolean isUpperCase(char c) { if (65 <= c && c <= 90) return true; return false; } }
[ "zs673@york.ac.uk" ]
zs673@york.ac.uk
95e146ac506685ef4bd5fb330ba3d47668e4d80e
cf6ba601038277ad62dc0d84e1de8262a3cc43e1
/JAVA Strings/Remove duplicates from a string.java
60006fb1bc15735855d93195e399d84b7ee75073
[]
no_license
imrantechwiz/JAVA-DS
6745cf308f6b62e0d9e168a3ed1440b6f234c26f
114215718459b50fa037c581615056366cf04a23
refs/heads/master
2022-12-29T17:27:39.714042
2020-10-12T19:12:26
2020-10-12T19:12:26
283,543,985
2
0
null
null
null
null
UTF-8
Java
false
false
935
java
import java.util.Scanner; class Result { static String removeAllDups(String str1) { int k=0; char a[]=str1.toCharArray(); char b[]=new char[a.length]; // create a another array; for(int i=0;i<a.length;i++){ // go through each element int z=check(a[i],b,k); //check if the char is present in new array or not if(z==1){ b[k++]=a[i]; } } String s=new String(b); return s.trim(); } static int check(char x,char b[],int k){ for(int i=0;i<k;i++){ if(x==b[i]){ return 0; } } return 1; //if not present return 1 then add into it } } class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t; t=Integer.parseInt(scan.nextLine().trim()); while(t>0) { t--; String a = scan.nextLine().trim(); System.out.println(Result.removeAllDups(a)); } scan.close(); } }
[ "noreply@github.com" ]
noreply@github.com
2c4c3d5cd7ba7a567b61a54852c37b6d388350ae
d60e287543a95a20350c2caeabafbec517cabe75
/LACCPlus/Camel/1168_2.java
95a1eb97e0e16707d62e21afa66915e166b5e2cc
[ "MIT" ]
permissive
sgholamian/log-aware-clone-detection
242067df2db6fd056f8d917cfbc143615c558b2c
9993cb081c420413c231d1807bfff342c39aa69a
refs/heads/main
2023-07-20T09:32:19.757643
2021-08-27T15:02:50
2021-08-27T15:02:50
337,837,827
0
0
null
null
null
null
UTF-8
Java
false
false
968
java
//,temp,FhirPatchIT.java,97,113,temp,BoxFoldersManagerIT.java,135,152 //,3 public class xxx { @Test public void testCreateSharedLink() throws Exception { final Map<String, Object> headers = new HashMap<>(); // parameter type is String headers.put("CamelBox.folderId", testFolder.getID()); // parameter type is com.box.sdk.BoxSharedLink.Access headers.put("CamelBox.access", BoxSharedLink.Access.COLLABORATORS); // parameter type is java.util.Date headers.put("CamelBox.unshareDate", null); // parameter type is com.box.sdk.BoxSharedLink.Permissions headers.put("CamelBox.permissions", new BoxSharedLink.Permissions()); final com.box.sdk.BoxSharedLink result = requestBodyAndHeaders("direct://CREATEFOLDERSHAREDLINK", null, headers); assertNotNull(result, "createFolderSharedLink result"); LOG.debug("createFolderSharedLink: " + result); } };
[ "SHOSHIN\\sgholamian@shoshin.uwaterloo.ca" ]
SHOSHIN\sgholamian@shoshin.uwaterloo.ca
362fc1f802778e56b2566a3254fc9513f770031d
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/serge-rider--dbeaver/0e63cf47bc4e548a934d29afd59209faed35ffb9/after/DataSourceDescriptorManager.java
94ccb11712e3bf7ea2a506de1bd58f4005466d7f
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
4,273
java
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2) * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jkiss.dbeaver.registry; import org.jkiss.code.Nullable; import org.jkiss.dbeaver.core.DBeaverCore; import org.jkiss.dbeaver.core.DBeaverUI; import org.jkiss.dbeaver.model.DBPConnectionConfiguration; import org.jkiss.dbeaver.model.edit.DBECommandContext; import org.jkiss.dbeaver.model.edit.DBEObjectMaker; import org.jkiss.dbeaver.model.impl.DBSObjectCache; import org.jkiss.dbeaver.model.impl.edit.AbstractObjectManager; import org.jkiss.dbeaver.model.struct.DBSObject; import org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler; import org.jkiss.dbeaver.ui.dialogs.connection.CreateConnectionDialog; import org.jkiss.dbeaver.ui.dialogs.connection.NewConnectionWizard; import java.util.Map; /** * DataSourceDescriptorManager */ public class DataSourceDescriptorManager extends AbstractObjectManager<DataSourceDescriptor> implements DBEObjectMaker<DataSourceDescriptor, DataSourceRegistry> { @Override public long getMakerOptions() { return 0; } @Nullable @Override public DBSObjectCache<? extends DBSObject, DataSourceDescriptor> getObjectsCache(DataSourceDescriptor object) { return null; } @Override public boolean canCreateObject(DataSourceRegistry parent) { return true; } @Override public boolean canDeleteObject(DataSourceDescriptor object) { return true; } @Override public DataSourceDescriptor createNewObject(DBECommandContext commandContext, DataSourceRegistry parent, Object copyFrom) { if (copyFrom != null) { DataSourceDescriptor dsTpl = (DataSourceDescriptor)copyFrom; DataSourceRegistry registry = parent != null ? parent : dsTpl.getRegistry(); DataSourceDescriptor dataSource = new DataSourceDescriptor( registry, DataSourceDescriptor.generateNewId(dsTpl.getDriver()), dsTpl.getDriver(), new DBPConnectionConfiguration(dsTpl.getConnectionConfiguration())); dataSource.copyFrom(dsTpl); // Generate new name String origName = dsTpl.getName(); String newName = origName; for (int i = 0; ; i++) { if (registry.findDataSourceByName(newName) == null) { break; } newName = origName + " " + (i + 1); } dataSource.setName(newName); registry.addDataSource(dataSource); } else { DataSourceRegistry registry; if (parent != null) { registry = parent; } else { registry = DBeaverCore.getInstance().getProjectRegistry().getActiveDataSourceRegistry(); } CreateConnectionDialog dialog = new CreateConnectionDialog( DBeaverUI.getActiveWorkbenchWindow(), new NewConnectionWizard(registry)); dialog.open(); } return null; } @Override public void deleteObject(DBECommandContext commandContext, final DataSourceDescriptor object, Map<String, Object> options) { Runnable remover = new Runnable() { @Override public void run() { object.getRegistry().removeDataSource(object); } }; if (object.isConnected()) { DataSourceHandler.disconnectDataSource(object, remover); } else { remover.run(); } } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
c7515fe04906b564e1417de3da7b050ce61a5855
2e750e3f76e2ee65229d3cb54a58b4f4f34f808c
/panz-commons/src/main/java/com/pwz/myGenerator/Log.java
48198a85b7253faeaf38c675600161ffadb35e72
[]
no_license
panwenzhuo2016/panz
2948a197b61d2d2d15ea66e271acb0dcdc0a1283
42161490fece0d9ce9f576f87d0c60a82efa3fbc
refs/heads/master
2021-05-12T01:48:08.974187
2018-12-02T12:51:31
2018-12-02T12:51:31
117,569,097
1
1
null
null
null
null
UTF-8
Java
false
false
2,146
java
package com.pwz.myGenerator; import com.pwz.util.DateUtil; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.text.SimpleDateFormat; import java.util.Date; /** * 类说明: * * @Author panwenzhuo * @Date created in 2018-6-22 9:05 **/ public class Log { // private String path = "/home/weblogic/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/";//112 别的文件夹没权限 // private String path = "/weblogic/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/";//正式 private String path = "c:/";//测试 private StringBuffer sb = new StringBuffer(); public Log(String path) { this.path += "mylog/" + DateUtil.format(new Date(),"yyyy-MM-dd") + "/"; File file = new File(this.path); if(!file.exists()){ file.mkdirs(); } this.path += path; } public StringBuffer info(String msg){ sb.append(msg).append("\n"); return sb; } public StringBuffer insert(String msg){ sb.insert(0,msg).append("\n"); return sb; } public boolean write2Path(){ if(sb.length() == 0){ return true; } try{ insert("打印时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"\n"); BufferedWriter writer = new BufferedWriter(new FileWriter(new File(path+ ".log"),true)); writer.write("\n"+sb); writer.close(); return true; }catch(Exception e){ e.printStackTrace(); return false; }finally{ sb.setLength(0); } } public static void main(String[] args) { Log log= new Log("ddddd"); log.info("sdfsdf"); log.write2Path(); log= new Log("ddddd"); log.info("sdfsdfwerwer"); log.write2Path(); } public StringBuffer error(String s, Exception e) { sb.append(s +"----报错 Exception :"+ e.getMessage()).append("\n"); return sb; } }
[ "758244899@qq.com" ]
758244899@qq.com
169c65f303a5016088976b98cc90333590b56cb8
277ec88bc77276eeda0fbc7920f5543502114cf7
/src/main/java/com/mcsimonflash/sponge/activetime/objects/ConfigHolder.java
86ff064323bb5eb7f881426ab8f2fed55063caeb
[]
no_license
yymydyy/ActiveTime
3997f3d1abab68b818c33b92c5acd21b85351802
5050597f9a5637aaafd4b1e7ab600ae188c98452
refs/heads/master
2021-03-03T17:23:54.342369
2020-03-17T01:05:19
2020-03-17T01:05:19
245,976,014
3
0
null
2020-03-09T08:02:20
2020-03-09T08:02:19
null
UTF-8
Java
false
false
1,512
java
package com.mcsimonflash.sponge.activetime.objects; import com.mcsimonflash.sponge.activetime.ActiveTime; import ninja.leaping.configurate.commented.CommentedConfigurationNode; import ninja.leaping.configurate.hocon.HoconConfigurationLoader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; public class ConfigHolder { private HoconConfigurationLoader loader; private CommentedConfigurationNode node; public ConfigHolder(Path path, boolean asset) throws IOException { try { if (Files.notExists(path)) { if (asset) { ActiveTime.getContainer().getAsset(path.getFileName().toString()).get().copyToFile(path); } else { Files.createFile(path); } } loader = HoconConfigurationLoader.builder().setPath(path).build(); node = loader.load(); } catch (IOException e) { ActiveTime.getLogger().error("Error loading config file! File:[" + path.getFileName().toString() + "]"); throw e; } } public CommentedConfigurationNode getNode(Object... path) { return node.getNode(path); } public boolean save() { try { loader.save(node); return true; } catch (IOException e) { ActiveTime.getLogger().error("Unable to save config file! Error:"); e.printStackTrace(); return false; } } }
[ "mcsimonflash@gmail.com" ]
mcsimonflash@gmail.com
79b14edf7ddea5f821bb3389a7a52dc99e156b68
52e8db343521c3b129178a093b2308d3a854a87d
/corba-chat-java-master/src/Client.java
277194e232543bfa610f3bf83a6a4646c36e934f
[]
no_license
Inonut/Faculty
548f5e4b477ea1e57378165dfdfb53306439752e
479e5df51e0795622b828eda214407a9d58ae9d3
refs/heads/master
2021-01-25T04:27:23.339851
2018-06-17T17:52:42
2018-06-17T17:52:42
93,443,841
0
1
null
null
null
null
UTF-8
Java
false
false
1,769
java
import CalculatorApp.CalculatorHelper; import CalculatorApp.Calculator; import org.omg.CosNaming.NamingContextExt; import org.omg.CosNaming.NamingContextExtHelper; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.Scanner; public class Client { public static void main(String[] args) { try { Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort","1051"); org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, props); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); String name = "calculator"; Calculator calculator = CalculatorHelper.narrow(ncRef.resolve_str(name)); System.out.println(String.format("21 * 2 = %d", calculator.mul(21, 2))); System.out.println(String.format("21 / 2 = %f", calculator.div(21, 2))); System.out.println(String.format("21 + 2 = %d", calculator.sum(21, 2))); System.out.println(String.format("21 - 2 = %d", calculator.sub(21, 2))); Scanner sc = new Scanner(System.in); List<String> tokens = new ArrayList<>(); String token = ""; System.out.println("Script: ----------type 'eval' for evaluation ------------"); while(true) { while(sc.hasNext()) { token = sc.nextLine(); if(token.equalsIgnoreCase("eval")) { break; } tokens.add(token); } if(token.equalsIgnoreCase("exit")) { break; } System.out.println(String.format("-------- %s", calculator.eval(tokens.stream().reduce("", (a, b) -> a.concat("\n").concat(b))))); } } catch (Exception e) { e.printStackTrace(); } } }
[ "raducanudragos12@gmail.com" ]
raducanudragos12@gmail.com
a2c6a9e8ade57446340443a6c2e07134fef75887
3a2c553584fa99f27b5575bb6c05cf4ad18e8d57
/MyHome/app/src/main/java/com/jenny/binding/BindAdapters.java
649735d2dda24c317ab49865b1eb22299e51946d
[]
no_license
JennnyPash/Test
5f6d5ea6f06e521261ad70b06c1ffd48af5ad605
c456f55d5b0b76a0344520713615857a6d354fef
refs/heads/master
2021-01-23T09:29:49.801819
2017-01-25T19:28:19
2017-01-25T19:28:19
39,328,423
0
0
null
null
null
null
UTF-8
Java
false
false
4,062
java
package com.jenny.binding; import android.databinding.BindingAdapter; import android.databinding.InverseBindingAdapter; import android.databinding.ObservableArrayList; import android.graphics.Color; import android.widget.EditText; import android.widget.ExpandableListAdapter; import android.widget.ExpandableListView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import com.jenny.database.Project; import com.jenny.database.Room; import com.jenny.database.Subject; import com.jenny.myhome.MyHomeApplication; import com.jenny.myhome.R; import java.util.ArrayList; import java.util.HashMap; import java.util.List; /** * Created by JennyPash on 1/14/2017. */ public class BindAdapters { @BindingAdapter("android:text") public static void setText(EditText editText, double value) { double currentVal; try { currentVal = Double.parseDouble(editText.getText().toString()); } catch (Exception e) { currentVal = 0d; } if (currentVal != value) { editText.setText(String.format("%.2f",value)); } } @InverseBindingAdapter(attribute = "android:text") public static double getDouble(EditText view) { double value; try { value = Double.parseDouble(view.getText().toString()); } catch (Exception e) { value = 0d; } return value; } @BindingAdapter("android:text") public static void setText(EditText editText, int value) { int currentVal; try { currentVal = Integer.parseInt(editText.getText().toString()); } catch (Exception e) { currentVal = 0; } if (currentVal != value) { editText.setText(String.valueOf(value)); } } @InverseBindingAdapter(attribute = "android:text") public static int getInt(EditText view) { int value; try { value = Integer.parseInt(view.getText().toString()); } catch (Exception e) { value = 0; } return value; } @BindingAdapter("app:items") public static void bindProjects(ListView listView, ObservableArrayList<Project> projects) { ListAdapter listAdapter = new EntityArrayAdapter(listView.getContext(), android.R.layout.simple_selectable_list_item , projects); listView.setAdapter(listAdapter); } @BindingAdapter("app:items") public static void bindList(ListView view, ObservableArrayList<Subject> list) { ListAdapter adapter = new EntityArrayAdapter(view.getContext(), android.R.layout.simple_list_item_1, list); view.setAdapter(adapter); } @BindingAdapter("app:items") public static void bindExpandableList(ExpandableListView expandableListView, List<RoomSummary> roomSumarries) { List<Room> listDataHeaders = new ArrayList<>(); HashMap<Room, RoomSummary> listDataChild = new HashMap<>(); for (RoomSummary roomSummary : roomSumarries) { listDataHeaders.add(roomSummary.getRoom()); listDataChild.put(roomSummary.getRoom(), roomSummary); } ExpandableListAdapter adapter = new RoomSummaryAdapter(expandableListView.getContext(), listDataHeaders, listDataChild); expandableListView.setAdapter(adapter); } @BindingAdapter("android:textColor") public static void setText(TextView textView, double budgetLeft) { int color; switch (Double.compare(budgetLeft, 0)) { case -1: color = MyHomeApplication.getContext().getResources().getColor(R.color.red); break; case 1: color = MyHomeApplication.getContext().getResources().getColor(R.color.green); break; default: TextView tv = new TextView(textView.getContext()); color = tv.getCurrentTextColor(); break; } textView.setTextColor(color); } }
[ "jenqpashova@gmail.com" ]
jenqpashova@gmail.com
e47cfd204bbfa1b87df9bfbfe0d9ccaeb0de5a5d
3267ab1845045da02541288013f7aabce622e827
/src/main/java/observer/Subject.java
750ec18ce8a3c31575cdde978b24134190be84d4
[]
no_license
kunaksergey/PatternsJava
f7c409b2e1a62f74223cbed3d4a30ee9dd82302b
834e51a8f4873268750984eaf6ec0c6a55f8fad5
refs/heads/master
2016-08-10T06:37:59.357550
2016-03-24T18:17:46
2016-03-24T18:17:46
54,216,299
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package observer; /** * Created by sa on 16.03.16. */ public interface Subject { void registerObserver(); void removeObserver(); void notifyObserver(); }
[ "kunaksergey@ukr.net" ]
kunaksergey@ukr.net
b1f4da47d7bcc38ffd669681452b6edffa303160
702fb356b7b6cdf1d6c2b973f7c0156190a16371
/src/main/java/com/wk/middleware/annotations/Table.java
c81bfa3a5ab4097063d4a8ad4eb15bf18d990794
[]
no_license
gaigechunfeng/mddb
6b84c8a21fc4cf1c7c820ba7abcc4bbd809718ab
2a786a6aad67bd89d8846e07903b130a6ff643fc
refs/heads/master
2020-04-27T00:18:40.909312
2019-03-06T06:04:43
2019-03-06T06:04:43
173,930,099
0
0
null
null
null
null
UTF-8
Java
false
false
442
java
package com.wk.middleware.annotations; import java.lang.annotation.*; /** * 表示实体对应数据库中一个表 * Created by jince on 2018/11/21. */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface Table { /** * 数据库表名 * * @return */ String name(); /** * 默认排序字段 * * @return */ String orderBy() default ""; }
[ "kun.wang@yintech.cn" ]
kun.wang@yintech.cn
36f3004c61cdfe2d551f3d72619b9eee0aca827b
792038d42831eb70a0be282d4955c4a90a5091bd
/DeliveriesRoot/DeliveriesServiceLayer/src/main/java/org/com/deliveries/service/DeliveriesService.java
d2f6c02d2d3a7a963f7c8396e716d7072f96a0af
[]
no_license
CARTESLA17/deliveries
ed5f8541a2f4ce82cf43ba3d20f130a38b70dc3c
2bc443f4627cfd67a780ada131c1cac9ca6ef607
refs/heads/main
2023-03-27T08:46:28.208923
2021-03-25T16:12:06
2021-03-25T16:12:06
347,785,284
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package org.com.deliveries.service; import org.com.deliveries.models.Deliveries; public interface DeliveriesService { public void manageDeliveries(Deliveries deliveries) throws Exception; }
[ "crodriguez@grupolpa.local" ]
crodriguez@grupolpa.local
df1a95ddf3ecc4f9fdabfeded1982f8e025b28d3
1f4e782f0772e8282d51b8210710e47bc8a1d40e
/Assignment 5/src/a5adept/Belt.java
8b711cdf68424c25c8194ac6ef5e093bc85633f6
[]
no_license
apharrison964/401Assignments
931905248776763d1ca5e4b9256f4f34fd7bc39c
9ae6661bbd7fc60ffd2340e2e10d4af21a1ac934
refs/heads/master
2016-09-06T19:24:45.350910
2015-12-23T05:03:25
2015-12-23T05:03:25
28,489,181
0
2
null
null
null
null
UTF-8
Java
false
false
2,435
java
package a5adept; import java.util.Iterator; import java.util.NoSuchElementException; import comp401.sushi.Plate; public class Belt implements Iterable<Plate> { private int size; private int position; private Plate[] plateArray; public Belt(int size) { this.size = size; if (size <= 0) { throw new IllegalArgumentException(); } plateArray = new Plate[size]; } // Helper method to take care of the modding private int modOperations(int position) { if (position < 0) { position = (((position % size) + size) % size); } else { position = (position % size); } return position; } public int getSize() { return size; } public Plate getPlateAtPosition(int position) { return plateArray[modOperations(position)]; } public void setPlateAtPosition(Plate plate, int position) throws BeltPlateException { position = modOperations(position); if (plate == null) { throw new IllegalArgumentException(); } else if (getPlateAtPosition(position) != null) { throw new BeltPlateException(position, plate, this); } plateArray[position] = plate; } public void clearPlateAtPosition(int position) { position = modOperations(position); plateArray[position] = null; } public Plate removePlateAtPosition(int position) { position = modOperations(position); Plate plateToRemove = getPlateAtPosition(position); if (plateToRemove == null) { throw new NoSuchElementException(); } else { clearPlateAtPosition(position); return plateToRemove; } } public int setPlateNearestToPosition(Plate plate, int position) throws BeltFullException { position = modOperations(position); for (int i = 0; i < plateArray.length; i++) { int j = position + i; j = modOperations(j); if (plateArray[j] == null) { plateArray[j] = plate; return j; } } throw new BeltFullException(this); } @Override public Iterator<Plate> iterator() { position = modOperations(position); return new BeltIterator(this, position); } public Iterator<Plate> iteratorFromPosition(int position) { position = modOperations(position); return new BeltIterator(this, position); } public void rotate() { Plate[] tempArray = new Plate[size]; for (int i = 0; i <= size - 1; i++) { if (i == 0) { tempArray[i] = plateArray[size - 1]; } else { tempArray[i] = plateArray[i - 1]; } } plateArray = tempArray.clone(); } }
[ "apharri3@live.unc.edu" ]
apharri3@live.unc.edu
e7c3a40d230b11ee964832fb1dc7222e10f19819
586709c5449ea670ca1f8ccba15675a1fe001c1c
/0001/app/src/main/java/com/example/tjss/a0001/MainActivity.java
ba30fe96da45d30a930849bd58debc438b0afa1c
[]
no_license
semasmelash/TJSS
758b69cf35ced90166c31086856d3a6932d9d9ac
fe217066232fe62d57386ef107bc4c935ebe14e8
refs/heads/master
2021-01-01T16:33:29.790647
2017-07-20T17:06:42
2017-07-20T17:06:42
97,859,729
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package com.example.tjss.a0001; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_relative); } }
[ "tjss@local.tjhsst.edu" ]
tjss@local.tjhsst.edu
0c8808325a4893ff43d1dc855189a3f77ef2ec67
c77fde95e726753daad0397a15661f09ac50c0cd
/minimumTotal_120.java
f4c9962d6240ffc8431b381966e0e4d7754653e0
[]
no_license
Hidewolf/LeetcodePractise
df64a603f50b40c96027a12f154d6de1503baba9
828a1d390fdd6bd2c3a05e75cb554b2692e38154
refs/heads/master
2023-01-27T11:27:45.691635
2020-12-11T08:48:21
2020-12-11T08:48:21
274,301,189
0
0
null
null
null
null
UTF-8
Java
false
false
1,795
java
import java.util.ArrayList; import java.util.List; public class minimumTotal_120 { public static void main(String[] args) { minimumTotal_120 t = new minimumTotal_120(); List<Integer> tIntegers = new ArrayList(); //System.out.println(t.minimumTotal(nums, 8)); } public int minimumTotal(List<List<Integer>> triangle) { for(int i = triangle.size()-1;i>0;i--){ for(int j = 0;j<triangle.get(i).size()-1;j++){ int t = triangle.get(i-1).get(j); int t1 = triangle.get(i).get(j); int t2 = triangle.get(i).get(j+1); if(t1<t2){ triangle.get(i-1).set(j, t+t1); }else{ triangle.get(i-1).set(j, t+t2); } } } return triangle.get(0).get(0); } } /* class Solution { public int minimumTotal(List<List<Integer>> triangle) { //dps? //dp 按层遍历利用动态规划优化,按照层dp[i][],类似于从左上到右下的矩阵 // 特判 if (triangle == null || triangle.size() == 0) { return 0; } int [][] dp =new int[triangle.size()][triangle.get(triangle.size()-1).size()]; dp[0][0] = triangle.get(0).get(0); for(int i =1 ;i <triangle.size();i++){ for(int j =0; j<=i; j++){ if(j == 0){ dp[i][j] = dp[i-1][j]+triangle.get(i).get(j); } else if(j == i){ dp[i][j] = dp[i-1][j-1]+triangle.get(i).get(j); } else{ dp[i][j] = Math.min(dp[i-1][j-1],dp[i-1][j])+triangle.get(i).get(j); } } } int res = Integer.MAX_VALUE; // dp最后一行记录了最小路径 for (int i = 0; i < triangle.get(triangle.size()-1).size(); i++) { res = Math.min(res, dp[triangle.size() - 1][i]); } return res; } }*/
[ "superestboy@126.com" ]
superestboy@126.com
70aac4b8c9d91bf846e06a8f7b4753f8407de924
919b2816ce09a52d95d91843ef69083f4313b9db
/search/DeviceStreamSearchResults.java
8e3145b978d816bfb4c9f5d087c6270e7d3c16f8
[]
no_license
Walidib/sitewhere
f6d582df20a6e670ebfb1ed849fdc9c38942c80d
985e87c3cf14b31d887b6f21c3118ca596d879c7
refs/heads/main
2023-08-27T04:25:55.699828
2021-09-20T01:46:08
2021-09-20T01:46:08
408,276,797
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
/* * Copyright (c) SiteWhere, LLC. All rights reserved. http://www.sitewhere.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package com.sitewhere.rest.model.search; import java.util.ArrayList; import java.util.List; import com.sitewhere.rest.model.device.streaming.DeviceStream; /** * Search results that contain device streams. Needed so that JSON marshaling * has a concrete class to inflate. * * @author dadams */ public class DeviceStreamSearchResults extends SearchResults<DeviceStream> { public DeviceStreamSearchResults() { super(new ArrayList<DeviceStream>()); } public DeviceStreamSearchResults(List<DeviceStream> results) { super(results); } }
[ "noreply@github.com" ]
noreply@github.com
e91fcc345a81bee693899b343a90c92530f814f6
7c194da3a2f795deb94379afff118d764efb735a
/kanbanery-for-android/gen/pl/project13/kanbanery/R.java
fbcc4086e0406b20026c68e3c2f8f62b6ffc3092
[]
no_license
pklipp/kanbanery-for-android
110c098b554b59948536027779980e693fe48767
ad2fb20f91dfa086c034ca6b29654f3d9ae24292
refs/heads/master
2020-05-29T11:49:56.981464
2011-10-09T17:54:34
2011-10-09T17:54:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
30,996
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package pl.project13.kanbanery; public final class R { public static final class array { public static final int column_capacities=0x7f060000; public static final int new_task_task_priorities=0x7f060001; } public static final class attr { /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int barColor=0x7f010001; /** <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int fadeDelay=0x7f010003; /** <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int fadeDuration=0x7f010004; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int highlightColor=0x7f010002; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int pageWidth=0x7f010000; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int roundRectRadius=0x7f010005; } public static final class color { public static final int black=0x7f070000; public static final int error_message=0x7f070004; public static final int estimateGray=0x7f070001; public static final int gray=0x7f070002; public static final int kanbanery_tasktype_yellow=0x7f070006; public static final int red=0x7f070005; public static final int white=0x7f070003; } public static final class dimen { public static final int assign_task_dialog_height=0x7f080008; public static final int column_header=0x7f080000; public static final int owner_maxHeight=0x7f080005; public static final int owner_maxWidth=0x7f080004; public static final int owner_small_maxHeight=0x7f080007; public static final int owner_small_maxWidth=0x7f080006; public static final int small_button_text_size=0x7f080003; public static final int task_title=0x7f080001; public static final int task_type=0x7f080002; } public static final class drawable { public static final int bg=0x7f020000; public static final int ic_contact_picture=0x7f020001; public static final int ic_contact_picture_2=0x7f020002; public static final int ic_contact_picture_small=0x7f020003; public static final int ic_github=0x7f020004; public static final int ic_kanbanery=0x7f020005; public static final int ic_not_ready_to_pull=0x7f020006; public static final int ic_plus=0x7f020007; public static final int ic_project13=0x7f020008; public static final int ic_ready_to_pull=0x7f020009; public static final int icon_add=0x7f02000a; public static final int icon_add_task=0x7f02000b; public static final int icon_arrow_refresh=0x7f02000c; public static final int icon_back=0x7f02000d; public static final int icon_block=0x7f02000e; public static final int icon_collapse=0x7f02000f; public static final int icon_comment=0x7f020010; public static final int icon_comment_add=0x7f020011; public static final int icon_deadline=0x7f020012; public static final int icon_delete=0x7f020013; public static final int icon_door_out=0x7f020014; public static final int icon_edit_clear=0x7f020015; public static final int icon_expand=0x7f020016; public static final int icon_folder=0x7f020017; public static final int icon_github=0x7f020018; public static final int icon_image=0x7f020019; public static final int icon_image_add=0x7f02001a; public static final int icon_issue=0x7f02001b; public static final int icon_key=0x7f02001c; public static final int icon_link=0x7f02001d; public static final int icon_new=0x7f02001e; public static final int icon_processing=0x7f02001f; public static final int icon_search=0x7f020020; public static final int icon_task_icebox_in=0x7f020021; public static final int icon_tasks=0x7f020022; public static final int icon_tool=0x7f020023; public static final int icon_ui_stars=0x7f020024; public static final int icon_zoom=0x7f020025; public static final int kanbanery_logo=0x7f020026; public static final int preview_widget=0x7f020027; public static final int subscribe_unsubscribe=0x7f020028; public static final int tutorial_overlay=0x7f020029; public static final int wrench=0x7f02002a; } public static final class id { public static final int after_column=0x7f0b000d; public static final int board_scroller=0x7f0b0001; public static final int body=0x7f0b0007; public static final int body_label=0x7f0b0013; public static final int bottom_text=0x7f0b0031; public static final int btn=0x7f0b0024; public static final int cancel=0x7f0b0016; public static final int cancel_btn=0x7f0b000c; public static final int capacity=0x7f0b000e; public static final int column_title=0x7f0b0004; public static final int columns_container=0x7f0b0002; public static final int columns_pager=0x7f0b0005; public static final int columns_refresh=0x7f0b0047; public static final int columns_sign_out=0x7f0b004b; public static final int commenter_image_btn=0x7f0b0008; public static final int comments=0x7f0b003c; public static final int comments_linear_layout=0x7f0b0009; public static final int container=0x7f0b0023; public static final int create_btn=0x7f0b000b; public static final int create_new_column_btn=0x7f0b000f; public static final int delete_btn=0x7f0b0036; public static final int delete_menu_item=0x7f0b0052; public static final int description_txt=0x7f0b003b; public static final int details_btn=0x7f0b0038; public static final int details_layout=0x7f0b0039; public static final int dont_have_an_account_yet_text=0x7f0b0022; public static final int email_edit_text=0x7f0b001f; public static final int estimate_btn=0x7f0b002c; public static final int hide_details_text_view=0x7f0b003a; public static final int how_many_tasks_todo=0x7f0b0043; public static final int id=0x7f0b0045; public static final int image=0x7f0b0019; public static final int is_ready_to_pull=0x7f0b0033; public static final int item_name=0x7f0b0017; public static final int item_quantity=0x7f0b0018; public static final int lets_get_it_now_btn=0x7f0b0015; public static final int linearLayout2=0x7f0b002e; public static final int login_table=0x7f0b001e; public static final int mark_as_done_menu_item=0x7f0b0050; public static final int mark_as_not_done_menu_item=0x7f0b0051; public static final int message=0x7f0b0000; public static final int move_btn=0x7f0b0035; public static final int move_menu_item=0x7f0b004c; public static final int move_sub_menu=0x7f0b004d; public static final int move_to_next_column_menu_item=0x7f0b004e; public static final int move_to_previous_column_menu_item=0x7f0b004f; public static final int new_column_menu_btn=0x7f0b0048; public static final int new_comment_btn=0x7f0b0037; public static final int new_comment_under_task_details_btn=0x7f0b000a; public static final int new_subtask_under_task_details_btn=0x7f0b0028; public static final int new_task_menu_btn=0x7f0b0046; public static final int open_settings=0x7f0b004a; public static final int pass_edit_text=0x7f0b0020; public static final int project_name=0x7f0b001a; public static final int quick_actions=0x7f0b0034; public static final int select_project_layout=0x7f0b001d; public static final int sign_in_btn=0x7f0b0021; public static final int subtask_body=0x7f0b0025; public static final int subtask_status_checkbox=0x7f0b0026; public static final int subtasks=0x7f0b003d; public static final int subtasks_linear_layout=0x7f0b0027; public static final int switch_project=0x7f0b0049; public static final int task_description=0x7f0b0012; public static final int task_details=0x7f0b0029; public static final int task_details_container=0x7f0b0006; public static final int task_id=0x7f0b0032; public static final int task_middle_contents=0x7f0b002f; public static final int task_owner_icon=0x7f0b0042; public static final int task_owner_image_btn=0x7f0b002d; public static final int task_title=0x7f0b0010; public static final int task_type=0x7f0b0011; public static final int task_type_btn=0x7f0b002b; public static final int top_level_container=0x7f0b002a; public static final int top_text=0x7f0b0030; public static final int tutorial_overlay=0x7f0b0003; public static final int user_display_name=0x7f0b0040; public static final int user_icon=0x7f0b003f; public static final int user_row=0x7f0b003e; public static final int watch_this_repository_check_box=0x7f0b001c; public static final int why_should_i_go_pro_text=0x7f0b0014; public static final int widget_layout=0x7f0b0041; public static final int workspace_name=0x7f0b001b; public static final int workspaces=0x7f0b0044; } public static final class layout { public static final int billing_not_supported=0x7f030000; public static final int board=0x7f030001; public static final int board_with_tutorial_overlay=0x7f030002; public static final int column=0x7f030003; public static final int column_header=0x7f030004; public static final int columns=0x7f030005; public static final int comment=0x7f030006; public static final int comments_under_task_on_board=0x7f030007; public static final int create_cancel_buttons=0x7f030008; public static final int dialog_assign_task=0x7f030009; public static final int dialog_new_column=0x7f03000a; public static final int dialog_new_task=0x7f03000b; public static final int dialog_with_one_edit_text=0x7f03000c; public static final int empty_workspaces_create_one=0x7f03000d; public static final int get_full_version_dialog=0x7f03000e; public static final int item_row=0x7f03000f; public static final int main=0x7f030010; public static final int select_project_item=0x7f030011; public static final int select_project_preference=0x7f030012; public static final int sign_in=0x7f030013; public static final int simple_dialog=0x7f030014; public static final int subtask=0x7f030015; public static final int subtasks_under_task_on_board=0x7f030016; public static final int task_list_fragment=0x7f030017; public static final int task_on_board=0x7f030018; public static final int user=0x7f030019; public static final int widget=0x7f03001a; public static final int workspaces_and_projects=0x7f03001b; public static final int workspaces_project=0x7f03001c; public static final int workspaces_workspace=0x7f03001d; } public static final class menu { public static final int columns_menu=0x7f0a0000; public static final int only_settings_menu=0x7f0a0001; public static final int task_context_menu=0x7f0a0002; } public static final class string { public static final int about_header=0x7f05002f; public static final int about_header_summary=0x7f050030; public static final int action_notification_sound_title=0x7f05003c; public static final int action_notifications_category_title=0x7f050039; public static final int add_comment=0x7f050072; public static final int add_subtask=0x7f050078; public static final int api_key=0x7f05003f; public static final int api_key_summary=0x7f050040; public static final int app_name=0x7f050017; public static final int assign_task_to=0x7f050049; public static final int assign_task_to_label=0x7f050080; public static final int blog_project13_summary=0x7f050037; public static final int blog_project13_title=0x7f050036; public static final int cache_properties_header=0x7f05002b; public static final int cache_properties_header_summary=0x7f05002c; public static final int cancel=0x7f050051; public static final int change_task_estimate=0x7f05005a; public static final int change_task_type=0x7f050059; public static final int clear_image_cache=0x7f05004d; public static final int clear_image_cache_summary=0x7f05004e; public static final int columns_refresh=0x7f050021; public static final int comments=0x7f050071; public static final int copyleft=0x7f050038; public static final int crash_dialog_comment_prompt=0x7f050006; public static final int crash_dialog_ok_toast=0x7f050007; public static final int crash_dialog_text=0x7f050005; public static final int crash_dialog_title=0x7f050004; public static final int crash_notif_text=0x7f050003; public static final int crash_notif_ticker_text=0x7f050001; public static final int crash_notif_title=0x7f050002; public static final int crash_toast_text=0x7f050000; public static final int create=0x7f050050; public static final int create_a_new_task=0x7f050070; public static final int create_new_column_label=0x7f050060; public static final int create_new_comment_label=0x7f050073; public static final int create_new_subtask_label=0x7f050079; public static final int create_task=0x7f05006b; public static final int create_workspace_and_project=0x7f050076; public static final int current_project_title=0x7f050045; public static final int delete=0x7f050062; public static final int delete_menu_item=0x7f050022; public static final int delete_task_message=0x7f050064; public static final int delete_task_title=0x7f050063; public static final int dont_have_an_account_yet_register=0x7f05005f; public static final int force_phone_mode=0x7f050068; public static final int force_phone_mode_summary=0x7f050069; public static final int form_task_description=0x7f05006e; public static final int form_task_title=0x7f05006c; public static final int form_task_type=0x7f05006d; public static final int general_preference_category=0x7f050081; public static final int generic_empty_list_view=0x7f05007d; public static final int get_pro_dialog_title=0x7f05005b; public static final int get_pro_now=0x7f05005c; public static final int get_pro_now_summary=0x7f05005e; public static final int get_pro_now_title=0x7f05005d; public static final int homepages_preference_category=0x7f050031; public static final int images_cache_category=0x7f05004b; public static final int images_cache_category_summary=0x7f05004c; public static final int janbanery_apikey=0x7f050008; public static final int janbanery_workspace=0x7f050009; public static final int jump_to_api_key_website=0x7f050041; public static final int jump_to_api_key_website_summary=0x7f050042; public static final int kanbanery=0x7f050018; public static final int kanbanery_account_category=0x7f05003e; public static final int kanbanery_android_homepage_summary=0x7f050035; public static final int kanbanery_android_homepage_title=0x7f050034; public static final int kanbanery_for_android_homepage_label=0x7f050084; public static final int kanbanery_for_android_homepage_summary=0x7f050085; public static final int kanbanery_homepage_summary=0x7f050033; public static final int kanbanery_homepage_title=0x7f050032; /** headers */ public static final int kanbanery_properties_header=0x7f050029; public static final int kanbanery_properties_header_summary=0x7f05002a; /** Important unlock app name pl.project13.kanbanery.topsecretunlockerapp */ public static final int kanbanery_unlock_app_name_base64=0x7f050019; public static final int mark_as_not_ready_to_pull_menu_item=0x7f05001d; public static final int mark_as_ready_to_pull_menu_item=0x7f05001c; public static final int maybe_later=0x7f05007e; public static final int move=0x7f050061; public static final int move_left_menu_item=0x7f05001b; public static final int move_menu_item=0x7f05001e; public static final int move_right_menu_item=0x7f05001a; public static final int my_watched_repositories_summary=0x7f050046; public static final int new_column_after_column=0x7f050057; public static final int new_column_capacity=0x7f05007a; public static final int new_column_menu_title=0x7f05004f; public static final int new_column_name=0x7f050052; public static final int new_comment_body=0x7f050074; public static final int new_subtask_body_label=0x7f05007b; public static final int new_subtask_create=0x7f05007c; public static final int new_task=0x7f05006f; public static final int new_task_menu_title=0x7f05000a; public static final int new_task_task_deadline=0x7f05000d; public static final int new_task_task_description=0x7f05000e; public static final int new_task_task_estimate=0x7f05000f; public static final int new_task_task_priority=0x7f05000c; public static final int new_task_task_priority_notice=0x7f050011; public static final int new_task_task_title=0x7f05000b; public static final int new_task_task_type=0x7f050010; public static final int next_column=0x7f05001f; public static final int no_thanks=0x7f05007f; public static final int notification_properties_header=0x7f05002d; public static final int notification_properties_header_summary=0x7f05002e; public static final int notifications_when_wifi_3g_category_title=0x7f05003d; public static final int ok=0x7f05004a; public static final int preference_key_action_notifications=0x7f050012; public static final int preference_key_api_key=0x7f050013; public static final int preference_key_clear_image_cache=0x7f050058; public static final int preference_key_current_project=0x7f050015; public static final int preference_key_current_workspace=0x7f050014; public static final int preference_key_force_run_in_phone_mode=0x7f050067; public static final int preference_key_show_tutorial=0x7f050016; public static final int previous_column=0x7f050020; public static final int projects_category=0x7f050043; public static final int projects_category_summary=0x7f050044; public static final int search_hint=0x7f050047; public static final int settings=0x7f050025; public static final int show_tutorial=0x7f050055; public static final int show_tutorial_summary=0x7f050056; public static final int sign_in=0x7f050023; public static final int sign_out=0x7f050024; public static final int subtasks=0x7f050077; public static final int switch_project=0x7f050048; public static final int task_description=0x7f050028; public static final int task_estimate=0x7f050026; public static final int task_priority=0x7f050027; public static final int the_password_will_not_be_stored_on_the_device=0x7f05006a; public static final int tutorial_category=0x7f050053; public static final int tutorial_category_summary=0x7f050054; public static final int upgrade_kanbanery_to_pro_label=0x7f050082; public static final int upgrade_kanbanery_to_pro_summary=0x7f050083; public static final int use_new_action_notifications_summary=0x7f05003b; public static final int use_new_action_notifications_title=0x7f05003a; public static final int view_mode=0x7f050065; public static final int view_mode_summary=0x7f050066; public static final int why_should_i_upgrade=0x7f050086; public static final int you_have_no_workspace_why_not_create_one_now=0x7f050075; } public static final class style { public static final int bold=0x7f090003; public static final int dialog_cancel_button=0x7f090008; public static final int dialog_create_button=0x7f090007; public static final int dialog_title=0x7f090006; public static final int repository_name=0x7f090001; public static final int task_property_title=0x7f090002; public static final int task_type=0x7f090000; public static final int workspaces_project_label=0x7f090005; /** Workspace / Project list in WorkspacesAndProjectsActivity */ public static final int workspaces_workspace_label=0x7f090004; } public static final class xml { public static final int about_preferences=0x7f040000; public static final int cache_preferences=0x7f040001; public static final int kanbanery_preferences=0x7f040002; public static final int not_pro_general_preferences=0x7f040003; public static final int notifications_preferences=0x7f040004; public static final int pro_general_preferences=0x7f040005; public static final int searchable=0x7f040006; } public static final class styleable { /** Attributes that can be used with a com_deezapps_widget_HorizontalPager. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #com_deezapps_widget_HorizontalPager_pageWidth pl.project13.kanbanery:pageWidth}</code></td><td></td></tr> </table> @see #com_deezapps_widget_HorizontalPager_pageWidth */ public static final int[] com_deezapps_widget_HorizontalPager = { 0x7f010000 }; /** <p>This symbol is the offset where the {@link pl.project13.kanbanery.R.attr#pageWidth} attribute's value can be found in the {@link #com_deezapps_widget_HorizontalPager} array. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name android:pageWidth */ public static final int com_deezapps_widget_HorizontalPager_pageWidth = 0; /** Attributes that can be used with a com_deezapps_widget_PagerControl. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #com_deezapps_widget_PagerControl_barColor pl.project13.kanbanery:barColor}</code></td><td></td></tr> <tr><td><code>{@link #com_deezapps_widget_PagerControl_fadeDelay pl.project13.kanbanery:fadeDelay}</code></td><td></td></tr> <tr><td><code>{@link #com_deezapps_widget_PagerControl_fadeDuration pl.project13.kanbanery:fadeDuration}</code></td><td></td></tr> <tr><td><code>{@link #com_deezapps_widget_PagerControl_highlightColor pl.project13.kanbanery:highlightColor}</code></td><td></td></tr> <tr><td><code>{@link #com_deezapps_widget_PagerControl_roundRectRadius pl.project13.kanbanery:roundRectRadius}</code></td><td></td></tr> </table> @see #com_deezapps_widget_PagerControl_barColor @see #com_deezapps_widget_PagerControl_fadeDelay @see #com_deezapps_widget_PagerControl_fadeDuration @see #com_deezapps_widget_PagerControl_highlightColor @see #com_deezapps_widget_PagerControl_roundRectRadius */ public static final int[] com_deezapps_widget_PagerControl = { 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005 }; /** <p>This symbol is the offset where the {@link pl.project13.kanbanery.R.attr#barColor} attribute's value can be found in the {@link #com_deezapps_widget_PagerControl} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name android:barColor */ public static final int com_deezapps_widget_PagerControl_barColor = 0; /** <p>This symbol is the offset where the {@link pl.project13.kanbanery.R.attr#fadeDelay} attribute's value can be found in the {@link #com_deezapps_widget_PagerControl} array. <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name android:fadeDelay */ public static final int com_deezapps_widget_PagerControl_fadeDelay = 2; /** <p>This symbol is the offset where the {@link pl.project13.kanbanery.R.attr#fadeDuration} attribute's value can be found in the {@link #com_deezapps_widget_PagerControl} array. <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name android:fadeDuration */ public static final int com_deezapps_widget_PagerControl_fadeDuration = 3; /** <p>This symbol is the offset where the {@link pl.project13.kanbanery.R.attr#highlightColor} attribute's value can be found in the {@link #com_deezapps_widget_PagerControl} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name android:highlightColor */ public static final int com_deezapps_widget_PagerControl_highlightColor = 1; /** <p>This symbol is the offset where the {@link pl.project13.kanbanery.R.attr#roundRectRadius} attribute's value can be found in the {@link #com_deezapps_widget_PagerControl} array. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name android:roundRectRadius */ public static final int com_deezapps_widget_PagerControl_roundRectRadius = 4; }; }
[ "konrad.malawski@project13.pl" ]
konrad.malawski@project13.pl
8dee57c1f4166a6a5411f11764b3d157eb56b84d
065b6b17476f0c860c188d11b696c6b79c26da1d
/samplespringjps-1/src/main/java/com/example/demo/controller/BookController.java
a1a0e2265367d549cc2af47f1f3dafab8c8bff5b
[]
no_license
PushkrajSonalkar/jpa25062019
0ab94241b3f125aa2ccc24ed7a1e7f43dc420611
015173c2f663d3158dc5bf9a474c0b0c16799ca4
refs/heads/master
2020-06-10T18:50:59.042602
2019-06-25T14:05:56
2019-06-25T14:05:56
193,711,459
0
0
null
null
null
null
UTF-8
Java
false
false
1,094
java
package com.example.demo.controller; import java.io.IOException; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.example.demo.model.Book; import com.example.demo.service.BookService; @Controller @RestController @RequestMapping("/rest") public class BookController { public static final Logger logger = LoggerFactory.getLogger(BookController.class); @Autowired private BookService bookService; @RequestMapping(value="/list_books" , method = RequestMethod.GET) public ModelAndView ListBooks(ModelAndView model) throws IOException { List<Book> listBooks = bookService.getAllBooks(); model.addObject("listBooks", listBooks); model.setViewName("books"); return model; } }
[ "pushkraj.sonalkar@gmail.com" ]
pushkraj.sonalkar@gmail.com
168f888647c8a7029e0b95e937078e96a41bb221
13b74d6761960b27ee5db75ef4e7c598cb7fd63e
/src/stadtradcrawl/WebCrawler.java
3f6e95943158f8e7c3ec6499588c4d2c42dd6c0e
[]
no_license
acf173/StadtradCrawler
54bf6c7c2b948506f94b5907a26279b2e73d1098
5a082c1674907461f284a41cf6bf95c09d0bd7ed
refs/heads/master
2020-12-24T10:43:57.622306
2016-11-02T09:15:37
2016-11-02T09:15:37
73,131,780
0
0
null
2016-11-07T23:56:14
2016-11-07T23:56:13
Java
UTF-8
Java
false
false
3,278
java
/* * Quelle: http://stackoverflow.com/questions/4308554/simplest-way-to-read-json-from-a-url-in-java * Author: Andreas L�ffler */ package stadtradcrawl; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.mysql.jdbc.Connection; import com.mysql.jdbc.Driver; public class WebCrawler { private JSONObject json = null; private JSONArray dataArray = null; public WebCrawler(String url) throws JSONException, IOException { super(); json = this.readJsonFromUrl(url); dataArray = json.getJSONObject("network").getJSONArray("stations"); } /*Read all from Reader rd and put it to one String. Return whole String */ private String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } /*Create Readers to read from the URL. URL is an inputparameter. Create form the returned String (Methode: readAll) one JSONObject. * JSONObject ist returned */ private JSONObject readJsonFromUrl(String url) throws IOException, JSONException { InputStream is = new URL(url).openStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { //finally will always execute, if an try block exists. Doesnt matter if there is an Exception or not. is.close(); } } /*Input-Parameter is JSONArray. Iterate through the array and print needed Information */ public void persistData() throws JSONException, InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection = (Connection) DriverManager.getConnection( "jdbc:mysql://mysqldb:3306/mi", "mi", "miws16" ); String query = " insert into crawledData (station_id, station_name, free_bikes, information_timestamp, latitude, longitude)" + " values (?, ?, ?, ?, ?, ?)"; for (int i = 0; i < dataArray.length(); i++) { PreparedStatement preparedStmt = connection.prepareStatement(query); preparedStmt.setString(1, dataArray.getJSONObject(i).get("id").toString()); preparedStmt.setString(2, dataArray.getJSONObject(i).get("name").toString()); preparedStmt.setString(3, dataArray.getJSONObject(i).get("free_bikes").toString()); preparedStmt.setString(4, dataArray.getJSONObject(i).get("timestamp").toString()); preparedStmt.setString(5, dataArray.getJSONObject(i).get("latitude").toString()); preparedStmt.setString(6, dataArray.getJSONObject(i).get("longitude").toString()); // execute the preparedstatement preparedStmt.execute(); } connection.close(); } }
[ "flah.ahmad@haw-hamburg.de" ]
flah.ahmad@haw-hamburg.de
85b4a6f1fc31d0c2c9114d0b4020b9d0cc2a394b
748767c0d9a515fcc50b0e1758838cad3adca399
/src/MinimumWindowSubstring.java
c5b510caaa958fa5cc389aa93fb8b2a51442e932
[]
no_license
Allen1012/leetcode
bcf48e007bcfcad6b5ce58ebc9873b8afc3ba642
6eeb5b19a90bed2d4a7db3dac187798f3080ece1
refs/heads/main
2023-03-27T10:46:12.145313
2021-03-29T03:55:09
2021-03-29T03:55:09
329,338,573
0
0
null
null
null
null
UTF-8
Java
false
false
4,732
java
import java.util.HashMap; /** * 76. 最小覆盖子串 * 难度 * 困难 * * 946 * * * * * * 给你一个字符串 s 、一个字符串 t 。返回 s 中涵盖 t 所有字符的最小子串。如果 s 中不存在涵盖 t 所有字符的子串,则返回空字符串 "" 。 * * 注意:如果 s 中存在这样的子串,我们保证它是唯一的答案。 * * * * 示例 1: * * 输入:s = "ADOBECODEBANC", t = "ABC" * 输出:"BANC" * 示例 2: * * 输入:s = "a", t = "a" * 输出:"a" * * * 提示: * * 1 <= s.length, t.length <= 105 * s 和 t 由英文字母组成 * * * 进阶:你能设计一个在 o(n) 时间内解决此问题的算法吗? * * https://leetcode-cn.com/problems/minimum-window-substring/ */ public class MinimumWindowSubstring { public static void main(String[] args) { String s = "ghkomrbfbkoowqwgaurizliesjnveoxmvjdjaepdqftmvsuyoogobrutahogxnvuxyezevfuaaiyufwjtezuxtpycfgasburzytdvazwakuxpsiiyhewctwgycgsgdkhdfnzfmvhwrellmvjvzfzsdgqgolorxvxciwjxtqvmxhxlcijeqiytqrzfcpyzlvbvrksmcoybxxpbgyfwgepzvrezgcytabptnjgpxgtweiykgfiolxniqthzwfswihpvtxlseepkopwuueiidyquratphnnqxflqcyiiezssoomlsxtyxlsolngtctjzywrbvajbzeuqsiblhwlehfvtubmwuxyvvpwsrhutlojgwktegekpjfidgwzdvxyrpwjgfdzttizquswcwgshockuzlzulznavzgdegwyovqlpmnluhsikeflpghagvcbujeapcyfxosmcizzpthbzompvurbrwenflnwnmdncwbfebevwnzwclnzhgcycglhtbfjnjwrfxwlacixqhvuvivcoxdrfqazrgigrgywdwjgztfrbanwiiayhdrmuunlcxstdsrjoapntugwutuedvemyyzusogumanpueyigpybjeyfasjfpqsqotkgjqaxspnmvnxbfvcobcudxflmvfcjanrjfthaiwofllgqglhkndpmiazgfdrfsjracyanwqsjcbakmjubmmowmpeuuwznfspjsryohtyjuawglsjxezvroallymafhpozgpqpiqzcsxkdptcutxnjzawxmwctltvtiljsbkuthgwwbyswxfgzfewubbpowkigvtywdupmankbndyligkqkiknjzchkmnfflekfvyhlijynjlwrxodgyrrxvzjhoroavahsapdiacwjpucnifviyohtprceksefunzucdfchbnwxplhxgpvxwrmpvqzowg"; String t = "jhdcgr"; MinimumWindowSubstring m = new MinimumWindowSubstring(); String ret = m.minWindow(s,t); System.out.println(ret); } public String minWindow(String s, String t) { if(s.isEmpty()){ return ""; } if(t.isEmpty()){ return s; } if(t.length() > s.length()){ return ""; } if(t.equals(s)){ return t; } HashMap<Character,Integer> tMap = new HashMap<Character, Integer>(); char c ; for (int i = 0; i < t.length(); i++) { c = t.charAt(i); if(tMap.containsKey(c)){ tMap.put(c,tMap.get(c) + 1); }else { tMap.put(c,1); } } int len = (s.length() - t.length()) / 2 + t.length(); findStr(t.length(),len,s.length(),s,tMap); return ret; } String ret = ""; public void findStr(int start ,int len,int end,String s,HashMap<Character,Integer> tMap){ int mid; System.out.println(start + " : " + len + " : "+end); if(len > end || len < start){ return; } HashMap<Character,Integer> map = new HashMap<Character, Integer>(); char temp; char c; for (int i = 0; i < len -1; i++) { c = s.charAt(i); if(map.containsKey(c)){ map.put(c,map.get(c) + 1); }else { map.put(c,1); } } for (int i = 0; i < s.length() - len + 1; i++) { temp = s.charAt( len + i - 1 ); if(map.containsKey(temp)){ map.put(temp,map.get(temp) + 1); }else { map.put(temp,1); } if(isEqual(map,tMap)){ String tem = s.substring(i,i+len); mid = (len - start) / 2 + start; if(mid == len){ len--; mid--; } findStr(start,mid,len,s,tMap); System.out.println("tem :" + tem); if(ret.isEmpty() || tem.length() < ret.length()){ ret = tem; } return ; } c = s.charAt(i); map.put(c,map.get(c) - 1); } mid = (end - len) / 2 + len; if(mid == len){ len++; mid++; } findStr(len,mid,end,s,tMap); return ; } public boolean isEqual(HashMap<Character,Integer> map1, HashMap<Character,Integer> map2){ for(char key:map2.keySet()) { if(!map1.containsKey(key)){ return false; } if((int)map1.get(key) < (int)map2.get(key)){ return false; } } return true; } }
[ "921543658@qq.com" ]
921543658@qq.com
69036d5c5ec3e2baab29aa5a1221bec0964d7b02
fc8bfd5c4569ed643b1b459831302765fb1a32aa
/app/src/main/java/com/app/coolweather/model/City.java
e20371eb66e4d6ef5e5231b1c51c2f8007d08ca5
[ "Apache-2.0" ]
permissive
guoweiwen/coolweather
87bba02109e08f0d0aed636cc340fc5845ec90c2
525ae4c9fa50cdba55ccb47ce389c959f108a2e7
refs/heads/master
2021-01-16T21:54:13.568135
2016-06-10T05:02:10
2016-06-10T05:02:10
60,683,217
0
0
null
null
null
null
UTF-8
Java
false
false
763
java
package com.app.coolweather.model; /** * 城市. */ public class City { private int id; private String cityName; private String cityCode; private int provinceId; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public String getCityCode() { return cityCode; } public void setCityCode(String cityCode) { this.cityCode = cityCode; } public int getProvinceId() { return provinceId; } public void setProvinceId(int provinceId) { this.provinceId = provinceId; } }
[ "467468775@qq.com" ]
467468775@qq.com
43b324a92049420170253d13f8964a810b269885
70b0f7b91c53267c01635956d0c284f12c81a9f9
/preference/src/test/java/org/ligboy/preference/ExampleUnitTest.java
7e6d81ef3ab47dbd204c16386ea86fa1e7b28dbd
[ "Apache-2.0" ]
permissive
ligboy/Preference
f15148590b9fe36d5cb81e4a5b53a78442a2d12b
9a7f012099f12ce2d1f552d15871a3961e332052
refs/heads/master
2021-01-10T08:43:44.524013
2015-12-23T08:33:39
2015-12-23T08:33:39
48,276,563
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package org.ligboy.preference; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "ligboy.liu@heysroad.com" ]
ligboy.liu@heysroad.com
44f872980b6c700f0fad5a907bc076126d4ff678
e740cba164d80aed0ecb9fe7714d8e40a138312a
/test/com/twu/biblioteca/ReturnCommandTest.java
0882501f03afb99fd12a5faf7f678bb005a49597
[ "Apache-2.0" ]
permissive
hpandya3/twu-biblioteca-harsh
44003c967665fac74383ca9953e7ff5c557557e4
e3282b00812769a7eaf816c2af828f21d1b8eefd
refs/heads/master
2021-10-26T02:07:30.919933
2018-01-23T02:49:22
2018-01-23T02:49:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,279
java
package com.twu.biblioteca; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.ArrayList; import static junit.framework.TestCase.assertTrue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; public class ReturnCommandTest { ReturnCommand rc; private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); private final ByteArrayOutputStream errContent = new ByteArrayOutputStream(); private Library getLibraryWithBooks() { ArrayList<Book> books = new ArrayList<Book>(); books.add(new Book("Code Complete", 1993, "Steve McConnell")); books.add(new Book("Clean Code", 2008, "Robert Cecil Martin")); return new Library(books); } @Before public void setUpStreams() throws BookCheckoutException { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); Library lib = getLibraryWithBooks(); lib.getAvailableBooks().get(0).checkout(); // Code Complete rc = new ReturnCommand("Return", lib); } @Test public void matches_commandTextDoesNotIncludeCommand_False() { assertFalse(rc.matches("retawd Code Complete")); } @Test public void matches_commandTextIncludesCommand_True() { assertTrue(rc.matches("Return Code Complete")); } @Test public void exec_ReturningTheCheckedOutBook_ReturnsBookSuccessfully() { assertTrue(rc.exec("Return Code Complete")); assertEquals("Thank you for returning the book.\n", outContent.toString()); } @Test public void exec_ReturningAnAlreadyReturnedBook_ReturnUnSuccessfull() { assertFalse(rc.exec("Return Clean Code")); assertEquals("That is not a valid book to return.\n", outContent.toString()); } @Test public void exec_ReturningABookNotPresentInLibrary_ReturnUnSuccessfull() { assertFalse(rc.exec("Return Design patterns")); assertEquals("That is not a valid book to return.\n", outContent.toString()); } @After public void cleanUpStreams() { System.setOut(null); System.setErr(null); } }
[ "harsh@AUhpandya.local" ]
harsh@AUhpandya.local
c9049be098babe8cf6646ed2d0c52bf035ba1d7a
bb795dfc8e82d870d466b1350ed44c5430274b11
/src/main/java/global/globalActions/randomActions.java
b5b688c0d024a77e10eab79d3f8a580c3275fa55
[]
no_license
yesodotQA/icu-automation
af39a73144c9c7a0d29e670314197f4adaaa2bd0
2908bab12e91e0cba75940add76b997ba1abb711
refs/heads/master
2021-01-03T19:44:56.857924
2020-02-13T10:12:03
2020-02-13T10:12:03
240,211,115
0
0
null
null
null
null
UTF-8
Java
false
false
2,480
java
package global.globalActions; import java.util.Random; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedConditions; import com.aventstack.extentreports.Status; import base.testBase; import global.globalElements.Tabs; import global.globalElements.middlePane; import global.globalElements.multipleSelect; import global.globalElements.theRightOfTheScreen; public class randomActions extends testBase{ Tabs tabs; middlePane middlepane; multipleSelect multipleselect; theRightOfTheScreen therightonthescreen; actionsMiddlePane actionmiddlepane; public randomActions(){ this.multipleselect = new multipleSelect(); this.middlepane = new middlePane(); this.tabs = new Tabs(); this.therightonthescreen = new theRightOfTheScreen(); this.actionmiddlepane = new actionsMiddlePane(); PageFactory.initElements(driver, this); } private void waitForVisibility (WebElement element) { wait.until(ExpectedConditions.visibilityOf(element)); } public void enterTagsFromList() throws InterruptedException{ String ExistingTag = "www (New)"; actionmiddlepane.openEntity("ExistingTags", "fjdkfhkfdjh"); waitForVisibility(therightonthescreen.enterTagsOnScreen); therightonthescreen.enterTagsOnScreen.click(); Thread.sleep(2000); for (int i = 0; i < therightonthescreen.listOfTagsOnScreen.size()-1; i++) { if (therightonthescreen.listOfTagsOnScreen.get(i).getText().equals(ExistingTag)) { therightonthescreen.listOfTagsOnScreen.get(i).click(); break; } } } public void chooseColor() throws InterruptedException { waitForVisibility(therightonthescreen.openColors); therightonthescreen.openColors.click(); Thread.sleep(2000); Random rand = new Random(); int randomColors = rand.nextInt(therightonthescreen.listOfColors.size()); therightonthescreen.listOfColors.get(randomColors).click(); } public void enterNameToEntity(String nam) throws InterruptedException{ waitForVisibility(middlepane.pressOnEntity); middlepane.pressOnEntity.click(); middlepane.pressOnEntity.sendKeys(nam); Thread.sleep(2000); if (middlepane.listOfnamesOfEntities.get(0).getText().equals(middlepane.enterTitle.getText())) { logger.log(Status.PASS, "enter name to entity from entity row"); } else { logger.log(Status.FAIL, "enter name to entity from entity row"); } } }
[ "israelfrank123@gmail.com" ]
israelfrank123@gmail.com
434df5bb4177409d8913414970c734072465ea89
558d06316061f6305f791ba866f213773d582648
/hw13/Holoporter.java
e65b7262956a9714146f46b85769547b6407cd8e
[]
no_license
bre216/CSE2
4d7944db1d3b034b89b06a4c5862223f02046f28
35814c1530633c97d3ce07e630a8bfa702de8b62
refs/heads/master
2021-01-17T11:17:09.127021
2016-05-14T21:20:20
2016-05-14T21:20:20
50,670,485
0
0
null
null
null
null
UTF-8
Java
false
false
13,597
java
// Brendan Eckardt // cse2 hw12 // 4.23.2016 // holoporter program using 3D ragged arrays import java.util.Scanner; //import scanner class import java.util.Random; //import random class import java.util.Arrays; //import array method public class Holoporter{ //start of class //start of main method public static void main (String [] args ){ Random rand=new Random(); //construct and instance of random method String[][][] mArray=new String[rand.nextInt(10)+1][][]; soRandom( mArray ); //run the soRandom method coder( mArray ); //run the coder method System.out.println("The original 3D array is: "); //print output message print( mArray ); //run print method String[][][] holder=new String[rand.nextInt(10)+1][][]; soRandom( holder ); //run soRandom method on new array holoport( mArray, holder ); //runs holoport method to transfer values from mArray to holder System.out.println("The copied 3D array is: "); //print output message print( holder ); //prints out the copied array System.out.println("Please enter a specific code to search for: "); //ask user for input Scanner sc=new Scanner(System.in); //construct an instance of the scanner class boolean test1=true; //create boolean variable to help navigate input tests String input="tttt"; //creates string variable while( test1 ){ //begins input check input=sc.next(); //sets next input as string variable if( input.matches("^[A-Z][A-Z][0-9][0-9][0-9][0-9]$") ){ //checks to see if input matches the required format test1=false; //if so, breaks out of input check } else{ //if input does not match required format for code System.out.println("Please enter a code in the form XXYYYY where X is an uppercase letter and Y is an integer from 0-9: "); //asks for correct format } } sampling( mArray, input); //runs the sampling method on mArray for the given input percentage( mArray, holder); //runs the percentage method frankenstein( holder ); //runs the frankenstein method on the copied array print( holder ); //prints array holder } //end of main method //method to create random ragged 3D array public static String[][][] soRandom( String[][][] array1 ){ Random rand=new Random(); //construct instance of random class for( int i=0; i<array1.length; i++ ){ //loops over the 1st array dimension array1[i]=new String[rand.nextInt(10)+1][]; //asigns each member of the array as a two dimensional array of size 1-10 for( int j=0; j<array1[i].length; j++ ){ //loops over the 2nd array dimension array1[i][j]=new String[rand.nextInt(10)+1]; //assigns each member of member array as an array of size 1-10 } } return array1; //returns the empty array } //end of space-creation method //method to fill array with codes for each position public static String[][][] coder( String[][][] array2 ){ Random rand=new Random(); //constructs an instance of the random class for( int i=0; i<array2.length; i++ ){ //loops over 1st dimension for( int j=0; j<array2[i].length; j++ ){ //loops over second dimension for( int k=0; k<array2[i][j].length; k++ ){ //loops over every index of 3rd dimension array2[i][j][k]=letter()+letter()+rand.nextInt(10)+rand.nextInt(10)+rand.nextInt(10)+rand.nextInt(10); //assigns that index a code value of the format specified } } } return array2; //returns the filled array with codes at each position } //end of coder method //method to print the 3D array public static void print(String[][][] arrayP){ for( int i=0; i<arrayP.length; i++ ){ //loops over the 1st dimension for( int j=0; j<arrayP[i].length; j++ ){ //loops over the 2nd dimension System.out.print("["); //prints start of output for( int k=0; k<arrayP[i][j].length; k++ ){ //loops over 3rd dimension if( k==arrayP[i][j].length-1){ //if the index is the last member in that array System.out.print(arrayP[i][j][k]); //prints out the code for that index } else{ //if that index is not the last position System.out.print(arrayP[i][j][k]+", "); //prints the code for that index and a comma } } System.out.print("]"); //prints the end of the 3rd level array if( j!=arrayP[i].length-1 ){ //if there is more to print System.out.print("|"); //separates that array from another 2nd dimensional array with a line } } if( i!=arrayP.length-1 ){ //if there is more to print System.out.print("---"); //separates that 1st dimensional array from another array with a series of dashes } } System.out.println(""); //moves to the next line to make the output clearer } //end of print method //holoporter method public static String[][][] holoport( String[][][] original, String[][][] copy ){ for( int i=0; i<copy.length; i++ ){ //for all elements of copy if( i<original.length ){ //if copy is shorter than original for( int j=0; j<copy[i].length; j++ ){ //for every element i of copy before the end of original if( j<original[i].length ){ //if that 2D array is smaller than original for( int k=0; k<copy[i][j].length; k++ ){ //for every element k of each 2nd dimensional array if( k<original[i][j].length ){ //if the index is lower than the length of the original array copy[i][j][k]=original[i][j][k]; //copies the value into the new array } else{ //if index is higher than the length of the original array copy[i][j][k]="$$$$$$"; //gives that position a value of $$$$$$ } } } else{ //if that 2D array is longer than original for( int k=0; k<copy[i][j].length; k++ ){ //repeats for second dimension copy[i][j][k]="$$$$$$"; //fills that position with $$$$$ } } } } else{ //if i is longer than original for( int j=0; j<copy[i].length; j++){ //for every element i past the end of original for( int k=0; k<copy[i][j].length; k++ ){ //for every element k copy[i][j][k]="$$$$$$"; //fills that position with $$$$$ } } } } return copy; //returns the copied array } //end of holoport method public static void sampling(String[][][] library, String input ){ String output="Code was not found"; //creates output variable for( int i=0; i<library.length; i++ ){ //loops over all elements of the array for( int j=0; j<library[i].length; j++ ){ for( int k=0; k<library[i][j].length; k++ ){ if( library[i][j][k].equals(input) ){ //if the code in that position matches the input output="Code was found in position ("+i+", "+j+", "+k+")"; //changes the output string to print location of the searched code } } } } System.out.println(output); //prints the output message } //end of sampling method public static void percentage( String[][][] original, String[][][] copy){ int sumOrig=0; //creates int variable to track number of elements in original int sumCopy=0; //creates int variable to track number of elements in copy for( int i=0; i<original.length; i++ ){ //loops over all elements in the original array for( int j=0; j<original[i].length; j++ ){ for( int k=0; k<original[i][j].length; k++ ){ sumOrig++; //increments sum for each element } } } for( int i=0; i<copy.length; i++ ){ //loops over all elements in copied array for( int j=0; j<copy[i].length; j++ ){ for( int k=0; k<copy[i][j].length; k++ ){ sumCopy++; //increments sum for each element } } } System.out.println(((sumCopy-sumOrig)*100/sumOrig)+"%"); //prints out the percentage output message } //end of percentage method public static String[][][] frankenstein( String[][][] holo ){ int i=0; //creates variable to help navigate array while( i<holo.length ){ //loops over every row int j=0; //creates variable to help navigate array while( j<holo[i].length ){ //loops over every column int k=1; //starts loop at 2nd element in list while( k<holo[i][j].length ){ //loops over all k elements while( holo[i][j][k].charAt(0)<holo[i][j][k-1].charAt(0) ){ //if the value is less than the previous value (alphabetically) String temp=holo[i][j][k-1]; //copies the previous code to a string holo[i][j][k-1]=holo[i][j][k]; //copies the current code into the previous position holo[i][j][k]=temp; //copies the previous code into the current position k--; //decrements k to check if the code needs to be switched further down the list if( k==0 ){ //if at the first element, breaks break; } } k++; //moves to the next element } j++; //moves to the next j level array } i++; //moves to the next i level array } i=1; //resets variable i while( i<holo.length ){ //for all member arrays while( holo[i].length<holo[i-1].length ){ //if the length of that i level array is less than the length of the previous array String[][] temp=holo[i]; //copies that array into a temporary string variable holo[i]=holo[i-1]; //copies the previous array into the current position holo[i-1]=temp; //copies the current array into the previous position i--; //decrements to check if array needs to be moved further down the list if( i==0 ){ //if at the first element, breaks break; } } i++; //moves to the next i level array } return holo; //returns the sorted array } //end of frankenstein method //method to return random letter for use in coding elements public static String letter(){ Random rand=new Random(); //constructs an instance of the random class int alpha=rand.nextInt(26); //creates random integer from 0-25 String lett="tt"; //creates string variable switch( alpha ){ //changes string variable to a capital letter based on the random integer generated case 0: lett="A"; break; case 1: lett="B"; break; case 2: lett="C"; break; case 3: lett="D"; break; case 4: lett="E"; break; case 5: lett="F"; break; case 6: lett="G"; break; case 7: lett="H"; break; case 8: lett="I"; break; case 9: lett="J"; break; case 10: lett="K"; break; case 11: lett="L"; break; case 12: lett="M"; break; case 13: lett="N"; break; case 14: lett="O"; break; case 15: lett="P"; break; case 16: lett="Q"; break; case 17: lett="R"; break; case 18: lett="S"; break; case 19: lett="T"; break; case 20: lett="U"; break; case 21: lett="V"; break; case 22: lett="W"; break; case 23: lett="X"; break; case 24: lett="Y"; break; case 25: lett="Z"; break; } return lett; //returns that randomly generated letter } //end of letter method } //end of class
[ "bre216@lehigh.edu" ]
bre216@lehigh.edu
9624675546f348efb3f36a27f5ace216a61102c1
0e0343f1ceacde0b67d7cbf6b0b81d08473265ab
/aurora_ide/aurora.ide.meta/src/aurora/ide/meta/extensions/ExtensionComponent.java
41635fda564908bfe97a350911dea60f3219a815
[]
no_license
Chajunghun/aurora-project
33d5f89e9f21c49d01d3d09d32102d3c496df851
d4d39861446ea941929780505987dbaf9e3b7a8d
refs/heads/master
2021-01-01T05:39:36.339810
2015-03-24T07:41:45
2015-03-24T07:41:45
33,435,911
0
1
null
null
null
null
UTF-8
Java
false
false
2,466
java
package aurora.ide.meta.extensions; import java.util.ArrayList; import java.util.List; import aurora.ide.helpers.DialogUtil; import aurora.ide.meta.gef.editors.components.ComponentCreator; public class ExtensionComponent { private String categoryId; private String creator; private String descriptor; private String id; private String name; private List<String> types = new ArrayList<String>(); private ComponentCreator cc; private String ioHandler; public ExtensionComponent(String categoryId, String creator, String descriptor, String id, String name, String ioHandler) { super(); this.categoryId = categoryId; this.creator = creator; this.descriptor = descriptor; this.id = id; this.name = name; this.ioHandler = ioHandler; } public ComponentCreator getCreator() { if (cc == null) { try { cc = (ComponentCreator) Class.forName(creator).newInstance(); } catch (InstantiationException e) { DialogUtil.logErrorException(e); } catch (IllegalAccessException e) { DialogUtil.logErrorException(e); } catch (ClassNotFoundException e) { DialogUtil.logErrorException(e); } } return cc; } public void setCreator(String creator) { this.creator = creator; } public String getDescriptor() { return descriptor; } public void setDescriptor(String descriptor) { this.descriptor = descriptor; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCategoryId() { return categoryId; } public void setCategoryId(String categoryId) { this.categoryId = categoryId; } // public DefaultIOHandler getIoHandler(String type) { // if (dio == null) { // try { // dio = (DefaultIOHandler) Class.forName(ioHandler).newInstance(); // } catch (InstantiationException e) { // DialogUtil.logErrorException(e); // } catch (IllegalAccessException e) { // DialogUtil.logErrorException(e); // } catch (ClassNotFoundException e) { // DialogUtil.logErrorException(e); // } // } // return dio; // } public void setIoHandler(String ioHandler) { this.ioHandler = ioHandler; } public List<String> getTypes() { return types; } public void setTypes(String types) { if (types != null) { String[] split = types.split(","); for (String s : split) { this.types.add(s.trim().toLowerCase()); } } } }
[ "rufus.sly@gmail.com@c3805726-bc34-11dd-8164-2ff6f70dce53" ]
rufus.sly@gmail.com@c3805726-bc34-11dd-8164-2ff6f70dce53
b902cdc49d159dc2ecd6406f5bf82e05ee2eb1c7
a03598bd73e974c32c90b82608d301c596f7b3c3
/src/main/java/br/ufrpe/trivendas/gui/controller/ResultsLayoutController.java
58120b0debcebaff245dd9bb6a12e88e43776611
[]
no_license
JesuisOriginal/TriVendas2
cafc183f051bfa6384c12a8cf598e1e9d6a83797
cd419cacfffbf0b65bff0a1d60d4051f0bd2e912
refs/heads/master
2020-03-25T06:10:46.683722
2018-08-07T15:42:00
2018-08-07T15:42:00
143,487,589
1
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
package br.ufrpe.trivendas.gui.controller; import br.ufrpe.trivendas.beans.Resultado; import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.AnchorPane; public class ResultsLayoutController implements Initializable { @FXML private TableView searchResult ; @FXML private AnchorPane resultLayout = new AnchorPane(); @FXML private TableColumn nameColumn; @FXML private TableColumn priceColumn; public ResultsLayoutController(TableView searchResult) { this.searchResult = searchResult; } private List<Resultado> listResult = new ArrayList<>(); @FXML private ObservableList<Resultado> lista = FXCollections.observableList(listResult); public void generateList(List resultName, List resultPrice) { for (int i = 0; i < resultName.size(); i++) { double tempPrice = (double) resultPrice.get(i); String tempName = (String) resultName.get(i); listResult.add(new Resultado(tempName, tempPrice)); } } @Override public void initialize(java.net.URL location, ResourceBundle resources) { for (int i = 0; i < listResult.size(); i++) { nameColumn.setCellValueFactory(new PropertyValueFactory<Resultado, String>("name")); priceColumn.setCellValueFactory(new PropertyValueFactory<Resultado, Double>("preco")); } searchResult.setItems(lista); } }
[ "brennol.c.b@hotmail.com" ]
brennol.c.b@hotmail.com
db7fb96a386f0a8f4feefd43450d63cd8e02b1d3
dbeb1797bc55740027022601beccbee40a651bfd
/src/test/java/com/smilegate/entrypoints/command/preferences/CoveragePreferenceControllerTest.java
101308fa2e3090ac2d2b5ec822d5aa72d75e61c2
[]
no_license
khwise/timeline
d626a264981fa6874774fc5160f4dc7de17725a5
2c3bbb216653ded6faef580921ae79e9ceeddab8
refs/heads/master
2022-11-07T06:16:28.570206
2020-05-06T07:40:06
2020-05-06T07:40:06
273,371,211
0
0
null
null
null
null
UTF-8
Java
false
false
871
java
package com.smilegate.entrypoints.command.preferences; import com.github.tomakehurst.wiremock.WireMockServer; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) @DisplayName("공개범위 설정 Controller 테스트") class CoveragePreferenceControllerTest { static WireMockServer wireMockServer; @BeforeAll static void before(){ wireMockServer = new WireMockServer(9091); wireMockServer.start(); } @Test void timeLineCovrage() { } @Test void communityCoverage() { } @AfterAll static void shutdown(){ wireMockServer.stop(); } }
[ "khjin@smilegate.com" ]
khjin@smilegate.com
046839fafbe3fac176a718c2fc9d167f80e378b3
a8a57531e0d18ead4dbb54f444d049e9803a3280
/API/src/main/java/me/matamor/generalapi/api/entries/DataStorageManager.java
f9fbcfc83df82f754731361ce92d6598a5623892
[]
no_license
MaTaMoR/GeneralAPI
225bbb96c9d4e8190cee3a7b268f528af2ecccfa
07ce263da6f71119362212b4330a87c7f09975a3
refs/heads/master
2023-05-02T22:20:01.480168
2021-05-21T14:45:16
2021-05-21T14:45:16
369,565,207
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
package me.matamor.generalapi.api.entries; import me.matamor.minesoundapi.storage.DataStorage; import me.matamor.minesoundapi.utils.Validate; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class DataStorageManager { private final Map<Class<? extends DataStorage>, DataStorage> entries = new ConcurrentHashMap<>(); public <T extends DataStorage> T registerStorage(T storageManager) { Validate.isFalse(this.entries.containsKey(storageManager.getClass()), "The ConnectionHandler " + storageManager.getClass().getName() + " is already registered"); this.entries.put(storageManager.getClass(), storageManager); return storageManager; } public <T extends DataStorage> T getDatabase(Class<T> clazz) { DataStorage database = this.entries.get(clazz); return (database == null ? null : (T) database); } public Collection<DataStorage> getEntries() { return Collections.unmodifiableCollection(this.entries.values()); } public void unload() { this.entries.clear(); } }
[ "matamor98@hotmail.com" ]
matamor98@hotmail.com
075c5fbedc7a65556d29d7344241a30ff362e18a
99cbd6f329c21ef0e75082fedae229e785531c9e
/Ej00_Criptografia/src/_04_Cifrado_asimetrico/RandomKeyElGamalExample.java
0401513a05a40df7bf9078ccd03650e99ae0aefa
[]
no_license
Fsgilp/seguridad_java
ad331582e4fa67acf7109fd6d09eb2643d2ef450
ea48ad983102377a6c7b81c291140aa453ae37b6
refs/heads/master
2023-03-30T11:45:47.341067
2021-04-06T16:00:07
2021-04-06T16:00:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,451
java
package _04_Cifrado_asimetrico; import java.security.Key; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.SecureRandom; import javax.crypto.Cipher; /** * El Gamal example with random key generation. */ public class RandomKeyElGamalExample { public static void main( String[] args) throws Exception { byte[] input = new byte[] { (byte)0xbe, (byte)0xef }; Cipher cipher = Cipher.getInstance("ElGamal/None/NoPadding", "BC"); SecureRandom random = Utils.createFixedRandom(); // create the keys KeyPairGenerator generator = KeyPairGenerator.getInstance("ElGamal", "BC"); generator.initialize(256, random); KeyPair pair = generator.generateKeyPair(); Key pubKey = pair.getPublic(); Key privKey = pair.getPrivate(); System.out.println("input : " + Utils.toHex(input)); // encryption step cipher.init(Cipher.ENCRYPT_MODE, pubKey, random); byte[] cipherText = cipher.doFinal(input); System.out.println("cipher: " + Utils.toHex(cipherText)); // decryption step cipher.init(Cipher.DECRYPT_MODE, privKey); byte[] plainText = cipher.doFinal(cipherText); System.out.println("plain : " + Utils.toHex(plainText)); } }
[ "a@b.c" ]
a@b.c
e2ff1fa513a179de0d5fa6db6c2a4f94c47586cc
53e5e529110851c892cd1fe007b6dda5094e8627
/modul 2/ex9/src/src/SqlConnectSingleton.java
411566e27bfff1f2e829e1d49dcefe9363e467bf
[]
no_license
KramerIT/ex
bbb2483e3dcd0e2dbb1cd00d407ab307cf13d1da
67cb946ce82d69dd8bfa532b8f7c3f60dea4a6dc
refs/heads/master
2020-05-31T18:43:01.034384
2014-03-06T13:32:17
2014-03-06T13:32:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,318
java
package src; import src.beans.ExpensesBean; import src.beans.ReceiverBean; import src.dao.ListExpensesDao; import java.sql.*; import java.util.ArrayList; public class SqlConnectSingleton implements ListExpensesDao { private String dbURL; private String username; private String password; Connection myConnection; private static SqlConnectSingleton instance = null; private SqlConnectSingleton(String dbURL, String username, String password){ this.dbURL = dbURL; this.username = username; this.password = password; } public static SqlConnectSingleton setSqlConnect(String dbURL, String username, String password){ if (instance == null) instance = new SqlConnectSingleton(dbURL, username, password); return instance; } public void addReceiver(ReceiverBean receiverBean){ try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); String query = "insert into receivers (num, name) " + "values" + "(" + receiverBean.getNum() + ", " + "\'" + receiverBean.getName() + "\'" + ")"; statement.executeUpdate(query); myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } } public void addExpense(ExpensesBean expensesBean){ try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); String query = "insert into expenses (num, paydate, receiver, value) " + "values" + "(" + expensesBean.getNum() + ", " + "\'" + expensesBean.getPayDate() + "\'" + ", " + expensesBean.getReceiver() + ", " + expensesBean.getValue() + ")"; statement.executeUpdate(query); myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } } public ReceiverBean getReceiver(int num){ ReceiverBean tempReceiver = new ReceiverBean(); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); String query = "select num, name from receivers where num = " + num; ResultSet resultSet = statement.executeQuery(query); while (resultSet.next()){ tempReceiver.setNum(resultSet.getInt(1)); tempReceiver.setName(resultSet.getString(2)); } myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } return tempReceiver; } public ExpensesBean getExpense(int num){ ExpensesBean tempExpense = new ExpensesBean(); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); String query = "select num, paydate, receiver, value from expenses where num = " + num; ResultSet resultSet = statement.executeQuery(query); while (resultSet.next()){ tempExpense.setNum(resultSet.getInt(1)); tempExpense.setPayDate(resultSet.getString(2)); tempExpense.setReceiver(resultSet.getString(3)); tempExpense.setValue(resultSet.getDouble(4)); } myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } return tempExpense; } public ArrayList<ReceiverBean> getReceivers(){ ArrayList<ReceiverBean> tempReceiverArray = new ArrayList<ReceiverBean>(); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); String query = "select * from receivers"; ResultSet resultSet = statement.executeQuery(query); while (resultSet.next()){ ReceiverBean tempReceiver = new ReceiverBean(); tempReceiver.setNum(resultSet.getInt(1)); tempReceiver.setName(resultSet.getString(2)); tempReceiverArray.add(tempReceiver); } myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } return tempReceiverArray; } public ArrayList<ExpensesBean> getExpenses(){ ArrayList<ExpensesBean> tempExpensesArray = new ArrayList<ExpensesBean>(); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); String query = "select * from expenses"; ResultSet resultSet = statement.executeQuery(query); while (resultSet.next()){ ExpensesBean tempExpenses = new ExpensesBean(); tempExpenses.setNum(resultSet.getInt(1)); tempExpenses.setPayDate(resultSet.getString(2)); tempExpenses.setReceiver(resultSet.getString(3)); tempExpenses.setValue(resultSet.getDouble(4)); tempExpensesArray.add(tempExpenses); } myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } return tempExpensesArray; } public void update_Query(String query){ try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); statement.executeUpdate(query); myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } } public ArrayList<String> execute_Query(String query){ ArrayList<String> tempArray = new ArrayList<String>(); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe){ System.out.println("Error loading drive:" + cnfe); } try { myConnection = DriverManager.getConnection(dbURL, username, password); java.sql.Statement statement = myConnection.createStatement(); ResultSet resultSet = statement.executeQuery(query); while (resultSet.next()){ ResultSetMetaData temp = resultSet.getMetaData(); for (int i = 1; i <= temp.getColumnCount(); i++){ tempArray.add(resultSet.getString(i)); } } myConnection.close(); } catch (SQLException e){ e.printStackTrace(); } return tempArray; } }
[ "kramaryri@gmail.com" ]
kramaryri@gmail.com
d5143c558ba513f791155abfe13600a079e3b74d
a1610e6c81eeb9eafedad545e7551cb725c83a00
/src/Controller.java
98288819748d62fff918e683f188f45b95769edc
[]
no_license
CarlosArregui/CChannelFX
19e139405e0748d087a5782fcb83390862fdb52f
9edfd5f42144b945049b4e5f161080ee281bbec8
refs/heads/master
2020-04-09T02:18:09.740578
2018-12-01T11:03:21
2018-12-01T11:03:21
159,935,683
0
0
null
null
null
null
UTF-8
Java
false
false
2,837
java
import java.io.IOException; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.effect.GaussianBlur; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.shape.Ellipse; import javafx.stage.Stage; public class Controller { @FXML public ImageView refugees; private Ellipse ceiling; public AnchorPane page; public Scene scene; public Stage sendStage; // private void initialize() { // Scene scene = new Scene(page); // // refugees.setEffect(new GaussianBlur(50)); // // refugees.fitWidthProperty().bind(sendStage.widthProperty()); // refugees.fitWidthProperty().bind(scene.widthProperty()); // refugees.setPreserveRatio(true); // sendStage.setScene(scene); // // } // private void initializeCeiling(AnchorPane root) { // ceiling = new Ellipse(); // ceiling.centerXProperty().bind(root.widthProperty().multiply(0.5)); // ceiling.centerYProperty().setValue(0); // ceiling.radiusXProperty().bind(root.widthProperty().multiply(0.8)); // ceiling.radiusYProperty().bind(root.heightProperty().multiply(0.6)); // } /** * Opens an stage to send the profile */ public void showSendProfile() { try { // Load the fxml file and create a new stage for the popup. FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("PaginaExtra.fxml")); AnchorPane page = (AnchorPane) loader.load(); Stage sendStage = new Stage(); sendStage.setTitle("Send Profile"); Scene scene = new Scene(page); sendStage.setScene(scene); sendStage.show(); // clips // ); // // ColorAdjust colorAdjust = new ColorAdjust(); // colorAdjust.setContrast(1); // colorAdjust.setHue(0); // colorAdjust.setBrightness(0); // colorAdjust.setSaturation(0); // // ceiling_image.setEffect(colorAdjust); // ceiling_image.setEffect(new GaussianBlur(5)); // refugees.setClip(ceiling); } catch (IOException e) { e.printStackTrace(); } } /** * la clase controladora que añade un efecto a la imagen */ class SetBlur { @FXML private ImageView refugees; /** * la etiqueta FXML permite acceder al componente imageView ya creado en * fxml */ @FXML public void initialize() { refugees.setEffect(new GaussianBlur(50)); } } /** * Method to handle the ImageView action in the Main stage */ @FXML private void handleSend() { showSendProfile(); // sendStage.close(); } /** * Closes the application when clicked on Exit in the secondary stage */ @FXML private void handleClose() { System.exit(0); } }
[ "carre@LAPTOP-LKARUGPA" ]
carre@LAPTOP-LKARUGPA
4fee4c260689d8040187d3e4cf8e02df7a280f30
a2c117638649bfcbe436d9b21d53a5a3c7f5c7bc
/app/src/androidTest/java/com/sumin/chatapp/ExampleInstrumentedTest.java
d0747cc0c36ab13c983ad19b7ff91e6723559865
[]
no_license
suminfx/ChatApp
c7d83add818c8e0831e730a9aa276d00a1b43e84
2f21c2bd04222f3effc8f73c1bd01a784467f890
refs/heads/master
2020-05-03T09:07:19.265478
2020-01-27T17:48:03
2020-01-27T17:48:03
178,545,733
1
0
null
null
null
null
UTF-8
Java
false
false
718
java
package com.sumin.chatapp; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.sumin.chatapp", appContext.getPackageName()); } }
[ "sumin931@yandex.ru" ]
sumin931@yandex.ru
c217179b0e238ebaf51600cae71afb2ca4d1bdc0
e253629e6562fd8627412655958731966cf1ecae
/src/main/java/com/pinedaisc/turista/objetos/Secretaria.java
babedf8289716ee8ff7cb255724b36f13c9d09cb
[]
no_license
pinedaisc/turistaElectronico
2e9df577953030af671ff6abfcb285f3c848803e
5e893eff1833390610d82d8ca4d3b98dbbcb1aed
refs/heads/main
2023-05-25T04:45:00.148837
2021-06-15T07:36:15
2021-06-15T07:36:15
372,413,497
0
0
null
null
null
null
UTF-8
Java
false
false
1,387
java
package com.pinedaisc.turista.objetos; public class Secretaria extends Propiedad{ double multiplicadorx1; double multiplicadorx2; double multiplicadorx3; double multiplicadorx4; public double getMultiplicadorx1() { return multiplicadorx1; } public void setMultiplicadorx1(double multiplicadorx1) { this.multiplicadorx1 = multiplicadorx1; } public double getMultiplicadorx2() { return multiplicadorx2; } public void setMultiplicadorx2(double multiplicadorx2) { this.multiplicadorx2 = multiplicadorx2; } public double getMultiplicadorx3() { return multiplicadorx3; } public void setMultiplicadorx3(double multiplicadorx3) { this.multiplicadorx3 = multiplicadorx3; } public double getMultiplicadorx4() { return multiplicadorx4; } public void setMultiplicadorx4(double multiplicadorx4) { this.multiplicadorx4 = multiplicadorx4; } @Override public String toString() { return "Secretaria [multiplicadorx1=" + multiplicadorx1 + ", multiplicadorx2=" + multiplicadorx2 + ", multiplicadorx3=" + multiplicadorx3 + ", multiplicadorx4=" + multiplicadorx4 + ", nombre=" + nombre + ", valor=" + valor + ", renta=" + renta + ", hipoteca=" + hipoteca + ", bloque=" + bloque + ", reglaadicional=" + reglaadicional + ", esEmbargado=" + esEmbargado + ", esHipotecado=" + esHipotecado + "]"; } }
[ "pinedaisc@gmail.com" ]
pinedaisc@gmail.com
0a4c1decc047327a02739173eec91c20c9ca78d4
0317e4016f434499968689bbefc91c89a5f40b2c
/sdk/graph-services/src/main/java/com/microsoft/graph/odata/DirectoryRoleTemplateCollectionOperations.java
81dde37440bfbaa384773f07ec95bbdaf945583e
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
bihai/Office-365-SDK-for-Android
fbf9b7c826f2b1ca5591ca5e47632c0badab80c5
9d51420705814e7e75d18b2af6e5614bd11e2362
refs/heads/master
2021-01-22T11:03:13.440877
2015-05-19T18:55:06
2015-05-19T18:55:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,180
java
/******************************************************************************* Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the MIT or Apache License; see LICENSE in the source repository root for authoritative license information. **NOTE** This code was generated by a tool and will occasionally be overwritten. We welcome comments and issues regarding this code; they will be addressed in the generation tool. If you wish to submit pull requests, please do so for the templates in that tool. This code was generated by Vipr (https://github.com/microsoft/vipr) using the T4TemplateWriter (https://github.com/msopentech/vipr-t4templatewriter). ******************************************************************************/ package com.microsoft.graph.odata; import com.microsoft.graph.*; import com.google.common.util.concurrent.*; import com.microsoft.services.odata.*; import com.microsoft.services.odata.interfaces.*; import static com.microsoft.services.odata.Helpers.*; /** * The type DirectoryRoleTemplateCollectionOperations */ public class DirectoryRoleTemplateCollectionOperations extends DirectoryObjectCollectionOperations{ /** * Instantiates a new DirectoryRoleTemplateCollectionOperations. * * @param urlComponent the url component * @param parent the parent */ public DirectoryRoleTemplateCollectionOperations(String urlComponent, ODataExecutable parent) { super(urlComponent, parent); } /** * Add parameter. * * @param name the name * @param value the value * @return the collection operations */ public DirectoryRoleTemplateCollectionOperations addParameter(String name, Object value) { addCustomParameter(name, value); return this; } /** * Add header. * * @param name the name * @param value the value * @return the collection operations */ public DirectoryRoleTemplateCollectionOperations addHeader(String name, String value) { addCustomHeader(name, value); return this; } }
[ "marcost@lagash.com" ]
marcost@lagash.com
a44619403f9f68d754c794a1ca15279c4eaeba84
a2dc7b30d172d11393dfe4c945e7e06bc197ea49
/src/main/java/com/yangyue/design/abstractfactory/example4/GAMainboard.java
2c5bac2284312d5a1d0d330bece3ad6598c10119
[]
no_license
qinxiangyangnet/design
d0aa274aebbb06e77ae696336d08e655016b7d39
17a4cc6712dbc18b4d6254b3f6b6a742dd3ffcc5
refs/heads/master
2023-07-09T01:00:03.992812
2021-07-27T05:31:46
2021-07-27T05:31:46
240,816,992
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package com.yangyue.design.abstractfactory.example4; /** * @program: design * @description:技嘉主板 * @author: yueyang * @create: 2020-02-26 06:52 **/ public class GAMainboard implements MainboardApi{ private int cpusHoles=0; public GAMainboard(int cpusHoles){this.cpusHoles=cpusHoles;} public void installCPU() { System.out.println("now in int GAMainboard,cpusHoles="+cpusHoles); } }
[ "SpringF1_Qin@163.com" ]
SpringF1_Qin@163.com
abe74a23562072457562c09154a88998a4e2e7a9
717f9f36a597fa8c56d9923bcb38d470fa04ac4e
/src/com/lucio/common/ApplicationContextFactory.java
d8f638703cbb288451fb322e9d91ffceba3cf36f
[]
no_license
Mangolucio/myBatis_Spring
50ac0c0bba42dc49b25d97daf39e95064a976075
39d79320492f718c7be18dcbcbd9c30f3c2c48a3
refs/heads/master
2021-04-03T09:22:34.087632
2016-06-07T08:21:43
2016-06-07T08:21:43
60,591,924
0
0
null
null
null
null
UTF-8
Java
false
false
640
java
package com.lucio.common; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class ApplicationContextFactory { private static ApplicationContext context = null; private ApplicationContextFactory() { super(); } public static void init() { String [] contextFileNames = new String [1]; contextFileNames[0] = "applicationContext-common.xml"; context = new ClassPathXmlApplicationContext(contextFileNames); } public static ApplicationContext getInstance() { if (null == context) { init(); } return context; } }
[ "lucio.liu@bleum.com" ]
lucio.liu@bleum.com
b0b6cb06f0911bcf858eeb32e4690535c3f7ad8c
fda795ae4ca9a5c90979f65386f4fee3f6aaf08d
/Nest_Client/src/main/java/io/github/hufghani/nest/NestService.java
1261c7cbec7ac8fad1dc46cf83df8aa9a4c595a0
[]
no_license
HUFGhani/The-Intelligent-Room
56b51bbbc29b9e5d125d3d9cc3a6c09834e6a7a2
5b09a705173af0c7fb2440d4af90f4f6f3101ffb
refs/heads/master
2022-06-21T23:39:47.570960
2017-04-21T20:54:52
2017-04-21T20:54:52
79,347,254
0
0
null
2022-06-20T23:29:30
2017-01-18T14:22:43
Java
UTF-8
Java
false
false
3,212
java
package io.github.hufghani.nest; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import javax.ws.rs.core.MediaType; import java.io.IOException; /** * Created by hamzaghani on 13/02/2017. */ public class NestService { ObjectMapper mapper = new ObjectMapper(); Client client = Client.create(); String baseURL = "https://developer-api.nest.com/devices/"; String auth = "c.qOL8PQR370XkE3F2oQbSSIwBENrVMYN1DhAQJRpmxDnuzd23e2Z0Ru4fsUKgzc20pHbBkhumPXp9qgwNUJuNJXSeif7By" + "D2SpcHRiEoX2sNecb7SvwmK3d1X91JGwJxRxMl2fTvDa3m3aa1W"; String device ="0KD654moZP0wgM2qlRxQxFcNidHWg5j2"; private boolean getautomated; public NestService() { super(); } public String getAllString(){ NestThermostat nestThermostat = null; try { WebResource webResource = client.resource(baseURL + "?auth=" + auth); ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON_TYPE).get(ClientResponse.class); if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } String stingJson = response.getEntity(String.class); nestThermostat = mapper.readValue(stingJson, NestThermostat.class); } catch (JsonGenerationException e) { e.printStackTrace(); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } nestThermostat.getThermostats().getThermostatElements().setAutomated(getautomated); return String.valueOf(nestThermostat.getThermostats().getThermostatElements().getStatus()); } public void setNestTemputure(double temputure, boolean getautomated) { this.getautomated = getautomated; double temp = 0; if (temp == temputure) { System.out.println("it the same"); } else { if (temputure > 0 && temputure >= 9 && temp != temputure) { System.out.println(temputure); temp = temputure; try { WebResource webResource = client.resource(baseURL + "thermostats/" + device + "/target_temperature_c?auth=" + auth); ClientResponse response = webResource.type(MediaType.TEXT_PLAIN_TYPE) .put(ClientResponse.class, String.valueOf(temputure)); if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } } catch (Exception e) { e.printStackTrace(); } } } } }
[ "h.u.f.ghani@gmail.com" ]
h.u.f.ghani@gmail.com
13de132b339814dcae8f1a23f30c502f9f37c039
75104e5799fff59f555746d2beb17e02afead8fa
/JavaArithmetic/src/javacode/arithmetic/DayOfYear.java
fa20ac2bc86255f14010763e6abbca604d98f8e7
[]
no_license
ccg5230/JavaArithmetic
a16cebebe8074afb23058b2ec0c2af65e8933787
9cc105f6a42838b5f868f09b57ad25e90236b69d
refs/heads/master
2020-06-30T23:11:47.246995
2019-08-07T05:39:58
2019-08-07T05:39:58
200,979,285
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
package javacode.arithmetic; /** * @className DayOfYear * @Description * @Author chungaochen * Date 2019/8/1 19:21 * Version 1.0 **/ public class DayOfYear { public static void main(String[] args) { int year = 2019,month=8,day=1; int days = getDayOfYear(2019,8,1); System.out.println(year + "-" + month + "-" + day + "是这年的第" + (days) + "天。"); } public static int getDayOfYear(int year, int month, int day) { if (year < 0 || month < 0 || month > 12 || day < 0 || day > 31) { System.out.println("输入错误,请重新输入!"); return -1; } int d = 0; int days = 0; for (int i = 1; i < month; i++) { switch (i) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: days = 31; break; case 4: case 6: case 9: case 11: days = 30; break; case 2: if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) { days = 29; } else { days = 28; } break; } d += days; } return d+day; } }
[ "ccg5230@163.com" ]
ccg5230@163.com
1d5e72c568d690e6a637dbe5a8494a38076fdf35
70671eeabc82c77e47343cfb37e5e9a76e206272
/Maping/src/main/java/com/onetoOneMaping/Question.java
52d988e4c6a2e266c5053724d7a3aa4722a5f878
[]
no_license
Sairajjadhavkh/Hibernate-practice
f1e5a126676ee5cfb386736cc60f94a7e4c76149
dd855ac570bf49f0d3dc067601979b9360199fd4
refs/heads/main
2023-07-17T15:09:37.051123
2021-08-26T18:54:39
2021-08-26T18:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,147
java
package com.onetoOneMaping; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToOne; @Entity public class Question { @Id @Column(name ="Question_Id") private int question_id; @Column(name ="Question") private String question; @OneToOne private Answer answer; public Question() { super(); // TODO Auto-generated constructor stub } public Question(int question_id, String question, Answer answer) { super(); this.question_id = question_id; this.question = question; this.answer = answer; } public int getId() { return question_id; } public void setId(int question_id) { this.question_id = question_id; } public String getQuestion() { return question; } public void setQuestion(String question) { this.question = question; } public Answer getAnswer() { return answer; } public void setAnswer(Answer answer) { this.answer = answer; } @Override public String toString() { return "Question [id=" + question_id + ", question=" + question + ", answer=" + answer + "]"; } }
[ "noreply@github.com" ]
noreply@github.com
305bdb212d05c477e0b4ec40e56611bfdff122e3
4b401eac46bc2f28b91a285a159f0c535d87fb89
/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/region/world/WorldRegionBase.java
4a18185cd782b557c2b037c9bc71fd9f188d3381
[ "MIT" ]
permissive
FaeyUmbrea/FoxGuard
4e6eb402778f79a03374f35c2c2f2313b19ece9d
82264c5b6302651111bf19da7f837eba0882d5a2
refs/heads/master
2021-05-31T09:15:43.058350
2016-04-24T03:09:41
2016-04-24T03:10:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,650
java
/* * This file is part of FoxGuard, licensed under the MIT License (MIT). * * Copyright (c) gravityfox - https://gravityfox.net/ * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package net.foxdenstudio.sponge.foxguard.plugin.region.world; import com.google.common.collect.ImmutableList; import net.foxdenstudio.sponge.foxguard.plugin.FGManager; import net.foxdenstudio.sponge.foxguard.plugin.object.FGObjectBase; import net.foxdenstudio.sponge.foxguard.plugin.handler.IHandler; import org.spongepowered.api.world.World; import java.util.ArrayList; import java.util.List; public abstract class WorldRegionBase extends FGObjectBase implements IWorldRegion { private final List<IHandler> handlers; private World world; WorldRegionBase(String name) { super(name); this.handlers = new ArrayList<>(); } @Override public List<IHandler> getHandlers() { return ImmutableList.copyOf(this.handlers); } @Override public boolean addHandler(IHandler handler) { if (!FGManager.getInstance().isRegistered(handler)) { return false; } return this.handlers.add(handler); } @Override public boolean removeHandler(IHandler handler) { return this.handlers.remove(handler); } @Override public void clearHandlers() { this.handlers.clear(); } @Override public World getWorld() { return this.world; } @Override public void setWorld(World world) { if (this.world == null) { this.world = world; } } }
[ "gravityreallyhatesme@gmail.com" ]
gravityreallyhatesme@gmail.com
b3f96a7f80e69e547b719ae4c6deea3d4a9137d9
dbe6824d94275dd9a500def01754f7a2517b6f19
/app/src/main/java/com/fanfou/app/opensource/service/FanfouServiceManager.java
4a44b7aeb9f549dd28604527e67642d75cb38459
[ "Apache-2.0" ]
permissive
jammychan/fanfouapp-opensource
b9bb65decbee92909dde0e3b8562474fb7eaf40b
eef74745af977f1b61d1fa97a71ddf90a1b696e9
refs/heads/master
2021-01-20T23:11:52.479217
2014-07-19T08:22:53
2014-07-19T08:22:53
20,449,672
1
0
null
null
null
null
UTF-8
Java
false
false
17,862
java
/******************************************************************************* * Copyright 2011, 2012, 2013 fanfou.com, Xiaoke, Zhang * * 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.fanfou.app.opensource.service; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.os.Handler; import android.os.Message; import android.os.Messenger; import android.util.Log; import android.widget.BaseAdapter; import com.fanfou.app.opensource.AppContext; import com.fanfou.app.opensource.api.bean.Status; import com.fanfou.app.opensource.api.bean.User; import com.fanfou.app.opensource.ui.ActionManager.ResultListener; import com.fanfou.app.opensource.ui.UIManager.ActionResultHandler; import com.fanfou.app.opensource.util.CommonHelper; import com.fanfou.app.opensource.util.StringHelper; /** * @author mcxiaoke * */ public final class FanfouServiceManager { private static final String TAG = "FanfouServiceManager"; public static void doDirectMessagesDelete(final Context context, final String id, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_DIRECT_MESSAGES_DESTROY); intent.putExtra(Constants.EXTRA_ID, id); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } public static void doFavorite(final Activity activity, final Status status) { FanfouServiceManager.doFavorite(activity, status, null, false); } public static void doFavorite(final Activity activity, final Status s, final BaseAdapter adapter) { final ActionResultHandler li = new ActionResultHandler() { @Override public void onActionSuccess(final int type, final String message) { if (type == Constants.TYPE_FAVORITES_CREATE) { s.favorited = true; } else { s.favorited = false; } adapter.notifyDataSetChanged(); } }; FanfouServiceManager.doFavorite(activity, s, li); } public static void doFavorite(final Activity activity, final Status status, final boolean finish) { FanfouServiceManager.doFavorite(activity, status, null, finish); } public static void doFavorite(final Activity activity, final Status s, final Cursor c) { final ActionResultHandler li = new ActionResultHandler() { @Override public void onActionSuccess(final int type, final String message) { c.requery(); } }; FanfouServiceManager.doFavorite(activity, s, li); } public static void doFavorite(final Activity activity, final Status status, final ResultListener li) { FanfouServiceManager.doFavorite(activity, status, li, false); } public static void doFavorite(final Activity activity, final Status status, final ResultListener li, final boolean finish) { if ((status == null) || status.isNull()) { if (AppContext.DEBUG) { Log.d(FanfouServiceManager.TAG, "doFavorite: status is null."); } throw new NullPointerException("status cannot be null."); } final int type = status.favorited ? Constants.TYPE_FAVORITES_DESTROY : Constants.TYPE_FAVORITES_CREATE; final Handler handler = new Handler() { @Override public void handleMessage(final Message msg) { switch (msg.what) { case Constants.RESULT_SUCCESS: final Status result = (Status) msg.getData().getParcelable( Constants.EXTRA_DATA); final String text = result.favorited ? "收藏成功" : "取消收藏成功"; CommonHelper.notify(activity.getApplicationContext(), text); FanfouServiceManager.onSuccess(li, type, text); if (finish) { activity.finish(); } break; case Constants.RESULT_ERROR: final String errorMessage = msg.getData().getString( Constants.EXTRA_ERROR); CommonHelper.notify(activity.getApplicationContext(), errorMessage); FanfouServiceManager.onFailed(li, type, "收藏失败"); break; default: break; } } }; if (status.favorited) { FanfouServiceManager.doUnfavorite(activity, status.id, handler); } else { FanfouServiceManager.doFavorite(activity, status.id, handler); } } public static void doFavorite(final Context context, final String id, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_FAVORITES_CREATE); intent.putExtra(Constants.EXTRA_ID, id); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } public static void doFetchDirectMessagesConversationList( final Context context, final Messenger messenger, final boolean doGetMore) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_DIRECT_MESSAGES_CONVERSTATION_LIST); intent.putExtra(Constants.EXTRA_MESSENGER, messenger); intent.putExtra(Constants.EXTRA_BOOLEAN, doGetMore); context.startService(intent); } public static void doFetchDirectMessagesInbox(final Context context, final Messenger messenger, final boolean doGetMore) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_DIRECT_MESSAGES_INBOX); intent.putExtra(Constants.EXTRA_MESSENGER, messenger); intent.putExtra(Constants.EXTRA_BOOLEAN, doGetMore); context.startService(intent); } public static void doFetchFavorites(final Context context, final Messenger messenger, final int page, final String userId) { FanfouServiceManager.doFetchTimeline(context, Constants.TYPE_FAVORITES_LIST, messenger, page, userId, null, null); } public static void doFetchFollowers(final Context context, final Handler handler, final int page, final String userId) { FanfouServiceManager.doFetchUsers(context, Constants.TYPE_USERS_FOLLOWERS, handler, page, userId); } public static void doFetchFriends(final Context context, final Handler handler, final int page, final String userId) { FanfouServiceManager.doFetchUsers(context, Constants.TYPE_USERS_FRIENDS, handler, page, userId); } public static void doFetchHomeTimeline(final Context context, final Messenger messenger, final String sinceId, final String maxId) { FanfouServiceManager.doFetchTimeline(context, Constants.TYPE_STATUSES_HOME_TIMELINE, messenger, 0, null, sinceId, maxId); } public static void doFetchMentions(final Context context, final Messenger messenger, final String sinceId, final String maxId) { FanfouServiceManager.doFetchTimeline(context, Constants.TYPE_STATUSES_MENTIONS, messenger, 0, null, sinceId, maxId); } public static void doFetchPublicTimeline(final Context context, final Messenger messenger) { FanfouServiceManager.doFetchTimeline(context, Constants.TYPE_STATUSES_PUBLIC_TIMELINE, messenger, 0, null, null, null); } private static void doFetchTimeline(final Context context, final int type, final Messenger messenger, final int page, final String userId, final String sinceId, final String maxId) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, type); intent.putExtra(Constants.EXTRA_MESSENGER, messenger); intent.putExtra(Constants.EXTRA_COUNT, Constants.MAX_TIMELINE_COUNT); intent.putExtra(Constants.EXTRA_PAGE, page); intent.putExtra(Constants.EXTRA_ID, userId); intent.putExtra(Constants.EXTRA_SINCE_ID, sinceId); intent.putExtra(Constants.EXTRA_MAX_ID, maxId); if (AppContext.DEBUG) { Log.d(FanfouServiceManager.TAG, "doFetchTimeline() type=" + type + " page=" + page + " userId=" + userId); } context.startService(intent); } private static void doFetchUsers(final Context context, final int type, final Handler handler, final int page, final String userId) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, type); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); intent.putExtra(Constants.EXTRA_COUNT, Constants.MAX_USERS_COUNT); intent.putExtra(Constants.EXTRA_PAGE, page); intent.putExtra(Constants.EXTRA_ID, userId); context.startService(intent); } public static void doFetchUserTimeline(final Context context, final Messenger messenger, final String userId, final String sinceId, final String maxId) { FanfouServiceManager.doFetchTimeline(context, Constants.TYPE_STATUSES_USER_TIMELINE, messenger, 0, userId, sinceId, maxId); } public static void doFollow(final Context context, final String userId, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_FRIENDSHIPS_CREATE); intent.putExtra(Constants.EXTRA_ID, userId); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } public static void doFollow(final Context context, final User user, final Handler handler) { if (user.following) { FanfouServiceManager.doUnFollow(context, user.id, handler); } else { FanfouServiceManager.doFollow(context, user.id, handler); } } public static void doFriendshipsExists(final Context context, final String userA, final String userB, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_FRIENDSHIPS_EXISTS); intent.putExtra("user_a", userA); intent.putExtra("user_b", userB); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } public static void doMessageDelete(final Activity activity, final String id, final ResultListener li, final boolean finish) { if (StringHelper.isEmpty(id)) { if (AppContext.DEBUG) { Log.d(FanfouServiceManager.TAG, "doMessageDelete: status id is null."); } throw new NullPointerException("directmessageid cannot be null."); } final Handler handler = new Handler() { @Override public void handleMessage(final Message msg) { switch (msg.what) { case Constants.RESULT_SUCCESS: CommonHelper.notify(AppContext.getAppContext(), "删除成功"); FanfouServiceManager.onSuccess(li, Constants.TYPE_DIRECT_MESSAGES_DESTROY, "删除成功"); if (finish && (activity != null)) { activity.finish(); } break; case Constants.RESULT_ERROR: final String errorMessage = msg.getData().getString( Constants.EXTRA_ERROR); CommonHelper.notify(activity.getApplicationContext(), errorMessage); FanfouServiceManager.onFailed(li, Constants.TYPE_DIRECT_MESSAGES_DESTROY, "删除失败"); break; default: break; } } }; FanfouServiceManager.doDirectMessagesDelete(activity, id, handler); } public static void doProfile(final Context context, final String userId, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_USERS_SHOW); intent.putExtra(Constants.EXTRA_ID, userId); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } public static void doStatusDelete(final Activity activity, final String id) { FanfouServiceManager.doStatusDelete(activity, id, null); } public static void doStatusDelete(final Activity activity, final String id, final boolean finish) { FanfouServiceManager.doStatusDelete(activity, id, null, finish); } public static void doStatusDelete(final Activity activity, final String id, final ResultListener li) { FanfouServiceManager.doStatusDelete(activity, id, li, false); } public static void doStatusDelete(final Activity activity, final String id, final ResultListener li, final boolean finish) { if (StringHelper.isEmpty(id)) { if (AppContext.DEBUG) { Log.d(FanfouServiceManager.TAG, "doStatusDelete: status id is null."); } throw new NullPointerException("statusid cannot be null."); } final Handler handler = new Handler() { @Override public void handleMessage(final Message msg) { switch (msg.what) { case Constants.RESULT_SUCCESS: CommonHelper.notify(AppContext.getAppContext(), "删除成功"); FanfouServiceManager.onSuccess(li, Constants.TYPE_STATUSES_DESTROY, "删除成功"); if (finish && (activity != null)) { activity.finish(); } break; case Constants.RESULT_ERROR: final String errorMessage = msg.getData().getString( Constants.EXTRA_ERROR); CommonHelper.notify(activity.getApplicationContext(), errorMessage); FanfouServiceManager.onFailed(li, Constants.TYPE_STATUSES_DESTROY, "删除失败"); break; default: break; } } }; FanfouServiceManager.doStatusesDelete(activity, id, handler); } public static void doStatusesDelete(final Context context, final String id, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_STATUSES_DESTROY); intent.putExtra(Constants.EXTRA_ID, id); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } public static void doUnfavorite(final Context context, final String id, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_FAVORITES_DESTROY); intent.putExtra(Constants.EXTRA_ID, id); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } public static void doUnFollow(final Context context, final String userId, final Handler handler) { final Intent intent = new Intent(context, FanFouService.class); intent.putExtra(Constants.EXTRA_TYPE, Constants.TYPE_FRIENDSHIPS_DESTROY); intent.putExtra(Constants.EXTRA_ID, userId); intent.putExtra(Constants.EXTRA_MESSENGER, new Messenger(handler)); context.startService(intent); } private static void onFailed(final ResultListener li, final int type, final String message) { if (li != null) { li.onActionFailed(type, message); } } private static void onSuccess(final ResultListener li, final int type, final String message) { if (li != null) { li.onActionSuccess(type, message); } } }
[ "mcxiaoke@gmail.com" ]
mcxiaoke@gmail.com
4bc0e939f266327c07903abaa85b28654e769a88
c5b1841d84f5a75573d79b4272a6d574a35113b8
/src/main/java/com/hardik/flenderson/exception/handler/AccessTokenExpiredExceptionHandler.java
20f1687264b2d66313b97e54c46e6b81403821dd
[]
no_license
spring-open-source/human-resource-management-system
f835eee6c0e2525ffcdf1d6817c40ec9a72663e3
444b04577f4fbf8673ce1908405578b20f144d08
refs/heads/main
2023-04-17T21:34:06.370960
2021-04-27T04:10:01
2021-04-27T04:10:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
package com.hardik.flenderson.exception.handler; import java.time.LocalDateTime; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import com.hardik.flenderson.exception.AccessTokenExpiredException; import com.hardik.flenderson.exception.dto.ExceptionResponseDto; @RestControllerAdvice public class AccessTokenExpiredExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(AccessTokenExpiredException.class) public ResponseEntity<ExceptionResponseDto> handler(Exception exception, WebRequest webRequest) { return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(ExceptionResponseDto.builder().timestamp(LocalDateTime.now()) .statusCode(HttpStatus.BAD_REQUEST.value()).message(exception.getMessage()) .exception(exception.getClass().getSimpleName().toUpperCase()).build()); } }
[ "hardik.behl7444@gmail.com" ]
hardik.behl7444@gmail.com
a296a6033c530971ac544685093fcde7947c12c5
84be84fca8a050e959f834468018f892aa1cca58
/app/src/main/java/com/masum/edu_portal/di/ViewModelProviderFactory.java
064bb6e94e971784b3d63a6b8928bbd944583c40
[]
no_license
mdmasum-shuvo/Edu_portal
d0b95d6db418ed16cc63ef358ebb1f4f01d92ce0
3f0364945d4547ccbb62ae8e881bcea836a5b393
refs/heads/master
2022-11-13T18:29:38.729369
2020-07-12T22:03:35
2020-07-12T22:03:35
268,340,883
0
0
null
null
null
null
UTF-8
Java
false
false
1,624
java
package com.masum.edu_portal.di; import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModelProvider; import java.util.Map; import javax.inject.Inject; import javax.inject.Provider; public class ViewModelProviderFactory implements ViewModelProvider.Factory { private static final String TAG = "ViewModelProviderFactor"; private final Map<Class<? extends ViewModel>, Provider<ViewModel>> creators; @Inject public ViewModelProviderFactory(Map<Class<? extends ViewModel>, Provider<ViewModel>> creators) { this.creators = creators; } @Override public <T extends ViewModel> T create(Class<T> modelClass) { Provider<? extends ViewModel> creator = creators.get(modelClass); if (creator == null) { // if the viewmodel has not been created // loop through the allowable keys (aka allowed classes with the @ViewModelKey) for (Map.Entry<Class<? extends ViewModel>, Provider<ViewModel>> entry : creators.entrySet()) { // if it's allowed, set the Provider<ViewModel> if (modelClass.isAssignableFrom(entry.getKey())) { creator = entry.getValue(); break; } } } // if this is not one of the allowed keys, throw exception if (creator == null) { throw new IllegalArgumentException("unknown model class " + modelClass); } // return the Provider try { return (T) creator.get(); } catch (Exception e) { throw new RuntimeException(e); } } }
[ "mdmasum.shuvo.cse@gmail.com" ]
mdmasum.shuvo.cse@gmail.com
7150c68cff66a8b22da108557fb0a06bcd3e39e9
192ec7935c661e7de156d554c2bf44d742912748
/app/src/main/java/com/uottawa/tipcalculator/AboutActivity.java
5d07f5eb650b25dddf3e1e9a848bc2671ce2348b
[]
no_license
DominicRoyStang/TipCalculator
74f6e39e144ed098175c8f92ca4aa68e8d74c7b0
75c6c17b3cd0af7130e677ec23ce2eec0b99f7b9
refs/heads/master
2021-01-21T21:26:05.802270
2017-06-20T03:30:49
2017-06-20T03:30:49
94,841,547
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.uottawa.tipcalculator; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class AboutActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); // Set up Settings ActionBar getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getSupportActionBar().setCustomView(R.layout.aboutmenu_layout); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }
[ "dominicroystang@gmail.com" ]
dominicroystang@gmail.com
85451af9ba1061d902c4b873a3d355e9a5fd93d5
5bb52d260b9f06f873673c26e6a3ddaec80d3dd9
/TeamCode/src/main/java/lib/fine/core/FineIMU.java
655d872320b6eedcba46e525cabdac6a54d31bd6
[ "BSD-3-Clause" ]
permissive
PsouthRobotics1182/Relic_Recovery
36ca766069261a0c8f5a22d94240d487d362861f
435a442ffc31eb9b36d972bb371c6eb8791603d1
refs/heads/master
2021-10-10T12:35:52.864754
2019-01-10T21:34:26
2019-01-10T21:34:26
111,466,705
0
1
null
null
null
null
UTF-8
Java
false
false
7,552
java
package lib.fine.core; import com.qualcomm.hardware.bosch.BNO055IMU; import com.qualcomm.hardware.bosch.JustLoggingAccelerationIntegrator; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.util.ElapsedTime; import org.firstinspires.ftc.robotcore.external.navigation.Acceleration; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.robotcore.external.navigation.Position; import org.firstinspires.ftc.robotcore.external.navigation.Velocity; /** * * This class is designed to wrap the built-in BN055 IMU within the rev hub with PID and angle resetting features */ public class FineIMU { /** * This enum is used to manage whether the robot is on or off the balancing pad * to allow for 2 different PID tunes, since the pad is low traction */ public enum Mode { ON_PAD, OFF_PAD } private Mode mode = Mode.ON_PAD; private BNO055IMU imu; private Orientation angles; private ElapsedTime runTime; private LinearOpMode opMode; private String name; /** * variables to manage PID's math */ private double prevError = 0; private double integral = 0; private double zeroPos = 0; /** * PID tuning variable * DO NOT directly call this, use {@link #kP() kp} method set instead */ private static final double kP_OFF_PAD = 0.041;//0.031 private static final double kI_OFF_PAD = 0.00;//0.00015 private static final double kD_OFF_PAD = 0.1;//0.21 private static final double kP_ON_PAD = 0.02; private static final double kI_ON_PAD = 0; private static final double kD_ON_PAD = 0.24; /** * makes IMU which can do PID and reset angle easily * @param opMode the opmode that is using the IMU * @param name name in the xml */ public FineIMU(LinearOpMode opMode, String name) { this.opMode = opMode; this.name = name; runTime = new ElapsedTime(); BNO055IMU.Parameters parameters = new BNO055IMU.Parameters(); parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES; parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC; parameters.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample opmode parameters.loggingEnabled = true; parameters.loggingTag = "IMU"; parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator(); imu = opMode.hardwareMap.get(BNO055IMU.class, name); imu.initialize(parameters); //how often to update values imu.startAccelerationIntegration(new Position(), new Velocity(), 100); } /** * changes from on balancing pad tune to off pad tune * @param mode the desired PID tune to use */ public void setMode(Mode mode) { this.mode = mode; } /** * call this method to get the p constant based on the PID tune mode * @return P constant for PID loop */ private double kP() { return (mode == Mode.ON_PAD) ? kP_ON_PAD : kP_OFF_PAD; } private double kI() { return (mode == Mode.ON_PAD) ? kI_ON_PAD : kI_OFF_PAD; } private double kD() { return (mode == Mode.ON_PAD) ? kD_ON_PAD : kD_OFF_PAD; } /** * * @return heading shifted based on how it was reset */ public double getHeading() { angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); return angles.firstAngle - zeroPos; } /** * * @return rate of rotation given by the IMU */ public double getRate() { return imu.getAngularVelocity().zRotationRate; } /** * uses acceleromet within the imu to get the angle of rotation relative to the ground * @return array with values corresponding to angles off level */ public double[] getLevelness() { double[] levels = new double[2]; levels[0] = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES).secondAngle; levels[1] = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES).thirdAngle; return levels; } /** * must calibrate IMU for this to work * @return acceleration value from IMU */ public Acceleration getAcceleration() { return imu.getAcceleration(); } /** * must calibrate IMU for this to work * @return velocity value from IMU */ public Velocity getVelocity() { return imu.getVelocity(); } /** * must calibrate IMU for this to work * @return position value from IMU */ public Position getPosition() { return imu.getPosition(); } /** * resets PID variables so it can be used for a separate process */ public void resetPID() { prevError = 0; integral = 0; } /** * resets angle so following call to {@link #getHeading()} */ public void resetAngle() { zeroPos = getHeading(); } /** * uses the PID algorithm to calculate desired power to get to the desired heading * @param angle angle to align to in degrees * @return the power to get to the angle */ public double align (double angle) { if (prevError == 0) runTime.reset(); angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); final double heading = getHeading(); final double error = angle-heading; integral = integral + error * kP() *runTime.milliseconds(); final double deravitive = (error - prevError)/runTime.milliseconds(); final double correction = error * kP() + deravitive * kD() + integral * kI(); //correction = Range.clip(correction, 0, 0.3); prevError = error; runTime.reset(); return correction; } /** * copy of {link #align(double angle)} but takes PID constants, designed to be used to tune the system * @param angle desired angle to align to * @param p P tune constant * @param i I tune constant * @param d D tune constant * @return th power to get to the angle */ public double alignTune (double angle, double p, double i, double d) { if (prevError == 0) runTime.reset(); angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); final double heading = getHeading(); final double error = angle-heading; integral = integral + error * p * runTime.milliseconds(); final double deravitive = (error - prevError)/runTime.milliseconds(); final double correction = error * p + deravitive * d + integral * i; //correction = Range.clip(correction, 0, 0.3); prevError = error; runTime.reset(); return correction; } public void addTelemetry() { opMode.telemetry.addData(name + " heading", getHeading()); opMode.telemetry.addData(name + " heading", imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES).firstAngle); opMode.telemetry.addData(name + " rate", imu.getAngularVelocity().zRotationRate); } }
[ "zbeezow@gmail.com" ]
zbeezow@gmail.com
ba44ccb483bd784cdb0c9cfea22a5e5b2eababa3
00e8ac91740e161fed6de3e326572ffbede0f968
/src/main/java/com/ruigu/fragrant/bot/FileBot.java
652f90abcc373895b1677154e92216a10e7e676d
[]
no_license
starwinkblink/wx-robot
4e153756fbe8d9216d15f74dbab312ad64e9eff2
bcbbc0ef1fad25e3c0513eaf8cb49f4db21d8547
refs/heads/master
2022-12-11T08:06:23.155418
2020-09-09T10:00:27
2020-09-09T10:00:27
294,072,815
1
0
null
null
null
null
UTF-8
Java
false
false
203
java
package com.ruigu.fragrant.bot; /** * @author HuangHuiWang * @date 2020/9/8 16:42 */ public class FileBot extends CommonBot { public FileBot(int msgFormat) { super(msgFormat); } }
[ "huanghuiwang@ruigushop.com" ]
huanghuiwang@ruigushop.com
cc6f847f9d8557f441914833eb7b739d3a66a514
13d432f694c6648308f0401525f0601b130fe12d
/src/main/java/com/vcv/exception/FileNotExistsException.java
18f3e1e7deb26d2755c16926c6b47a82ddb8d89a
[]
no_license
clearLove8080/management
786f4d1653698dedd107cc7cf0ef93242876c723
4255bd3f0b8ba26995bd80f17cb44a390e4225b5
refs/heads/master
2022-06-23T18:02:12.836236
2019-07-04T09:56:58
2019-07-04T09:56:58
191,580,337
3
0
null
2022-06-17T02:13:13
2019-06-12T13:49:41
HTML
UTF-8
Java
false
false
196
java
package com.vcv.exception; public class FileNotExistsException extends Exception { //构造函数 public FileNotExistsException(){ //重写 super("文件不存在"); } }
[ "597213343@qq.com" ]
597213343@qq.com
b79416aafe9397441b49f0ef3a8beff8d63cd406
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/protocal/protobuf/ghy.java
c9e549e39d7043de7ba4d708f6d009dcb28b8939
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
6,870
java
package com.tencent.mm.protocal.protobuf; import com.tencent.matrix.trace.core.AppMethodBeat; import java.util.LinkedList; import org.json.JSONObject; public final class ghy extends com.tencent.mm.bx.a { public int IJG; public long YYo; public dhb aaLr; public acm aaLs; public int aayc; public LinkedList<String> acer; public LinkedList<aem> aces; public String vYk; public String yts; public ghy() { AppMethodBeat.i(117951); this.acer = new LinkedList(); this.aces = new LinkedList(); AppMethodBeat.o(117951); } private JSONObject toJSON() { AppMethodBeat.i(258719); JSONObject localJSONObject = new JSONObject(); try { com.tencent.mm.bk.a.a(localJSONObject, "ConfigKeys", this.acer, false); com.tencent.mm.bk.a.a(localJSONObject, "H5Version", Integer.valueOf(this.aayc), false); com.tencent.mm.bk.a.a(localJSONObject, "Language", this.yts, false); com.tencent.mm.bk.a.a(localJSONObject, "Scene", Integer.valueOf(this.IJG), false); com.tencent.mm.bk.a.a(localJSONObject, "BusinessType", Long.valueOf(this.YYo), false); com.tencent.mm.bk.a.a(localJSONObject, "NetType", this.vYk, false); com.tencent.mm.bk.a.a(localJSONObject, "Location", this.aaLr, false); com.tencent.mm.bk.a.a(localJSONObject, "ExtParams", this.aces, false); com.tencent.mm.bk.a.a(localJSONObject, "ChildMode", this.aaLs, false); label121: AppMethodBeat.o(258719); return localJSONObject; } catch (Exception localException) { break label121; } } public final int op(int paramInt, Object... paramVarArgs) { AppMethodBeat.i(117952); if (paramInt == 0) { paramVarArgs = (i.a.a.c.a)paramVarArgs[0]; paramVarArgs.e(1, 1, this.acer); paramVarArgs.bS(2, this.aayc); if (this.yts != null) { paramVarArgs.g(3, this.yts); } paramVarArgs.bS(4, this.IJG); paramVarArgs.bv(5, this.YYo); if (this.vYk != null) { paramVarArgs.g(6, this.vYk); } if (this.aaLr != null) { paramVarArgs.qD(7, this.aaLr.computeSize()); this.aaLr.writeFields(paramVarArgs); } paramVarArgs.e(8, 8, this.aces); if (this.aaLs != null) { paramVarArgs.qD(9, this.aaLs.computeSize()); this.aaLs.writeFields(paramVarArgs); } AppMethodBeat.o(117952); return 0; } int i; if (paramInt == 1) { i = i.a.a.a.c(1, 1, this.acer) + 0 + i.a.a.b.b.a.cJ(2, this.aayc); paramInt = i; if (this.yts != null) { paramInt = i + i.a.a.b.b.a.h(3, this.yts); } i = paramInt + i.a.a.b.b.a.cJ(4, this.IJG) + i.a.a.b.b.a.q(5, this.YYo); paramInt = i; if (this.vYk != null) { paramInt = i + i.a.a.b.b.a.h(6, this.vYk); } i = paramInt; if (this.aaLr != null) { i = paramInt + i.a.a.a.qC(7, this.aaLr.computeSize()); } i += i.a.a.a.c(8, 8, this.aces); paramInt = i; if (this.aaLs != null) { paramInt = i + i.a.a.a.qC(9, this.aaLs.computeSize()); } AppMethodBeat.o(117952); return paramInt; } if (paramInt == 2) { paramVarArgs = (byte[])paramVarArgs[0]; this.acer.clear(); this.aces.clear(); paramVarArgs = new i.a.a.a.a(paramVarArgs, unknownTagHandler); for (paramInt = com.tencent.mm.bx.a.getNextFieldNumber(paramVarArgs); paramInt > 0; paramInt = com.tencent.mm.bx.a.getNextFieldNumber(paramVarArgs)) { if (!super.populateBuilderWithField(paramVarArgs, this, paramInt)) { paramVarArgs.kFT(); } } AppMethodBeat.o(117952); return 0; } if (paramInt == 3) { Object localObject1 = (i.a.a.a.a)paramVarArgs[0]; ghy localghy = (ghy)paramVarArgs[1]; paramInt = ((Integer)paramVarArgs[2]).intValue(); Object localObject2; switch (paramInt) { default: AppMethodBeat.o(117952); return -1; case 1: localghy.acer.add(((i.a.a.a.a)localObject1).ajGk.readString()); AppMethodBeat.o(117952); return 0; case 2: localghy.aayc = ((i.a.a.a.a)localObject1).ajGk.aar(); AppMethodBeat.o(117952); return 0; case 3: localghy.yts = ((i.a.a.a.a)localObject1).ajGk.readString(); AppMethodBeat.o(117952); return 0; case 4: localghy.IJG = ((i.a.a.a.a)localObject1).ajGk.aar(); AppMethodBeat.o(117952); return 0; case 5: localghy.YYo = ((i.a.a.a.a)localObject1).ajGk.aaw(); AppMethodBeat.o(117952); return 0; case 6: localghy.vYk = ((i.a.a.a.a)localObject1).ajGk.readString(); AppMethodBeat.o(117952); return 0; case 7: paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt); i = paramVarArgs.size(); paramInt = 0; while (paramInt < i) { localObject1 = (byte[])paramVarArgs.get(paramInt); localObject2 = new dhb(); if ((localObject1 != null) && (localObject1.length > 0)) { ((dhb)localObject2).parseFrom((byte[])localObject1); } localghy.aaLr = ((dhb)localObject2); paramInt += 1; } AppMethodBeat.o(117952); return 0; case 8: paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt); i = paramVarArgs.size(); paramInt = 0; while (paramInt < i) { localObject1 = (byte[])paramVarArgs.get(paramInt); localObject2 = new aem(); if ((localObject1 != null) && (localObject1.length > 0)) { ((aem)localObject2).parseFrom((byte[])localObject1); } localghy.aces.add(localObject2); paramInt += 1; } AppMethodBeat.o(117952); return 0; } paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt); i = paramVarArgs.size(); paramInt = 0; while (paramInt < i) { localObject1 = (byte[])paramVarArgs.get(paramInt); localObject2 = new acm(); if ((localObject1 != null) && (localObject1.length > 0)) { ((acm)localObject2).parseFrom((byte[])localObject1); } localghy.aaLs = ((acm)localObject2); paramInt += 1; } AppMethodBeat.o(117952); return 0; } AppMethodBeat.o(117952); return -1; } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes.jar * Qualified Name: com.tencent.mm.protocal.protobuf.ghy * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
e156488427e26600412f69821cc199634b12d5ca
0ec87342d163c04609cc25cf9637c3b8ae357b9a
/src/main/java/com/test/demo/model/Address.java
ab7ca00ab211b0fa2cddb7224e77b586338e3531
[]
no_license
tvck/SpringBootDemoBNY
bfdce5d6011548fd1043a8de37e805434682e609
60a75cee4867527f05790378974a474fef16f593
refs/heads/master
2020-03-21T17:03:07.743339
2018-06-27T04:07:41
2018-06-27T04:07:41
138,810,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,431
java
package com.test.demo.model; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; @Entity @Table(name="address") public class Address { @Id @GenericGenerator(name = "gen",strategy = "increment") @GeneratedValue(generator = "gen") private int id; @Column private String street; @Column private String suite; @Column private String city; @Column private String zipcode; @OneToOne(cascade = CascadeType.ALL) private Geo geo; public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getSuite() { return suite; } public void setSuite(String suite) { this.suite = suite; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getZipcode() { return zipcode; } public void setZipcode(String zipcode) { this.zipcode = zipcode; } public Geo getGeo() { return geo; } public void setGeo(Geo geo) { this.geo = geo; } @Override public String toString() { return street + '\'' + ", suite='" + suite + '\'' + ", city='" + city + '\'' + ", zipcode='" + zipcode + '\'' + ", " + geo; } }
[ "koukoukou@me.com" ]
koukoukou@me.com
ab03d1dc1760af253e2eb2f3bbbec902a7f91a30
ea5c5ca17d957666a699517078187d6f8490c1fa
/src/main/java/com/activeandroid/ModelInfo.java
e2f7ca57081a75696f1d9395fe01fc2c232611a1
[]
no_license
AtlantaMobileDevGroup/TaskTrak.android
038adbbfde89b6e5d411631a95fcd52847656b71
3afb05a83df75cac5aecd51f3f4849562fb753d9
refs/heads/master
2016-09-05T20:46:48.620101
2013-06-28T04:01:13
2013-06-28T04:01:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,299
java
package com.activeandroid; /* * Copyright (C) 2010 Michael Pardo * * 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. */ import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Application; import com.activeandroid.serializer.TypeSerializer; import com.activeandroid.util.Log; import com.activeandroid.util.ReflectionUtils; import dalvik.system.DexFile; final class ModelInfo { ////////////////////////////////////////////////////////////////////////////////////// // PRIVATE METHODS ////////////////////////////////////////////////////////////////////////////////////// private Map<Class<? extends Model>, TableInfo> mTableInfos; private Map<Class<?>, TypeSerializer> mTypeSerializers; ////////////////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS ////////////////////////////////////////////////////////////////////////////////////// public ModelInfo(Application application) { mTableInfos = new HashMap<Class<? extends Model>, TableInfo>(); mTypeSerializers = new HashMap<Class<?>, TypeSerializer>(); try { scanForModel(application); } catch (IOException e) { Log.e("Couln't open source path.", e); } Log.i("ModelInfo loaded."); } ////////////////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS ////////////////////////////////////////////////////////////////////////////////////// public Collection<TableInfo> getTableInfos() { return mTableInfos.values(); } public TableInfo getTableInfo(Class<? extends Model> type) { return mTableInfos.get(type); } @SuppressWarnings("unchecked") public List<Class<? extends Model>> getModelClasses() { return (List<Class<? extends Model>>) mTableInfos.keySet(); } public TypeSerializer getTypeSerializer(Class<?> type) { return mTypeSerializers.get(type); } ////////////////////////////////////////////////////////////////////////////////////// // PRIVATE METHODS ////////////////////////////////////////////////////////////////////////////////////// private void scanForModel(Application application) throws IOException { String packageName = application.getPackageName(); String sourcePath = application.getApplicationInfo().sourceDir; List<String> paths = new ArrayList<String>(); if (sourcePath != null) { DexFile dexfile = new DexFile(sourcePath); Enumeration<String> entries = dexfile.entries(); while (entries.hasMoreElements()) { paths.add(entries.nextElement()); } } // Robolectric fallback else { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = classLoader.getResources(""); while (resources.hasMoreElements()) { String path = resources.nextElement().getFile(); if (path.contains("bin") || path.contains("classes")) { paths.add(path); } } } for (String path : paths) { File file = new File(path); scanForModelClasses(file, packageName, application.getClass().getClassLoader()); } } private void scanForModelClasses(File path, String packageName, ClassLoader classLoader) { if (path.isDirectory()) { for (File file : path.listFiles()) { scanForModelClasses(file, packageName, classLoader); } } else { String className = path.getName(); // Robolectric fallback if (!path.getPath().equals(className)) { className = path.getPath(); if (className.endsWith(".class")) { className = className.substring(0, className.length() - 6); } else { return; } className = className.replace("/", "."); int packageNameIndex = className.lastIndexOf(packageName); if (packageNameIndex < 0) { return; } className = className.substring(packageNameIndex); } try { Class<?> discoveredClass = Class.forName(className, false, classLoader); if (ReflectionUtils.isModel(discoveredClass)) { @SuppressWarnings("unchecked") Class<? extends Model> modelClass = (Class<? extends Model>) discoveredClass; mTableInfos.put(modelClass, new TableInfo(modelClass)); } else if (ReflectionUtils.isTypeSerializer(discoveredClass)) { TypeSerializer typeSerializer = (TypeSerializer) discoveredClass.newInstance(); mTypeSerializers.put(typeSerializer.getDeserializedType(), typeSerializer); } } catch (ClassNotFoundException e) { Log.e("Couldn't create class.", e); } catch (InstantiationException e) { Log.e("Couldn't instantiate TypeSerializer.", e); } catch (IllegalAccessException e) { Log.e("IllegalAccessException", e); } } } }
[ "cajun.code@gmail.com" ]
cajun.code@gmail.com
d8f5a17e1b791f307f21bc3e72aad43c31a469be
92225460ebca1bb6a594d77b6559b3629b7a94fa
/src/com/kingdee/eas/fdc/schedule/IBizType.java
77b3f3f6d522691ab2335cab787d597ea7a5c1d3
[]
no_license
yangfan0725/sd
45182d34575381be3bbdd55f3f68854a6900a362
39ebad6e2eb76286d551a9e21967f3f5dc4880da
refs/heads/master
2023-04-29T01:56:43.770005
2023-04-24T05:41:13
2023-04-24T05:41:13
512,073,641
0
1
null
null
null
null
UTF-8
Java
false
false
1,318
java
package com.kingdee.eas.fdc.schedule; import com.kingdee.bos.BOSException; //import com.kingdee.bos.metadata.*; import com.kingdee.bos.framework.*; import com.kingdee.bos.util.*; import com.kingdee.bos.Context; import java.lang.String; import com.kingdee.bos.util.*; import com.kingdee.eas.common.EASBizException; import com.kingdee.bos.metadata.entity.EntityViewInfo; import com.kingdee.bos.dao.IObjectPK; import com.kingdee.bos.Context; import com.kingdee.bos.BOSException; import com.kingdee.eas.framework.CoreBaseInfo; import com.kingdee.bos.framework.*; import com.kingdee.eas.framework.IDataBase; import com.kingdee.bos.metadata.entity.SelectorItemCollection; import com.kingdee.eas.framework.CoreBaseCollection; public interface IBizType extends IDataBase { public BizTypeInfo getBizTypeInfo(IObjectPK pk) throws BOSException, EASBizException; public BizTypeInfo getBizTypeInfo(IObjectPK pk, SelectorItemCollection selector) throws BOSException, EASBizException; public BizTypeInfo getBizTypeInfo(String oql) throws BOSException, EASBizException; public BizTypeCollection getBizTypeCollection() throws BOSException; public BizTypeCollection getBizTypeCollection(EntityViewInfo view) throws BOSException; public BizTypeCollection getBizTypeCollection(String oql) throws BOSException; }
[ "yfsmile@qq.com" ]
yfsmile@qq.com
f45eefc75c18e712c88b0d23e3cef1dcecdf2867
2c87edb3c63040e33c85f483d71ea8cb40f13693
/src/main/java/com/example/demo/repository/SimpleSingerRepository.java
3142dc99654b2fb4c46dcd584a5e0dd37db09a00
[]
no_license
sieunkr/graphql-gds-sample
d159408983c73c1774525c6a05f0343488423e7e
331ea5dc3d45add809d8955efad5e8deb577362d
refs/heads/master
2023-03-26T10:47:43.184105
2021-03-21T03:48:55
2021-03-21T03:48:55
347,296,849
0
1
null
null
null
null
UTF-8
Java
false
false
1,572
java
package com.example.demo.repository; import com.example.demo.type.GenderCode; import com.example.demo.type.Singer; import org.springframework.stereotype.Repository; import javax.annotation.PostConstruct; import java.util.*; import java.util.stream.Collectors; @Repository public class SimpleSingerRepository implements SingerRepository { private List<Singer> singerList = new ArrayList<>(); private Map<String, Singer> singerMap = new HashMap<>(); @PostConstruct void init() { singerList = List.of( Singer.builder() .name("아이유") .age(29) .gender(GenderCode.FEMALE) .build(), Singer.builder() .name("피오") .age(29) .gender(GenderCode.MALE) .build(), Singer.builder() .name("백아연") .age(29) .gender(GenderCode.FEMALE) .build(), Singer.builder() .name("지수") .age(27) .gender(GenderCode.FEMALE) .build() ); } @Override public List<Singer> findAll() { return singerList; } @Override public List<Singer> findByName(String name) { return findAll().stream().filter(s -> s.getName().contains(name)).collect(Collectors.toList()); } }
[ "sieunkr@gmail.com" ]
sieunkr@gmail.com
3a2acdcf19c961d14e8418414544b7d5dbdf0a75
034eefa89b6ca310f4529803c9e785ee3b6a6f11
/src/test/blackbox/BlackBoxTestCaseSimplify1.java
38e5606b98ae9c6d4562f5acb827b0b5a67c9057
[]
no_license
WindInWillows/lab1
b4fe4b556d36f8ef93d8a3e2191d2a8efc710891
7cde804a36836775688effb54949562dc7084d4b
refs/heads/master
2021-01-18T17:33:44.052326
2016-11-21T11:14:30
2016-11-21T11:14:30
69,327,117
0
3
null
2016-10-24T14:44:13
2016-09-27T06:40:19
Java
GB18030
Java
false
false
555
java
package test.blackbox; import static org.junit.Assert.*; import org.junit.Test; import poly.Polynome; public class BlackBoxTestCaseSimplify1 { @Test public void test() { Polynome po = new Polynome(); //输入表达式 String expressionStr = "x+4*y^2*z"; po.getInput(expressionStr); //输入化简命令 String commandStr = "!simplify x=1 y z=-1"; po.getInput(commandStr); //得到化简结果 String actual = po.simplify(); String expected = "1-4*y^2"; assertEquals(expected, actual); } }
[ "zzy_xpy@163.com" ]
zzy_xpy@163.com
fe8acd45fb940cbc19f31e097c336a5f2b2d9298
2d039bd12e232a678176299f9bfd9662e21bb294
/DesignPatterns/src/Adapter/duixiang/USB.java
8fcc7aa5fc305fa0210b4d5b815fb90a4ad83564
[]
no_license
zhenzhaoxing/Java
332e434008973a6276d596243f5c492a5140b6d5
0a4db11d4a008b13afdd3a1688041b814f7d7002
refs/heads/master
2020-04-21T17:41:54.590940
2019-02-26T07:13:10
2019-02-26T07:13:10
169,744,804
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package Adapter.duixiang; public interface USB { void isUsb(); }
[ "1937.67276@qq.com" ]
1937.67276@qq.com
bf0fb6f69bdddc7404a1e71b4576a73ac1c54b62
77b3b4b3e08253c0fd8ca4bc5f5176e9d0507986
/Eighth_Config_Context_Example/src/EmployeeRegistration.java
83a3090937c77587cec0d8977aa57c9aa0f7092e
[]
no_license
debiprasadmishra50/Advance-Java-Practice---JAVA-EE
413bcffd6631b85d0d892403f571b0a69dbf1f2b
40edbb070c3c92885fd0f33ebabe1fd70e8b5b62
refs/heads/master
2022-11-10T17:09:23.478424
2020-06-28T07:17:26
2020-06-28T07:17:26
275,529,224
0
0
null
null
null
null
UTF-8
Java
false
false
2,537
java
import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class EmployeeRegistration */ public class EmployeeRegistration extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public EmployeeRegistration() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); response.setContentType("text/html"); int empid = Integer.parseInt(request.getParameter("empid")); String ename = request.getParameter("ename"); double salary = Double.parseDouble(request.getParameter("salary")); out.print("<br>Roll : "+empid); out.print("<br><hr>Name : "+ename); out.print("<br><hr>Cgpa : "+salary); out.print("<hr>"); try { ServletContext context = getServletContext(); ServletConfig config = getServletConfig(); String driver = context.getInitParameter("driver"); String url = context.getInitParameter("url"); String username = config.getInitParameter("username"); String password = config.getInitParameter("password"); Class.forName(driver); Connection con = DriverManager.getConnection(url,username,password); String sql = "insert into Employee values (?,?,?)"; PreparedStatement pst = con.prepareStatement(sql); pst.setInt(1, empid); pst.setString(2, ename); pst.setDouble(3, salary); int status = pst.executeUpdate(); if(status > 0) out.println("<h1>Employee Records inserted Successfully</h1>"); else out.println("<h1>Error insertion in Employee Registration</h1>"); } catch (Exception e) { e.printStackTrace(); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "debiprasadmishra50@gmail.com" ]
debiprasadmishra50@gmail.com