blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
a4a07fd171fbc42de28a591ddefb462a66f522be
3a8ca1d981629f49bd9e75f68fc2287b7c830177
/src/main/java/guru/sfg/brewery/model/events/NewInventoryEvent.java
4c632df3a40f5e1612e0479f22a67b5e6675a8a4
[]
no_license
kmoreti/kmoreti-beer-inventory-service
9b583dc061f0875c2a2d16dcb9630cce0df72307
297616c2f6a157aa052c6f9e6acf9a38e3e45db2
refs/heads/master
2023-06-07T00:56:58.119877
2021-07-03T18:16:47
2021-07-03T18:16:47
285,384,857
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package guru.sfg.brewery.model.events; import lombok.NoArgsConstructor; /** * Created by jt on 2019-07-21. */ @NoArgsConstructor public class NewInventoryEvent extends BeerEvent { private static final long serialVersionUID = -3915175777227421743L; public NewInventoryEvent(BeerDto beerDto) { super(beerDto); } }
b5e9687164986719a83c0e54df7c7371b5319317
5e2f9e49ac0d118c217895b48ec9c200fbefed91
/wdwebLib/src/main/java/com/wdweblib/web/WDWebChromeClient.java
29fb2291f6d48ffc3e374da52857a9770f44da90
[]
no_license
1208912705/WDWebView
64d3881524a922a046185e6cf5b3efb58e7c5234
94edddb1cc37ebc54fe3ddb0bec2a99cc47f241e
refs/heads/master
2023-06-02T11:17:24.483335
2021-06-16T08:33:24
2021-06-16T08:33:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,694
java
package com.wdweblib.web; import android.graphics.Bitmap; import android.net.Uri; import android.os.Message; import android.util.Log; import android.view.View; import androidx.annotation.Nullable; import com.tencent.smtt.export.external.interfaces.ConsoleMessage; import com.tencent.smtt.export.external.interfaces.GeolocationPermissionsCallback; import com.tencent.smtt.export.external.interfaces.IX5WebChromeClient; import com.tencent.smtt.export.external.interfaces.JsPromptResult; import com.tencent.smtt.export.external.interfaces.JsResult; import com.tencent.smtt.export.external.interfaces.PermissionRequest; import com.tencent.smtt.sdk.ValueCallback; import com.tencent.smtt.sdk.WebChromeClient; import com.tencent.smtt.sdk.WebStorage; import com.tencent.smtt.sdk.WebView; import com.wdweblib.LoadView; /** * code by markfeng * <p> * create on 2021-05-26 16:12 */ public class WDWebChromeClient extends WebChromeClient { private LoadView mLoadView; public WDWebChromeClient() { super(); } @Override public void onExceededDatabaseQuota(String s, String s1, long l, long l1, long l2, WebStorage.QuotaUpdater quotaUpdater) { super.onExceededDatabaseQuota(s, s1, l, l1, l2, quotaUpdater); Log.i("WDWeb","onExceededDatabaseQuota"); } @Override public Bitmap getDefaultVideoPoster() { Log.i("WDWeb","getDefaultVideoPoster"); return super.getDefaultVideoPoster(); } @Override public void getVisitedHistory(ValueCallback<String[]> valueCallback) { super.getVisitedHistory(valueCallback); Log.i("WDWeb","getVisitedHistory"); } @Override public boolean onConsoleMessage(ConsoleMessage consoleMessage) { Log.i("WDWeb","onConsoleMessage"); return super.onConsoleMessage(consoleMessage); } @Override public boolean onCreateWindow(WebView webView, boolean b, boolean b1, Message message) { Log.i("WDWeb","onCreateWindow"); return super.onCreateWindow(webView, b, b1, message); } @Override public void onGeolocationPermissionsHidePrompt() { Log.i("WDWeb","onGeolocationPermissionsHidePrompt"); super.onGeolocationPermissionsHidePrompt(); } @Override public void onGeolocationPermissionsShowPrompt(String s, GeolocationPermissionsCallback geolocationPermissionsCallback) { Log.i("WDWeb","onGeolocationPermissionsShowPrompt"); super.onGeolocationPermissionsShowPrompt(s, geolocationPermissionsCallback); } @Override public void onHideCustomView() { Log.i("WDWeb","onHideCustomView"); super.onHideCustomView(); } @Override public boolean onJsAlert(WebView webView, String s, String s1, JsResult jsResult) { Log.i("WDWeb","onJsAlert"); return super.onJsAlert(webView, s, s1, jsResult); } @Override public boolean onJsConfirm(WebView webView, String s, String s1, JsResult jsResult) { Log.i("WDWeb","onJsConfirm"); return super.onJsConfirm(webView, s, s1, jsResult); } @Override public boolean onJsPrompt(WebView webView, String s, String s1, String s2, JsPromptResult jsPromptResult) { Log.i("WDWeb","onJsPrompt"); return super.onJsPrompt(webView, s, s1, s2, jsPromptResult); } @Override public boolean onJsBeforeUnload(WebView webView, String s, String s1, JsResult jsResult) { Log.i("WDWeb","onJsBeforeUnload"); return super.onJsBeforeUnload(webView, s, s1, jsResult); } @Override public boolean onJsTimeout() { Log.i("WDWeb","onJsTimeout"); return super.onJsTimeout(); } @Override public void onProgressChanged(WebView webView, int newProgress) { Log.i("WDWeb","onProgressChanged"); super.onProgressChanged(webView, newProgress); if (newProgress == 100) { if (mLoadView != null) { mLoadView.hide(); } } } @Override public void onReachedMaxAppCacheSize(long l, long l1, WebStorage.QuotaUpdater quotaUpdater) { super.onReachedMaxAppCacheSize(l, l1, quotaUpdater); Log.i("WDWeb","onReachedMaxAppCacheSize"); } @Override public void onReceivedIcon(WebView webView, Bitmap bitmap) { super.onReceivedIcon(webView, bitmap); Log.i("WDWeb","onReceivedIcon"); } @Override public void onReceivedTouchIconUrl(WebView webView, String s, boolean b) { super.onReceivedTouchIconUrl(webView, s, b); Log.i("WDWeb","onReceivedTouchIconUrl"); } @Override public void onReceivedTitle(WebView webView, String s) { super.onReceivedTitle(webView, s); Log.i("WDWeb","onReceivedTitle"); } @Override public void onRequestFocus(WebView webView) { super.onRequestFocus(webView); Log.i("WDWeb","onRequestFocus"); } @Override public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback customViewCallback) { super.onShowCustomView(view, customViewCallback); Log.i("WDWeb","onShowCustomView"); } @Override public void onShowCustomView(View view, int i, IX5WebChromeClient.CustomViewCallback customViewCallback) { super.onShowCustomView(view, i, customViewCallback); Log.i("WDWeb","onShowCustomView"); } @Override public void onCloseWindow(WebView webView) { super.onCloseWindow(webView); Log.i("WDWeb","onCloseWindow"); } @Override public View getVideoLoadingProgressView() { Log.i("WDWeb","getVideoLoadingProgressView"); return super.getVideoLoadingProgressView(); } @Override public void openFileChooser(ValueCallback<Uri> valueCallback, String s, String s1) { super.openFileChooser(valueCallback, s, s1); Log.i("WDWeb","openFileChooser"); } @Override public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, FileChooserParams fileChooserParams) { Log.i("WDWeb","onShowFileChooser"); return super.onShowFileChooser(webView, valueCallback, fileChooserParams); } @Override public void onPermissionRequest(PermissionRequest permissionRequest) { super.onPermissionRequest(permissionRequest); Log.i("WDWeb","onPermissionRequest"); } @Override public void onPermissionRequestCanceled(PermissionRequest permissionRequest) { super.onPermissionRequestCanceled(permissionRequest); Log.i("WDWeb","onPermissionRequestCanceled"); } public void setLoadView(LoadView mLoadView) { this.mLoadView = mLoadView; } }
b13a29062d705760d99798f82d50b22752edd179
03be3f540f93a1507e82e4e84a651e205ba2971e
/.svn/pristine/b1/b13a29062d705760d99798f82d50b22752edd179.svn-base
7b484e9603552f058a89cfc6a80f86ff76edafcf
[]
no_license
Tarunjain19/DXC_SVN
448103f0c56e79616a2801acbf5d369d6e256b36
99a90150d30374929382c3181ee8b1f914c905ae
refs/heads/master
2022-06-04T10:36:52.755986
2020-05-06T08:44:47
2020-05-06T08:44:47
261,372,252
0
0
null
null
null
null
UTF-8
Java
false
false
3,941
package flow.subflow.NumberVerification; /** * The Data class handles many types of server-side operations including data * collection (from a data sources such as a database, or web service), variable * assignments and operations (like copying variable values, performing mathematic * operations, and collection iteration), conditional evaluation to control callflow * execution based on variable values, and logging/tracing statements. * * Items created in the getDataActions() method are executed/evaluated in order * and if a condional branch condition evaluates to "true" then the branch is * activated and the execution of data actions is halted. If no "true" conditions * are encountered, then all data actions will be executed/evaluated and the * application will proceed to the "Default" servlet. * Last generated by Orchestration Designer at: 2015-MAY-08 04:11:36 PM */ public class ChkIntelligentLayer extends com.avaya.sce.runtime.Data { //{{START:CLASS:FIELDS //}}END:CLASS:FIELDS /** * Default constructor * Last generated by Orchestration Designer at: 2015-MAY-08 04:11:36 PM */ public ChkIntelligentLayer() { //{{START:CLASS:CONSTRUCTOR super(); //}}END:CLASS:CONSTRUCTOR } /** * Returns the Next item which will forward application execution * to the next form in the call flow. * Last generated by Orchestration Designer at: 2017-AUG-28 11:20:45 AM */ public com.avaya.sce.runtime.Next getNext(com.avaya.sce.runtimecommon.SCESession mySession) { com.avaya.sce.runtime.Next next = null; return next; } /** * Create a list of local variables used by items in the data node. * * This method is generated automatically by the code generator * and should not be manually edited. Manual edits may be overwritten * by the code generator. * Last generated by Orchestration Designer at: 2017-AUG-28 11:20:45 AM */ public java.util.Collection<VariableInfo> getLocalVariables(){ java.util.Collection<VariableInfo> variables = new java.util.ArrayList<VariableInfo>(); return variables; } /** * Creates and conditionally executes operations that have been configured * in the Callflow. This method will build a collection of operations and * have the framework execute the operations by calling evaluateActions(). * If the evaluation causes the framework to forward to a different servlet * then execution stops. * Returning true from this method means that the framework has forwarded the * request to a different servlet. Returning false means that the default * Next will be invoked. * * This method is generated automatically by the code generator * and should not be manually edited. Manual edits may be overwritten * by the code generator. * Last generated by Orchestration Designer at: 2017-AUG-28 11:20:45 AM */ public boolean executeDataActions(com.avaya.sce.runtimecommon.SCESession mySession) throws Exception { java.util.Collection actions = null; actions = new java.util.ArrayList(1); if(evaluateActions(actions, mySession)) { return true; } actions = null; if(((com.avaya.sce.runtime.Condition)new com.avaya.sce.runtime.Condition("condition1", "Flag:isFromIntelligentLayer", com.avaya.sce.runtime.Expression.STRING_EQUAL_IGNORE, "Constants:yes", true).setDebugId(698)).evaluate(mySession)) { actions = new java.util.ArrayList(1); actions.add(new com.avaya.sce.runtime.Next("NumberVerification-MainMenu", "MainMenu").setDebugId(697)); if(evaluateActions(actions, mySession)) { return true; } actions = null; } else { actions = new java.util.ArrayList(1); actions.add(new com.avaya.sce.runtime.Next("NumberVerification-LinkDown", "LinkDown").setDebugId(700)); if(evaluateActions(actions, mySession)) { return true; } actions = null; } // return false if the evaluation of actions did not cause a servlet forward or redirect return false; } }
449dbba924637cfd793c11bad6594af1ee37159a
168025ead95cdcd3383df39e6aee2ec881b39e93
/src/main/java/com/example/datajdbcexample/DataJdbcExampleApplication.java
b5d3c2fa6efd7b98bccc215dcaac08a8fc10518a
[]
no_license
eduanb/data-jdbc-example
6eeed3fef02af21d8b46c886f2c90a753e04e9b7
36cec933882bc3edf3d752337fabc540e5125c51
refs/heads/master
2023-03-13T09:27:10.992327
2021-02-08T11:52:35
2021-02-08T11:52:35
337,058,061
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package com.example.datajdbcexample; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DataJdbcExampleApplication { public static void main(String[] args) { SpringApplication.run(DataJdbcExampleApplication.class, args); } }
53aa6eb5b1ff4949b7bf50ed73154bf7c715a705
50fae8de82c5bef70e27e52787e31bea31366ed8
/src/main/java/com/sjtu/icare/modules/gero/entity/GeroEntity.java
399114c626b4943036ff1dbe7de1f9c3864df556
[]
no_license
wwhui/icare
88f7618014d7469ab137f173f61cd99771201232
d86b84a987447dd2122e0a22bb674a67e7ebad9a
refs/heads/master
2021-01-22T02:39:17.699586
2015-03-25T07:18:34
2015-03-25T07:18:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,022
java
/** * @Package com.sjtu.icare.modules.gero.entity * @Description TODO * @date Mar 24, 2015 5:16:33 PM * @author Wang Qi * @version TODO */ package com.sjtu.icare.modules.gero.entity; import java.io.Serializable; import com.sjtu.icare.common.persistence.DataEntity; public class GeroEntity extends DataEntity<GeroEntity> implements Serializable { private static final long serialVersionUID = 1L; private Integer id; private String name; private String city; private String district; private String address; private String contact; private String licence; private Integer scale; private Integer careLevel; private Integer contactId; private String logoUrl; private String photoUrl; private String registerDate; private String cancelDate; /* (non-Javadoc) * @see com.sjtu.icare.common.persistence.BaseEntity#preDelete() */ @Override public void preDelete() { // TODO Auto-generated method stub } /** * @return the id */ public int getId() { return super.getId(); } /** * @param id the id to set */ public void setId(Integer id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the city */ public String getCity() { return city; } /** * @param city the city to set */ public void setCity(String city) { this.city = city; } /** * @return the district */ public String getDistrict() { return district; } /** * @param district the district to set */ public void setDistrict(String district) { this.district = district; } /** * @return the address */ public String getAddress() { return address; } /** * @param address the address to set */ public void setAddress(String address) { this.address = address; } /** * @return the contact */ public String getContact() { return contact; } /** * @param contact the contact to set */ public void setContact(String contact) { this.contact = contact; } /** * @return the licence */ public String getLicence() { return licence; } /** * @param licence the licence to set */ public void setLicence(String licence) { this.licence = licence; } /** * @return the scale */ public Integer getScale() { return scale; } /** * @param scale the scale to set */ public void setScale(Integer scale) { this.scale = scale; } /** * @return the careLevel */ public Integer getCareLevel() { return careLevel; } /** * @param careLevel the careLevel to set */ public void setCareLevel(Integer careLevel) { this.careLevel = careLevel; } /** * @return the contactId */ public Integer getContactId() { return contactId; } /** * @param contactId the contactId to set */ public void setContactId(Integer contactId) { this.contactId = contactId; } /** * @return the logoUrl */ public String getLogoUrl() { return logoUrl; } /** * @param logoUrl the logoUrl to set */ public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } /** * @return the photoUrl */ public String getPhotoUrl() { return photoUrl; } /** * @param photoUrl the photoUrl to set */ public void setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; } /** * @return the registerDate */ public String getRegisterDate() { return registerDate; } /** * @param registerDate the registerDate to set */ public void setRegisterDate(String registerDate) { this.registerDate = registerDate; } /** * @return the cancelDate */ public String getCancelDate() { return cancelDate; } /** * @param cancelDate the cancelDate to set */ public void setCancelDate(String cancelDate) { this.cancelDate = cancelDate; } /** * @return the serialversionuid */ public static long getSerialversionuid() { return serialVersionUID; } }
42753b78fcc79cb4d7acceda6d3010a407cf81c0
02665a65ba1f08a738257d1c0473f52b961947d6
/Complete Search/Maximum number of overlapping intervals – Merge Overlapping Intervals – Max Task Load.java
dc25a0ebafe00f4602e2a3c6f6633c8be9779fb5
[]
no_license
mehedi-imam241/DS-and-Algo
8660d44f126718772eb148ebb21045483f0f1742
67015cde98c863a1505f9477a0321e93eba9408b
refs/heads/master
2022-11-15T05:02:25.692646
2020-07-03T14:50:23
2020-07-03T14:50:23
276,923,514
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
import java.io.File; import java.io.FileInputStream; import java.io.PrintStream; import java.util.Arrays; class A { public static void main(String[] args) { try { System.setIn(new FileInputStream(new File("input.txt"))); System.setOut(new PrintStream(new File("output.txt"))); } catch (Exception e) { } int[] start = { 0, 3, 4, 7, 1 }; int[] end = { 2, 7, 6, 8, 5 }; System.out.println(maxOverlapIntervalCount(start, end)); } public static int maxOverlapIntervalCount(int[] start, int[] end) { int maxOverlap = 0; int currentOverlap = 0; Arrays.sort(start); Arrays.sort(end); int i = 0; int j = 0; while (i < start.length && j < end.length) { int s = start[i]; int e = end[j]; if (s < e) { currentOverlap++; maxOverlap = Math.max(maxOverlap, currentOverlap); i++; } else { currentOverlap--; j++; } } return maxOverlap; } }
403fc7f6bdcde4b3e9451c610edcba52240c9cbf
88b883da0599391a81548686ef325ad6337a1547
/app/src/main/java/org/opensharingtoolkit/daoplayer/audio/FileCache.java
d231020240e700fa811a112c4cb895f11970f779
[ "BSD-3-Clause" ]
permissive
cgreenhalgh/daoplayer
c1994df3cd9456dd52602a9dfcccec9c7fd01316
30182756c665e2579ed055aa7909b302357b6af3
refs/heads/master
2021-01-17T09:19:08.768340
2018-01-17T17:35:57
2018-01-17T17:35:57
25,549,962
0
0
null
null
null
null
UTF-8
Java
false
false
17,847
java
/** * */ package org.opensharingtoolkit.daoplayer.audio; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; import java.util.TreeMap; import java.util.TreeSet; import java.util.Vector; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import org.opensharingtoolkit.daoplayer.IAudio; import org.opensharingtoolkit.daoplayer.ILog; import org.opensharingtoolkit.daoplayer.audio.AudioEngine.StateType; import android.content.Context; import android.util.Log; /** * Maintains cache of decoded files, decoding more as required. Used by AudioEngine. * Updates based on AudioEngine queue State. Uses internal threads to decode in the * background. * * @author pszcmg */ public class FileCache { static boolean debug = true; public static class Block { short mSamples[]; int mChannels; int mStartFrame; // Note frame number // internal int mIndex; long mLastRequestedTime; /** * @return the mSamples */ public short[] getSamples() { return mSamples; } /** * @return the mChannels */ public int getChannels() { return mChannels; } /** * @return the mStartFrame */ public int getStartFrame() { return mStartFrame; } /** * @return the mIndex */ public int getIndex() { return mIndex; } }; static class File { String mPath; FileDecoder mDecoder; TreeMap<Integer,Block> mBlocks = new TreeMap<Integer,Block>(); File(String path) { mPath = path; } } private static final String TAG = "daoplayer-filecache"; private static final long CACHE_RETAIN_TIME_MS = 2000; private static final int CACHE_RATAIN_SAMPLES = (2*44100); private Map<String,File> mFiles = new HashMap<String,File>(); private Vector<FileNeedTask> mTasks = new Vector<FileNeedTask>(); private ExecutorService mExecutor; /** may use context to access assets */ private Context mContext; private static ILog mLog; /** * @param mContext */ public FileCache(Context mContext, ILog log) { this.mContext = mContext; mLog = log; mExecutor = Executors.newSingleThreadExecutor(); } /** play out API */ public Block getBlock(AFile afile, int frame, Block lastBlock) { File file = null; synchronized(this) { file = mFiles.get(afile.getPath()); } if (file==null) return null; synchronized(file.mBlocks) { TreeMap.Entry<Integer,Block> ent = file.mBlocks.floorEntry(frame); if (ent!=null) { Block b = ent.getValue(); if (b.mStartFrame<=frame && b.mStartFrame+b.mSamples.length/b.mChannels > frame) { // found in cache! b.mLastRequestedTime = System.currentTimeMillis(); return b; } } // cache miss } return null; } public void reset() { synchronized (this) { for (File file : mFiles.values()) { if (file.mDecoder!=null) file.mDecoder.cancel(); } // TODO no need?! mFiles.clear(); } } static class NeedRec { public NeedRec(AFile file) { mFile = file; } AFile mFile; TreeMap<Integer,Interval> mIntervals = new TreeMap<Integer,Interval>(); public void merge(Interval ival) { int fromInclusive = ival.mFromInclusive; TreeMap.Entry<Integer,Interval> from = mIntervals.floorEntry(fromInclusive); if (from!=null) fromInclusive = from.getValue().mFromInclusive; // overlaps // copy Collection<Interval> overlaps = new LinkedList<Interval>(); overlaps.addAll(mIntervals.subMap(fromInclusive, ival.mToExclusive).values()); for (Interval overlap : overlaps) { if (overlap.mToExclusive<=ival.mFromInclusive) // shouldn't happen continue; else if (overlap.mToExclusive<=ival.mToExclusive) { // 1. ends at/before new if (overlap.mFromInclusive<ival.mFromInclusive) { // 1.1 starts before new (and ends at/before new) if (overlap.mPriority==ival.mPriority) { // merge (into new) ival.mFromInclusive = overlap.mFromInclusive; mIntervals.remove(overlap.mFromInclusive); } else if (overlap.mPriority>ival.mPriority){ // we shrink ival.mFromInclusive = overlap.mToExclusive; // dead? if (ival.mFromInclusive>=ival.mToExclusive) return; } else { // they shrink overlap.mToExclusive = ival.mFromInclusive; } } else { // 1.2. start at/after new (and ends at/before new), i.e. dominated! if (overlap.mPriority==ival.mPriority) { // merge (into new) ival.mFromInclusive = overlap.mFromInclusive; mIntervals.remove(overlap.mFromInclusive); } else if (overlap.mPriority>ival.mPriority){ // we shrink, possible split off before if (ival.mFromInclusive<overlap.mFromInclusive) { Interval fragment = new Interval(ival.mFromInclusive, overlap.mFromInclusive, ival.mPriority); mIntervals.put(fragment.mFromInclusive, fragment); } ival.mFromInclusive = overlap.mToExclusive; // dead? if (ival.mFromInclusive>=ival.mToExclusive) return; } else { // it shrinks = killed! mIntervals.remove(overlap.mFromInclusive); } } } else { // 2. ends after new if (overlap.mFromInclusive<ival.mFromInclusive) { // 2.1 starts before new (and ends after new) if (overlap.mPriority==ival.mPriority) { // we are no needed! (merge) return; } else if (overlap.mPriority>ival.mPriority) { // we are no needed! (killed) return; } else { // we split it Interval fragment = new Interval(ival.mToExclusive, overlap.mToExclusive, overlap.mPriority); mIntervals.put(fragment.mFromInclusive, fragment); overlap.mToExclusive = ival.mFromInclusive; } } else { // 2.2 starts at/after new (and ends after new) if (overlap.mPriority==ival.mPriority) { // merge (in order) ival.mToExclusive = overlap.mToExclusive; mIntervals.remove(overlap.mFromInclusive); } else if (overlap.mPriority>ival.mPriority) { // we shrink ival.mToExclusive = overlap.mFromInclusive; // dead? if (ival.mFromInclusive>=ival.mToExclusive) return; } else { // it shrinks if (ival.mToExclusive>=overlap.mToExclusive) mIntervals.remove(overlap.mFromInclusive); else overlap.mFromInclusive = ival.mToExclusive; } } } }//for overlaps // add what is left! mIntervals.put(ival.mFromInclusive, ival); } }; static int getPriority(AudioEngine.StateType type) { switch(type) { case STATE_DISCARDED: case STATE_WRITTEN: default: return -1; case STATE_IN_PROGRESS: return 1; case STATE_NEXT: return 1; case STATE_FUTURE: return 0; case STATE_FUTURE2: return 0; } } static class Interval { int mFromInclusive; int mToExclusive; int mPriority; Interval(int fromInclusive, int toExclusive) { mFromInclusive = fromInclusive; mToExclusive = toExclusive; } public Interval(int fromInclusive, int toExclusive, int priority) { mFromInclusive = fromInclusive; mToExclusive = toExclusive; mPriority = priority; } } public void update(Vector<AudioEngine.StateRec> stateQueue, HashMap<Integer, ATrack> mTracks, int samplesPerBlock, AudioEngine engine) { // What file spans do we need and how soon? HashMap<String,NeedRec> needRecs = new HashMap<String,NeedRec>(); for (AudioEngine.StateRec srec : stateQueue) { if (srec.mType==AudioEngine.StateType.STATE_IN_PROGRESS || srec.mType==AudioEngine.StateType.STATE_NEXT) { int blockLength = samplesPerBlock*2; for (ATrack track : mTracks.values()) { AState.TrackRef tr = srec.mState.get(track); if (tr==null || tr.isPaused()) // TODO ok with align? continue; int [] align = tr.getAlign(); // frames, inclusive int bufStart = 0, bufEnd = -1; int refPos = tr.getPos(); float pwlVolume[] = tr.getPwlVolume(); int vol = 0; if (pwlVolume==null) { // 12 bit shift vol = (int)(tr.getVolume() * 0x1000); if (vol<=0) { // silent continue; } } int sceneTime = engine.secondsToSamples(srec.mSceneTime); // each aligned sub-section for (int ai=0; ai<=(align!=null ? align.length : 0) && bufStart<=blockLength-1; ai+=2, bufStart = bufEnd+1) { int tpos = refPos+bufStart; if (align!=null && align.length>=2) { if (ai<align.length) { // up to an alignment if (align[ai]<=sceneTime+bufStart) { // already past refPos = align[ai+1]+sceneTime-align[ai]; //Log.d(TAG,"Align track at +"+bufStart+": "+sceneTime+" -> "+tr.getPos()+" (align "+align[ai]+"->"+align[ai+1]+")"); continue; } if (align[ai]>=sceneTime+blockLength) // after this buffer bufEnd = blockLength-1; else { // coming up... bufEnd = align[ai]-sceneTime-1; // for next time refPos = align[ai+1]+sceneTime-align[ai]; } } else { // from last alignment bufEnd = blockLength-1; } } else bufEnd = blockLength-1; if (pwlVolume!=null) { float fromSceneTime = (float)engine.samplesToSeconds(sceneTime+bufStart); float toSceneTime = (float)engine.samplesToSeconds(sceneTime+bufEnd); if (!AudioEngine.pwlNonzero(fromSceneTime, toSceneTime, pwlVolume)) { // silent continue; } Float cvol = AudioEngine.pwlConstant(fromSceneTime, toSceneTime, pwlVolume); if (cvol!=null) { pwlVolume = null; vol = (int)(cvol * 0x1000); if (vol<=0) { // silent continue; } } } for (ATrack.FileRef fr : track.mFileRefs) { int spos = tpos, epos = tpos+bufEnd-bufStart; if (fr.mTrackPos > epos || fr.mRepeats==0) continue; if (fr.mTrackPos > spos) spos = fr.mTrackPos; int repetition = 0; AFile file = (AFile)fr.mFile; int length = fr.mLength; if (length==IAudio.ITrack.LENGTH_ALL) repetition = 0; else { repetition = (spos - fr.mTrackPos)/length; if (fr.mRepeats!=IAudio.ITrack.REPEATS_FOREVER) { if (repetition >= fr.mRepeats) continue; if (fr.mTrackPos+length*fr.mRepeats<epos) epos = fr.mTrackPos+length*fr.mRepeats; } } // within file? while (spos <= epos) { int fpos = fr.mFilePos+(spos-fr.mTrackPos-repetition*length); // fpos is position in file of spos in track NeedRec nr = needRecs.get(file.getPath()); if (nr==null) { nr = new NeedRec(file); needRecs.put(file.getPath(), nr); } Interval ival = new Interval(fpos, fpos+epos-spos, getPriority(srec.mType)); nr.merge(ival); // next repetition if (length==IAudio.ITrack.LENGTH_ALL) // can't repeat length all (for now, anyway) break; repetition++; if (fr.mRepeats!=IAudio.ITrack.REPEATS_FOREVER && repetition >= fr.mRepeats) break; spos = fr.mTrackPos+repetition*length; continue; } } } } } } // Throw this over the the background thread!! update(needRecs); } private synchronized void update(HashMap<String, NeedRec> needRecs) { // old tasks for (FileNeedTask task : mTasks) { task.cancel(false); } mTasks.clear(); // eject old long now = System.currentTimeMillis(); long old = now-CACHE_RETAIN_TIME_MS; for (File file : mFiles.values()) { synchronized(file.mBlocks) { Iterator<TreeMap.Entry<Integer,Block>> iter = file.mBlocks.tailMap(CACHE_RATAIN_SAMPLES).entrySet().iterator(); while(iter.hasNext()) { TreeMap.Entry<Integer,Block> entry = iter.next(); if (entry.getValue().mLastRequestedTime < old && entry.getValue().mStartFrame>=CACHE_RATAIN_SAMPLES) { if (debug) Log.d(TAG,"Eject block "+entry.getValue().mStartFrame+"("+entry.getValue().mSamples.length+") from cache for "+file.mPath); iter.remove(); } } } } // decode / blocks...? for (NeedRec nrec : needRecs.values()) { File file = null; synchronized(this) { file = mFiles.get(nrec.mFile.getPath()); if (file==null) { file = new File(nrec.mFile.getPath()); mFiles.put(nrec.mFile.getPath(), file); } if (file.mDecoder==null) { file.mDecoder = new FileDecoder(nrec.mFile.getPath(), mContext); //file.mDecoder.queueDecode(); } } FileNeedTask task = new FileNeedTask(nrec, file, 1); mTasks.add(task); mExecutor.execute(task); } } /** handle needed stuff from a File */ static class FileNeedTask extends FutureTask<Boolean> { FileNeedTask(final NeedRec nrec, final File file, final int priority) { super(new Runnable() { public void run() { work(nrec, file, priority); } }, true); } private static void work(NeedRec nrec, File file, int priority) { //Log.d(TAG,"work pri="+priority+" on "+nrec.mFile.getPath()); for (Interval needed : nrec.mIntervals.values()) { if (needed.mPriority!=priority) { //if (needed.mPriority<0) if (debug) Log.d(TAG,"ignore work pri="+needed.mPriority+"/"+priority+" "+needed.mFromInclusive+"-"+needed.mToExclusive+" of "+nrec.mFile.getPath()); continue; } Collection<Block> blocks = null; synchronized(file.mBlocks) { // block at/immediately before int startFrame = needed.mFromInclusive; TreeMap.Entry<Integer,Block> ent = file.mBlocks.floorEntry(startFrame); if (ent!=null) startFrame = ent.getValue().mStartFrame; // candidate blocks blocks = file.mBlocks.subMap(startFrame, needed.mToExclusive).values(); } if (debug) Log.d(TAG,"work pri="+needed.mPriority+" "+needed.mFromInclusive+"-"+needed.mToExclusive+" of "+nrec.mFile.getPath()); // have we already got this? // gaps? from/length TreeMap<Integer,Interval> gaps = new TreeMap<Integer,Interval>(); gaps.put(needed.mFromInclusive, new Interval(needed.mFromInclusive, needed.mToExclusive, needed.mPriority)); long now = System.currentTimeMillis(); for (Block b : blocks) { b.mLastRequestedTime = now; int length = b.mSamples.length/b.mChannels; int startFrame = b.mStartFrame; TreeMap.Entry<Integer,Interval> from = gaps.floorEntry(b.mStartFrame); if (from!=null) startFrame = from.getValue().mFromInclusive; // copy Collection<Interval> overlapGaps = new LinkedList<Interval>(); overlapGaps.addAll(gaps.subMap(startFrame, b.mStartFrame+length).values()); for (Interval overlapGap : overlapGaps) { // start after? if (overlapGap.mFromInclusive>=b.mStartFrame) { if (overlapGap.mToExclusive<=b.mStartFrame+length) //discard gaps.remove(overlapGap.mFromInclusive); else if (overlapGap.mFromInclusive<b.mStartFrame+length) { // clip start gaps.remove(overlapGap.mFromInclusive); overlapGap.mFromInclusive = b.mStartFrame+length; gaps.put(overlapGap.mFromInclusive, overlapGap); } } else if (overlapGap.mToExclusive>b.mStartFrame) { if (overlapGap.mToExclusive<=b.mStartFrame+length) // clip end overlapGap.mToExclusive = b.mStartFrame; else { if (debug) Log.d(TAG,"split gap "+overlapGap.mFromInclusive+"-"+overlapGap.mToExclusive+" with "+b.mStartFrame+"-"+(b.mStartFrame+length)+" in "+nrec.mFile.getPath()); // split gap - post gaps.put(b.mStartFrame+length, new Interval(b.mStartFrame+length, overlapGap.mToExclusive, overlapGap.mPriority)); // pre overlapGap.mToExclusive = b.mStartFrame; } } } } // these are the fragment(s) we are missing from that particular interval for (Interval gap : gaps.values()) { if (debug) Log.d(TAG,"gap "+gap.mFromInclusive+"-"+gap.mToExclusive+" in "+nrec.mFile.getPath()); int bpos = gap.mFromInclusive; while (!file.mDecoder.isFailed() && bpos<gap.mToExclusive) { if (!file.mDecoder.isStarted()) { file.mDecoder.start(); if (file.mDecoder.isFailed()) { Log.e(TAG,"Failed to start decoder for "+file.mPath); mLog.logError("Unable to read/decode audio file "+file.mPath); break; } } Block b = file.mDecoder.getBlock(bpos); if (b==null) { if (debug) Log.d(TAG,"Could not get block "+bpos+" for "+file.mPath); break; } b.mLastRequestedTime = now; synchronized (file.mBlocks) { if (debug) Log.d(TAG,"Got block "+bpos+" (+"+b.mSamples.length/b.mChannels+") for "+file.mPath); file.mBlocks.put(b.mStartFrame, b); } bpos += b.mSamples.length/b.mChannels; } } // TODO mark past end } } }; /** warm up for files... */ public void init(HashMap<Integer, ATrack> mTracks) { HashMap<String,NeedRec> needRecs = new HashMap<String,NeedRec>(); for (ATrack atrack : mTracks.values()) { for (ATrack.FileRef fr : atrack.mFileRefs) { AFile file = (AFile)fr.mFile; NeedRec nr = needRecs.get(file.getPath()); if (nr==null) { nr = new NeedRec(file); needRecs.put(file.getPath(), nr); } Interval ival = new Interval(0,1, getPriority(StateType.STATE_NEXT)); nr.merge(ival); } } update(needRecs); } /** all done ? */ public synchronized boolean isIdle() { for (FileNeedTask task : mTasks) { if (!task.isDone() && !task.isCancelled()) return false; } return true; } }
c27edcfe3f9e45eec94d001159ff4b368ceafff4
eea0cb722d00fd78389487a36b19e9f25cee9698
/src/core/org.openhab.core/src/main/java/org/openhab/core/internal/events/EventBusImpl.java
006c0f78b24a1b88b84108f0c63cac19884dbc5d
[]
no_license
aiyi/openhab
8d9a18a1264cf431efac30519de68e2afc6623fa
e846b1fd3ced304e9343f1bc61fa370e3e3d9940
refs/heads/master
2016-09-03T01:03:04.189605
2014-11-16T06:30:51
2014-11-16T06:30:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,885
java
/** * openHAB, the open Home Automation Bus. * Copyright (C) 2010-2013, openHAB.org <[email protected]> * * See the contributors.txt file in the distribution for a * full listing of individual contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 3 of the * License, or (at your option) any later version. * * 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, see <http://www.gnu.org/licenses>. * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or * combining it with Eclipse (or a modified version of that library), * containing parts covered by the terms of the Eclipse Public License * (EPL), the licensors of this Program grant you additional permission * to convey the resulting work. */ package org.openhab.core.internal.events; import net.engio.mbassy.bus.BusConfiguration; import net.engio.mbassy.bus.MBassador; import net.engio.mbassy.listener.Handler; import net.engio.mbassy.listener.Listener; import net.engio.mbassy.listener.References; import org.openhab.core.events.EventBus; import org.openhab.core.events.Event; import org.openhab.core.events.EventSubscriber; import org.openhab.core.types.Command; import org.openhab.core.types.EventType; import org.openhab.core.types.State; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This is the implementation of the {@link EventBus} interface. * Through it, events can be sent to the EventBus service in * order to broadcast them. * * @author Jesse * @since 2.0.0 */ public class EventBusImpl implements EventBus { private static final Logger logger = LoggerFactory.getLogger(EventBusImpl.class); private MBassador<Event> eventBus; public EventBusImpl() { eventBus = new MBassador<Event>(BusConfiguration.Default()); } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#addSubscriber(org.openhab * .core.events.EventSubscriber) */ public void addSubscriber(EventSubscriber subscriber) { EventHandler handler = new EventHandler(subscriber); eventBus.subscribe(handler); } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#sendCommand(org.openhab * .core.items.GenericItem, org.openhab.core.datatypes.DataType) */ public void sendCommand(String itemName, Command command) { if (command != null) { eventBus.publish(createCommandEvent(itemName, command)); } else { logger.warn("given command is NULL, couldn't send command to '{}'", itemName); } } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#postCommand(org.openhab * .core.items.GenericItem, org.openhab.core.datatypes.DataType) */ public void postCommand(String itemName, Command command) { if (command != null) { eventBus.publishAsync(createCommandEvent(itemName, command)); } else { logger.warn("given command is NULL, couldn't post command to '{}'", itemName); } } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#postUpdate(org.openhab * .core.items.GenericItem, org.openhab.core.datatypes.DataType) */ public void postUpdate(String itemName, State newState) { if (newState != null) { eventBus.publishAsync(createUpdateEvent(itemName, newState)); } else { logger.warn("given new state is NULL, couldn't post update for '{}'", itemName); } } private Event createUpdateEvent(String itemName, State newState) { return new Event(EventType.UPDATE, itemName, newState); } private Event createCommandEvent(String itemName, Command command) { return new Event(EventType.COMMAND, itemName, command); } @Listener(references = References.Strong) public class EventHandler { EventSubscriber subscriber; public EventHandler(EventSubscriber subscriber) { this.subscriber = subscriber; } @Handler public void handleEvent(Event event) { String itemName = (String) event.getItemName(); EventType eventType = event.getEventType(); if(eventType == EventType.UPDATE) { State newState = (State) event.getEventData(); if(newState!=null) subscriber.receiveUpdate(itemName, newState); } else if(eventType == EventType.COMMAND) { Command command = (Command) event.getEventData(); if(command!=null) subscriber.receiveCommand(itemName, command); } else { return; // we have received an event with an invalid event type } } } }
e232526dba227c5f68176f930aa886dfd706bf20
999457318ecbc81307321b7a1de8436f91fda8b8
/multiplayerPacMan/src/networking/exceptions/NoRegistryException.java
0d6f4cb8d0b301082c3eefa6383883d0a10ee5ee
[]
no_license
s3725331/multiPlayerPacMan
4a670da60c88569314be1548822d1d3e2c1a7f28
bf122cab5050e80a3166d353371d4eb6023677bd
refs/heads/master
2023-01-25T00:18:37.944808
2020-12-10T05:13:58
2020-12-10T05:13:58
205,306,936
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package networking.exceptions; public class NoRegistryException extends ClientException{ public NoRegistryException(String message) { super(message); } }
a15d351a4649ce755c3756f8f2a6889ce106fbbf
6fd1c5e48bb1c2cdf6ca45941cb14d7dc9ed9488
/RMI-WSWeb/src/myRest/Server.java
0b3e910e31ac388d65e70e3aece91c4db82978bf
[]
no_license
Adria331/RMI-YouTube-Web-Service
765328ed91f0b8bb165133d4c8c962a0e2969fe2
fa3c60d2c81d2938c90c29357a98e66fbe8865ac
refs/heads/master
2021-08-31T14:06:34.138867
2017-12-21T15:50:32
2017-12-21T15:50:32
115,022,130
0
0
null
null
null
null
UTF-8
Java
false
false
3,599
java
package myRest; import java.rmi.*; import java.net.MalformedURLException; import java.util.*; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.util.Scanner; public class Server{ private static int port; private static String ip; static boolean addServer; public static void main(String args[]) throws RemoteException, MalformedURLException, AccessException{ try{ ip = scanner("Select the Ip address of the server (default is localhost)"); String port2 = scanner("Select the port of the server (default is 4000)"); if(port2 == null || port2.equals("")) port = 4000; else{ port = Integer.parseInt(port2); } if(ip == null || ip.equals("")) ip = "localhost"; ServerImp obj = new ServerImp(); startRegistry(); String url = "rmi://" + ip + ":" + Integer.toString(port) + "/mytube"; Naming.rebind(url, obj); obj.setIp(ip); obj.setPort(port); // addServer = true; // while(addServer){ // String si = scanner("Do you want to connect with other server? y/n"); // // if(si.equals("y")){ // String ipserver2 = scanner("Which ip"); // String portserver2 = scanner("Which port?"); // if(ipserver2.equals("") || portserver2.equals("")){ // System.out.println("Port or ip not valid"); // }else{ // String urlserver2 = "rmi://" + ipserver2 + ":" + portserver2 + "/mytube"; // try{ // InterfaceServer s = (InterfaceServer) Naming.lookup(urlserver2); // s.addServer((InterfaceServer) Naming.lookup(url)); // obj.addServer(s); // }catch(NotBoundException ex){ // System.out.println("The url is not currently bound"); // }catch(MalformedURLException ex){ // System.out.println("Registry has not an appropiate url"); // }catch(RemoteException ex){ // System.out.println("Registry cannot be contacted"); // } // } // }else if(si.equals("n")){ // addServer = false; // }else{ // System.out.println("Not a valid response"); // } // } System.out.println("Server ready"); }catch(RemoteException ex){ System.out.println("Server not ready"); }catch(MalformedURLException ex){ System.out.println("Registry has not an appropiate url"); } /*catch(AccessException ex){ System.out.println("Operation not permited"); }*/ } public static void startRegistry() throws RemoteException{ try{ Registry registry= LocateRegistry.getRegistry(port); registry.list(); }catch(RemoteException ex){ System.out.println("RMI registry is not located at port " + port); LocateRegistry.createRegistry(port); System.out.println("RMI registry created at port " + port); } } public static String scanner(String message){ System.out.println(message); Scanner scan = new Scanner(System.in); String text = scan.nextLine(); return text; } }
230db138bcd8183d11d5d4f144cc35aa1312c79e
97f7b0634ec16248b3c636be9fe0e6ce6035bd67
/src/main/java/com/github/steveash/guavate/ObjIntPair.java
998e4e213cfff8713fe940c4a156e444f674ce92
[ "Apache-2.0" ]
permissive
steveash/guavate
0cca8f6479c65e41eb1a72c19a159f0ec5e80ea8
29f77327e378a0da93c1ab05137f8b02afdba3fd
refs/heads/master
2021-01-20T20:28:03.568036
2017-01-13T00:02:01
2017-01-13T00:02:01
62,578,877
8
0
null
null
null
null
UTF-8
Java
false
false
4,533
java
/** * Copyright (C) 2015 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.github.steveash.guavate; import java.io.Serializable; import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Preconditions; import com.google.common.collect.ComparisonChain; import com.google.common.collect.ImmutableList; /** * An immutable pair consisting of an {@code Object} and an {@code int}. * <p> * This class is similar to {@link Pair} but includes a primitive element. * <p> * This class is immutable and thread-safe. * * @param <A> the type of the object */ public final class ObjIntPair<A> implements Comparable<ObjIntPair<A>>, Serializable { /** * The first element in this pair. */ private final A first; /** * The second element in this pair. */ private final int second; //------------------------------------------------------------------------- /** * Obtains an instance from an {@code Object} and an {@code int}. * * @param <A> the first element type * @param first the first element * @param second the second element * @return a pair formed from the two parameters */ public static <A> ObjIntPair<A> of(A first, int second) { return new ObjIntPair<>(first, second); } /** * Obtains an instance from a {@code Pair}. * * @param <A> the first element type * @param pair the pair to convert * @return a pair formed by extracting values from the pair */ public static <A> ObjIntPair<A> ofPair(Pair<A, Integer> pair) { Preconditions.checkNotNull(pair, "pair"); return new ObjIntPair<A>(pair.getLeft(), pair.getRight()); } /** * Gets the elements from this pair as a list. * <p> * The list returns each element in the pair in order. * * @return the elements as an immutable list */ public ImmutableList<Object> elements() { return ImmutableList.of(first, second); } //------------------------------------------------------------------------- /** * Converts this pair to an object-based {@code Pair}. * * @return the object-based pair */ public Pair<A, Integer> toPair() { return Pair.of(first, second); } //------------------------------------------------------------------------- /** * Compares the pair based on the first element followed by the second element. * <p> * The first element must be {@code Comparable}. * * @param other the other pair * @return negative if this is less, zero if equal, positive if greater * @throws ClassCastException if the object is not comparable */ @Override public int compareTo(ObjIntPair<A> other) { return ComparisonChain.start() .compare((Comparable<?>) first, (Comparable<?>) other.first) .compare(second, other.second) .result(); } //------------------------------------------------------------------------- /** * Gets the pair using a standard string format. * <p> * The standard format is '[$first, $second]'. Spaces around the values are trimmed. * * @return the pair as a string */ @Override public String toString() { return new StringBuilder() .append('[') .append(first) .append(", ") .append(second) .append(']') .toString(); } /** * The serialization version id. */ private static final long serialVersionUID = 1L; private ObjIntPair( A first, int second) { this.first = first; this.second = second; } //----------------------------------------------------------------------- /** * Gets the first element in this pair. * @return the value of the property, not null */ public A getFirst() { return first; } //----------------------------------------------------------------------- /** * Gets the second element in this pair. * @return the value of the property */ public int getSecond() { return second; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ObjIntPair<?> that = (ObjIntPair<?>) o; if (second != that.second) return false; return first != null ? first.equals(that.first) : that.first == null; } @Override public int hashCode() { int result = first != null ? first.hashCode() : 0; result = 31 * result + second; return result; } }
45ce6829233a84b369dc31aba78668af4c4d5ca4
382d0914b30e5c7a0a6611f929bdcc76259747ed
/GamePhomExtension/src/game/vn/game/phom/PhomConfig.java
4412d5a3a1a4773b4a0fb2b516c52ce3e20efb02
[]
no_license
Mrkenvin1982/viet13
874dbb02cb4d8659ac677a6b9f46d9315d1f1df8
d63aefaacf879df26441af625354bd9183a0820c
refs/heads/master
2022-04-09T06:53:04.807008
2020-03-24T16:24:58
2020-03-24T16:24:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,135
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 game.vn.game.phom; import game.vn.util.watchservice.PropertyConfigurator; /** * * @author tuanp */ public class PhomConfig extends PropertyConfigurator{ private static final String MAX_VIEWER= "game.phom.MaxViewer"; private final static PhomConfig INSTANCE=new PhomConfig("conf/","phom.properties"); /** * Singleton class. Get an instance of BaicaoConfig. * * @return An instance of ServerInfo. */ public static PhomConfig getInstance() { return INSTANCE; } public PhomConfig(String path, String nameFile){ super(path, nameFile); } /** * số viewer tối đa cho game * * @return */ public int getMaxViewer() { return getIntAttribute(MAX_VIEWER, 0); } public boolean isTest() { return getBooleanAttribute("IS_TEST"); } int getTestCase() { return getIntAttribute("TESTCASE", 0); } }
2c247c143f49607c29f2ea03f3edd3de86cd0330
95c74898b5960d65370a3f2d94b9e3e6de35e1ae
/widget/src/main/java/com/qiwu/widget/cubepage/base/AbsSwipeControlViewPager.java
c1e8538a8b605009815ba1b2669c020945bb59d3
[]
no_license
chaomitang/CubePager
e1e5e50301401d63b0619b1e174d9627a945ae9a
bd59fb61da0506b3f17d8133eb0208e4b759ff6f
refs/heads/master
2020-09-27T07:25:35.783785
2019-12-07T09:51:55
2019-12-07T09:51:55
226,463,472
3
0
null
null
null
null
UTF-8
Java
false
false
1,246
java
package com.qiwu.widget.cubepage.base; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; import com.qiwu.widget.base.viewpager.SwipeDirection; import com.qiwu.widget.base.viewpager.ViewPager; /** * Author: qi.wu * Date: 2019-10-31 */ public abstract class AbsSwipeControlViewPager extends ViewPager { private float initialXValue; private SwipeDirection swipeDirection; private Rect mSwipeForbiddenRect; public AbsSwipeControlViewPager(Context context, AttributeSet attrs) { super(context, attrs); } public void setSwipeForbiddenRect(int left, int top, int right, int bottom) { mSwipeForbiddenRect = new Rect(left, top, right, bottom); } @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN && mSwipeForbiddenRect != null) { if (event.getX() <= mSwipeForbiddenRect.right && event.getX() >= mSwipeForbiddenRect.left && event.getY() <= mSwipeForbiddenRect.bottom && event.getY() >= mSwipeForbiddenRect.top) { return false; } } return super.onTouchEvent(event); } }
8a4b5175718d5e5ade8d862bad6dccae5aaa3cb4
1921c12b102764f56087840f95bb38f4077cb5dd
/backend/src/main/java/com/hh/webcollect/common/exception/WcException.java
a59bf53c152b1314ca0dd504a05a9800d74234de
[ "MIT" ]
permissive
panhb/webcollect
1ae52aac588833b11ce8c9d3635ac28b8d248c17
d5416c71cd3ca81f5dac4f1d4a1a5195826d01b9
refs/heads/master
2021-07-08T22:24:51.435977
2019-03-19T06:38:46
2019-03-19T06:38:46
147,649,870
0
0
null
null
null
null
UTF-8
Java
false
false
1,085
java
package com.hh.webcollect.common.exception; import com.hh.webcollect.common.Constant; import com.hh.webcollect.common.enums.error.ErrorCode; /** * @author hongbo.pan * @date 2018/9/6 */ public class WcException extends RuntimeException { /** * 非业务异常, 默认0 */ private int code = Constant.FAIL; private String errMsg; public WcException(String errMsg) { super(errMsg); } public WcException(ErrorCode errorCode) { super(errorCode.getMsg()); this.code = errorCode.getCode(); this.errMsg = errorCode.getMsg(); } public WcException(String errMsg, Throwable e) { super(errMsg, e); this.errMsg = errMsg; } public WcException(ErrorCode errorCode, Throwable e) { this(errorCode.getMsg(), e); this.code = errorCode.getCode(); this.errMsg = errorCode.getMsg(); } public WcException(Throwable e) { super(e); } public int getCode() { return code; } public String getErrMsg() { return errMsg; } }
f854497206c1869a5078e9f0236c5d8b94ddef5c
edcb0687d27051dd4fc13e2208be9048c295d02f
/test1.java
fc74b752fcefdd63da2b9452a6499f1a8ca57172
[]
no_license
Rajeshwari1330/demo1
51a97b0262f4aec0adf498d076efe55a8b607d8f
26c396bcd2abc5ddfebc6907107c604eb4300506
refs/heads/master
2022-08-09T19:47:10.994030
2020-05-19T10:31:55
2020-05-19T10:31:55
263,656,536
0
0
null
null
null
null
UTF-8
Java
false
false
99
java
class t1 { public static void main(String[] args) { System.out.println("welcome......."); } }
0b69f14b77f39d5d3cb038aa29970b960f402fcb
984142b31b636f285413296426aa5c46d7e7b726
/app/src/main/java/com/app/mak/cellular/AgentsList/Page.java
581ad1b99b1b5be36bb14bef458fd7fdd98ebb6c
[]
no_license
priyankagiri14/mak_cellular
c02eb00c3ff532b47fb4a6380c0f9d8a36dd3769
a5d85cc6c7e7a6a4a9b1a89a6415f2ffc2aa018d
refs/heads/master
2020-09-25T14:08:36.655883
2020-02-18T11:53:53
2020-02-18T11:53:53
226,019,832
0
0
null
null
null
null
UTF-8
Java
false
false
1,406
java
package com.app.mak.cellular.AgentsList; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; class Page { @SerializedName("numberOfElements") @Expose private Integer numberOfElements; @SerializedName("totalElements") @Expose private Integer totalElements; @SerializedName("totalPages") @Expose private Integer totalPages; @SerializedName("size") @Expose private Integer size; @SerializedName("pageNumber") @Expose private Integer pageNumber; public Integer getNumberOfElements() { return numberOfElements; } public void setNumberOfElements(Integer numberOfElements) { this.numberOfElements = numberOfElements; } public Integer getTotalElements() { return totalElements; } public void setTotalElements(Integer totalElements) { this.totalElements = totalElements; } public Integer getTotalPages() { return totalPages; } public void setTotalPages(Integer totalPages) { this.totalPages = totalPages; } public Integer getSize() { return size; } public void setSize(Integer size) { this.size = size; } public Integer getPageNumber() { return pageNumber; } public void setPageNumber(Integer pageNumber) { this.pageNumber = pageNumber; } }
cca925e1323f5c2a12054e2dbb981c2dfa4f767d
56eb3ae460ef6d7e327fe8cf22963f995a63ea67
/app/src/main/java/fuzik/com/myapplication/fragment_activity_demo/CustomNavigatorActivity.java
288e828d331bedfc160077ab389bec4e7c7929dc
[]
no_license
LuckyCode1992/hxl123
43c8441a7457dff2e7fd60cd5e53d70660cdd2e5
630632e22bdb1daec505e54fa180c758369e1643
refs/heads/master
2021-05-09T06:54:21.908788
2018-03-16T09:32:44
2018-03-16T09:32:44
119,343,849
0
0
null
null
null
null
UTF-8
Java
false
false
3,670
java
package fuzik.com.myapplication.fragment_activity_demo; import android.graphics.Color; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import java.util.Arrays; import java.util.List; import fuzik.com.myapplication.R; import fuzik.com.myapplication.fragment_activity_demo.fragment_formwork.MagicIndicator; import fuzik.com.myapplication.fragment_activity_demo.fragment_formwork.ViewPagerHelper; import fuzik.com.myapplication.fragment_activity_demo.fragment_formwork.buildins.circlenavigator.CircleNavigator; import fuzik.com.myapplication.fragment_activity_demo.navigator.ScaleCircleNavigator; public class CustomNavigatorActivity extends AppCompatActivity { private static final String[] CHANNELS = new String[]{"CUPCAKE", "DONUT", "ECLAIR", "GINGERBREAD", "HONEYCOMB", "ICE_CREAM_SANDWICH", "JELLY_BEAN", "KITKAT", "LOLLIPOP", "M", "NOUGAT"}; private List<String> mDataList = Arrays.asList(CHANNELS); private ExamplePagerAdapter mExamplePagerAdapter = new ExamplePagerAdapter(mDataList); private ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_custom_navigator); mViewPager = (ViewPager) findViewById(R.id.view_pager); mViewPager.setAdapter(mExamplePagerAdapter); initMagicIndicator1(); initMagicIndicator2(); initMagicIndicator3(); } private void initMagicIndicator1() { MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator1); CircleNavigator circleNavigator = new CircleNavigator(this); circleNavigator.setCircleCount(CHANNELS.length); circleNavigator.setCircleColor(Color.RED); circleNavigator.setCircleClickListener(new CircleNavigator.OnCircleClickListener() { @Override public void onClick(int index) { mViewPager.setCurrentItem(index); } }); magicIndicator.setNavigator(circleNavigator); ViewPagerHelper.bind(magicIndicator, mViewPager); } private void initMagicIndicator2() { MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator2); CircleNavigator circleNavigator = new CircleNavigator(this); circleNavigator.setFollowTouch(false); circleNavigator.setCircleCount(CHANNELS.length); circleNavigator.setCircleColor(Color.RED); circleNavigator.setCircleClickListener(new CircleNavigator.OnCircleClickListener() { @Override public void onClick(int index) { mViewPager.setCurrentItem(index); } }); magicIndicator.setNavigator(circleNavigator); ViewPagerHelper.bind(magicIndicator, mViewPager); } private void initMagicIndicator3() { MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator3); ScaleCircleNavigator scaleCircleNavigator = new ScaleCircleNavigator(this); scaleCircleNavigator.setCircleCount(CHANNELS.length); scaleCircleNavigator.setNormalCircleColor(Color.LTGRAY); scaleCircleNavigator.setSelectedCircleColor(Color.DKGRAY); scaleCircleNavigator.setCircleClickListener(new ScaleCircleNavigator.OnCircleClickListener() { @Override public void onClick(int index) { mViewPager.setCurrentItem(index); } }); magicIndicator.setNavigator(scaleCircleNavigator); ViewPagerHelper.bind(magicIndicator, mViewPager); } }
[ "hxl4321" ]
hxl4321
4fb7fffbe8ed42cc8247e245974200306b6413cf
39241f3186ce7a61fc5f687960cc3d0d18aaf584
/app/build/generated/source/r/debug/com/example/sony/smarteyeglass/extension/helloworld/R.java
a38452baaf506f294d3326450da555619c784988
[]
no_license
adiprakash/SpotifyGlass
a9e76918bf184b5a1fa21b10dac3c7992b10bfde
bc64f2c5f90ca051ddc3798ea0971a231c4f185c
refs/heads/master
2020-06-16T00:46:06.668729
2016-12-21T21:21:32
2016-12-21T21:21:32
75,255,221
1
0
null
null
null
null
UTF-8
Java
false
false
24,359
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 com.example.sony.smarteyeglass.extension.helloworld; public final class R { public static final class attr { /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <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 fontPath=0x7f010006; /** <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>top</code></td><td>0x30</td><td></td></tr> <tr><td><code>bottom</code></td><td>0x50</td><td></td></tr> <tr><td><code>left</code></td><td>0x03</td><td></td></tr> <tr><td><code>right</code></td><td>0x05</td><td></td></tr> <tr><td><code>center_vertical</code></td><td>0x10</td><td></td></tr> <tr><td><code>center_horizontal</code></td><td>0x01</td><td></td></tr> <tr><td><code>center</code></td><td>0x11</td><td></td></tr> </table> */ public static final int gravity=0x7f010000; /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <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 template=0x7f010005; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textArray=0x7f010003; /** <p>May 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. <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>match_parent</code></td><td>-1</td><td></td></tr> </table> */ public static final int textSize=0x7f010002; /** <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 timeOffset=0x7f010001; /** <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>constant</code></td><td>0</td><td></td></tr> <tr><td><code>seconds</code></td><td>1</td><td></td></tr> <tr><td><code>seconds_digit2</code></td><td>2</td><td></td></tr> <tr><td><code>seconds_digit1</code></td><td>3</td><td></td></tr> <tr><td><code>minutes</code></td><td>4</td><td></td></tr> <tr><td><code>minutes_digit2</code></td><td>5</td><td></td></tr> <tr><td><code>minutes_digit1</code></td><td>6</td><td></td></tr> <tr><td><code>hours</code></td><td>7</td><td></td></tr> <tr><td><code>hours_digit2</code></td><td>8</td><td></td></tr> <tr><td><code>hours_digit1</code></td><td>9</td><td></td></tr> <tr><td><code>days_of_week</code></td><td>10</td><td></td></tr> <tr><td><code>days_of_month</code></td><td>11</td><td></td></tr> <tr><td><code>days_of_month_digit2</code></td><td>12</td><td></td></tr> <tr><td><code>days_of_month_digit1</code></td><td>13</td><td></td></tr> <tr><td><code>days_of_year</code></td><td>14</td><td></td></tr> <tr><td><code>days_of_year_digit3</code></td><td>15</td><td></td></tr> <tr><td><code>days_of_year_digit2</code></td><td>16</td><td></td></tr> <tr><td><code>days_of_year_digit1</code></td><td>17</td><td></td></tr> <tr><td><code>months</code></td><td>18</td><td></td></tr> <tr><td><code>months_digit2</code></td><td>19</td><td></td></tr> <tr><td><code>months_digit1</code></td><td>20</td><td></td></tr> <tr><td><code>years_digit4</code></td><td>21</td><td></td></tr> <tr><td><code>years_digit3</code></td><td>22</td><td></td></tr> <tr><td><code>years_digit2</code></td><td>23</td><td></td></tr> <tr><td><code>years_digit1</code></td><td>24</td><td></td></tr> <tr><td><code>am_pm</code></td><td>25</td><td></td></tr> <tr><td><code>hours_fine</code></td><td>26</td><td></td></tr> </table> */ public static final int timeType=0x7f010004; } public static final class color { public static final int smart_watch_2_text_color_grey=0x7f060000; public static final int smart_watch_2_text_color_orange=0x7f060001; public static final int smart_watch_2_text_color_white=0x7f060002; public static final int smart_watch_text_color_grey=0x7f060003; public static final int smart_watch_text_color_orange=0x7f060004; public static final int smart_watch_text_color_white=0x7f060005; } public static final class dimen { public static final int headset_pro_control_height=0x7f040003; public static final int headset_pro_control_width=0x7f040004; public static final int headset_pro_text_size=0x7f040000; public static final int smart_eyeglass_text_size_medium=0x7f040005; public static final int smart_eyeglass_text_size_small=0x7f040006; public static final int smart_watch_2_control_height=0x7f040007; public static final int smart_watch_2_control_width=0x7f040008; public static final int smart_watch_2_statusbar_height=0x7f040009; public static final int smart_watch_2_text_size_large=0x7f04000a; public static final int smart_watch_2_text_size_medium=0x7f04000b; public static final int smart_watch_2_text_size_small=0x7f04000c; public static final int smart_watch_2_widget_cell_height=0x7f04000d; public static final int smart_watch_2_widget_cell_width=0x7f04000e; public static final int smart_watch_2_widget_height=0x7f04000f; public static final int smart_watch_2_widget_width=0x7f040010; public static final int smart_watch_control_height=0x7f040011; public static final int smart_watch_control_width=0x7f040012; public static final int smart_watch_text_size_normal=0x7f040001; public static final int smart_watch_text_size_small=0x7f040002; public static final int smart_watch_text_size_widget_badge=0x7f040013; public static final int smart_watch_text_size_widget_name=0x7f040014; public static final int smart_watch_text_size_widget_text=0x7f040015; public static final int smart_watch_text_size_widget_time=0x7f040016; public static final int smart_watch_widget_height_inner=0x7f040017; public static final int smart_watch_widget_height_outer=0x7f040018; public static final int smart_watch_widget_text_background_height=0x7f040019; public static final int smart_watch_widget_text_background_width=0x7f04001a; public static final int smart_watch_widget_width_inner=0x7f04001b; public static final int smart_watch_widget_width_outer=0x7f04001c; public static final int smarteyeglass_control_height=0x7f04001d; public static final int smarteyeglass_control_width=0x7f04001e; public static final int smarteyeglass_text_size_large=0x7f04001f; public static final int smarteyeglass_text_size_normal=0x7f040020; public static final int smarteyeglass_text_size_small=0x7f040021; public static final int smarteyeglass_widget_height=0x7f040022; public static final int smarteyeglass_widget_width=0x7f040023; } public static final class drawable { public static final int a=0x7f020000; public static final int actions_view_in_phone=0x7f020001; public static final int b=0x7f020002; public static final int background=0x7f020003; public static final int badge_counter=0x7f020004; public static final int c=0x7f020005; public static final int d=0x7f020006; public static final int headset_pro_cancel_icn=0x7f020007; public static final int headset_pro_focus_xs_icn=0x7f020008; public static final int headset_pro_ok_icn=0x7f020009; public static final int icon=0x7f02000a; public static final int icon_extension=0x7f02000b; public static final int icon_extension48=0x7f02000c; public static final int next=0x7f02000d; public static final int pause=0x7f02000e; public static final int plan1=0x7f02000f; public static final int plan2=0x7f020010; public static final int play=0x7f020011; public static final int shape=0x7f020012; public static final int song=0x7f020013; public static final int test=0x7f020014; public static final int test1=0x7f020015; public static final int text_bg=0x7f020016; public static final int widget_frame=0x7f020017; } public static final class id { public static final int am_pm=0x7f090008; public static final int bottom=0x7f090000; public static final int btn_update_this=0x7f090024; public static final int center=0x7f090001; public static final int center_horizontal=0x7f090002; public static final int center_vertical=0x7f090003; public static final int constant=0x7f090009; public static final int days_of_month=0x7f09000a; public static final int days_of_month_digit1=0x7f09000b; public static final int days_of_month_digit2=0x7f09000c; public static final int days_of_week=0x7f09000d; public static final int days_of_year=0x7f09000e; public static final int days_of_year_digit1=0x7f09000f; public static final int days_of_year_digit2=0x7f090010; public static final int days_of_year_digit3=0x7f090011; public static final int hours=0x7f090012; public static final int hours_digit1=0x7f090013; public static final int hours_digit2=0x7f090014; public static final int hours_fine=0x7f090015; public static final int image=0x7f090023; public static final int label=0x7f090027; public static final int left=0x7f090004; public static final int match_parent=0x7f090007; public static final int minutes=0x7f090016; public static final int minutes_digit1=0x7f090017; public static final int minutes_digit2=0x7f090018; public static final int months=0x7f090019; public static final int months_digit1=0x7f09001a; public static final int months_digit2=0x7f09001b; public static final int phn_play_btn=0x7f090026; public static final int phn_text=0x7f090029; public static final int phn_title=0x7f090028; public static final int play_btn=0x7f090039; public static final int right=0x7f090005; public static final int seconds=0x7f09001c; public static final int seconds_digit1=0x7f09001d; public static final int seconds_digit2=0x7f09001e; public static final int smart_watch_notification_widget_background=0x7f09002a; public static final int smart_watch_notification_widget_text_background=0x7f09002b; public static final int smart_watch_notification_widget_text_name=0x7f09002e; public static final int smart_watch_notification_widget_text_time=0x7f09002c; public static final int smart_watch_notification_widget_text_title=0x7f09002d; public static final int smart_watch_widget_custom_image=0x7f09002f; public static final int smart_watch_widget_custom_text_view=0x7f090030; public static final int smart_watch_widget_event_counter_badge=0x7f090032; public static final int smart_watch_widget_event_counter_text=0x7f090033; public static final int smart_watch_widget_icon=0x7f090031; public static final int smarteyeglass_widget_icon=0x7f090035; public static final int smarteyeglass_widget_inner=0x7f090034; public static final int smarteyeglass_widget_inner_image=0x7f090037; public static final int smarteyeglass_widget_text=0x7f090036; public static final int spotify_glass=0x7f090038; public static final int spotify_phone=0x7f090025; public static final int text=0x7f09003b; public static final int title=0x7f09003a; public static final int top=0x7f090006; public static final int years_digit1=0x7f09001f; public static final int years_digit2=0x7f090020; public static final int years_digit3=0x7f090021; public static final int years_digit4=0x7f090022; } public static final class integer { public static final int api_version=0x7f070000; } public static final class layout { public static final int layout=0x7f030000; public static final int phonelayout=0x7f030001; public static final int smart_watch_notification_widget=0x7f030002; public static final int smart_watch_widget=0x7f030003; public static final int smarteyeglass_widgetcard=0x7f030004; public static final int spotify_layout=0x7f030005; } public static final class string { public static final int api_version_error_throw_message=0x7f080000; public static final int app_name=0x7f080001; public static final int configuration_text=0x7f080002; public static final int extension_name=0x7f080003; public static final int hello_blank_fragment=0x7f080004; public static final int play_button=0x7f080005; public static final int preference_activity_title=0x7f080006; public static final int preference_key_read_me=0x7f080007; public static final int text_phone_to_smarteyeglass=0x7f080008; public static final int text_title_layout=0x7f080009; } public static final class style { public static final int ExtensionLightTheme=0x7f050000; } public static final class styleable { /** Attributes that can be used with a TimeLayout. <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 #TimeLayout_gravity com.example.sony.smarteyeglass.extension.helloworld:gravity}</code></td><td></td></tr> <tr><td><code>{@link #TimeLayout_timeOffset com.example.sony.smarteyeglass.extension.helloworld:timeOffset}</code></td><td></td></tr> </table> @see #TimeLayout_gravity @see #TimeLayout_timeOffset */ public static final int[] TimeLayout = { 0x7f010000, 0x7f010001 }; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#gravity} attribute's value can be found in the {@link #TimeLayout} array. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>top</code></td><td>0x30</td><td></td></tr> <tr><td><code>bottom</code></td><td>0x50</td><td></td></tr> <tr><td><code>left</code></td><td>0x03</td><td></td></tr> <tr><td><code>right</code></td><td>0x05</td><td></td></tr> <tr><td><code>center_vertical</code></td><td>0x10</td><td></td></tr> <tr><td><code>center_horizontal</code></td><td>0x01</td><td></td></tr> <tr><td><code>center</code></td><td>0x11</td><td></td></tr> </table> @attr name com.example.sony.smarteyeglass.extension.helloworld:gravity */ public static final int TimeLayout_gravity = 0; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#timeOffset} attribute's value can be found in the {@link #TimeLayout} 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 com.example.sony.smarteyeglass.extension.helloworld:timeOffset */ public static final int TimeLayout_timeOffset = 1; /** Attributes that can be used with a TimeView. <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 #TimeView_fontPath com.example.sony.smarteyeglass.extension.helloworld:fontPath}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_template com.example.sony.smarteyeglass.extension.helloworld:template}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_textArray com.example.sony.smarteyeglass.extension.helloworld:textArray}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_textSize com.example.sony.smarteyeglass.extension.helloworld:textSize}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_timeType com.example.sony.smarteyeglass.extension.helloworld:timeType}</code></td><td></td></tr> </table> @see #TimeView_fontPath @see #TimeView_template @see #TimeView_textArray @see #TimeView_textSize @see #TimeView_timeType */ public static final int[] TimeView = { 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 }; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#fontPath} attribute's value can be found in the {@link #TimeView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <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 com.example.sony.smarteyeglass.extension.helloworld:fontPath */ public static final int TimeView_fontPath = 4; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#template} attribute's value can be found in the {@link #TimeView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <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 com.example.sony.smarteyeglass.extension.helloworld:template */ public static final int TimeView_template = 3; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#textArray} attribute's value can be found in the {@link #TimeView} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.example.sony.smarteyeglass.extension.helloworld:textArray */ public static final int TimeView_textArray = 1; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#textSize} attribute's value can be found in the {@link #TimeView} array. <p>May 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. <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>match_parent</code></td><td>-1</td><td></td></tr> </table> @attr name com.example.sony.smarteyeglass.extension.helloworld:textSize */ public static final int TimeView_textSize = 0; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#timeType} attribute's value can be found in the {@link #TimeView} array. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>constant</code></td><td>0</td><td></td></tr> <tr><td><code>seconds</code></td><td>1</td><td></td></tr> <tr><td><code>seconds_digit2</code></td><td>2</td><td></td></tr> <tr><td><code>seconds_digit1</code></td><td>3</td><td></td></tr> <tr><td><code>minutes</code></td><td>4</td><td></td></tr> <tr><td><code>minutes_digit2</code></td><td>5</td><td></td></tr> <tr><td><code>minutes_digit1</code></td><td>6</td><td></td></tr> <tr><td><code>hours</code></td><td>7</td><td></td></tr> <tr><td><code>hours_digit2</code></td><td>8</td><td></td></tr> <tr><td><code>hours_digit1</code></td><td>9</td><td></td></tr> <tr><td><code>days_of_week</code></td><td>10</td><td></td></tr> <tr><td><code>days_of_month</code></td><td>11</td><td></td></tr> <tr><td><code>days_of_month_digit2</code></td><td>12</td><td></td></tr> <tr><td><code>days_of_month_digit1</code></td><td>13</td><td></td></tr> <tr><td><code>days_of_year</code></td><td>14</td><td></td></tr> <tr><td><code>days_of_year_digit3</code></td><td>15</td><td></td></tr> <tr><td><code>days_of_year_digit2</code></td><td>16</td><td></td></tr> <tr><td><code>days_of_year_digit1</code></td><td>17</td><td></td></tr> <tr><td><code>months</code></td><td>18</td><td></td></tr> <tr><td><code>months_digit2</code></td><td>19</td><td></td></tr> <tr><td><code>months_digit1</code></td><td>20</td><td></td></tr> <tr><td><code>years_digit4</code></td><td>21</td><td></td></tr> <tr><td><code>years_digit3</code></td><td>22</td><td></td></tr> <tr><td><code>years_digit2</code></td><td>23</td><td></td></tr> <tr><td><code>years_digit1</code></td><td>24</td><td></td></tr> <tr><td><code>am_pm</code></td><td>25</td><td></td></tr> <tr><td><code>hours_fine</code></td><td>26</td><td></td></tr> </table> @attr name com.example.sony.smarteyeglass.extension.helloworld:timeType */ public static final int TimeView_timeType = 2; }; }
[ "ADITYA PRAKASH" ]
ADITYA PRAKASH
2dc9d92dfc31ae98770f2c809ede51a70c10f0b7
9938e1ff4f22e5678977992e8b8339ea9f8de0cc
/src/com/homework/Homework004.java
8fa0d44ef3cd9e64d6fc25e476a5028540f83f6f
[]
no_license
anastasia-sineavscaia/JavaBasicsBatch9
bce735b5f2fa27d99e544d099f33c572bc2ef80d
849bf31c8a238460d76939606bc6e4e82196f088
refs/heads/main
2023-03-29T03:18:55.163557
2021-04-05T21:35:19
2021-04-05T21:35:19
351,095,382
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.homework; public class Homework004 { public static void main(String[] args) { char a, b; a = '*'; b = '#'; String c, d, e; c = "**"; d = "***"; e = "##"; System.out.println(a); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(b); } }
215ce4a2259df6562edb76b524e36b76feaaaf4a
47761f5843a42ec5ce4b0e4a5ab23579e8c44959
/src/main/java/com/geniisys/giac/service/GIACChartOfAcctsService.java
3d300dc77859a089c5cf533119f0080ce7236aa0
[]
no_license
jabautista/GeniisysSCA
df6171c27594638193949df1a65c679444d51b9f
6dc1b21386453240f0632f37f00344df07f6bedd
refs/heads/development
2021-01-19T20:54:11.936774
2017-04-20T02:05:41
2017-04-20T02:05:41
88,571,440
2
0
null
2017-08-02T01:48:59
2017-04-18T02:18:03
PLSQL
UTF-8
Java
false
false
1,912
java
/** * * Project Name: Geniisys Web * Version: * Author: Computer Professionals, Inc. * */ package com.geniisys.giac.service; import java.sql.SQLException; import java.text.ParseException; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.json.JSONException; import org.json.JSONObject; import com.geniisys.framework.util.PaginatedList; import com.geniisys.giac.entity.GIACChartOfAccts; /** * The Interface GIACOrderOfPaymentService. */ public interface GIACChartOfAcctsService { /** * Get Account Code Details. * * @return the GIACChartOfAccts * @throws SQLException the sQL exception */ PaginatedList getAccountCodeDtls(Map<String, Object> params, Integer pageNo) throws SQLException; PaginatedList getAccountCodeDtls2(String keyword, Integer pageNo) throws SQLException; List<GIACChartOfAccts> getAllChartOfAccts() throws SQLException; List<GIACChartOfAccts> getAccountCodes(Map<String, Object> params) throws SQLException; JSONObject showGiacs311(HttpServletRequest request, String userId) throws SQLException, JSONException; String checkGiacs311UserFunction(HttpServletRequest request, String userId) throws SQLException; String getGlMotherAcct(HttpServletRequest request) throws SQLException; String getIncrementedLevel(HttpServletRequest request) throws SQLException; JSONObject getChildRecList(HttpServletRequest request, String userId) throws SQLException, JSONException; Map<String, Object> getChildChartOfAccts (HttpServletRequest request, String userId) throws SQLException, JSONException, ParseException; void valUpdateRec(HttpServletRequest request) throws SQLException; void saveGiacs311(HttpServletRequest request, String userId) throws SQLException, JSONException; void valAddRec(HttpServletRequest request) throws SQLException; void valDelRec(HttpServletRequest request) throws SQLException; }
247027356ff469f821efe15374d4ebf6e9ebb07d
c199c3a7a29e1616361d58bf3f5a635440fe89cd
/src/main/java/utils/StringUtils.java
f47319403f0a2cb53fa265fecb2197a89fe85f37
[]
no_license
lxxjn0/jwp-was
e55c600015ff57140949246893deeca8a6c8051c
af644d07f668c28ee05741f92fdfc6cbfc2ea64d
refs/heads/main
2023-02-05T23:12:09.892307
2020-10-19T11:15:06
2020-11-15T04:02:38
293,973,531
0
0
null
2020-09-09T01:50:54
2020-09-09T01:50:53
null
UTF-8
Java
false
false
796
java
package utils; import java.util.HashMap; import java.util.Map; import java.util.Objects; public class StringUtils { private static final String PARAMETER_DELIMITER = "="; private static final String PARAMETERS_DELIMITER = "&"; private static final int PARAMETER_KEY = 0; private static final int PARAMETER_VALUE = 1; public static Map<String, String> readParameters(String line) { Objects.requireNonNull(line); Map<String, String> params = new HashMap<>(); String[] paramTokens = line.split(PARAMETERS_DELIMITER); for (String paramToken : paramTokens) { String[] strings = paramToken.split(PARAMETER_DELIMITER); params.put(strings[PARAMETER_KEY], strings[PARAMETER_VALUE]); } return params; } }
220ff900d9073b75753921e8f2dd531582d489aa
b31cf5586f210c7c5b5245b6cae47f0ec0c57099
/itoken-common/src/main/java/com/sen/itoken/common/utils/MapperUtils.java
f5a3df61beca5a26fc664b9964f50ac02c966e0b
[ "Apache-2.0" ]
permissive
sumforest/itoken
7a012ed55b3e4c9976cc0a6ba94a68a20059d399
427f4fa56631d27cf9f40ab4ae3b0b6818cd62ac
refs/heads/master
2022-11-30T11:18:42.786801
2019-10-08T16:24:44
2019-10-08T16:24:44
205,435,175
1
0
Apache-2.0
2022-11-16T09:48:46
2019-08-30T18:17:48
Java
UTF-8
Java
false
false
6,477
java
package com.sen.itoken.common.utils; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Jackson 工具类 * <p>Title: MapperUtils</p> * <p>Description: </p> * * @author Lusifer * @version 1.0.0 * @date 2018/3/4 21:50 */ public class MapperUtils { private final static ObjectMapper objectMapper = new ObjectMapper(); public static ObjectMapper getInstance() { return objectMapper; } /** * 转换为 JSON 字符串 * * @param obj * @return * @throws Exception */ public static String obj2json(Object obj) throws Exception { return objectMapper.writeValueAsString(obj); } /** * 转换为 JSON 字符串,忽略空值 * * @param obj * @return * @throws Exception */ public static String obj2jsonIgnoreNull(Object obj) throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper.writeValueAsString(obj); } /** * 转换为 JavaBean * * @param jsonString * @param clazz * @return * @throws Exception */ public static <T> T json2pojo(String jsonString, Class<T> clazz) throws Exception { objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); return objectMapper.readValue(jsonString, clazz); } /** * 字符串转换为 Map<String, Object> * * @param jsonString * @return * @throws Exception */ public static <T> Map<String, Object> json2map(String jsonString) throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper.readValue(jsonString, Map.class); } /** * 字符串转换为 Map<String, T> */ public static <T> Map<String, T> json2map(String jsonString, Class<T> clazz) throws Exception { Map<String, Map<String, Object>> map = objectMapper.readValue(jsonString, new TypeReference<Map<String, T>>() { }); Map<String, T> result = new HashMap<String, T>(); for (Map.Entry<String, Map<String, Object>> entry : map.entrySet()) { result.put(entry.getKey(), map2pojo(entry.getValue(), clazz)); } return result; } /** * 深度转换 JSON 成 Map * * @param json * @return */ public static Map<String, Object> json2mapDeeply(String json) throws Exception { return json2MapRecursion(json, objectMapper); } /** * 把 JSON 解析成 List,如果 List 内部的元素存在 jsonString,继续解析 * * @param json * @param mapper 解析工具 * @return * @throws Exception */ private static List<Object> json2ListRecursion(String json, ObjectMapper mapper) throws Exception { if (json == null) { return null; } List<Object> list = mapper.readValue(json, List.class); for (Object obj : list) { if (obj != null && obj instanceof String) { String str = (String) obj; if (str.startsWith("[")) { obj = json2ListRecursion(str, mapper); } else if (obj.toString().startsWith("{")) { obj = json2MapRecursion(str, mapper); } } } return list; } /** * 把 JSON 解析成 Map,如果 Map 内部的 Value 存在 jsonString,继续解析 * * @param json * @param mapper * @return * @throws Exception */ private static Map<String, Object> json2MapRecursion(String json, ObjectMapper mapper) throws Exception { if (json == null) { return null; } Map<String, Object> map = mapper.readValue(json, Map.class); for (Map.Entry<String, Object> entry : map.entrySet()) { Object obj = entry.getValue(); if (obj != null && obj instanceof String) { String str = ((String) obj); if (str.startsWith("[")) { List<?> list = json2ListRecursion(str, mapper); map.put(entry.getKey(), list); } else if (str.startsWith("{")) { Map<String, Object> mapRecursion = json2MapRecursion(str, mapper); map.put(entry.getKey(), mapRecursion); } } } return map; } /** * 将 JSON 数组转换为集合 * * @param jsonArrayStr * @param clazz * @return * @throws Exception */ public static <T> List<T> json2list(String jsonArrayStr, Class<T> clazz) throws Exception { JavaType javaType = getCollectionType(ArrayList.class, clazz); List<T> list = (List<T>) objectMapper.readValue(jsonArrayStr, javaType); return list; } /** * 获取泛型的 Collection Type * * @param collectionClass 泛型的Collection * @param elementClasses 元素类 * @return JavaType Java类型 * @since 1.0 */ public static JavaType getCollectionType(Class<?> collectionClass, Class<?>... elementClasses) { return objectMapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); } /** * 将 Map 转换为 JavaBean * * @param map * @param clazz * @return */ public static <T> T map2pojo(Map map, Class<T> clazz) { return objectMapper.convertValue(map, clazz); } /** * 将 Map 转换为 JSON * * @param map * @return */ public static String mapToJson(Map map) { try { return objectMapper.writeValueAsString(map); } catch (Exception e) { e.printStackTrace(); } return ""; } /** * 将 JSON 对象转换为 JavaBean * * @param obj * @param clazz * @return */ public static <T> T obj2pojo(Object obj, Class<T> clazz) { return objectMapper.convertValue(obj, clazz); } }
[ "12345678" ]
12345678
fca5ceccab199e7c65bb82de5d6132dd729d42da
6afc726f36d09fc8ac9ce32d17a22cf05ad5552a
/mall_product/src/main/java/com/yang/mall_product/vo/MemberPrice.java
7f75885319f16de19457af1377145fe5500d192c
[]
no_license
yang0123456789/dismall
843fb37c94198657b45b81c80fa141674f99e30b
dfd12609bff15cfc768aaff9af7d545b50258f95
refs/heads/main
2023-01-08T10:49:06.761440
2020-11-08T12:01:58
2020-11-08T12:01:58
308,582,822
0
0
null
null
null
null
UTF-8
Java
false
false
275
java
package com.yang.mall_product.vo; import lombok.Data; import java.math.BigDecimal; /** * <p>Title: AttrRespVo</p> * Description:会员价格 * date: */ @Data public class MemberPrice { private Long id; private String name; private BigDecimal price; }
98c5ba03270299e3a49d21ef3c33bfca29917aa3
6102a0757d8c73ca3fb4e55dd44db91fb4d38343
/AllInOne-master/app/src/main/java/practice/myte/com/allinone/BrowseActivity.java
3e8da71c363b9d2fa3e4476a7c2dc10368bc226e
[]
no_license
SAMAPTY-SAHA/250_project
878a936fd6fc93384c522474136e211ea524d534
aad45cfded19f095954ca44ab99f2ed328457f40
refs/heads/master
2021-06-25T08:50:51.769560
2021-01-15T13:44:40
2021-01-15T13:44:40
185,013,161
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package practice.myte.com.allinone; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class BrowseActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_browse); } }
5bf1e88051905c35cc5be09e0eb29c016a31ae2d
ca030864a3a1c24be6b9d1802c2353da4ca0d441
/classes4.dex_source_from_JADX/com/facebook/graphql/deserializers/GraphQLImageDeserializer.java
177bbf33b8e8db25f4499a2329d2550901f66e33
[]
no_license
pxson001/facebook-app
87aa51e29195eeaae69adeb30219547f83a5b7b1
640630f078980f9818049625ebc42569c67c69f7
refs/heads/master
2020-04-07T20:36:45.758523
2018-03-07T09:04:57
2018-03-07T09:04:57
124,208,458
4
0
null
null
null
null
UTF-8
Java
false
false
4,691
java
package com.facebook.graphql.deserializers; import com.facebook.flatbuffers.FlatBufferBuilder; import com.facebook.flatbuffers.MutableFlatBuffer; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.SerializerProvider; import java.nio.ByteBuffer; import java.util.ArrayList; /* compiled from: refetch_is_prefetch */ public class GraphQLImageDeserializer { public static int m3908a(JsonParser jsonParser, FlatBufferBuilder flatBufferBuilder) { int[] iArr = new int[5]; boolean[] zArr = new boolean[3]; int[] iArr2 = new int[2]; double[] dArr = new double[1]; while (jsonParser.c() != JsonToken.END_OBJECT) { String i = jsonParser.i(); jsonParser.c(); if (!(jsonParser.g() == JsonToken.VALUE_NULL || i == null)) { if (i.equals("height")) { zArr[0] = true; iArr2[0] = jsonParser.E(); } else if (i.equals("name")) { iArr[1] = flatBufferBuilder.b(jsonParser.o()); } else if (i.equals("scale")) { zArr[1] = true; dArr[0] = jsonParser.G(); } else if (i.equals("uri")) { iArr[3] = flatBufferBuilder.b(jsonParser.o()); } else if (i.equals("width")) { zArr[2] = true; iArr2[1] = jsonParser.E(); } else { jsonParser.f(); } } } flatBufferBuilder.c(5); if (zArr[0]) { flatBufferBuilder.a(0, iArr2[0], 0); } flatBufferBuilder.b(1, iArr[1]); if (zArr[1]) { flatBufferBuilder.a(2, dArr[0], 0.0d); } flatBufferBuilder.b(3, iArr[3]); if (zArr[2]) { flatBufferBuilder.a(4, iArr2[1], 0); } return flatBufferBuilder.d(); } public static int m3912b(JsonParser jsonParser, FlatBufferBuilder flatBufferBuilder) { ArrayList arrayList = new ArrayList(); if (jsonParser.g() == JsonToken.START_ARRAY) { while (jsonParser.c() != JsonToken.END_ARRAY) { arrayList.add(Integer.valueOf(m3908a(jsonParser, flatBufferBuilder))); } } if (arrayList.isEmpty()) { return 0; } int[] iArr = new int[arrayList.size()]; for (int i = 0; i < arrayList.size(); i++) { iArr[i] = ((Integer) arrayList.get(i)).intValue(); } return flatBufferBuilder.a(iArr, true); } public static MutableFlatBuffer m3909a(JsonParser jsonParser, short s) { FlatBufferBuilder flatBufferBuilder = new FlatBufferBuilder(128); int a = m3908a(jsonParser, flatBufferBuilder); if (1 != 0) { flatBufferBuilder.c(2); flatBufferBuilder.a(0, s, 0); flatBufferBuilder.b(1, a); a = flatBufferBuilder.d(); } flatBufferBuilder.d(a); ByteBuffer wrap = ByteBuffer.wrap(flatBufferBuilder.e()); wrap.position(0); MutableFlatBuffer mutableFlatBuffer = new MutableFlatBuffer(wrap, null, null, true, null); mutableFlatBuffer.a(4, Boolean.valueOf(true)); return mutableFlatBuffer; } public static void m3911a(MutableFlatBuffer mutableFlatBuffer, int i, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) { jsonGenerator.d(); for (int i2 = 0; i2 < mutableFlatBuffer.c(i); i2++) { m3910a(mutableFlatBuffer, mutableFlatBuffer.m(i, i2), jsonGenerator); } jsonGenerator.e(); } public static void m3910a(MutableFlatBuffer mutableFlatBuffer, int i, JsonGenerator jsonGenerator) { jsonGenerator.f(); int a = mutableFlatBuffer.a(i, 0, 0); if (a != 0) { jsonGenerator.a("height"); jsonGenerator.b(a); } if (mutableFlatBuffer.g(i, 1) != 0) { jsonGenerator.a("name"); jsonGenerator.b(mutableFlatBuffer.c(i, 1)); } double a2 = mutableFlatBuffer.a(i, 2, 0.0d); if (a2 != 0.0d) { jsonGenerator.a("scale"); jsonGenerator.a(a2); } if (mutableFlatBuffer.g(i, 3) != 0) { jsonGenerator.a("uri"); jsonGenerator.b(mutableFlatBuffer.c(i, 3)); } a = mutableFlatBuffer.a(i, 4, 0); if (a != 0) { jsonGenerator.a("width"); jsonGenerator.b(a); } jsonGenerator.g(); } }
51fde2082dcda36f3203135fef9ed595e0ad2743
8cda516c22997c54262721c3d3dc85f7c2bc8d47
/src/main/java/MUN/Factory/DataPoint.java
372982a32799691d6de2310e17620e283c43c069
[]
no_license
BenxinNiu/stockopedia-server
226d06a51588de6c1f8b4252cc2747c50077ea04
8587165f4569b8e71fbc8246e68a31d0d9762d17
refs/heads/master
2021-05-04T15:35:11.525537
2018-04-02T14:36:33
2018-04-02T14:36:33
120,233,221
0
0
null
null
null
null
UTF-8
Java
false
false
4,460
java
package MUN.Factory; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class DataPoint { private String date; private String minute; private String label; private double high; private double low; private double average; private double volume; private double notional; private double numberOfTrades; private double marketHigh; private double marketLow; private double marketAverage; private double marketVolume; private double marketNotional; private double marketNumberOfTrades; private double changeOverTime; private double marketChangeOverTime; public void setDate(String date) { this.date = date; } public void setMinute(String minute) { this.minute = minute; } public void setLabel(String label) { this.label = label; } public void setHigh(double high) { this.high = high; } public void setLow(double low) { this.low = low; } public void setAverage(double average) { this.average = average; } public void setVolume(double volume) { this.volume = volume; } public void setNotional(double notional) { this.notional = notional; } public void setNumberOfTrades(double numberOfTrades) { this.numberOfTrades = numberOfTrades; } public void setMarketHigh(double marketHigh) { this.marketHigh = marketHigh; } public void setMarketLow(double marketLow) { this.marketLow = marketLow; } public void setMarketAverage(double marketAverage) { this.marketAverage = marketAverage; } public void setMarketVolume(double marketVolume) { this.marketVolume = marketVolume; } public void setMarketNotional(double marketNotional) { this.marketNotional = marketNotional; } public void setMarketNumberOfTrades(double marketNumberOfTrades) { this.marketNumberOfTrades = marketNumberOfTrades; } public void setChangeOverTime(double changeOverTime) { this.changeOverTime = changeOverTime; } public void setMarketChangeOverTime(double marketChangeOverTime) { this.marketChangeOverTime = marketChangeOverTime; } public DataPoint(String date, String minute, String label, double high, double low, double average, double volume, double notional, double numberOfTrades, double marketHigh, double marketLow, double marketAverage, double marketVolume, double marketNotional, double marketNumberOfTrades, double changeOverTime, double marketChangeOverTime) { this.date = date; this.minute = minute; this.label = label; this.high = high; this.low = low; this.average = average; this.volume = volume; this.notional = notional; this.numberOfTrades = numberOfTrades; this.marketHigh = marketHigh; this.marketLow = marketLow; this.marketAverage = marketAverage; this.marketVolume = marketVolume; this.marketNotional = marketNotional; this.marketNumberOfTrades = marketNumberOfTrades; this.changeOverTime = changeOverTime; this.marketChangeOverTime = marketChangeOverTime; } public DataPoint(){ } public String getDate() { return date; } public String getMinute() { return minute; } public String getLabel() { return label; } public double getHigh() { return high; } public double getLow() { return low; } public double getAverage() { return average; } public double getVolume() { return volume; } public double getNotional() { return notional; } public double getNumberOfTrades() { return numberOfTrades; } public double getMarketHigh() { return marketHigh; } public double getMarketLow() { return marketLow; } public double getMarketAverage() { return marketAverage; } public double getMarketVolume() { return marketVolume; } public double getMarketNotional() { return marketNotional; } public double getMarketNumberOfTrades() { return marketNumberOfTrades; } public double getChangeOverTime() { return changeOverTime; } public double getMarketChangeOverTime() { return marketChangeOverTime; } }
[ "benxinniu880808" ]
benxinniu880808
9d968f2861af7c905af939eba1a4e0c7566fde5f
82fe40b4498945ed6e6432c0c497ce9c61f8b4d6
/src/main/java/com/hbo/advertiser/documents/Category.java
4dd966397990d036db3e75dd438718a511ae3bbb
[]
no_license
boualiHoussem/ads-management-application
4384cd711dea255358718a4bd6c75350ccc9e8e0
6d6d0892426a6ff573664e9648182d6e95905d69
refs/heads/master
2020-04-12T05:49:22.466540
2018-12-18T18:56:32
2018-12-18T18:56:32
162,332,869
0
0
null
null
null
null
UTF-8
Java
false
false
2,501
java
package com.hbo.advertiser.documents; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import java.util.List; import java.util.Objects; @Document(collection = "category") public class Category { @Id private Long idCategory; private String categoryName; private String description; private List<Ad> ad; private List<SubCategory> subCategory; public Category() { } public Long getIdCategory() { return idCategory; } public void setIdCategory(Long idCategory) { this.idCategory = idCategory; } public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public List<Ad> getAd() { return ad; } public void setAd(List<Ad> ad) { this.ad = ad; } public List<SubCategory> getSubCategory() { return subCategory; } public void setSubCategory(List<SubCategory> subCategory) { this.subCategory = subCategory; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Category category = (Category) o; return Objects.equals(idCategory, category.idCategory) && Objects.equals(categoryName, category.categoryName) && Objects.equals(description, category.description) && Objects.equals(ad, category.ad) && Objects.equals(subCategory, category.subCategory); } @Override public int hashCode() { return Objects.hash(idCategory, categoryName, description, ad, subCategory); } @Override public String toString() { ObjectMapper mapper = new ObjectMapper(); String jsonStr = ""; try { mapper.enable(SerializationFeature.INDENT_OUTPUT); jsonStr = mapper.writeValueAsString(this); } catch (JsonProcessingException e) { e.printStackTrace(); } return jsonStr; } }
caa41ad6cbb8447ab0650f05acb6c96ec5ce3167
1158de76914d90e72375f396843f007b4a140508
/project3/Crocus-backEnd/src/main/java/com/ga/crocus/model/User.java
c3a4c5ee9df54f900b9a6dc135ff35d62244ba71
[]
no_license
shadenalmangour/JDI-projects
b3c40f834a3332c8808ddbdf1b474cecc500f11b
23911af8082f0ebf3354540a1574be30af8a6a34
refs/heads/main
2023-03-21T03:45:38.623393
2021-03-08T21:37:46
2021-03-08T21:37:46
345,223,314
0
0
null
null
null
null
UTF-8
Java
false
false
3,856
java
package com.ga.crocus.model; import java.time.LocalDateTime; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import org.springframework.beans.factory.annotation.Value; import com.fasterxml.jackson.annotation.JsonBackReference; @Entity @Table(name = "User") public class User { @Id @GeneratedValue @Column(name = "id", nullable = false, updatable = false) private int id; @JsonBackReference("post") @OneToMany(mappedBy="user") private Set<Post> posts; @JsonBackReference("comment") @OneToMany(mappedBy="user") private Set<Comment> comments; public Set<Post> getPosts() { return posts; } public void setPosts(Set<Post> posts) { this.posts = posts; } public Set<Comment> getComments() { return comments; } public void setComments(Set<Comment> comments) { this.comments = comments; } @Column(name="userRole", nullable = false, updatable = false) private String userRole; // @Value("${some.key:ADMIN}") // private String ADMIN; // public String getUserRole() { return userRole; } public void setUserRole(String userRole) { this.userRole = userRole; } @Column(name="firstName", nullable = false, updatable = true) private String firstName; @Column(name="lastName", nullable = false, updatable = true) private String lastName; @Column(name="emailAddress", nullable = false, updatable = true) private String emailAddress; @Column(name="phoneNumber", nullable = false, updatable = true) private String phoneNumber; @Column(name="password", nullable = false, updatable = true) private String password; @Column(name="confirmPassword", nullable = false, updatable = true) private String confirmPassword; @Column(name = "createdAt", nullable = false, updatable = false) @CreationTimestamp private LocalDateTime createAt; @Column(name = "updatedat", nullable = false, updatable = true) @UpdateTimestamp private LocalDateTime updateAt; private String oldPass; public int getId() { return id; } public void setId(int id) { this.id = id; } // public Set<Post> getPosts() { // return posts; // } // public void setPosts(Set<Post> posts) { // this.posts = posts; // } // public Set<Comment> getComments() { // return comments; // } // public void setComments(Set<Comment> comments) { // this.comments = comments; // } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getConfirmPassword() { return confirmPassword; } public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; } public LocalDateTime getCreateAt() { return createAt; } public void setCreateAt(LocalDateTime createAt) { this.createAt = createAt; } public LocalDateTime getUpdateAt() { return updateAt; } public void setUpdateAt(LocalDateTime updateAt) { this.updateAt = updateAt; } public String getOldPass() { return oldPass; } public void setOldPass(String oldPass) { this.oldPass = oldPass; } }
32cb28102c6cf23eec6d8ff5c4cd7d90497a555f
7e383869011e80af81b12ee13f942b246e136e63
/project/src/com/iact/vo/AbstractSysmanager.java
493b53b2106afc5f942f55cb88dff3f74cd26962
[]
no_license
ryan4fun/iaccct
5594c03cbff0f3955261c2f4d117612fb9e1e6db
ea69585d78c9a20a844376fc27361656443a3d4b
refs/heads/master
2020-12-31T04:28:39.646353
2012-08-22T10:05:14
2012-08-22T10:05:14
53,239,169
0
0
null
null
null
null
UTF-8
Java
false
false
2,131
java
package com.iact.vo; /** * AbstractSysmanager entity provides the base persistence definition of the * Sysmanager entity. @author MyEclipse Persistence Tools */ public abstract class AbstractSysmanager implements java.io.Serializable { // Fields private Long id; private String login; private String pwd; private String name; private String description; private Integer roleType; private String bizCode; private Integer status; // Constructors /** default constructor */ public AbstractSysmanager() { } /** minimal constructor */ public AbstractSysmanager(Long id, String login, String pwd, Integer roleType, Integer status) { this.id = id; this.login = login; this.pwd = pwd; this.roleType = roleType; this.status = status; } /** full constructor */ public AbstractSysmanager(Long id, String login, String pwd, String name, String description, Integer roleType, String bizCode, Integer status) { this.id = id; this.login = login; this.pwd = pwd; this.name = name; this.description = description; this.roleType = roleType; this.bizCode = bizCode; this.status = status; } // Property accessors public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getLogin() { return this.login; } public void setLogin(String login) { this.login = login; } public String getPwd() { return this.pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public Integer getRoleType() { return this.roleType; } public void setRoleType(Integer roleType) { this.roleType = roleType; } public String getBizCode() { return this.bizCode; } public void setBizCode(String bizCode) { this.bizCode = bizCode; } public Integer getStatus() { return this.status; } public void setStatus(Integer status) { this.status = status; } }
b05bae72c30eaa295fc360297d19da29b22510f4
5beffc697ac5eb90feed6277a9ffe1c97d361315
/exercicio42.java
0123e227e04529f52291adff25fdab89fd9a4f2a
[]
no_license
jok1n9/p1
538d26575f74c33f54235acefad4f941e3acfb92
388c0ad7be6d4adea89cf373bd0fe020b3d3d557
refs/heads/master
2020-11-24T09:33:46.286109
2019-12-20T17:33:19
2019-12-20T17:33:19
228,082,019
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
import java.util.Scanner; public class exercicio42 { public static void main(String[] args){ Scanner notas= new Scanner(System.in); int op; int n=1; op= notas.nextInt(); while(op>=0){ n = n * op; op= notas.nextInt(); } System.out.printf("Números= %d",n); } }
c7d7eddfe1790ac0747183d68ba24c796e5bcbd0
dfe30f8de1a2222817e274de2eea9438fbc0faad
/app/build/generated/source/r/debug/android/support/swiperefreshlayout/R.java
c076961dbdc80ff40eaf850182337ed2671f3bc3
[ "Apache-2.0" ]
permissive
thasneemp/MVVMKotlinBase
ef46b8a49744f8d2149c0ddc9d71978af157d250
36c20a7fee6a71a9a3c0a6266d4a577800422027
refs/heads/master
2020-03-27T07:52:14.973779
2018-09-01T09:57:40
2018-09-01T09:57:40
146,199,099
0
0
null
null
null
null
UTF-8
Java
false
false
10,179
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.swiperefreshlayout; public final class R { public static final class attr { public static final int alpha = 0x7f020027; public static final int font = 0x7f02007f; public static final int fontProviderAuthority = 0x7f020081; public static final int fontProviderCerts = 0x7f020082; public static final int fontProviderFetchStrategy = 0x7f020083; public static final int fontProviderFetchTimeout = 0x7f020084; public static final int fontProviderPackage = 0x7f020085; public static final int fontProviderQuery = 0x7f020086; public static final int fontStyle = 0x7f020087; public static final int fontVariationSettings = 0x7f020088; public static final int fontWeight = 0x7f020089; public static final int ttcIndex = 0x7f020145; } public static final class color { public static final int notification_action_color_filter = 0x7f04003f; public static final int notification_icon_bg_color = 0x7f040040; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_light = 0x7f04004c; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f050061; public static final int notification_action_text_size = 0x7f050062; public static final int notification_big_circle_margin = 0x7f050063; public static final int notification_content_margin_start = 0x7f050064; public static final int notification_large_icon_height = 0x7f050065; public static final int notification_large_icon_width = 0x7f050066; public static final int notification_main_column_padding_top = 0x7f050067; public static final int notification_media_narrow_margin = 0x7f050068; public static final int notification_right_icon_size = 0x7f050069; public static final int notification_right_side_padding_top = 0x7f05006a; public static final int notification_small_icon_background_padding = 0x7f05006b; public static final int notification_small_icon_size_as_large = 0x7f05006c; public static final int notification_subtext_size = 0x7f05006d; public static final int notification_top_pad = 0x7f05006e; public static final int notification_top_pad_large_text = 0x7f05006f; } public static final class drawable { public static final int notification_action_background = 0x7f060057; public static final int notification_bg = 0x7f060058; public static final int notification_bg_low = 0x7f060059; public static final int notification_bg_low_normal = 0x7f06005a; public static final int notification_bg_low_pressed = 0x7f06005b; public static final int notification_bg_normal = 0x7f06005c; public static final int notification_bg_normal_pressed = 0x7f06005d; public static final int notification_icon_background = 0x7f06005e; public static final int notification_template_icon_bg = 0x7f06005f; public static final int notification_template_icon_low_bg = 0x7f060060; public static final int notification_tile_bg = 0x7f060061; public static final int notify_panel_notification_icon_bg = 0x7f060062; } public static final class id { public static final int action_container = 0x7f07000d; public static final int action_divider = 0x7f07000f; public static final int action_image = 0x7f070010; public static final int action_text = 0x7f070016; public static final int actions = 0x7f070017; public static final int async = 0x7f07001d; public static final int blocking = 0x7f070020; public static final int chronometer = 0x7f070028; public static final int forever = 0x7f07003d; public static final int icon = 0x7f070042; public static final int icon_group = 0x7f070043; public static final int info = 0x7f070046; public static final int italic = 0x7f070048; public static final int line1 = 0x7f07004b; public static final int line3 = 0x7f07004c; public static final int normal = 0x7f070054; public static final int notification_background = 0x7f070055; public static final int notification_main_column = 0x7f070056; public static final int notification_main_column_container = 0x7f070057; public static final int right_icon = 0x7f070062; public static final int right_side = 0x7f070063; public static final int tag_transition_group = 0x7f070083; public static final int tag_unhandled_key_event_manager = 0x7f070084; public static final int tag_unhandled_key_listeners = 0x7f070085; public static final int text = 0x7f070086; public static final int text2 = 0x7f070087; public static final int time = 0x7f07008b; public static final int title = 0x7f07008c; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { public static final int notification_action = 0x7f09001d; public static final int notification_action_tombstone = 0x7f09001e; public static final int notification_template_custom_big = 0x7f09001f; public static final int notification_template_icon_group = 0x7f090020; public static final int notification_template_part_chronometer = 0x7f090021; public static final int notification_template_part_time = 0x7f090022; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0b0029; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0c00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158; public static final int Widget_Compat_NotificationActionText = 0x7f0c0159; } public static final class styleable { public static final int[] ColorStateListItem = { 0x010101a5, 0x0101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f020081, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f020085, 0x7f020086 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f02007f, 0x7f020087, 0x7f020088, 0x7f020089, 0x7f020145 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2, 0x010101a3, 0x010101a4, 0x01010201, 0x0101020b, 0x01010510, 0x01010511, 0x01010512, 0x01010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x010101a5, 0x01010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
56e961ee35bebb8d61d76a2c0b0234dac6c5cbe3
bd678353695f8f68f5a6776d2e14da7dcaea5cc7
/src/main/java/IPersistencia.java
46ead4410f5bb408ee081599148434843ed0afa5
[]
no_license
lucasdebeterco/persistencia-sms-email
8433eecfad08dce6cf61fa2f73233c2ec847335d
cd63620d9f6ac19d9feb70f259ab6fb5ac61ba9c
refs/heads/master
2023-04-07T12:54:30.621285
2020-03-13T14:17:40
2020-03-13T14:17:40
247,086,711
0
0
null
2023-03-27T22:20:43
2020-03-13T14:11:34
Java
UTF-8
Java
false
false
85
java
public interface IPersistencia { public boolean gravarMensagem(Mensagem msg); }
8787594604319170e2432744b2b612d005ddf5e0
d103da4ce7fd436bb8a411cefd2194a3fd37053a
/src/test/java/com/diegolirio/bolao/BolaoApplicationTests.java
446c7e1d81827230efd119fc5666221bd5d66874
[]
no_license
diegolirio/jbolao
29b45e52dc11d9a9951dbcd0ca6c7488351c12f1
f85612180814ba6e2539cc9760f4e4e9ea90c995
refs/heads/master
2021-01-10T22:22:20.395864
2016-09-27T17:30:37
2016-09-27T17:30:37
62,684,883
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.diegolirio.bolao; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class BolaoApplicationTests { @Test public void contextLoads() { } }
3220d7e5ff4586863145f4f74ae4fea388350389
566a1992cb01620957ab883827a14a90e8d910a9
/src/java/br/com/tiago/amado/springmvc/model/Operacao.java
836beed0583569b95e966c378f034e53b6c45799
[]
no_license
tiagodurante/spring-mvc-aula02
11076418fdd0a2360c278028cc8b1085a467b271
756e6896a3c60fd2a908d1764472c36076ead0ba
refs/heads/master
2021-01-21T18:33:10.384807
2017-05-27T15:45:30
2017-05-27T15:45:30
92,052,669
0
0
null
null
null
null
UTF-8
Java
false
false
2,036
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 br.com.tiago.amado.springmvc.model; import java.io.Serializable; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToOne; /** * * @author tiago */ @Entity public class Operacao implements Serializable{ @Id private Long id; private String tipo; @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Conta conta; private String saldoAnterior; private String valor; private String saldoAtual; @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Cliente identificador; public Operacao() { } public String getSaldoAtual() { return saldoAtual; } public void setSaldoAtual(String saldoAtual) { this.saldoAtual = saldoAtual; } public Cliente getIdentificador() { return identificador; } public void setIdentificador(Cliente identificador) { this.identificador = identificador; } public Conta getConta() { return conta; } public void setConta(Conta conta) { this.conta = conta; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public String getSaldoAnterior() { return saldoAnterior; } public void setSaldoAnterior(String saldoAnterior) { this.saldoAnterior = saldoAnterior; } public String getValor() { return valor; } public void setValor(String valor) { this.valor = valor; } }
[ "Faculdade Alfa@WinMac02" ]
Faculdade Alfa@WinMac02
58cc79f4a717c705a26c00b08d58a1a027250d2c
a65217a7c3371102c670ceea49f180de2d561ce4
/app/src/main/java/com/sss/myhwmonitorapp/viewmodels/DataViewModel.java
5e250b8a460fcdab916cf3589b154eaae120d50c
[]
no_license
salauddin23shumon/mySensorApp
84afcf824263edbe2c04d5daef59750b1d8b5ac7
3d2a9c680ede3406f9e237f02f635e4dfbe4a4a3
refs/heads/master
2023-03-26T03:11:29.438287
2021-03-29T06:09:26
2021-03-29T06:09:26
352,419,644
0
0
null
null
null
null
UTF-8
Java
false
false
821
java
package com.sss.myhwmonitorapp.viewmodels; import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import com.sss.myhwmonitorapp.db.SensorModel; import com.sss.myhwmonitorapp.repositories.DataRepo; import com.sss.myhwmonitorapp.repositories.SensorRepo; import com.sss.myhwmonitorapp.responses.SensorDataResponse; import java.util.List; public class DataViewModel extends AndroidViewModel { private DataRepo dataRepo; public DataViewModel(@NonNull Application application) { super(application); dataRepo = DataRepo.getInstance(application); } public LiveData<List<SensorModel>> getAllSensorData() { return dataRepo.getAllData(); } }
[ "salauddin.23shumon.com" ]
salauddin.23shumon.com
80f97b32df1e4d5dfd5fc3e0292129981b6ddcff
4ed93a63a84b9f507c17926eeb0a91ed160c4349
/example-library-api/src/main/java/de/example/library/service/BookService.java
6b258a3773c6d99d6a258c3ec80ec80936980add
[]
no_license
Rebekka25/Spring
56384bc1d61dac6d6da1c41cccf222665ab1bae4
0a2581c486f67f7f7541fac5b99e3303c70cb2c6
refs/heads/master
2022-12-10T11:56:30.110875
2020-09-10T07:09:35
2020-09-10T07:09:35
292,241,054
0
0
null
null
null
null
ISO-8859-3
Java
false
false
576
java
package de.example.library.service; import java.util.List; import org.springframework.stereotype.Service; import de.example.library.entity.Book; import de.example.library.entity.User; @Service public interface BookService { /** * Gibt eine Liste von Büchern zurück. * @return */ List<Book> getBooks(); /** * Gibt ein Buch unter der Angabe der Isbn wieder. * @param isbn * @return */ Book getBookWithIsbn(String isbn); /** * * @param book * @param user * @return */ boolean borrow(Book book,User user); }
edb220f86d1d218f643e81b3e46f3166b23ba008
8ab66badb6469ecbb8bd9a18c3375cb00269ada3
/String/src/P7.java
10ff600db61eb4ab7b153bf947b1445523acfd51
[]
no_license
rahul228/AllCoreJavaCodes
58e857117dd9655d85c426be0aab6ec3129e6563
5bd5d22f6ce162b4c5424e553d7eb5cdc80b18d4
refs/heads/master
2021-06-30T11:45:01.068658
2018-12-01T16:03:13
2018-12-01T16:03:13
159,956,872
4
1
null
2020-10-01T10:58:51
2018-12-01T15:13:48
Java
UTF-8
Java
false
false
268
java
public class P7 { public static void main(String[] args) { // TODO Auto-generated method stub String st="Think"; String st1="Think"; if(st.equalsIgnoreCase(st1)) { System.out.println("Same"); } else { System.out.println("Not equal"); } } }
981f6aa5d58dffd48429e2e5cffa335b7033946a
eae55e89a398c0a3f0b589ee5e4c3a36d280a91d
/src/decorator/HelmetDecorator.java
89ac32595cd71c93ad68d438dadeeeabc2f2ebb7
[]
no_license
Florgardu/designPattern
09b02518f121dca7e3feee97ed2574cf6db628d9
75129afd655b313b0bf236cc60b7e249bcf3b3e5
refs/heads/master
2023-02-28T16:36:14.254810
2021-02-16T23:04:07
2021-02-16T23:04:07
287,552,594
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package decorator; public class HelmetDecorator extends EnemyDecorator { public HelmetDecorator(Enemy enemigo) { super(enemigo); // TODO Auto-generated constructor stub } @Override public int takeDamage() { // TODO Auto-generated method stub return this.enemigo.takeDamage() / 2; } }
c6bb8e13c73a8a12d65ba72a85ec3964f4212da1
5095c94365c79436e0f1c98a50405ae8e27a89eb
/atomicobjects-gui/src/main/java/net/catchpole/scene/renderer/ModelRenderer.java
8a6f5fb88c4272a2b99cd730682676f6ffcfacad
[ "Apache-2.0" ]
permissive
slipperyseal/atomicobjects
f5da8a832681550d8efc84d03e6c64b5f7a3bf49
212f9d830386fe9947f7770ab673273c007dc88d
refs/heads/slippery
2023-03-10T18:40:25.499262
2023-02-26T01:27:55
2023-02-26T01:27:55
20,993,244
3
1
Apache-2.0
2022-06-13T03:48:50
2014-06-19T08:25:25
Java
UTF-8
Java
false
false
5,553
java
package net.catchpole.scene.renderer; // Copyright 2014 catchpole.net // // 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 net.catchpole.model.Model; import net.catchpole.model.ValueModel; import net.catchpole.scene.Milieu; import net.catchpole.scene.Renderer; import net.catchpole.scene.effigy.Effigy; import net.catchpole.scene.effigy.EffigySource; import net.catchpole.scene.effigy.ModelEffigySource; import net.catchpole.scene.overlay.ImageOverlay; import net.catchpole.scene.overlay.ListOverlay; import net.catchpole.scene.overlay.OverlayManager; import net.catchpole.scene.spacial.Coordinate3D; import net.catchpole.scene.spacial.Position; import javax.media.opengl.GL; import javax.media.opengl.GL2; public class ModelRenderer implements Renderer { private static final float[] lightPosition = {-45.f, 60.f, 70.0f, 0.f}; private static final float[] lightAmbient = {0.110f, 0.110f, 0.110f, 1.f}; private static final float[] lightDiffuse = {1.0f, 1.0f, 1.0f, 1.f}; private static final float[] materialSpec = {1.0f, 1.0f, 1.0f, 0.0f}; private static final float[] zeroVec4 = {0.0f, 0.0f, 0.0f, 0.f}; private final OverlayManager overlayManager; private final Model rootModel; private final EffigySource effigySource = new ModelEffigySource(); private final Coordinate3D zoom = new Coordinate3D(0f, 0f, -100f); public ModelRenderer(Model model) { this.rootModel = model; this.overlayManager = new OverlayManager(); } public OverlayManager getOverlayManager() { return overlayManager; } public void init(Milieu milieu) { this.overlayManager.addOverlay(new ListOverlay(rootModel)); this.overlayManager.addOverlay(new ImageOverlay("./test.jpg")); } public void resize(Milieu milieu, int width, int height) { overlayManager.resize(milieu, width, height); GL2 gl2 = milieu.getGL().getGL2(); float aspect = height != 0 ? (float) width / (float) height : 1.0f; gl2.glViewport(0, 0, width, height); gl2.glScissor(0, 0, width, height); gl2.glMatrixMode(GL2.GL_MODELVIEW); gl2.glLoadIdentity(); gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, lightPosition, 0); gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, lightAmbient, 0); gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, lightDiffuse, 0); gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, zeroVec4, 0); gl2.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_SPECULAR, materialSpec, 0); gl2.glEnable(GL2.GL_NORMALIZE); gl2.glEnable(GL2.GL_LIGHTING); gl2.glEnable(GL2.GL_LIGHT0); gl2.glEnable(GL2.GL_COLOR_MATERIAL); gl2.glEnable(GL.GL_CULL_FACE); gl2.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST); gl2.glShadeModel(GL2.GL_SMOOTH); gl2.glDisable(GL.GL_DITHER); gl2.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); gl2.glEnableClientState(GL2.GL_VERTEX_ARRAY); gl2.glEnableClientState(GL2.GL_NORMAL_ARRAY); gl2.glEnableClientState(GL2.GL_COLOR_ARRAY); gl2.glMatrixMode(GL2.GL_PROJECTION); gl2.glLoadIdentity(); milieu.getGLU().gluPerspective(50.0f, aspect, 0.5f, 2900.0f); gl2.glCullFace(GL.GL_BACK); } public Coordinate3D getZoom() { return zoom; } public void render(Milieu milieu) { GL2 gl2 = milieu.getGL().getGL2(); gl2.glClear(GL.GL_COLOR_BUFFER_BIT); gl2.glMatrixMode(GL2.GL_MODELVIEW); // single entry ValueModel. render loop will not render the root node ValueModel valueModel = new ValueModel(null, null); valueModel.addChild(rootModel); render(valueModel, milieu, zoom, 0); overlayManager.render(milieu); } private void render(Model model, Milieu milieu, Coordinate3D source, int depth) { float spin1 = (((milieu.getRenderTime() & 0xffff) * (1.0f / (float) 0xffff))) + (depth * 0.2f) * 360f; float spin2 = (((milieu.getRenderTime() & 0xfff) * (1.0f / (float) 0xfff))) * 360f; int count = 0; for (Model subModel : model) { count++; } int index = 0; for (Model subModel : model) { int objectSpacing = (subModel.iterator().hasNext() ? 150 : 100); float rotation = (((float)Math.PI * 2) / ((float) count) * index++) + (1.0f * depth); // offset to stop overlap Coordinate3D target = new Coordinate3D( source.getX() + (objectSpacing * (float)Math.sin(rotation)), source.getY() + (objectSpacing * (float)Math.cos(rotation)), source.getZ()); Effigy effigy = effigySource.getIdiograph(subModel.getType()); effigy.render(milieu, new Position(target, spin1, spin2)); render(subModel, milieu, target, depth + 1); } } public void destory(Milieu milieu) { effigySource.destroy(milieu); } }
26fa0416c2470304e66c4a5e9f5267bfa18d275a
e4d9f772dd05729cfe0496719d1762048437267c
/mall-product/src/main/java/com/mimehoo/mall/product/dao/SpuCommentDao.java
a400488f9db89515c2fe88c07dfeca4eac543cd5
[]
no_license
ffmm520/mall
fa176e24de71d746e85839b6922b8effd11d51aa
23758ba2a2c595283c11d392a5c7306b4dec3ce8
refs/heads/master
2023-08-11T02:06:39.194207
2021-09-07T07:39:01
2021-09-07T07:39:01
401,942,939
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.mimehoo.mall.product.dao; import com.mimehoo.mall.product.entity.SpuCommentEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** * 商品评价 * * @author baboon * @email [email protected] * @date 2021-09-01 16:46:54 */ @Mapper public interface SpuCommentDao extends BaseMapper<SpuCommentEntity> { }
f45c6da96fc066232fbd8063807cdba3ebfcd840
a301f3fcadc1f8de1aeac1fec20f835168d27105
/src/test/java/arbeidskrav/roman/RomanConverter.java
3e9c241409abe6624602cd93677efe889449d1ce
[]
no_license
jeppemannen/roman
d8df0390b2d6c5c7c98fc4f97b07249fea00b1ca
804a8b1feea7d61de5297794b451b65dee101eaf
refs/heads/master
2020-07-20T12:19:44.412531
2019-09-10T13:19:31
2019-09-10T13:19:31
206,639,116
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
package arbeidskrav.roman; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class RomanConverter { @Test void shouldReturnIVfor4() { assertEquals("IV", RunRomanConverter.toRoman(4)); } @Test void shouldReturnIXfor9() { assertEquals("IX", RunRomanConverter.toRoman(9)); } @Test void shouldCalculateSimpleDigits() { assertEquals("MMMDCCCLXXXVIII", RunRomanConverter.toRoman(3888)); } @Test void shouldCalculateFourDigits() { assertEquals("CDXLIV", RunRomanConverter.toRoman(444)); } @Test void shouldCalculateNinelikeDigits() { assertEquals("CMXCIX", RunRomanConverter.toRoman(999)); } }
867b2595e476a24ee7e6e7fcc6b5b2596a5e3fee
7983412de76ffe9158b1fa21ec5d7a2d1617cad0
/src/main/java/com/zhangyue/mybatispluslearning/config/DataSourceConfig.java
9ce4dd69bb021d166fa0f62002fbe4cbc2e6f736
[]
no_license
zhangyue950425/mybatispluslearning
1d9f58081ce8ae945fd1de2af15050fde7c0abd8
2317bb8d746cc28da71b2505b46cf1ca4bbebcdf
refs/heads/master
2023-05-12T01:20:17.031987
2019-04-03T12:08:54
2019-04-03T12:08:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,370
java
/* * Copyright (c) 2011-2019, hubin ([email protected]). * <p> * 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 * <p> * https://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.zhangyue.mybatispluslearning.config; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils; import com.zhangyue.mybatispluslearning.config.converts.*; import com.zhangyue.mybatispluslearning.config.querys.*; import lombok.Data; import lombok.experimental.Accessors; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * 数据库配置 * * @author YangHu * @since 2016/8/30 */ @Data @Accessors(chain = true) public class DataSourceConfig { /** * 数据库信息查询 */ private IDbQuery dbQuery; /** * 数据库类型 */ private DbType dbType; /** * PostgreSQL schemaName */ private String schemaName; /** * 类型转换 */ private ITypeConvert typeConvert; /** * 驱动连接的URL */ private String url; /** * 驱动名称 */ private String driverName; /** * 数据库连接用户名 */ private String username; /** * 数据库连接密码 */ private String password; public IDbQuery getDbQuery() { if (null == dbQuery) { switch (getDbType()) { case ORACLE: dbQuery = new OracleQuery(); break; case SQL_SERVER: dbQuery = new SqlServerQuery(); break; case POSTGRE_SQL: dbQuery = new PostgreSqlQuery(); break; case DB2: dbQuery = new DB2Query(); break; case MARIADB: dbQuery = new MariadbQuery(); break; case H2: dbQuery = new H2Query(); break; default: // 默认 MYSQL dbQuery = new MySqlQuery(); break; } } return dbQuery; } /** * 判断数据库类型 * * @return 类型枚举值 */ public DbType getDbType() { if (null == this.dbType) { this.dbType = this.getDbType(this.driverName); if (null == this.dbType) { this.dbType = this.getDbType(this.url.toLowerCase()); if (null == this.dbType) { throw ExceptionUtils.mpe("Unknown type of database!"); } } } return this.dbType; } /** * 判断数据库类型 * * @param str 用于寻找特征的字符串,可以是 driverName 或小写后的 url * @return 类型枚举值,如果没找到,则返回 null */ private DbType getDbType(String str) { if (str.contains("mysql")) { return DbType.MYSQL; } else if (str.contains("oracle")) { return DbType.ORACLE; } else if (str.contains("postgresql")) { return DbType.POSTGRE_SQL; } else if (str.contains("sqlserver")) { return DbType.SQL_SERVER; } else if (str.contains("db2")) { return DbType.DB2; } else if (str.contains("mariadb")) { return DbType.MARIADB; } else if (str.contains("h2")) { return DbType.H2; } else { return null; } } public ITypeConvert getTypeConvert() { if (null == typeConvert) { switch (getDbType()) { case ORACLE: typeConvert = new OracleTypeConvert(); break; case SQL_SERVER: typeConvert = new SqlServerTypeConvert(); break; case POSTGRE_SQL: typeConvert = new PostgreSqlTypeConvert(); break; case DB2: typeConvert = new DB2TypeConvert(); break; case MARIADB: typeConvert = new MySqlTypeConvert(); break; default: // 默认 MYSQL typeConvert = new MySqlTypeConvert(); break; } } return typeConvert; } /** * 创建数据库连接对象 * * @return Connection */ public Connection getConn() { Connection conn = null; try { Class.forName(driverName); conn = DriverManager.getConnection(url, username, password); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } return conn; } }
1c387dfde4a99692852367949627585dd7dfd64a
79da92f56e78ae2056ea9361566c67a076405713
/src/com/mdc/enva/DesignPattern/Old/Bridge/RedCircle.java
82b7a1c65b1a0fe32fbe354eb4f93e9a11c7ca49
[]
no_license
costeldragu/Java
eafb7be5fed20cc904392a825fe4ef7fb1cb0389
e2b2dc40863c15685da3d2be45d8df304e083f73
refs/heads/master
2021-06-10T12:15:08.010205
2021-01-17T20:31:31
2021-01-17T20:31:31
67,597,464
0
0
null
null
null
null
UTF-8
Java
false
false
276
java
package com.mdc.enva.DesignPattern.Old.Bridge; public class RedCircle implements DrawAPI { @Override public void drawCircle(int radius, int x, int y) { System.out.println("Drawing Circle[ color: red, radius: " + radius + ", x: " + x + ", " + y + "]"); } }
d6bb39d843314e89eeb69332bcb1c33ac19367f5
6b34d4f2a33011bdadfc3b6e4459b5a3be14db44
/WordArena/client/core/src/com/slamdunk/toolkit/settings/FloatSetting.java
a6c6026131e6343105d3d6bae4231aff8a1ed8b6
[]
no_license
opack/slamdunk-prototypes
d679961d3bd155a49edd5eec67757726a2f89707
0150e7f5f3d10878caf429862343af3430985bf3
refs/heads/master
2021-01-12T13:26:55.907928
2015-03-15T20:49:58
2015-03-15T20:49:58
69,169,855
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
package com.slamdunk.toolkit.settings; public class FloatSetting { private PreferencesManager preferences; private final String key; private final float defaultValue; public FloatSetting(PreferencesManager preferences, String key, float defaultValue) { this.preferences = preferences; this.key = key; this.defaultValue = defaultValue; } public void set(float value) { preferences.putFloat(key, value); preferences.flush(); } public float get() { return preferences.getFloat(key, defaultValue); } }
168449cee1bf14d43176884a9ed0274836b5be32
2dcf8a98d4b959673a61fb00e0d6a36496a45e05
/modules/extensions/es/es-cae/src/test/java/com/coremedia/blueprint/elastic/social/cae/flows/RegistrationHelperTest.java
baca2cda893c0b7b1c548964b8a318f3f435f30f
[]
no_license
renickj/bycoremedia
d2f4a22a6074e56106b0495bbe879390af0d3d42
474a07d75386a9b59951e152560b05b6b8c93191
refs/heads/master
2021-01-17T17:09:33.819411
2016-04-25T17:13:11
2016-04-25T17:13:11
70,011,590
0
0
null
null
null
null
UTF-8
Java
false
false
23,385
java
package com.coremedia.blueprint.elastic.social.cae.flows; import com.coremedia.blueprint.common.contentbeans.Page; import com.coremedia.blueprint.elastic.social.cae.user.UserContext; import com.coremedia.blueprint.elastic.social.configuration.ElasticSocialConfiguration; import com.coremedia.blueprint.elastic.social.configuration.ElasticSocialPlugin; import com.coremedia.elastic.core.api.blobs.Blob; import com.coremedia.elastic.core.api.blobs.BlobException; import com.coremedia.elastic.core.api.blobs.BlobService; import com.coremedia.elastic.core.api.settings.Settings; import com.coremedia.elastic.core.api.users.DuplicateEmailException; import com.coremedia.elastic.core.api.users.DuplicateNameException; import com.coremedia.elastic.social.api.ModerationType; import com.coremedia.elastic.social.api.mail.MailTemplateNotFoundException; import com.coremedia.elastic.social.api.registration.RegistrationService; import com.coremedia.elastic.social.api.registration.TokenExpiredException; import com.coremedia.elastic.social.api.users.CommunityUser; import com.coremedia.elastic.social.api.users.CommunityUserService; import com.coremedia.elastic.social.springsecurity.SocialAuthenticationToken; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpUriRequest; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatcher; import org.mockito.InjectMocks; import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.binding.message.DefaultMessageContext; import org.springframework.binding.message.DefaultMessageResolver; import org.springframework.binding.message.MessageResolver; import org.springframework.social.connect.Connection; import org.springframework.social.connect.web.ProviderSignInAttempt; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.webflow.context.ExternalContext; import org.springframework.webflow.core.collection.ParameterMap; import org.springframework.webflow.core.collection.SharedAttributeMap; import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.RequestContextHolder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.jsp.jstl.fmt.LocalizationContext; import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; import java.util.Enumeration; import java.util.HashMap; import java.util.Locale; import java.util.TimeZone; import static com.coremedia.blueprint.elastic.social.cae.flows.WebflowMessageKeys.ACTIVATE_REGISTRATION_SUCCESS; import static java.util.Arrays.asList; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.anyVararg; import static org.mockito.Matchers.argThat; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class RegistrationHelperTest { private static final HashMap<String, Object> USER_PROPERTIES = new HashMap<>(); private static final String USERNAME = "knacki"; private static final String GIVENNAME = "backi"; private static final String SURNAME = "hacki"; private static final String PASSWORD = "geheim"; private static final String EMAIL = USERNAME + "@bologna.it"; private static final Locale LOCALE = Locale.ENGLISH; private static final String CONTENT_TYPE = "image/jpeg"; private static final String ACTIVATION_KEY = "1234"; private Registration registration; @InjectMocks RegistrationHelper registrationHelper; @Mock private RegistrationService registrationService; @Mock private RequestContext requestContext; @Mock private CommunityUser communityUser; @Mock private ExternalContext externalContext; @Mock private DefaultMessageContext messageContext; @Mock private BlobService blobService; @Mock private Blob blob; @Mock private InputStream inputStream; @Mock private CommonsMultipartFile file; @Mock private HttpServletRequest request; @Mock private Page page; @Mock private ElasticSocialPlugin elasticSocialPlugin; @Mock private ElasticSocialConfiguration elasticSocialConfiguration; @Mock private CommunityUserService communityUserService; @Mock private Connection connection; @Mock private org.springframework.social.connect.UserProfile profile; @Mock private HttpSession httpSession; @Mock private ProviderSignInAttempt providerSignInAttempt; @Mock private HttpClient httpClient; @Mock private HttpResponse httpResponse; @Mock private StatusLine statusLine; @Mock private HttpEntity entity; @Mock private Header contentType; @Mock private SharedAttributeMap sessionMap; @Mock private LocalizationContext localizationContext; @Mock private PasswordPolicy passwordPolicy; @Mock private Settings settings; @Mock private ParameterMap parameterMap; @Mock private LoginHelper loginHelper; @Mock private Enumeration<String> headerNames; @SuppressWarnings("unchecked") @Before public void init() throws IOException, URISyntaxException { USER_PROPERTIES.put("givenName", GIVENNAME); USER_PROPERTIES.put("surName", SURNAME); registration = initRegistration(); when(requestContext.getMessageContext()).thenReturn(messageContext); RequestContextHolder.setRequestContext(requestContext); when(externalContext.getLocale()).thenReturn(LOCALE); when(requestContext.getExternalContext()).thenReturn(externalContext); when(externalContext.getNativeRequest()).thenReturn(request); when(request.getAttribute("cmpage")).thenReturn(page); when(messageContext.hasErrorMessages()).thenReturn(false); when(blobService.put(inputStream, CONTENT_TYPE, null)).thenReturn(blob); when(blobService.put(inputStream, CONTENT_TYPE, USERNAME)).thenReturn(blob); when(file.getInputStream()).thenReturn(inputStream); when(file.getContentType()).thenReturn(CONTENT_TYPE); when(communityUser.getLocale()).thenReturn(LOCALE); when(elasticSocialPlugin.getElasticSocialConfiguration(anyVararg())).thenReturn(elasticSocialConfiguration); when(elasticSocialConfiguration.getMaxImageFileSize()).thenReturn(512000); when(request.getAttribute("cmpage")).thenReturn(page); when(profile.getEmail()).thenReturn(EMAIL); when(profile.getUsername()).thenReturn(USERNAME); when(connection.fetchUserProfile()).thenReturn(profile); when(connection.getImageUrl()).thenReturn("http://download.oracle.com/index.html"); when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(httpResponse); when(httpResponse.getStatusLine()).thenReturn(statusLine); when(httpResponse.getEntity()).thenReturn(entity); when(statusLine.getStatusCode()).thenReturn(org.apache.http.HttpStatus.SC_OK); when(entity.getContent()).thenReturn(inputStream); when(entity.getContentType()).thenReturn(contentType); when(contentType.getValue()).thenReturn(CONTENT_TYPE); when(providerSignInAttempt.getConnection()).thenReturn(connection); when(httpSession.getAttribute(ProviderSignInAttempt.class.getName())).thenReturn(providerSignInAttempt); when(registrationService.getUserByToken(any(String.class))).thenReturn(communityUser); when(loginHelper.authenticate(any(SocialAuthenticationToken.class), any(RequestContext.class))).thenReturn(true); when(request.getSession(false)).thenReturn(httpSession); RequestAttributes attributes = new ServletRequestAttributes(request); when(request.getAttributeNames()).thenReturn(headerNames); when(headerNames.hasMoreElements()).thenReturn(false); when(attributes.getAttribute(ProviderSignInAttempt.class.getName(), RequestAttributes.SCOPE_SESSION)).thenReturn(providerSignInAttempt); //when(request.getAttribute(LOCALIZATION_KEY)).thenReturn(localizationContext); when(passwordPolicy.verify(PASSWORD)).thenReturn(true); registrationHelper.initialize(); } @Test public void register() { when(registrationService.register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenReturn(communityUser); boolean isRegistered = registrationHelper.register(registration, requestContext, null); assertTrue(isRegistered); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, never()).addMessage(any(MessageResolver.class)); } @SuppressWarnings({"ThrowableInstanceNeverThrown"}) @Test public void registerButUsernameNotAvailable() { when(registrationService.register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenThrow(new DuplicateNameException(null, null)); boolean isRegistered = registrationHelper.register(registration, requestContext, null); assertFalse(isRegistered); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, atLeast(1)).addMessage(any(MessageResolver.class)); verify(communityUser, never()).save(); } @SuppressWarnings({"ThrowableInstanceNeverThrown"}) @Test public void registerButEmailNotAvailable() { when(registrationService.register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenThrow(new DuplicateEmailException(null, null)); boolean isRegistered = registrationHelper.register(registration, requestContext, null); assertFalse(isRegistered); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, atLeast(1)).addMessage(any(MessageResolver.class)); verify(communityUser, never()).save(); } @SuppressWarnings({"ThrowableInstanceNeverThrown"}) @Test public void registerWithMailException() { when(registrationService.register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenThrow(new MailTemplateNotFoundException("", LOCALE)); boolean isRegistered = registrationHelper.register(registration, requestContext, null); assertFalse(isRegistered); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, atLeast(1)).addMessage(any(MessageResolver.class)); verify(communityUser, never()).save(); } @Test public void testRegisterWithImage() throws IOException { when(registrationService.register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenReturn(communityUser); when(file.getSize()).thenReturn(1000L); boolean userSaved = registrationHelper.register(registration, requestContext, file); assertTrue(userSaved); verify(communityUser).save(); verify(blobService).put(inputStream, CONTENT_TYPE, null); verify(communityUser).setImage(blob); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, never()).addMessage(any(MessageResolver.class)); } @Test public void registerWithAutomaticActivation() { when(registrationService.register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenReturn(communityUser); when(settings.getBoolean("elastic.automatic.user.activation", false)).thenReturn(true); when(registrationService.activateRegistration(anyString(), any(ModerationType.class))).thenReturn(true); registrationHelper.initialize(); boolean isRegistered = registrationHelper.register(registration, requestContext, null); assertTrue(isRegistered); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, Locale.ENGLISH, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(registrationService).activateRegistration(anyString(), any(ModerationType.class)); verify(messageContext, atLeastOnce()).addMessage(message(ACTIVATE_REGISTRATION_SUCCESS)); } @Test public void testRegisterWithBlobException() { when(registrationService.register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenReturn(communityUser); when(file.getSize()).thenReturn(1000L); when(blobService.put(inputStream, CONTENT_TYPE, null)).thenThrow(new BlobException("I/O error")); boolean userSaved = registrationHelper.register(registration, requestContext, file); assertTrue(userSaved); verify(communityUser, never()).save(); verify(blobService).put(inputStream, CONTENT_TYPE, null); verify(communityUser, never()).setImage(blob); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, times(1)).addMessage(any(MessageResolver.class)); } @Test public void testRegisterWithIOException() throws IOException { when(registrationService.register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenReturn(communityUser); when(file.getSize()).thenReturn(1000L); when(file.getInputStream()).thenThrow(new IOException("I/O error")); boolean userSaved = registrationHelper.register(registration, requestContext, file); assertTrue(userSaved); verify(communityUser, never()).save(); verify(blobService, never()).put(inputStream, CONTENT_TYPE, null); verify(communityUser, never()).setImage(blob); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, times(1)).addMessage(any(MessageResolver.class)); } @Test public void testRegisterWithImageTooBig() throws IOException { when(file.getSize()).thenReturn(512001L); when(registrationService.register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenReturn(communityUser); boolean userSaved = registrationHelper.register(registration, requestContext, file); assertTrue(userSaved); verify(communityUser, never()).save(); verify(blobService, never()).put(inputStream, CONTENT_TYPE, null); verify(communityUser, never()).setImage(blob); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, times(1)).addMessage(any(MessageResolver.class)); } @Test public void testRegisterWithImageUnsupportedContentType() throws IOException { when(file.getSize()).thenReturn(512000L); when(file.getContentType()).thenReturn("abcd"); when(registrationService.register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES)).thenReturn(communityUser); boolean userSaved = registrationHelper.register(registration, requestContext, file); assertTrue(userSaved); verify(communityUser, never()).save(); verify(blobService, never()).put(inputStream, CONTENT_TYPE, null); verify(communityUser, never()).setImage(blob); verify(registrationService).register(USERNAME, PASSWORD, EMAIL, LOCALE, TimeZone.getTimeZone("UTC"), USER_PROPERTIES); verify(messageContext, times(1)).addMessage(any(MessageResolver.class)); } @SuppressWarnings("unchecked") @Test public void activateModerationTypeNone() { ModerationType moderationType = ModerationType.NONE; when(registrationService.activateRegistration(ACTIVATION_KEY, moderationType)).thenReturn(true); HttpServletRequest request = mock(HttpServletRequest.class); when(elasticSocialConfiguration.getUserModerationType()).thenReturn(moderationType); when(request.getAttribute("cmpage")).thenReturn(page); when(requestContext.getExternalContext().getNativeRequest()).thenReturn(request); boolean isActivated = registrationHelper.activate(ACTIVATION_KEY, requestContext); assertTrue(isActivated); verify(messageContext, atLeastOnce()).addMessage(message(ACTIVATE_REGISTRATION_SUCCESS)); } @Test public void activateModerationTypePost() { ModerationType moderationType = ModerationType.POST_MODERATION; when(registrationService.activateRegistration(ACTIVATION_KEY, moderationType)).thenReturn(true); when(elasticSocialConfiguration.getUserModerationType()).thenReturn(moderationType); boolean isActivated = registrationHelper.activate(ACTIVATION_KEY, requestContext); assertTrue(isActivated); verify(messageContext, atLeastOnce()).addMessage(message(ACTIVATE_REGISTRATION_SUCCESS)); } @Test public void activateModerationTypePre() { ModerationType moderationType = ModerationType.PRE_MODERATION; when(registrationService.activateRegistration(ACTIVATION_KEY, moderationType)).thenReturn(true); when(elasticSocialConfiguration.getUserModerationType()).thenReturn(moderationType); boolean isActivated = registrationHelper.activate(ACTIVATION_KEY, requestContext); assertTrue(isActivated); verify(messageContext, times(1)).addMessage(any(MessageResolver.class)); } @Test public void activateNotSuccessful() { ModerationType moderationType = ModerationType.PRE_MODERATION; when(registrationService.activateRegistration(ACTIVATION_KEY, moderationType)).thenReturn(false); when(elasticSocialConfiguration.getUserModerationType()).thenReturn(moderationType); boolean isActivated = registrationHelper.activate(ACTIVATION_KEY, requestContext); assertFalse(isActivated); verify(messageContext, times(1)).addMessage(any(MessageResolver.class)); } @SuppressWarnings("unchecked") @Test public void activateTokenExpired() { ModerationType moderationType = ModerationType.PRE_MODERATION; when(registrationService.activateRegistration(ACTIVATION_KEY, moderationType)).thenThrow(new TokenExpiredException("")); when(elasticSocialConfiguration.getUserModerationType()).thenReturn(moderationType); when(request.getAttribute("cmpage")).thenReturn(page); when(requestContext.getExternalContext().getNativeRequest()).thenReturn(request); boolean isActivated = registrationHelper.activate(ACTIVATION_KEY, requestContext); assertFalse(isActivated); verify(messageContext, times(1)).addMessage(any(MessageResolver.class)); } @Test public void redirectLoggedInUserToHomePage() { UserContext.setUser(communityUser); registrationHelper.redirectLoggedInUserToHomePage(requestContext); verify(externalContext).requestExternalRedirect("contextRelative:"); } @Test public void redirectLoggedInUserToHomePageNoUser() { UserContext.clear(); registrationHelper.redirectLoggedInUserToHomePage(requestContext); verify(externalContext, never()).requestExternalRedirect("contextRelative:"); } @Test public void preProcess() { Registration registration = initRegistration(); registrationHelper.preProcess(registration, requestContext); verify(communityUserService).getUserByEmail(EMAIL); verify(communityUserService).getUserByName(USERNAME); verify(messageContext, never()).addMessage(Matchers.<MessageResolver>any()); assertTrue(registration.isRegisteringWithProvider()); } @Test public void preProcessNameAndEmailAlreadyUsed() { when(communityUserService.getUserByEmail(EMAIL)).thenReturn(communityUser); when(communityUserService.getUserByName(USERNAME)).thenReturn(communityUser); registrationHelper.preProcess(initRegistration(), requestContext); verify(communityUserService).getUserByEmail(EMAIL); verify(communityUserService).getUserByName(USERNAME); verify(messageContext, times(2)).addMessage(Matchers.<MessageResolver>any()); } @Test public void preProcessNameAndEmailBlank() { when(profile.getEmail()).thenReturn(""); when(profile.getUsername()).thenReturn(null); registrationHelper.preProcess(initRegistration(), requestContext); verify(communityUserService, never()).getUserByEmail(anyString()); verify(communityUserService, never()).getUserByName(anyString()); verify(messageContext, never()).addMessage(Matchers.<MessageResolver>any()); } @Test public void preProcessConnectionNull() { when(providerSignInAttempt.getConnection()).thenReturn(null); registrationHelper.preProcess(initRegistration(), requestContext); verify(communityUserService, never()).getUserByEmail(EMAIL); verify(communityUserService, never()).getUserByName(USERNAME); verify(messageContext, never()).addMessage(Matchers.<MessageResolver>any()); } @Test public void testPostProcessProviderConnectionDuplicateConnection() { when(requestContext.getExternalContext()).thenReturn(externalContext); when(externalContext.getSessionMap()).thenReturn(sessionMap); when(sessionMap.remove("providerLogin.messageKey")).thenReturn("some.key"); when(requestContext.getRequestParameters()).thenReturn(parameterMap); registrationHelper.postProcessProviderRegistration(requestContext); verify(messageContext).addMessage(Matchers.<MessageResolver>anyObject()); verify(parameterMap).contains("error"); } @Test public void testPostProcessProviderConnectionError() { when(requestContext.getExternalContext()).thenReturn(externalContext); when(externalContext.getSessionMap()).thenReturn(sessionMap); when(requestContext.getRequestParameters()).thenReturn(parameterMap); when(parameterMap.contains("error")).thenReturn(true); registrationHelper.postProcessProviderRegistration(requestContext); verify(messageContext).addMessage(Matchers.<MessageResolver>anyObject()); verify(parameterMap).contains("error"); } private Registration initRegistration() { Registration registration = new Registration(); registration.setUsername(USERNAME); registration.setGivenname(GIVENNAME); registration.setSurname(SURNAME); registration.setEmailAddress(EMAIL); registration.setPassword(PASSWORD); registration.setConfirmPassword(PASSWORD); registration.setTimeZoneId(TimeZone.getTimeZone("UTC").getID()); registration.setPasswordPolicy(passwordPolicy); registration.setAcceptTermsOfUse(true); return registration; } private static MessageResolver message(final String code) { return argThat(new ArgumentMatcher<MessageResolver>() { @Override public boolean matches(Object argument) { return argument instanceof DefaultMessageResolver && asList(((DefaultMessageResolver) argument).getCodes()).equals(asList(code)); } }); } }
30df3f652d299dd753d7779854d102b596393702
5488b952dc5bba7edff028643f1514f01d9b087c
/src/visao/FormUsuario.java
971f06f72f10947070239ef34d730baef90df9ed
[]
no_license
MayaraDinizCostaUchoa/Sistema_de_Cadastro
637fca2338bcbd00e5e1eb9bd8b2fd54405073a6
5057ee0b8d26d55882ac4a0499a1302715ead9e9
refs/heads/main
2023-03-23T21:54:58.492258
2021-03-24T15:37:39
2021-03-24T15:37:39
351,131,775
0
0
null
null
null
null
UTF-8
Java
false
false
26,302
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 visao; import java.sql.SQLException; import java.util.ArrayList; import javax.swing.JOptionPane; import javax.swing.ListSelectionModel; import modeloBeans.BeansUsuario; import modeloBeans.ModeloTabela; import modeloConection.ConectarNoBanco; import modeloDao.DaoUsuario; /** * * @author User */ public class FormUsuario extends javax.swing.JFrame { ConectarNoBanco connBanco = new ConectarNoBanco(); BeansUsuario mod = new BeansUsuario(); DaoUsuario control = new DaoUsuario(); int flag = 0; public FormUsuario() { initComponents(); preencherTabelaUsuario("select *from usuarios order by nome_usuario"); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jButtonVoltar = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jButtonNovo = new javax.swing.JButton(); jButtonSalvar = new javax.swing.JButton(); jButtonCancelar = new javax.swing.JButton(); jButtonEditar = new javax.swing.JButton(); jButtonExcluir = new javax.swing.JButton(); jLabelUsuario = new javax.swing.JLabel(); jTextFieldUsuario = new javax.swing.JTextField(); jPasswordFieldSenha = new javax.swing.JPasswordField(); jLabelSenha = new javax.swing.JLabel(); jPasswordFieldConfirmarSenha = new javax.swing.JPasswordField(); jLabelConfirmarSenha = new javax.swing.JLabel(); jLabelTipo = new javax.swing.JLabel(); jComboBoxTipo = new javax.swing.JComboBox<>(); jTextFieldPesquisar = new javax.swing.JTextField(); jButtonPesquisar = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTableUsuario = new javax.swing.JTable(); jLabelCodUsuario = new javax.swing.JLabel(); jTextFieldCodUsuario = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jButtonVoltarr = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jButtonVoltar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButtonVoltar.setText("Voltar"); jButtonVoltar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonVoltarActionPerformed(evt); } }); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Therapias - Habilitação Pediátrica"); getContentPane().setLayout(null); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 32)); // NOI18N jLabel1.setForeground(new java.awt.Color(0, 102, 102)); jLabel1.setText("CADASTRO DE USUÁRIOS"); getContentPane().add(jLabel1); jLabel1.setBounds(370, 10, 420, 50); jButtonNovo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButtonNovo.setText("Novo"); jButtonNovo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonNovoActionPerformed(evt); } }); getContentPane().add(jButtonNovo); jButtonNovo.setBounds(70, 160, 100, 30); jButtonSalvar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButtonSalvar.setText("Salvar"); jButtonSalvar.setEnabled(false); jButtonSalvar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSalvarActionPerformed(evt); } }); getContentPane().add(jButtonSalvar); jButtonSalvar.setBounds(70, 200, 100, 30); jButtonCancelar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButtonCancelar.setText("Cancelar"); jButtonCancelar.setEnabled(false); jButtonCancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonCancelarActionPerformed(evt); } }); getContentPane().add(jButtonCancelar); jButtonCancelar.setBounds(70, 320, 100, 30); jButtonEditar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButtonEditar.setText("Editar"); jButtonEditar.setEnabled(false); jButtonEditar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonEditarActionPerformed(evt); } }); getContentPane().add(jButtonEditar); jButtonEditar.setBounds(70, 240, 100, 30); jButtonExcluir.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButtonExcluir.setText("Excluir"); jButtonExcluir.setEnabled(false); jButtonExcluir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonExcluirActionPerformed(evt); } }); getContentPane().add(jButtonExcluir); jButtonExcluir.setBounds(70, 280, 100, 30); jLabelUsuario.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabelUsuario.setText("Usuário:"); getContentPane().add(jLabelUsuario); jLabelUsuario.setBounds(310, 110, 50, 16); jTextFieldUsuario.setEnabled(false); getContentPane().add(jTextFieldUsuario); jTextFieldUsuario.setBounds(370, 100, 280, 30); jPasswordFieldSenha.setEnabled(false); getContentPane().add(jPasswordFieldSenha); jPasswordFieldSenha.setBounds(370, 150, 200, 30); jLabelSenha.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabelSenha.setText("Senha:"); getContentPane().add(jLabelSenha); jLabelSenha.setBounds(320, 160, 41, 16); jPasswordFieldConfirmarSenha.setEnabled(false); jPasswordFieldConfirmarSenha.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPasswordFieldConfirmarSenhaActionPerformed(evt); } }); getContentPane().add(jPasswordFieldConfirmarSenha); jPasswordFieldConfirmarSenha.setBounds(700, 150, 180, 30); jLabelConfirmarSenha.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabelConfirmarSenha.setText("Confirma Senha:"); getContentPane().add(jLabelConfirmarSenha); jLabelConfirmarSenha.setBounds(590, 160, 97, 16); jLabelTipo.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabelTipo.setText("Tipo:"); getContentPane().add(jLabelTipo); jLabelTipo.setBounds(330, 200, 30, 16); jComboBoxTipo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "-------------------", "Administrativo", "Direção", "Financeiro", "Recepção", "Terapeuta", "ADS" })); jComboBoxTipo.setEnabled(false); getContentPane().add(jComboBoxTipo); jComboBoxTipo.setBounds(370, 190, 120, 30); getContentPane().add(jTextFieldPesquisar); jTextFieldPesquisar.setBounds(400, 300, 260, 30); jButtonPesquisar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButtonPesquisar.setText("Pesquisar"); jButtonPesquisar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonPesquisarActionPerformed(evt); } }); getContentPane().add(jButtonPesquisar); jButtonPesquisar.setBounds(670, 300, 100, 30); jTableUsuario.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {}, {}, {}, {} }, new String [] { } )); jTableUsuario.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTableUsuarioMouseClicked(evt); } }); jScrollPane1.setViewportView(jTableUsuario); getContentPane().add(jScrollPane1); jScrollPane1.setBounds(350, 360, 460, 100); jLabelCodUsuario.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jLabelCodUsuario.setText("Cod.:"); getContentPane().add(jLabelCodUsuario); jLabelCodUsuario.setBounds(680, 110, 31, 16); jTextFieldCodUsuario.setEnabled(false); jTextFieldCodUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextFieldCodUsuarioActionPerformed(evt); } }); getContentPane().add(jTextFieldCodUsuario); jTextFieldCodUsuario.setBounds(720, 100, 60, 30); jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/foto.png"))); // NOI18N getContentPane().add(jLabel3); jLabel3.setBounds(50, 30, 110, 110); jPanel1.setBackground(new java.awt.Color(0, 102, 102)); getContentPane().add(jPanel1); jPanel1.setBounds(270, 260, 610, 5); jButtonVoltarr.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N jButtonVoltarr.setText("Voltar"); jButtonVoltarr.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonVoltarrActionPerformed(evt); } }); getContentPane().add(jButtonVoltarr); jButtonVoltarr.setBounds(70, 400, 100, 30); jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/tela_adjacentes.jpg"))); // NOI18N getContentPane().add(jLabel2); jLabel2.setBounds(0, 0, 890, 480); setSize(new java.awt.Dimension(906, 516)); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jPasswordFieldConfirmarSenhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordFieldConfirmarSenhaActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jPasswordFieldConfirmarSenhaActionPerformed private void jButtonNovoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNovoActionPerformed flag = 1; jTextFieldUsuario.setEnabled(true); jPasswordFieldSenha.setEnabled(true); jPasswordFieldConfirmarSenha.setEnabled(true); jComboBoxTipo.setEnabled(true); jTextFieldPesquisar.setEnabled(false); jButtonSalvar.setEnabled(true); jButtonCancelar.setEnabled(true); jButtonEditar.setEnabled(false); jButtonPesquisar.setEnabled(false); jButtonNovo.setEnabled(false); jButtonCancelar.setEnabled(false); jTextFieldUsuario.setText(""); jComboBoxTipo.setSelectedItem(""); jPasswordFieldSenha.setText(""); jPasswordFieldConfirmarSenha.setText(""); jTextFieldPesquisar.setText(""); jTextFieldCodUsuario.setText(""); }//GEN-LAST:event_jButtonNovoActionPerformed private void jButtonSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSalvarActionPerformed try { if(jTextFieldUsuario.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Preencha o campo USUÁRIO para continuar"); jTextFieldUsuario.requestFocus(); }else if(jPasswordFieldSenha.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Preencha o campo SENHA para continuar"); jPasswordFieldSenha.requestFocus(); }else if(jPasswordFieldConfirmarSenha.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Preencha o campo CONFIRMAR SENHA para continuar"); jPasswordFieldConfirmarSenha.requestFocus(); }else if(jPasswordFieldSenha.getText().equals(jPasswordFieldConfirmarSenha.getText())){ if(flag ==1){ mod.setNomeUsuario(jTextFieldUsuario.getText()); mod.setSenhaUsuario(jPasswordFieldSenha.getText()); mod.setTipoUsuario((String)jComboBoxTipo.getSelectedItem()); control.Salvar(mod); preencherTabelaUsuario("select *from usuarios order by nome_usuario"); jTextFieldUsuario.setText(""); jPasswordFieldSenha.setText(""); jPasswordFieldConfirmarSenha.setText(""); jComboBoxTipo.setSelectedItem(""); jTextFieldPesquisar.setText(""); jTextFieldUsuario.setEnabled(false); jPasswordFieldSenha.setEnabled(false); jPasswordFieldConfirmarSenha.setEnabled(false); jComboBoxTipo.setEnabled(false); jTextFieldPesquisar.setEnabled(true); jButtonSalvar.setEnabled(false); jButtonCancelar.setEnabled(false); jButtonPesquisar.setEnabled(true); jButtonNovo.setEnabled(true); jTextFieldCodUsuario.setText(""); jButtonCancelar.setEnabled(false); }else{ mod.setCodUsuario(Integer.parseInt(jTextFieldCodUsuario.getText())); mod.setNomeUsuario(jTextFieldUsuario.getText()); mod.setSenhaUsuario(jPasswordFieldSenha.getText()); mod.setTipoUsuario((String)jComboBoxTipo.getSelectedItem()); control.Editar(mod); preencherTabelaUsuario("select *from usuarios order by nome_usuario"); jTextFieldCodUsuario.setText(""); jTextFieldUsuario.setText(""); jPasswordFieldSenha.setText(""); jPasswordFieldConfirmarSenha.setText(""); jTextFieldPesquisar.setText(""); jComboBoxTipo.setSelectedItem(""); jTextFieldUsuario.setEnabled(false); jPasswordFieldSenha.setEnabled(false); jPasswordFieldConfirmarSenha.setEnabled(false); jComboBoxTipo.setEnabled(false); jTextFieldPesquisar.setEnabled(true); jButtonPesquisar.setEnabled(true); jButtonSalvar.setEnabled(false); jButtonNovo.setEnabled(true); jButtonCancelar.setEnabled(false); jButtonEditar.setEnabled(false); } }else{ JOptionPane.showMessageDialog(rootPane, "Senhas não correspondem!"); } } catch (SQLException ex) { //Logger.getLogger(FormFuncionarios.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButtonSalvarActionPerformed private void jTextFieldCodUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldCodUsuarioActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextFieldCodUsuarioActionPerformed private void jButtonPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesquisarActionPerformed mod.setPesquisar(jTextFieldPesquisar.getText()); BeansUsuario model = control.buscaUsuario(mod); jTextFieldCodUsuario.setText(String.valueOf(model.getCodUsuario())); jTextFieldUsuario.setText(model.getNomeUsuario()); jPasswordFieldSenha.setText(model.getSenhaUsuario()); jPasswordFieldConfirmarSenha.setText(model.getSenhaUsuario()); jComboBoxTipo.setSelectedItem(model.getTipoUsuario()); jButtonExcluir.setEnabled(!true); jButtonEditar.setEnabled(!true); jButtonNovo.setEnabled(true); jButtonCancelar.setEnabled(false); preencherTabelaUsuario("select *from usuarios where nome_usuario like'%" + jTextFieldPesquisar.getText() +"%'"); }//GEN-LAST:event_jButtonPesquisarActionPerformed private void jButtonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarActionPerformed jTextFieldUsuario.setEnabled(!true); jPasswordFieldSenha.setEnabled(!true); jPasswordFieldConfirmarSenha.setEnabled(!true); jComboBoxTipo.setEnabled(!true); jTextFieldPesquisar.setEnabled(true); jButtonPesquisar.setEnabled(true); jButtonSalvar.setEnabled(!true); jButtonCancelar.setEnabled(!true); jButtonNovo.setEnabled(true); jButtonEditar.setEnabled(false); jButtonExcluir.setEnabled(false); jTextFieldUsuario.setText(""); jPasswordFieldSenha.setText(""); jPasswordFieldConfirmarSenha.setText(""); jComboBoxTipo.setSelectedItem(""); jTextFieldCodUsuario.setText(""); jTextFieldPesquisar.setText(""); }//GEN-LAST:event_jButtonCancelarActionPerformed private void jButtonVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVoltarActionPerformed dispose(); }//GEN-LAST:event_jButtonVoltarActionPerformed private void jButtonEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditarActionPerformed flag = 2; jTextFieldUsuario.setEnabled(true); jPasswordFieldSenha.setEnabled(true); jPasswordFieldConfirmarSenha.setEnabled(true); jComboBoxTipo.setEnabled(true); jTextFieldPesquisar.setEnabled(false); jButtonPesquisar.setEnabled(false); jButtonSalvar.setEnabled(true); jButtonCancelar.setEnabled(true); jButtonEditar.setEnabled(false); jButtonNovo.setEnabled(false); jButtonExcluir.setEnabled(false); preencherTabelaUsuario("select *from usuarios"); }//GEN-LAST:event_jButtonEditarActionPerformed private void jButtonExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExcluirActionPerformed int resposta= 0; resposta = JOptionPane.showConfirmDialog(rootPane, "Deseja realmente excluir?"); if(resposta == JOptionPane.YES_OPTION){ mod.setCodUsuario(Integer.parseInt(jTextFieldCodUsuario.getText())); control.Excluir(mod); preencherTabelaUsuario("select *from usuarios order by nome_usuario"); jTextFieldUsuario.setText(""); jPasswordFieldSenha.setText(""); jPasswordFieldConfirmarSenha.setText(""); jComboBoxTipo.setSelectedItem(""); jTextFieldCodUsuario.setText(""); jTextFieldPesquisar.setText(""); jButtonSalvar.setEnabled(false); jButtonCancelar.setEnabled(false); jButtonEditar.setEnabled(false); jButtonNovo.setEnabled(true); jButtonExcluir.setEnabled(false); } }//GEN-LAST:event_jButtonExcluirActionPerformed private void jTableUsuarioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableUsuarioMouseClicked String nome_usuario = "" + jTableUsuario.getValueAt(jTableUsuario.getSelectedRow(), 1); connBanco.conexao(); connBanco.executaSQL("select *from usuarios where nome_usuario='"+nome_usuario+"'"); try { connBanco.rs.first(); jTextFieldCodUsuario.setText(String.valueOf(connBanco.rs.getInt("cod_usuario"))); jTextFieldUsuario.setText(connBanco.rs.getString("nome_usuario")); jComboBoxTipo.setSelectedItem(connBanco.rs.getString("tipo_usuario")); jPasswordFieldSenha.setText(connBanco.rs.getString("senha_usuario")); jPasswordFieldConfirmarSenha.setText(connBanco.rs.getString("senha_usuario")); connBanco.desconecta(); } catch (SQLException ex) { JOptionPane.showMessageDialog(rootPane, "Erro ao selecionar os dados!\nERRO:" + ex); } connBanco.desconecta(); jButtonNovo.setEnabled(false); jButtonEditar.setEnabled(true); jButtonExcluir.setEnabled(true); jButtonCancelar.setEnabled(true); jButtonSalvar.setEnabled(false); jTextFieldCodUsuario.setEnabled(false); jTextFieldUsuario.setEnabled(false); jPasswordFieldSenha.setEnabled(false); jPasswordFieldConfirmarSenha.setEnabled(false); jComboBoxTipo.setEnabled(false); }//GEN-LAST:event_jTableUsuarioMouseClicked private void jButtonVoltarrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVoltarrActionPerformed dispose(); }//GEN-LAST:event_jButtonVoltarrActionPerformed public void preencherTabelaUsuario(String Sql){ ArrayList dados = new ArrayList(); String[] colunas = new String[] {"Cód.","Usuário","Tipo"}; connBanco.conexao(); connBanco.executaSQL(Sql); try{ connBanco.rs.first(); do{ dados.add(new Object[]{connBanco.rs.getInt("cod_usuario"), connBanco.rs.getString("nome_usuario"), connBanco.rs.getString("tipo_usuario")}); }while(connBanco.rs.next()); }catch (SQLException ex){ JOptionPane.showMessageDialog(rootPane, "Erro ao preencher ArrayListUsu" + ex); } ModeloTabela modelo= new ModeloTabela(dados, colunas); jTableUsuario.setModel(modelo); jTableUsuario.getColumnModel().getColumn(0).setPreferredWidth(40); jTableUsuario.getColumnModel().getColumn(0).setResizable(false); jTableUsuario.getColumnModel().getColumn(1).setPreferredWidth(250); jTableUsuario.getColumnModel().getColumn(1).setResizable(false); jTableUsuario.getColumnModel().getColumn(2).setPreferredWidth(120); jTableUsuario.getColumnModel().getColumn(2).setResizable(false); jTableUsuario.getTableHeader().setReorderingAllowed(false); jTableUsuario.setAutoResizeMode(jTableUsuario.AUTO_RESIZE_OFF); jTableUsuario.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); connBanco.desconecta(); } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(FormUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(FormUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(FormUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(FormUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FormUsuario().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonCancelar; private javax.swing.JButton jButtonEditar; private javax.swing.JButton jButtonExcluir; private javax.swing.JButton jButtonNovo; private javax.swing.JButton jButtonPesquisar; private javax.swing.JButton jButtonSalvar; private javax.swing.JButton jButtonVoltar; private javax.swing.JButton jButtonVoltarr; private javax.swing.JComboBox<String> jComboBoxTipo; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabelCodUsuario; private javax.swing.JLabel jLabelConfirmarSenha; private javax.swing.JLabel jLabelSenha; private javax.swing.JLabel jLabelTipo; private javax.swing.JLabel jLabelUsuario; private javax.swing.JPanel jPanel1; private javax.swing.JPasswordField jPasswordFieldConfirmarSenha; private javax.swing.JPasswordField jPasswordFieldSenha; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTableUsuario; private javax.swing.JTextField jTextFieldCodUsuario; private javax.swing.JTextField jTextFieldPesquisar; private javax.swing.JTextField jTextFieldUsuario; // End of variables declaration//GEN-END:variables }
a479780e00e10f77497894e0c2b84f0553374415
6ce17c44a2c20fd315f9c0c901d79787ec427b6e
/applicationSprint2/app/build/generated/source/buildConfig/debug/com/foxes/capstone/BuildConfig.java
f612e789cc6a47c4c511e96ab3e86737afdfc6a2
[]
no_license
foxes/test4time
39f904ba30cf096fbed4d330f2610d314630e565
a4aa0d281ba4519588f63a367a01b02d05f913d6
refs/heads/master
2021-01-11T11:01:26.627450
2017-09-19T18:31:07
2017-09-19T18:31:07
78,816,894
0
3
null
2017-04-21T01:31:41
2017-01-13T05:01:40
Java
UTF-8
Java
false
false
443
java
/** * Automatically generated file. DO NOT MODIFY */ package com.foxes.capstone; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.foxes.capstone"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
a8687295c5fb912ed97e2d3e90596aa6a0ae38b7
69414473d63b2ff36387e30d9da394098695ddd6
/src/plugins/hm/src/java/larson/hm/plugin/util/JdbcUtils.java
7ca4c1c3c0c0ebc54897898bb45cd7ae3153fc3d
[]
no_license
larsonzhong/HM_Plugin
b57c12ac6a94372600c7179f2566343a0c6c9db0
e7d6d256b46ccc68fc1f8b17ac5f417a30c67399
refs/heads/master
2016-09-05T10:32:25.508458
2015-04-22T10:39:00
2015-04-22T10:39:00
33,908,671
0
0
null
null
null
null
UTF-8
Java
false
false
9,109
java
package larson.hm.plugin.util; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import larson.hm.plugin.handler.ResultSetHandler; import larson.hm.plugin.model.bean.Homework; import larson.hm.plugin.model.bean.Major; import larson.hm.plugin.model.bean.Notice; import larson.hm.plugin.model.bean.Subject; import org.jivesoftware.database.DbConnectionManager; /** * ��ݿ���� * * @author Larson * */ public class JdbcUtils { /** * 获取连接 * * @return * @throws SQLException */ private static Connection getConnection() throws SQLException { return DbConnectionManager.getConnection(); } /** * 关闭连接 * * @param resultSet * @param statement * @param connection */ public static void release(Connection connection, PreparedStatement statement, ResultSet resultSet) { DbConnectionManager.closeConnection(resultSet, statement, connection); } /** * * @param sql * @param params * @throws SQLException */ public static int update(String sql, Object params[]) throws SQLException { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; int effectRaw = 0; try { conn = getConnection(); ps = conn.prepareStatement(sql); for (int i = 0; i < params.length; i++) { ps.setObject(i + 1, params[i]); } effectRaw = ps.executeUpdate(); } finally { release(conn, ps, rs); } return effectRaw; } /** * * @param sql * @param params * @param rsh * @return * @throws Exception */ public static <T> Object query(String sql, Object params[], ResultSetHandler rsh) throws Exception { Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try { conn = getConnection(); st = conn.prepareStatement(sql); for (int i = 0; i < params.length; i++) { st.setObject(i + 1, params[i]); } rs = st.executeQuery(); return rsh.handler(rs); } finally { release(conn, st, rs); } } /** * ��ȡ���е�major * * @param beanHandler * @param sql * @return */ public static List<Major> getAllMajors(String sql) { Connection conn = null; PreparedStatement st = null; ResultSet rs = null; Major major = null; List<Major> majors = new ArrayList<Major>(); try { conn = getConnection(); st = conn.prepareStatement(sql); rs = st.executeQuery(sql); while (rs.next()) { major = new Major(); major.setId(rs.getInt("id")); major.setName(rs.getString("name")); majors.add(major); major = null; } return majors; } catch (Exception e) { throw new MyException(e); } finally { release(conn, st, rs); } } /** * * @param beanHandler * @param sql * @return */ public static List<Subject> getAllSubjects(String sql) { Connection conn = null; PreparedStatement st = null; ResultSet rs = null; Subject subject = null; List<Subject> subjects = new ArrayList<Subject>(); try { conn = getConnection(); st = conn.prepareStatement(sql); rs = st.executeQuery(sql); while (rs.next()) { subject = new Subject(); subject.setId(rs.getInt("id")); subject.setName(rs.getString("name")); subject.setMajorName(rs.getString("majorName")); subjects.add(subject); subject = null; } return subjects; } catch (Exception e) { throw new MyException(e); } finally { release(conn, st, rs); } } /** * ��ʱ�õ�homework��� * * @param sql * @throws SQLException */ public static void addHomework(String sql) throws SQLException { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = getConnection(); ps = conn.prepareStatement(sql); ps.executeUpdate(); } finally { release(conn, ps, rs); } } /** * 获取给定时间的前两周的数据 * * @param sql * @return */ public static List<Notice> get2WeekNotice(String sql) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Notice notice = null; List<Notice> notices = new ArrayList<Notice>(); try { conn = getConnection(); ps = conn.prepareStatement(sql); rs = ps.executeQuery(sql); while (rs.next()) { notice = new Notice(); notice.setId(rs.getInt("id")); notice.setTitle(rs.getString("title")); notice.setContent(rs.getString("content")); notice.setType(rs.getInt("type")); long pubT = Long.parseLong(rs.getString("publishTime")); notice.setPublishTime(pubT); if (is2Week(pubT)) notices.add(notice); notice = null; } return notices; } catch (Exception e) { throw new MyException(e); } finally { release(conn, ps, rs); } } private static boolean is2Week(long pubT) { long curT = System.currentTimeMillis(); if ((curT - pubT) / (1000 * 3600 * 24 * 14) < 1) return true; else return false; } /** * 获取客户端发布时间以后的消息 * * @param sql * @param lastNoticePublishTime * @return */ public static List<Notice> getAfterNotice(String sql, String lastNoticePublishTime) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Notice notice = null; List<Notice> notices = new ArrayList<Notice>(); try { conn = getConnection(); ps = conn.prepareStatement(sql); rs = ps.executeQuery(sql); while (rs.next()) { notice = new Notice(); notice.setId(rs.getInt("id")); notice.setTitle(rs.getString("title")); notice.setContent(rs.getString("content")); notice.setType(rs.getInt("type")); long sqlPubT = Long.parseLong(rs.getString("publishTime")); notice.setPublishTime(sqlPubT); if (isAfterTime(sqlPubT, lastNoticePublishTime)) notices.add(notice); notice = null; } return notices; } catch (Exception e) { throw new MyException(e); } finally { release(conn, ps, rs); } } /** * 给定的时间lastNoticePublishTime是不是在查询的数据之前,是的话true * * @param pubT * 查询到的数据发布时间 * @param lastNoticePublishTime * 软件收到最后的消息时间 * @return */ private static boolean isAfterTime(long sqlPubT, String lastNoticePublishTime) { long lastTime = Long.parseLong(lastNoticePublishTime); if ((sqlPubT - lastTime) > 0) return true; else return false; } public static List<Homework> getAfterHomeworks(String sql, String lastHomeworkPublishTime) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Homework homework = null; List<Homework> homeworks = new ArrayList<Homework>(); try { conn = getConnection(); ps = conn.prepareStatement(sql); rs = ps.executeQuery(sql); while (rs.next()) { homework = new Homework(); homework.setId(rs.getInt("id")); homework.setId(rs.getInt("id")); homework.setDescribe(rs.getString("content")); homework.setImageUrl(rs.getString("imageUrl")); homework.setLimitTime(rs.getString("limitTime")); homework.setSubject(rs.getString("subject")); homework.setType(rs.getString("type")); homework.setVoiceUrl(rs.getString("voiceUrl")); long pubT = Long.parseLong(rs.getString("publishTime")); homework.setPublishTime(pubT); if (isAfterTime(pubT, lastHomeworkPublishTime)) homeworks.add(homework); homework = null; } return homeworks; } catch (Exception e) { throw new MyException(e); } finally { release(conn, ps, rs); } } /** * 获取给定时间的前两周的数据 * * @param sql * @return */ public static List<Homework> get2WeekHomeworks(String sql) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Homework homework = null; List<Homework> homeworks = new ArrayList<Homework>(); try { conn = getConnection(); ps = conn.prepareStatement(sql); rs = ps.executeQuery(sql); while (rs.next()) { homework = new Homework(); homework.setId(rs.getInt("id")); homework.setDescribe(rs.getString("content")); homework.setImageUrl(rs.getString("imageUrl")); homework.setLimitTime(rs.getString("limitTime")); homework.setSubject(rs.getString("subject")); homework.setType(rs.getString("type")); homework.setVoiceUrl(rs.getString("voiceUrl")); long pubT = Long.parseLong(rs.getString("publishTime")); homework.setPublishTime(pubT); if (is2Week(pubT)) homeworks.add(homework); homework = null; } return homeworks; } catch (Exception e) { throw new MyException(e); } finally { release(conn, ps, rs); } } }
3ef61de33cf64946824309233b664c61e8c240f5
cd1d792fa7caad7b14755fb53063323ee2097f59
/src/io/renren/controller/SysLoginController.java
70357532b0811c8331c81f98d609eff66c6e6938
[]
no_license
zhouqing0428/CAHGAdmin
383fe179f11b090b066596654c41ee8271e69920
f08df7a18a65bb352396ba01e644c62c5f7de507
refs/heads/master
2020-09-09T08:21:43.783274
2019-12-19T09:31:08
2019-12-19T09:31:08
221,397,758
0
0
null
null
null
null
UTF-8
Java
false
false
3,132
java
package io.renren.controller; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.LockedAccountException; import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.crypto.hash.Sha256Hash; import org.apache.shiro.subject.Subject; 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.ResponseBody; import com.google.code.kaptcha.Constants; import com.google.code.kaptcha.Producer; import io.renren.utils.R; import io.renren.utils.ShiroUtils; /** * 登录相关 * * @author * @email * @date */ @Controller public class SysLoginController { @Autowired private Producer producer; @RequestMapping("captcha.jpg") public void captcha(HttpServletResponse response)throws ServletException, IOException { response.setHeader("Cache-Control", "no-store, no-cache"); response.setContentType("image/jpeg"); //生成文字验证码 String text = producer.createText(); //生成图片验证码 BufferedImage image = producer.createImage(text); //保存到shiro session ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text); ServletOutputStream out = response.getOutputStream(); ImageIO.write(image, "jpg", out); } /** * 登录 */ @ResponseBody @RequestMapping(value = "/sys/login", method = RequestMethod.POST) public R login(String username, String password, String captcha)throws IOException { // String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); // if(!captcha.equalsIgnoreCase(kaptcha)){ // return R.error("验证码不正确"); // } try{ Subject subject = ShiroUtils.getSubject(); //sha256加密 password = new Sha256Hash(password).toHex(); UsernamePasswordToken token = new UsernamePasswordToken(username, password); subject.login(token); //subject.login()调用这样的时候,就会调doGetAuthenticationInfo方法 }catch (UnknownAccountException e) { return R.error(e.getMessage()); }catch (IncorrectCredentialsException e) { return R.error(e.getMessage()); }catch (LockedAccountException e) { return R.error(e.getMessage()); }catch (AuthenticationException e) { return R.error("账户验证失败"); } return R.ok(); } /** * 退出 */ @RequestMapping(value = "logout", method = RequestMethod.GET) public String logout() { ShiroUtils.logout(); return "redirect:login.html"; } }
ba5e80a927d112ef6154a4197981837419b4ce26
f5e869f0369b42833f09c0e99d64b7950876479a
/com/assignment/MinHeap.java
8b864f6ec6e5b02b5035888fc6bb89bfa97feece
[]
no_license
chaandchopra/MinimumSpanningTree
518dfd8b1b67cf6ca8cc0e43e5ddc5639f0dd826
2ca88d7249c3ee6bec0175c09a14507e65331e7c
refs/heads/master
2020-05-02T16:59:55.300284
2019-03-29T20:06:23
2019-03-29T20:06:23
178,085,371
0
1
null
null
null
null
UTF-8
Java
false
false
3,389
java
//MinHeap package com.assignment; import java.util.*; import java.lang.*; /** * Write a description of class Heap here. * * @author (your name) * @version (a version number or a date) */ public class MinHeap { // instance variables - replace the example below with your own private Node [] myHeap; private int capacity; private int size; /** * Constructor for objects of class Heap */ public MinHeap(int capacity) { this.myHeap = new Node[capacity]; this.size = 0; this.capacity = capacity; } public MinHeap(Node list[]) { // initialise instance variables this.myHeap = new Node[list.length]; this.myHeap = list; this.capacity = list.length; this.size = list.length; } private int lchild(int i){ return 2*i; } private int rchild(int i){ return 2*i+1; } private int parent(int i){ return i/2; } public void Heapify(int i) { int l = lchild(i); //int size = this.myHeap.length; int r = rchild(i); int smallest = i; //System.out.println("smallest "+ smallest + " l " + l + " r "+ r ); if(l < size && this.myHeap[l].getWeight() <= this.myHeap[i].getWeight()) smallest = l; else smallest = i; if(r < size && this.myHeap[r].getWeight() <= this.myHeap[smallest].getWeight()) smallest = r; //System.out.println("after comparing -smallest "+ smallest + " l " + l + " r "+ r ); if(smallest != i) { Node temp = this.myHeap[i]; this.myHeap[i] = this.myHeap[smallest]; this.myHeap[smallest] = temp; Heapify(smallest); } } public void BuildHeap() { int n = this.myHeap.length; int value = (int)Math.floor(n/2)-1; for(int i = value; i >= 0; --i) { Heapify(i); } } public Node extractMin() { //System.out.println("emin size " + size); if(this.size == 0){ System.out.println("Heap Underflow"); return null; } Node r = myHeap[0]; myHeap[0] = myHeap[this.size - 1]; myHeap[this.size - 1] = r; this.size--; Heapify(0); return r; } public void addElement(Node n) { //System.out.println if(this.size == this.capacity) { System.out.println("Overflow"); return; } myHeap[this.size] = n; int current = this.size; this.size++; //System.out.println("MinHeap size "+this.size); while (myHeap[current].getWeight() < myHeap[parent(current)].getWeight()) { //swap(current, parent(current)); Node temp = myHeap[current]; myHeap[current] = myHeap[parent(current)]; myHeap[parent(current)] = temp; current = parent(current); } } public void HeapSort() { BuildHeap(); int n = this.myHeap.length, k = n; while(k >= 0) { Heapify(k); k--; } } public String toString() { String s = ""; for(Node n : myHeap) { s = s + n + " "; } return s; } }
7e302de1c6355581a541a909386459e01a69c9ab
d4f7f00b2ba06f4e63f098b671aa0e7826beaeb5
/src/main/java/com/falana/awaf/context/controls/RateLimit.java
e84f60ef2e25c10b9c858822acfb7b121e9170dd
[]
no_license
falanadamian/awaf
a2357b8f4d19802df7b736d1c894dd5f11353f84
d6998976b05b5d218340690cf09bd334b4c0b996
refs/heads/master
2022-07-14T19:52:34.416463
2020-05-17T14:17:23
2020-05-17T14:17:23
264,683,418
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.falana.awaf.context.controls; import lombok.Getter; import lombok.Setter; import java.util.ArrayList; import java.util.List; @Getter @Setter public class RateLimit { private List<IPSecThroughput> ipSecThroughputs = new ArrayList<>(); private List<String> whitelist = new ArrayList<>(); }
5c7bbe422e7dca0dce62bff70cfe8f5f3590ee4b
b5a060b26216e1f1f633f18bca33d9201378083e
/src/main/java/com/example/making_restaurant/application/service/FileService.java
f8aa213418af43afc601898184940f9b173598d5
[]
no_license
wuvp2356/making_restaurant
9bf1c111ad73804f6faec04e70f5bab440458108
e4a557a7bc114e70d6c75a8c4fdbb92d714ba500
refs/heads/making_restaurant
2023-01-02T00:18:09.605917
2020-10-01T12:54:41
2020-10-01T12:54:41
293,083,525
0
0
null
2020-09-20T01:25:25
2020-09-05T13:41:04
Java
UTF-8
Java
false
false
3,159
java
package com.example.making_restaurant.application.service; import java.util.UUID; import com.example.making_restaurant.infrastructure.File; import com.example.making_restaurant.infrastructure.FileRepository; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * メニューのサービスクラス * ユーザが行いたい操作(いわゆるユースケース)を記述する * これでSpringMVC + Thymeleafでできる基本的なことは全部 * あとはMVCのMのところ、モデルを作るのが一番重要で大変なところ * M: Model * V: View * C: Controller * VはThymeleaf, Cはcontroller, Serviceを通してModelを動かす * thymeleafはhtmlにControllerから受けとったパラメータを埋め込む役割 * よくあるダメな例として、Thymeleafの中に業務ロジックを書く、というのがある。 * thymeleafはControllerからパラメータを受け取って、htmlに埋め込む。 * <div th:text="${message}">この部分がmessageで置き換わるよ!</div> * でも一応thymeleafにもif文とかがあって、条件によって表示する・しないとかが制御できる * でもそれを間違って使うと、本来業務として判断するロジックをthymeleafでやってしまって、 * 巨大なhtmlが作り上げられる。 * そうそう、一部機能を使わないとか本当はmodel内で判定すべきことがviewでやれてしまう * そうなると「業務」の流れがmodel内だけじゃなく、viewも見に行かないと分からなくなるから、 * 死ぬ。 * あとthymeleaf見てわかる通りjavaじゃないから、参照関係で追うことも難しい。 * どうしてもviewとmodelの形が合わない場合はdto(data transfer object)や * view modelを使う。 * 業務ロジックは絶対にmodelの中に閉じ込めないといけない。 * 障害や改修のときもそうだけど、システム移行のときもmodelがあるかどうかでかなり違う。 * コストでいうと多分数十倍ぐらい変わる。 * というわけで、商品の新規登録、一覧表示の機能を画面も合わせて実装してみて。 * 画面から新規登録するときはhtmlのformっていうのを使うと、楽にPOSTできるよ。 * 多分PHPでやってたから分かると思う。 * あ、あとgit push ってできる? */ @Service public class FileService { private final FileRepository fileRepository; public FileService(FileRepository fileRepository) { this.fileRepository = fileRepository; } /** * メニューを全検索する */ public List<File> findAll() { return (List)fileRepository.findAll(); } /** * メニューを新しく作る */ public File create(String name,String startdate,String enddate) { final File file = new File(); file.setUuId(UUID.randomUUID()); file.setName(name); file.setStartdate(startdate); file.setEnddate(enddate); return fileRepository.save(file); } }
077202f807556dfcd710fc7cf910b7c6f93eb365
7060b864e2b1e87d066a42c29a69abaf6fa9a417
/app/src/main/java/com/norah1to/simplenotification/ViewModel/TagViewModel.java
29aa83144b7d71899d7d28756c111a3e6b5ff2fe
[ "BSD-2-Clause" ]
permissive
NoraH1to/newSimpleNotification
cb4ed5aec66048945bcf5c47ac3dbbff1112a8cd
503bb4f4e832e905e6e43a192b05833c1b1f425e
refs/heads/master
2022-12-21T06:03:24.368213
2019-12-06T15:44:08
2019-12-06T15:44:08
221,650,843
0
0
null
null
null
null
UTF-8
Java
false
false
1,360
java
package com.norah1to.simplenotification.ViewModel; import android.app.Application; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import com.norah1to.simplenotification.Entity.Tag; import com.norah1to.simplenotification.Repository.TagRepository; import java.util.List; public class TagViewModel extends AndroidViewModel { private TagRepository mRepository; private LiveData<List<Tag>> mAllTags; public TagViewModel(Application application) { super(application); mRepository = new TagRepository(application); mAllTags = mRepository.getmAllTags(); } // 全部 tag public LiveData<List<Tag>> getmAllTags() { return mAllTags; } // 插入一条 public void insert(Tag tag) { mRepository.insert(tag); } // 删除一条 public int delete(Tag tag) { return mRepository.deleteTag(tag); } // 根据内容删掉一条 public int deleteByName(String name) { return mRepository.deleteTagByName(name); } // 根据内容查找一条 public Tag getTagByName(String name) { return mRepository.getTagByName(name); } // 根据 tagID 拿到一条 public Tag getTag(String tagID) { return mRepository.getTag(tagID); } }
be4628aa2cd5ee4c4dd48d83b0f85df4f8cacbd6
4a9ba943a3dbccfb2b92641f14c39e9b56707c21
/src/java/iotbay/g15/model/PaymentInfo.java
7402c6b711a1d5c789aa12bfdfa7ae00fb77f6a3
[]
no_license
rjyg/IoTBay
e743338e8700edfcf40894c0a559038f7ec3faae
81f346827cdeff238b3c4ec81dbb3df6a1e702af
refs/heads/master
2023-05-07T01:08:51.681603
2021-05-17T13:58:25
2021-05-17T13:58:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,819
java
package iotbay.g15.model; import java.io.Serializable; /** * * @author Isha Yokhanna */ public class PaymentInfo implements Serializable{ private int paymentInfoID; private int userID; private String cardNumber; private String cardExpiryDate; private int cardCVC; private String cardHolderName; private int streetNumber; private String streetName; private String streetType; private String suburb; private String state; private int postcode; private String country; private double credit; private boolean active; public PaymentInfo(int paymentInfoID, int userID, String cardNumber, String cardExpiryDate, int cardCVC, String cardHolderName, int streetNumber, String streetName, String streetType, String suburb, String state, int postcode, String country, double credit, boolean active) { this.paymentInfoID = paymentInfoID; this.userID = userID; this.cardNumber = cardNumber; this.cardExpiryDate = cardExpiryDate; this.cardCVC = cardCVC; this.cardHolderName = cardHolderName; this.streetNumber = streetNumber; this.streetName = streetName; this.streetType = streetType; this.suburb = suburb; this.state = state; this.postcode = postcode; this.country = country; this.credit = credit; this.active = active; } public int getPaymentInfoID() { return paymentInfoID; } public void setPaymentInfoID(int paymentInfoID) { this.paymentInfoID = paymentInfoID; } public int getUserID(){ return userID; } public void setUserID(int userID){ this.userID = userID; } public String getCardNumber() { return cardNumber; } public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; } public String getCardExpiryDate() { return cardExpiryDate; } public void setExpiryDate(String cardExpiryDate) { this.cardExpiryDate = cardExpiryDate; } public int getCardCVC() { return cardCVC; } public void setCardCvc(int cardCVC) { this.cardCVC = cardCVC; } public String getCardHolderName() { return cardHolderName; } public void setCardHolderName(String cardHolderName) { this.cardHolderName = cardHolderName; } public int getStreetNumber() { return streetNumber; } public void setStreetNumber(int streetNumber) { this.streetNumber = streetNumber; } public String getStreetName() { return streetName; } public void setStreetName(String streetName) { this.streetName = streetName; } public String getStreetType() { return streetType; } public void setStreetType(String streetType) { this.streetType = streetType; } public String getSuburb() { return suburb; } public void setSuburb(String suburb) { this.suburb = suburb; } public String getState() { return state; } public void setState(String state) { this.state = state; } public int getPostcode() { return postcode; } public void setPostcode(int postcode) { this.postcode = postcode; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public double getCredit(){ return this.credit; } public void setCredit(double credit){ this.credit = credit; } public boolean isActive(){ return this.active; } public void setActive(boolean val){ this.active = val; } }
202e9d715e33ffa46c5e515d25461b05381ac1b1
4e7767faca2ff81e44cba0dfe6b71c5b4ce037ea
/lab11/src/Ex_4/WriteThread.java
3f5f2c0c2fb953eaac9b977c2cff8f22d9abfead
[]
no_license
gantugs0130/Java
b83ced4e311ff7e72b1026f80038c711ba60cfea
b2a3e20480f5949aa027d29541e0cb9c9cd47daa
refs/heads/master
2020-04-28T00:56:34.242021
2019-05-16T07:53:49
2019-05-16T07:53:49
174,835,148
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package Ex_4; import java.io.*; import java.net.*; /** * This thread is responsible for reading user's input and send it * to the server. * It runs in an infinite loop until the user types 'bye' to quit. * * @author www.codejava.net */ public class WriteThread extends Thread { private PrintWriter writer; private Socket socket; private ChatClient client; public WriteThread(Socket socket, ChatClient client) { this.socket = socket; this.client = client; try { OutputStream output = socket.getOutputStream(); writer = new PrintWriter(output, true); } catch (IOException ex) { System.out.println("Error getting output stream: " + ex.getMessage()); ex.printStackTrace(); } } public void run() { Console console = System.console(); String userName = "gantugs"; client.setUserName("gantugs"); writer.println(userName); String text; do { text = console.readLine("[" + userName + "]: "); writer.println(text); } while (!text.equals("bye")); try { socket.close(); } catch (IOException ex) { System.out.println("Error writing to server: " + ex.getMessage()); } } }
786f3ec196fcd63a3ab9802b56fd6f4b05695257
8c2c3256b3649c22bb261eefc4688b41ed84da67
/src/FileFactory.java
b3aebc1196adaefd3dc7dbe621a0940d1425673b
[]
no_license
dumanOktay/FlyWeightOrnek2
25433b18f486a2e7d79e1a98d19b89251d423932
eb211f1f2074d2f82c1b710b8533f8e6e715947e
refs/heads/master
2021-01-11T10:37:20.256039
2016-12-13T09:59:41
2016-12-13T09:59:41
76,344,636
0
0
null
null
null
null
UTF-8
Java
false
false
442
java
import java.util.HashMap; /** * Created by okt on 12/13/16. */ public class FileFactory { private static HashMap<String,MFile> myFileHashMap = new HashMap<>(); public static MyFile getMyFile(String key){ MyFile myFile; myFile = (MyFile) myFileHashMap.get(key); if (myFile== null){ myFile = new MyFile(key); myFileHashMap.put(key, myFile); } return myFile; } }
4d61cfe0b4f7e5f2ade15d466fa19052ce3107a0
778c3eb567783c411783689f35b327818bb730e0
/app/src/main/java/com/gzcbkj/chongbao/fragment/PetSelectTypeFragment.java
aaa8d1ddbc179c3d0d4d394c7050e8a385291e6d
[]
no_license
hackerlank/Pet
15fac6bb42364b18490ee5db2bfe7373770178b1
db1b65c356a4704496a8d4f8ffc1ba21521a9bd6
refs/heads/master
2020-03-12T08:39:37.993994
2018-04-01T14:24:03
2018-04-01T14:24:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,976
java
package com.gzcbkj.chongbao.fragment; import android.net.Uri; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.gzcbkj.chongbao.R; import com.gzcbkj.chongbao.activity.BaseActivity; import com.gzcbkj.chongbao.bean.PetVarietyBean; import com.gzcbkj.chongbao.bean.ResponseBean; import com.gzcbkj.chongbao.http.HttpMethods; import com.gzcbkj.chongbao.http.OnHttpErrorListener; import com.gzcbkj.chongbao.http.ProgressSubscriber; import com.gzcbkj.chongbao.http.SubscriberOnNextListener; import com.gzcbkj.chongbao.manager.DataManager; import com.gzcbkj.chongbao.utils.Constants; import com.gzcbkj.chongbao.utils.Utils; import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.listener.OnRefreshListener; import java.io.File; import java.util.ArrayList; /** * Created by huangzhifeng on 2018/2/27. */ public class PetSelectTypeFragment extends BaseFragment implements OnRefreshListener { private ArrayList<PetSelectTypeItemFragment> mFragments; @Override protected int getLayoutId() { return R.layout.fragment_select_pet_type; } @Override protected void onViewCreated(View view) { setText(R.id.tvTitle, R.string.shide_pet_type); initViewPager(); setViewsOnClickListener(R.id.llTab1, R.id.llTab2); SmartRefreshLayout smartRefreshLayout = fv(R.id.smartLayout); smartRefreshLayout.setOnRefreshListener(this); smartRefreshLayout.autoRefresh(); } private void initViewPager() { ViewPager viewPager = fv(R.id.viewPager); mFragments = new ArrayList<>(); for (int i = 0; i < 2; ++i) { mFragments.add(new PetSelectTypeItemFragment()); } viewPager.setAdapter(new FragmentPagerAdapter(getActivity().getSupportFragmentManager()) { @Override public BaseFragment getItem(int position) { return mFragments.get(position); } @Override public int getCount() { return mFragments.size(); } }); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { initTab(position); } @Override public void onPageScrollStateChanged(int state) { } }); viewPager.setCurrentItem(0); initTab(0); } private void initTab(int pos) { ViewGroup viewGroup; for (int i = 0; i < 2; ++i) { viewGroup = fv(getResources().getIdentifier("llTab" + (i + 1), "id", getActivity().getPackageName())); ((TextView) viewGroup.getChildAt(0)).setTextColor(getResources().getColor(i == pos ? R.color.color_33_33_33 : R.color.color_99_99_99)); viewGroup.getChildAt(1).setVisibility(i == pos ? View.VISIBLE : View.INVISIBLE); } } @Override public void updateUIText() { } @Override public void onClick(View view) { int id = view.getId(); switch (id) { case R.id.llTab1: ((ViewPager)fv(R.id.viewPager)).setCurrentItem(0); break; case R.id.llTab2: ((ViewPager)fv(R.id.viewPager)).setCurrentItem(1); break; } } @Override public void onRefresh(final RefreshLayout refreshlayout) { ProgressSubscriber subscriber = new ProgressSubscriber(new SubscriberOnNextListener<ResponseBean>() { @Override public void onNext(ResponseBean bean) { if (getView() == null) { return; } refreshlayout.finishRefresh(); if (bean == null) { return; } setText(R.id.tv1,bean.getPetTypeList().get(0).getTypeName()); setText(R.id.tv2,bean.getPetTypeList().get(1).getTypeName()); ArrayList<PetVarietyBean> list1=new ArrayList<>(); ArrayList<PetVarietyBean> list2=new ArrayList<>(); for(PetVarietyBean petVarietyBean:bean.getPetVarietyList()){ if(petVarietyBean.getPetType()==bean.getPetTypeList().get(0).getId()){ list1.add(petVarietyBean); }else if(petVarietyBean.getPetType()==bean.getPetTypeList().get(1).getId()){ list2.add(petVarietyBean); } } mFragments.get(0).setPetName(bean.getPetTypeList().get(0).getTypeName()); mFragments.get(1).setPetName(bean.getPetTypeList().get(1).getTypeName()); mFragments.get(0).setData(list1); mFragments.get(1).setData(list2); } }, getActivity(), false, new OnHttpErrorListener() { @Override public void onConnectError(Throwable e) { if (getView() == null) { return; } refreshlayout.finishRefresh(); ((BaseActivity) getActivity()).connectError(e); } @Override public void onServerError(int errorCode, String errorMsg) { if (getView() == null) { return; } refreshlayout.finishRefresh(); ((BaseActivity) getActivity()).serverError(errorCode, errorMsg); } }); HttpMethods.getInstance().queryTypeInfoList(subscriber); } }
62a16e1c8e1bef427936e6c48cae396d3a3380ea
e7dc82d8fcd6d73bd37db4df4dfd0f4deeb0e7cb
/controle-estoque/src/main/java/com/uem/controle/estoque/builder/UnidadeMedidaBuilder.java
e6c36c8ec61c22cd908f320fd40638a9f6c69049
[]
no_license
RodolfoBorri/estocai-controle-estoque
f526207ceffee516a9ebc3ac7bf64ccd3f6d8fc6
9114f81bf814f0d9da878959403031b1644629d7
refs/heads/master
2023-04-10T17:09:19.571713
2021-04-15T19:59:25
2021-04-15T19:59:25
335,140,791
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
package com.uem.controle.estoque.builder; import com.uem.controle.estoque.entity.UnidadeMedida; public class UnidadeMedidaBuilder { private String descricao; private String unidade; public UnidadeMedidaBuilder setDescricao(String descricao) { this.descricao = descricao; return this; } public UnidadeMedidaBuilder setUnidade(String unidade) { this.unidade = unidade; return this; } public UnidadeMedidaBuilder(String descricao, String unidade) { super(); this.descricao = descricao; this.unidade = unidade; } public UnidadeMedidaBuilder() { } public UnidadeMedida build() { return new UnidadeMedida(descricao, unidade); } }
dce122e9197ffb8fd835907b078627e680caa10a
93f399d565fb0a7bc00e6c2deaf166275695cffd
/src/main/java/samparser/samrecorditerator/SamRecordIterable.java
75560c5f326574c3163843deb1515406a15ffd7b
[]
no_license
Kirvolque/variant_caller
38f4836346ceedb55f1afd4845054f3078b1a7ed
ef92bfe57d0b95af46341354ae1708fca7efd2aa
refs/heads/master
2023-04-29T06:13:11.666206
2023-04-16T11:28:10
2023-04-16T11:28:10
175,215,959
1
2
null
2019-07-27T21:23:16
2019-03-12T13:22:01
Java
UTF-8
Java
false
false
417
java
package samparser.samrecorditerator; import lombok.NonNull; import sequence.SamRecord; import java.io.BufferedReader; public class SamRecordIterable implements Iterable<SamRecord> { private BufferedReader reader; public SamRecordIterable(@NonNull final BufferedReader reader) { this.reader = reader; } @Override public SamRecordIterator iterator() { return new SamRecordIterator(reader); } }
2c0ed07a314a8f8b5ded34fa0dcb65a24fa40001
0759be11403fe2826455ac9b53755f65912c5e28
/TYTimeAss/app/src/main/java/com/example/hongnhung/tytimeass/models/Article.java
e371430d6a5fd8a61d99b9ffc5701a17c8dcea4c
[ "Apache-2.0" ]
permissive
nhungnguyen123/AssignWeek2
10f59a4d169488cd9e8a47203379782aa8a0354c
ac77ed12855166a17c7e85afacb1cca26db9ae61
refs/heads/master
2021-01-21T06:24:17.780048
2017-02-27T14:22:09
2017-02-27T14:22:09
83,223,728
0
0
null
null
null
null
UTF-8
Java
false
false
2,678
java
package com.example.hongnhung.tytimeass.models; import android.os.Parcel; import android.os.Parcelable; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by hongnhung on 26/02/2017. */ public class Article implements Parcelable { @SerializedName("web_url") public String WebUrl; @SerializedName("snippet") public String Snippet; @SerializedName("lead_paragraph") public String LeadPara; @SerializedName("multimedia") List<Multimedia> listMultimedias; @SerializedName("headline") public Headline headline; @SerializedName("pub_date") public String PubDate; public Headline getHeadline() { return headline; } public void setHeadline(Headline headline) { this.headline = headline; } @SerializedName("document_type") public String Type; public Article() { } protected Article(Parcel in) { WebUrl = in.readString(); Snippet = in.readString(); LeadPara = in.readString(); PubDate = in.readString(); Type = in.readString(); } public static final Creator<Article> CREATOR = new Creator<Article>() { @Override public Article createFromParcel(Parcel in) { return new Article(in); } @Override public Article[] newArray(int size) { return new Article[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(WebUrl); dest.writeString(Snippet); dest.writeString(LeadPara); dest.writeString(PubDate); dest.writeString(Type); } public String getType() { return Type; } public void setType(String type) { Type = type; } public String getWebUrl() { return WebUrl; } public void setWebUrl(String webUrl) { WebUrl = webUrl; } public String getSnippet() { return Snippet; } public void setSnippet(String snippet) { Snippet = snippet; } public String getLeadPara() { return LeadPara; } public void setLeadPara(String leadPara) { LeadPara = leadPara; } public List<Multimedia> getListMultimedias() { return listMultimedias; } public void setListMultimedias(List<Multimedia> listMultimedias) { this.listMultimedias = listMultimedias; } public String getPubDate() { return PubDate; } public void setPubDate(String pubDate) { PubDate = pubDate; } }
0f03371a82d4117c19ba812fcf81dac55b9550c2
8d675bb2bc914fcee1ad2b60b14878448679767b
/MeLi/app/src/main/java/com/mercadolibre/puboe/meli/fragments/SearchResultsFragment.java
003079844d0a323d9e1d5982bb15169a26a6a6dd
[]
no_license
puboe/android-training
19a75c58ab2813ebd69cc5bee2439645952e0add
06bc862e5fe63c9a39cec3e160e6ecf05c546dcb
refs/heads/master
2021-01-18T21:14:28.919732
2016-04-14T17:56:17
2016-04-14T17:56:17
21,427,936
2
0
null
2014-07-29T17:21:34
2014-07-02T14:44:47
Java
UTF-8
Java
false
false
6,068
java
package com.mercadolibre.puboe.meli.fragments; import android.app.Activity; import android.app.ListFragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.ListView; import com.mercadolibre.puboe.meli.R; import com.mercadolibre.puboe.meli.SearchAdapter; import com.mercadolibre.puboe.meli.model.Item; import com.mercadolibre.puboe.meli.model.Search; /** * Activities that contain this fragment must implement the * {@link SearchResultsFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link SearchResultsFragment#newInstance} factory method to * create an instance of this fragment. * */ public class SearchResultsFragment extends ListFragment { public static final String KEY_DATA = "key_data"; private SearchAdapter adapter; private ListView listView; private View mainView; private OnFragmentInteractionListener mListener; public static SearchResultsFragment newInstance() { SearchResultsFragment fragment = new SearchResultsFragment(); return fragment; } public SearchResultsFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i("SearchResultsFragemnt", "onCreateView"); mainView = inflater.inflate(R.layout.fragment_search_results, container, false); return mainView; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); listView = (ListView) mainView.findViewById(android.R.id.list); listView.setOnScrollListener(new mOnScrollListener()); Log.i("SearchResultsFragemnt", "onViewCreated with saved state: " + (savedInstanceState != null) + " and searchObject: " + (mListener.getSearchObjectFromActivity() != null) + " and adapter: " + (adapter != null)); // System.out.println("Not first: " + savedInstanceState.getBoolean("not_first")); if(savedInstanceState != null && savedInstanceState.getBoolean("not_first")) { Search search = mListener.getSearchObjectFromActivity(); if(search != null) { showResults(search); } } } @Override public void onAttach(Activity activity) { super.onAttach(activity); Log.i(SearchResultsFragment.class.getSimpleName(), "onAttach"); try { mListener = (OnFragmentInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } } @Override public void onDetach() { super.onDetach(); Log.i("SearchResultsFragment", "dettaching fragment"); mListener = null; listView = null; adapter = null; mainView = null; } @Override public void onStart() { super.onStart(); // When in two-pane layout, set the listview to highlight the selected list item // (We do this during onStart because at the point the listview is available.) if (getFragmentManager().findFragmentById(R.id.list_frame) != null) { Log.i(SearchResultsFragment.class.getSimpleName(), "Setting CHOICE MODE"); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); } } @Override public void onSaveInstanceState(Bundle outState) { Log.i("SearchResultsFragment", "onSaveInstanceState"); outState.putBoolean("not_first", true); super.onSaveInstanceState(outState); } public void showResults(Search results) { if(results == null) { Log.i("SearchResultsFragment: ", "showResults: results null"); } else if(results.getResults() == null) { Log.i("SearchResultsFragment: ", "showResults: getResults null"); } if (adapter == null) { adapter = new SearchAdapter(getActivity(), results); setListAdapter(adapter); } else if(getListAdapter() != null){ adapter.notifyDataSetChanged(); } else { setListAdapter(adapter); } getActivity().setTitle(results.getQuery().replace("+", " ")); } @Override public void onListItemClick(ListView l, View v, int position, long id) { Item item = (Item)l.getItemAtPosition(position); mListener.onItemSelected(item.getId()); getListView().setItemChecked(position, true); } public interface OnFragmentInteractionListener { public void onItemSelected(String id); public void onRequestMoreItems(); public Search getSearchObjectFromActivity(); } private class mOnScrollListener implements AbsListView.OnScrollListener { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (mListener.getSearchObjectFromActivity() == null) { Log.w(SearchResultsFragment.class.getSimpleName(), "onScroll searchObject == null"); return; } if (firstVisibleItem + visibleItemCount == totalItemCount && totalItemCount > mListener.getSearchObjectFromActivity().getPaging().getOffset()) { Log.w(SearchResultsFragment.class.getSimpleName(), "onScroll firstVisible: " + firstVisibleItem + ", visibleCount:" + visibleItemCount + ", totalCount: " + totalItemCount); mListener.onRequestMoreItems(); } } } }
eaaa9b92d4c0aa0c46bb9cf69453c698ad16722e
4c68c53745a215cdb325b526e59921c0ab25ec4e
/src/main/java/com/imooc/sell/config/WechatMpConfig.java
47bb3bb7928328cd5e3e56aa3aaca28969c21d86
[]
no_license
gsy13213009/sell
0dcf2c9ce7b61005660f1dea10fd73bd8e7175f5
a7aacb0a37bc7c50bcb184cc121b07c66e36a616
refs/heads/master
2022-12-26T00:05:59.983034
2020-06-02T01:36:49
2020-06-02T01:36:49
262,999,789
0
0
null
2020-10-13T21:54:19
2020-05-11T09:38:33
Java
UTF-8
Java
false
false
1,042
java
package com.imooc.sell.config; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; import me.chanjar.weixin.mp.config.WxMpConfigStorage; import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; @Service public class WechatMpConfig { @Autowired private WechatAccountConfig wechatAccountConfig; @Bean public WxMpService wxMpService() { WxMpService wxMpService = new WxMpServiceImpl(); wxMpService.setWxMpConfigStorage(wxMpConfigStorage()); return wxMpService; } public WxMpConfigStorage wxMpConfigStorage() { WxMpDefaultConfigImpl wxMpConfigStorage = new WxMpDefaultConfigImpl(); wxMpConfigStorage.setAppId(wechatAccountConfig.getMpAppId()); wxMpConfigStorage.setSecret(wechatAccountConfig.getMpAppSecret()); return wxMpConfigStorage; } }
1a8122b561fa0245f9e9a9f1934968a221506f02
95e944448000c08dd3d6915abb468767c9f29d3c
/sources/com/bef/effectsdk/testing/TestResult.java
8c1ccfdd0e7aa8666993948da308d08e635a761a
[]
no_license
xrealm/tiktok-src
261b1faaf7b39d64bb7cb4106dc1a35963bd6868
90f305b5f981d39cfb313d75ab231326c9fca597
refs/heads/master
2022-11-12T06:43:07.401661
2020-07-04T20:21:12
2020-07-04T20:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.bef.effectsdk.testing; public class TestResult { public int failed_test_count; public String report; public int reportable_test_count; public TestResult(int i, int i2, String str) { this.reportable_test_count = i; this.failed_test_count = i2; this.report = str; } }
fcdc0c56053cef21ba5c54ac16b0142dd8152231
7ef760a2927684f20ec8ba91bdb2631918599964
/src/main/java/org/valuereporter/agent/crawler/PublicMethodCrawler.java
c87fe7c251de06c6be3487f0ce9f5181b53d8d18
[ "Apache-2.0" ]
permissive
valuereporter/_deprecated-Valuereporter-Agent
ccf97c7d0c3bd2acb681d5494c19780077aac844
9bbae27035a80777be5074d361bd102c61f50e09
refs/heads/master
2021-11-30T22:38:31.600477
2018-05-25T06:59:24
2018-05-25T06:59:24
52,442,743
0
0
Apache-2.0
2021-11-26T01:52:58
2016-02-24T13:05:15
Java
UTF-8
Java
false
false
3,257
java
package org.valuereporter.agent.crawler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.valuereporter.agent.ImplementedMethod; import org.valuereporter.agent.http.HttpImplementedMethodSender; import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; /** * @author <a href="[email protected]">Bard Lind</a> */ public class PublicMethodCrawler implements Runnable { private static final Logger log = LoggerFactory.getLogger(PublicMethodCrawler.class); private final String reporterHost; private final String reporterPort; private final String prefix; private final String basePackage; private List<ImplementedMethod> publicMethods = new ArrayList<>(); private int MAX_CACHE_SIZE = 500; public PublicMethodCrawler(String reporterHost, String reporterPort, String prefix, String basePackage) { this.reporterHost = reporterHost; this.reporterPort = reporterPort; this.prefix = prefix; this.basePackage = basePackage; } @Override public void run() { crawlForPublicMethods(); } protected void crawlForPublicMethods() { log.info("Starting to crawl for Public Methods."); try { ArrayList<String> names = PublicMethodFinder.getClassNamesFromPackage(basePackage); log.info("Found these names {}", names.size()); List<Class> classes = PublicMethodFinder.findClasses(names); for (Class clazz : classes) { List<ImplementedMethod> publicMethodsInClass = null; log.trace("Found a potential class. {}", clazz.getName()); if (clazz.isPrimitive() || clazz.isArray() || clazz.isAnnotation() || clazz.isEnum() || clazz.isInterface()) { log.trace("Skip class {}: not a class", clazz.getName()); } else { publicMethodsInClass = PublicMethodFinder.findPublicMethods(clazz); updateMethodsForClass(publicMethodsInClass, clazz.getName()); } } } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } log.info("Crawled all classes. Local cash has {} elements still. Forwarding these to ValueReporter.", publicMethods.size()); forwardOutput(); log.info("Done crawling."); } protected void updateMethodsForClass(List<ImplementedMethod> publicMethodsInClass, String className) { if (publicMethodsInClass != null) { log.trace("Found {} public methods in {}", publicMethodsInClass.size(), className); publicMethods.addAll(publicMethodsInClass); if (publicMethods.size() >= MAX_CACHE_SIZE) { forwardOutput(); } } else { log.warn("Observed Method is null"); } } private void forwardOutput() { log.trace("Forwarding PublicMethods. Local cache size {}", publicMethods.size()); new Thread(new HttpImplementedMethodSender(reporterHost, reporterPort, prefix, publicMethods)).start(); publicMethods.clear(); } }
327dd8563e6621555d70e9259ed3747a4c78a5fe
8d4d26b3369d282d9454daf4db4f5e219fd0d01b
/src/kr/ac/uos/ai/arbi/monitor/model/SequenceColorBean.java
6a6b605893ea9ee7f04b9a814d2eeca233e2c4f6
[]
no_license
WOWEunji/ARBIFramework-0.8.m03
43745deec929301fb9f853fe425cb2cd13d7769a
65ed6b6ad7d676f1ffdd00de19e5dd45dbcfc330
refs/heads/master
2022-04-05T08:18:12.113696
2020-01-30T01:28:06
2020-01-30T01:28:06
237,117,041
1
0
null
null
null
null
UTF-8
Java
false
false
1,558
java
package kr.ac.uos.ai.arbi.monitor.model; import java.awt.Color; public class SequenceColorBean implements TableEntry<Object>{ private static final SequenceColorBean[] NULL_ARRAY = new SequenceColorBean[0]; private static final Color DEFAULT_COLOR = Color.decode("#000000"); private Object key; private Color lineColor; private Color fontColor; public SequenceColorBean(Object key) { setKey(key); } public SequenceColorBean(Object key, Color lineColor, Color fontColor) { setKey(key); setLineColor(lineColor); setFontColor(fontColor); } void setKey(Object key) { this.key = key; } public void setLineColor(Color lineColor) { this.lineColor = lineColor; if(this.lineColor != null) return; this.lineColor = DEFAULT_COLOR; } public void setFontColor(Color fontColor) { this.fontColor = fontColor; if(this.fontColor != null) return; this.fontColor = DEFAULT_COLOR; } public Object getKey() { return this.key; } public Color getLineColor() { return this.lineColor; } public Color getFontColor() { return this.fontColor; } public Object getValue(int columnIndex) { switch (columnIndex) { case 0: return getKey(); case 1: return getLineColor(); case 2: return getFontColor(); } return null; } public void setValue(int columnIndex, Object value) { switch (columnIndex) { case 0: setKey(value); case 1: setLineColor((Color) value); case 2: setFontColor((Color) value); } } }
10c57356ac04ec98efeab7c4cf40cc88123e04f6
094e66aff18fd3a93ea24e4f23f5bc4efa5d71d6
/yit-education-util/src/main/java/com/yuu/yit/education/util/enums/MsgTypeEnum.java
78eca47c45ab6a0b987bcac01d04c935bf61d998
[ "MIT", "Apache-2.0" ]
permissive
71yuu/YIT
55b76dbec855b8e67f42a7eb00e9fa8e919ec4cb
53bb7ba8b8e686b2857c1e2812a0f38bd32f57e3
refs/heads/master
2022-09-08T06:51:30.819760
2019-11-29T06:24:19
2019-11-29T06:24:19
216,706,258
0
0
Apache-2.0
2022-09-01T23:14:33
2019-10-22T02:27:22
Java
UTF-8
Java
false
false
370
java
/** * Copyright 2015-2017 广州市领课网络科技有限公司 */ package com.yuu.yit.education.util.enums; import lombok.AllArgsConstructor; import lombok.Getter; /** * 短信类型 * * @author Yuu * */ @Getter @AllArgsConstructor public enum MsgTypeEnum { SYSTEM(1, "系统消息"), OTHER(2, "其他"); private Integer code; private String desc; }
45b65859c16f66516065ae25d244d6f0ae01b5bd
99939d907d431109d2f1c5f5e2c043ba5278b707
/app/libs/PdfBox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java
3c8fc5f67fba3af3f43aff8eb99013cc9ccc80d6
[]
no_license
pancosances/PTPrinter
61ddfcafda809123db95c97ae3c47a9ba4f0d5f5
ada10ab857f605829d5c53f9a5255798411807b5
refs/heads/master
2021-07-13T04:09:54.718922
2017-10-17T21:29:43
2017-10-17T21:29:43
106,248,116
0
0
null
null
null
null
UTF-8
Java
false
false
14,361
java
package org.apache.pdfbox.pdmodel; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.pdmodel.common.COSArrayList; import org.apache.pdfbox.pdmodel.common.COSObjectable; import org.apache.pdfbox.pdmodel.common.PDDestinationOrAction; import org.apache.pdfbox.pdmodel.common.PDMetadata; import org.apache.pdfbox.pdmodel.common.PDPageLabels; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDMarkInfo; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot; import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent; import org.apache.pdfbox.pdmodel.graphics.optionalcontent.PDOptionalContentProperties; import org.apache.pdfbox.pdmodel.interactive.action.PDActionFactory; import org.apache.pdfbox.pdmodel.interactive.action.PDDocumentCatalogAdditionalActions; import org.apache.pdfbox.pdmodel.interactive.action.PDURIDictionary; import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination; import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline; import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; import org.apache.pdfbox.pdmodel.interactive.pagenavigation.PDThread; import org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * The Document Catalog of a PDF. * * @author Ben Litchfield */ public class PDDocumentCatalog implements COSObjectable { private final COSDictionary root; private final PDDocument document; private PDAcroForm cachedAcroForm; /** * Constructor. Acroform. * * @param doc The document that this catalog is part of. */ public PDDocumentCatalog(PDDocument doc) { document = doc; root = new COSDictionary(); root.setItem(COSName.TYPE, COSName.CATALOG); document.getDocument().getTrailer().setItem(COSName.ROOT, root); } /** * Constructor. * * @param doc The document that this catalog is part of. * @param rootDictionary The root dictionary that this object wraps. */ public PDDocumentCatalog(PDDocument doc, COSDictionary rootDictionary) { document = doc; root = rootDictionary; } /** * Convert this standard java object to a COS object. * * @return The cos object that matches this Java object. */ public COSDictionary getCOSObject() { return root; } /** * Get the documents AcroForm. This will return null if no AcroForm is part of the document. * * @return The documents acroform. */ public PDAcroForm getAcroForm() { if(cachedAcroForm == null) { COSDictionary dict = (COSDictionary)root.getDictionaryObject(COSName.ACRO_FORM); cachedAcroForm = dict == null ? null : new PDAcroForm(document, dict); } return cachedAcroForm; } /** * Sets the Acroform for this catalog. * * @param acroForm The new Acroform. */ public void setAcroForm(PDAcroForm acroForm) { root.setItem(COSName.ACRO_FORM, acroForm); cachedAcroForm = null; } /** * Returns all pages in the document, as a page tree. */ public PDPageTree getPages() { // TODO cache me? return new PDPageTree((COSDictionary)root.getDictionaryObject(COSName.PAGES)); } /** * Get the viewer preferences associated with this document or null if they do not exist. * * @return The document's viewer preferences. */ public PDViewerPreferences getViewerPreferences() { COSDictionary dict = (COSDictionary)root.getDictionaryObject(COSName.VIEWER_PREFERENCES); return dict == null ? null : new PDViewerPreferences(dict); } /** * Sets the viewer preferences. * * @param prefs The new viewer preferences. */ public void setViewerPreferences(PDViewerPreferences prefs) { root.setItem(COSName.VIEWER_PREFERENCES, prefs); } /** * Get the outline associated with this document or null if it does not exist. * * @return The document's outline. */ public PDDocumentOutline getDocumentOutline() { COSDictionary dict = (COSDictionary)root.getDictionaryObject(COSName.OUTLINES); return dict == null ? null : new PDDocumentOutline(dict); } /** * Sets the document outlines. * * @param outlines The new document outlines. */ public void setDocumentOutline(PDDocumentOutline outlines) { root.setItem(COSName.OUTLINES, outlines); } /** * Returns the document's article threads. */ public List<PDThread> getThreads() { COSArray array = (COSArray)root.getDictionaryObject(COSName.THREADS); if(array == null) { array = new COSArray(); root.setItem(COSName.THREADS, array); } List<PDThread> pdObjects = new ArrayList<PDThread>(); for(int i = 0; i < array.size(); i++) { pdObjects.add(new PDThread((COSDictionary)array.getObject(i))); } return new COSArrayList<PDThread>(pdObjects, array); } /** * Sets the list of threads for this pdf document. * * @param threads The list of threads, or null to clear it. */ public void setThreads(List threads) { root.setItem( COSName.THREADS, COSArrayList.converterToCOSArray(threads)); } /** * Get the metadata that is part of the document catalog. This will return null if there is no * meta data for this object. * * @return The metadata for this object. */ public PDMetadata getMetadata() { COSBase metaObj = root.getDictionaryObject(COSName.METADATA); if(metaObj instanceof COSStream) { return new PDMetadata((COSStream) metaObj); } return null; } /** * Sets the metadata for this object. This can be null. * * @param meta The meta data for this object. */ public void setMetadata(PDMetadata meta) { root.setItem(COSName.METADATA, meta); } /** * Sets the Document Open Action for this object. * * @param action The action you want to perform. */ public void setOpenAction(PDDestinationOrAction action) { root.setItem(COSName.OPEN_ACTION, action); } /** * Get the Document Open Action for this object. * * @return The action to perform when the document is opened. * * @throws IOException If there is an error creating the destination or action. */ public PDDestinationOrAction getOpenAction() throws IOException { COSBase openAction = root.getDictionaryObject(COSName.OPEN_ACTION); if(openAction == null) { return null; } else if(openAction instanceof COSDictionary) { return PDActionFactory.createAction((COSDictionary)openAction); } else if(openAction instanceof COSArray) { return PDDestination.create(openAction); } else { throw new IOException("Unknown OpenAction " + openAction); } } /** * @return The Additional Actions for this Document */ public PDDocumentCatalogAdditionalActions getActions() { COSDictionary addAction = (COSDictionary) root.getDictionaryObject(COSName.AA); if (addAction == null) { addAction = new COSDictionary(); root.setItem(COSName.AA, addAction); } return new PDDocumentCatalogAdditionalActions(addAction); } /** * Sets the additional actions for the document. * * @param actions The actions that are associated with this document. */ public void setActions(PDDocumentCatalogAdditionalActions actions) { root.setItem(COSName.AA, actions); } /** * @return The names dictionary for this document or null if none exist. */ public PDDocumentNameDictionary getNames() { COSDictionary names = (COSDictionary) root.getDictionaryObject(COSName.NAMES); return names == null ? null : new PDDocumentNameDictionary(this, names); } /** * Sets the names dictionary for the document. * * @param names The names dictionary that is associated with this document. */ public void setNames(PDDocumentNameDictionary names) { root.setItem(COSName.NAMES, names); } /** * Get info about doc's usage of tagged features. This will return null if there is no * information. * * @return The new mark info. */ public PDMarkInfo getMarkInfo() { COSDictionary dic = (COSDictionary)root.getDictionaryObject(COSName.MARK_INFO); return dic == null ? null : new PDMarkInfo(dic); } /** * Sets information about the doc's usage of tagged features. * * @param markInfo The new MarkInfo data. */ public void setMarkInfo(PDMarkInfo markInfo) { root.setItem(COSName.MARK_INFO, markInfo); } /** * Get the list of OutputIntents defined in the document. * * @return The list of PDOutputIntent */ public List<PDOutputIntent> getOutputIntents () { List<PDOutputIntent> retval = new ArrayList<PDOutputIntent>(); COSArray array = (COSArray)root.getDictionaryObject(COSName.OUTPUT_INTENTS); if (array != null) { for (COSBase cosBase : array) { PDOutputIntent oi = new PDOutputIntent((COSDictionary)cosBase); retval.add(oi); } } return retval; } /** * Add an OutputIntent to the list. If there is not OutputIntent, the list is created and the * first element added. * * @param outputIntent the OutputIntent to add. */ public void addOutputIntent(PDOutputIntent outputIntent) { COSArray array = (COSArray)root.getDictionaryObject(COSName.OUTPUT_INTENTS); if (array == null) { array = new COSArray(); root.setItem(COSName.OUTPUT_INTENTS, array); } array.add(outputIntent.getCOSObject()); } /** * Replace the list of OutputIntents of the document. * * @param outputIntents the list of OutputIntents, if the list is empty all OutputIntents are * removed. */ public void setOutputIntents(List<PDOutputIntent> outputIntents) { COSArray array = new COSArray(); for (PDOutputIntent intent : outputIntents) { array.add(intent.getCOSObject()); } root.setItem(COSName.OUTPUT_INTENTS, array); } /** * Returns the page display mode. */ public PageMode getPageMode() { String mode = root.getNameAsString(COSName.PAGE_MODE); if (mode != null) { return PageMode.fromString(mode); } else { return PageMode.USE_NONE; } } /** * Sets the page mode. * * @param mode The new page mode. */ public void setPageMode(PageMode mode) { root.setName(COSName.PAGE_MODE, mode.stringValue()); } /** * Returns the page layout. */ public PageLayout getPageLayout() { String mode = root.getNameAsString(COSName.PAGE_LAYOUT); if (mode != null) { return PageLayout.fromString(mode); } else { return PageLayout.SINGLE_PAGE; } } /** * Sets the page layout. * * @param layout The new page layout. */ public void setPageLayout(PageLayout layout) { root.setName(COSName.PAGE_LAYOUT, layout.stringValue()); } /** * Returns the document-level URI. */ public PDURIDictionary getURI() { COSDictionary uri = (COSDictionary)root.getDictionaryObject(COSName.URI); return uri == null ? null : new PDURIDictionary(uri); } /** * Sets the document level uri. * * @param uri The new document level uri. */ public void setURI(PDURIDictionary uri) { root.setItem(COSName.URI, uri); } /** * Get the document's structure tree root, or null if none exists. */ public PDStructureTreeRoot getStructureTreeRoot() { COSDictionary dict = (COSDictionary)root.getDictionaryObject(COSName.STRUCT_TREE_ROOT); return dict == null ? null : new PDStructureTreeRoot(dict); } /** * Sets the document's structure tree root. * * @param treeRoot The new structure tree. */ public void setStructureTreeRoot(PDStructureTreeRoot treeRoot) { root.setItem(COSName.STRUCT_TREE_ROOT, treeRoot); } /** * Returns the language for the document, or null. */ public String getLanguage() { return root.getString(COSName.LANG); } /** * Sets the Language for the document. * * @param language The new document language. */ public void setLanguage(String language) { root.setString(COSName.LANG, language); } /** * Returns the PDF specification version this document conforms to. * * @return the PDF version (e.g. "1.4") */ public String getVersion() { return root.getNameAsString(COSName.VERSION); } /** * Sets the PDF specification version this document conforms to. * * @param version the PDF version (e.g. "1.4") */ public void setVersion(String version) { root.setName(COSName.VERSION, version); } /** * Returns the page labels descriptor of the document. * * @return the page labels descriptor of the document. * @throws IOException If there is a problem retrieving the page labels. */ public PDPageLabels getPageLabels() throws IOException { COSDictionary dict = (COSDictionary) root.getDictionaryObject(COSName.PAGE_LABELS); return dict == null ? null : new PDPageLabels(document, dict); } /** * Sets the page label descriptor for the document. * * @param labels the new page label descriptor to set. */ public void setPageLabels(PDPageLabels labels) { root.setItem(COSName.PAGE_LABELS, labels); } /** * Get the optional content properties dictionary associated with this document. * * @return the optional properties dictionary or null if it is not present * @since PDF 1.5 */ public PDOptionalContentProperties getOCProperties() { COSDictionary dict = (COSDictionary)root.getDictionaryObject(COSName.OCPROPERTIES); return dict == null ? null : new PDOptionalContentProperties(dict); } /** * Sets the optional content properties dictionary. * * @param ocProperties the optional properties dictionary * @since PDF 1.5 */ public void setOCProperties(PDOptionalContentProperties ocProperties) { root.setItem(COSName.OCPROPERTIES, ocProperties); // optional content groups require PDF 1.5 if (ocProperties != null && document.getVersion() < 1.5) { document.setVersion(1.5f); } } }
dd17df6edeff9ea22b9be88e706626e9524d9f85
a97871fbf2241dab24ffdfe7a39e411b2614bd3d
/src/main/java/com/leveloper/chacha/springbootchacha/domain/delivery/Delivery.java
a92ebd10e60b7ecf3c9deac0c1be5b2a596ebefd
[]
no_license
tkdgusl94/chacha-springboot
7e589e215c2b0070c27dd597bfb6fa1c301c049c
cf31b88aa27f0036de10185eabeb0ed4e065c6cd
refs/heads/master
2020-12-14T22:01:37.015406
2020-02-20T05:28:37
2020-02-20T05:28:37
234,883,870
0
0
null
2020-01-20T08:26:35
2020-01-19T10:49:15
Java
UTF-8
Java
false
false
723
java
package com.leveloper.chacha.springbootchacha.domain.delivery; import com.leveloper.chacha.springbootchacha.domain.user.Address; import com.leveloper.chacha.springbootchacha.domain.BaseTimeEntity; import com.leveloper.chacha.springbootchacha.domain.order.Order; import lombok.Getter; import javax.persistence.*; @Getter @Entity public class Delivery extends BaseTimeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="delivery_id") private Long id; @OneToOne(mappedBy = "delivery", fetch = FetchType.LAZY) private Order order; @Embedded private Address address; @Enumerated(EnumType.STRING) @Column(length = 20) private DeliveryStatus status; }
bd4335c022354fc1f10ca668707b1604b6cc9e65
8740b13932b1f19d213ad6a99be5d907e1f12bc5
/src/com/mraof/minestuck/block/BlockGlowingMushroom.java
af3b276d8ddb5e995647d88839703aec41a484bc
[]
no_license
Padamariuse/Minestuck
eb89e55a94989b7cb50f9f03d8f24525d8f2c314
bc74f85bd766881e8151fc7f196599de0a0afeb7
refs/heads/1.12
2021-06-26T12:59:41.390650
2019-06-22T21:13:25
2019-06-22T21:13:25
151,946,739
3
0
null
2019-04-18T07:25:18
2018-10-07T13:54:02
Java
UTF-8
Java
false
false
2,007
java
package com.mraof.minestuck.block; import com.mraof.minestuck.item.TabMinestuck; import net.minecraft.block.BlockBush; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import java.util.Random; public class BlockGlowingMushroom extends BlockBush { public BlockGlowingMushroom() { super(); setCreativeTab(TabMinestuck.instance); setUnlocalizedName("glowingMushroom"); setLightLevel(0.75F); setSoundType(SoundType.PLANT); } @Override protected boolean canSustainBush(IBlockState state) { return state.isFullBlock(); } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { super.updateTick(worldIn, pos, state, rand); if(canSpread(worldIn, pos, state) && rand.nextInt(25) == 0) { int count = 0; Iterable blocks = BlockPos.getAllInBoxMutable(pos.add(-4, -1, -4), pos.add(4, 1, 4)); for(BlockPos checkPos : (Iterable<BlockPos>) blocks) if(worldIn.getBlockState(checkPos).getBlock() == this) { count++; if (count >= 5) return; } for (int i = 0; i < 5; ++i) { BlockPos spreadPos = pos.add(rand.nextInt(3) - 1, rand.nextInt(2) - rand.nextInt(2), rand.nextInt(3) - 1); if (worldIn.isAirBlock(spreadPos) && this.canSpread(worldIn, spreadPos, this.getDefaultState())) { worldIn.setBlockState(spreadPos, this.getDefaultState(), 2); return; } } } } public boolean canSpread(World world, BlockPos pos, IBlockState state) { IBlockState soil = world.getBlockState(pos.down()); return soil.getBlock().equals(MinestuckBlocks.coloredDirt) && soil.getValue(BlockColoredDirt.BLOCK_TYPE).equals(BlockColoredDirt.BlockType.BLUE); } @Override public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return MapColor.DIAMOND; } }
3828161b873a977a48ebefa15027e609a7baedd8
22fe459f59c54b975b7ad4a254ee48226fe6c5a0
/TravelB/app/src/main/java/com/fancik/travelb/PilihanTravelA.java
c2ddba1d0f2f653c22ea0fb38465eb4b0c86f0a5
[]
no_license
fandytic/pemesananTravel-android
3ceda2ce4fb4af2f0f4eff7d759cef7a97544a68
7c3dab75fa3bc9f420429618ba62cb881df7d837
refs/heads/master
2020-03-25T20:20:40.537052
2018-08-09T09:11:36
2018-08-09T09:11:36
144,127,171
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
package com.fancik.travelb; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; /** * Created by Fandy TIC on 02/12/2017. */ public class PilihanTravelA extends AppCompatActivity { TextView txt_nohp; String nohp,id; SharedPreferences sharedpreferences; public static final String TAG_ID = "id"; public static final String TAG_NOHP = "nohp"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pilihan_travela); txt_nohp = (TextView) findViewById(R.id.txt_nohp); sharedpreferences = getSharedPreferences(MainActivity.my_shared_preferences, Context.MODE_PRIVATE); id = getIntent().getStringExtra(TAG_ID); nohp = getIntent().getStringExtra(TAG_NOHP); txt_nohp.setText(nohp); } public void ChooseArya(View view) { Intent i = new Intent(getApplicationContext(), Tab.class); i.putExtra(TAG_ID, id); i.putExtra(TAG_NOHP, nohp); startActivity(i); } public void ChooseTri(View view) { Intent i = new Intent(getApplicationContext(), TabBukittinggi2.class); i.putExtra(TAG_ID, id); i.putExtra(TAG_NOHP, nohp); startActivity(i); } }
5e1cfe4998a0a1cfcd833109df840c68c52fbea2
2bf0681b131f0d470d8db274fe6aca05a0404fc9
/neighbour.java
7f4e46aae11e27a7fe806b69706153a74586b59b
[]
no_license
jesusglzbernal/k-knn
cc1b3dee24c9b42890661f3f5dd27664a7206a02
f7d107fc40260a9beef67822255a80511d4193f0
refs/heads/master
2021-01-17T16:46:24.163956
2016-10-25T04:22:40
2016-10-25T04:22:40
71,849,190
0
1
null
null
null
null
UTF-8
Java
false
false
1,373
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package kknn; import java.util.Comparator; /** * * @author jagonzalez * Class to compare a query instance with its neighbors, a comparator */ class neighbour implements Comparable<neighbour> { int number; // Number of neighbor double dist; // Distance to this neighbor String sclass; // Class of this neighbor // Constructor, sets the number, distance, and class to 0, 0.0 and "" public neighbour () { this.number = 0; this.dist = 0.0; this.sclass = ""; } // Constructor, stores the number, distance and class public neighbour(int mn, double md, String mc) { this.number = mn; this.dist = md; this.sclass = mc; } // Returns the distance of this neighbor public double getDistance() { return this.dist; } @Override public int compareTo(neighbour o) { throw new UnsupportedOperationException("Not supported yet."); } // Compares 2 instances, returns the result of the comparison public static class sorter implements Comparator<neighbour> { @Override public int compare(neighbour o1, neighbour o2) { return o1.dist > o2.dist ? 1 : (o1.dist < o2.dist ? -1 : 0); } } }
fda251c88d61f0f0996fe0e39da704da386c4e8b
69c2129d3b727dcc31471a2beaa17b07a140a654
/src/se/his/iit/it325g/common/rendezvous/Observer.java
a8017a7a8066e4bab1af72018fe1dfaf4be9eb99
[]
no_license
s-larson/Parallell_Processes_Assignment_2
d68f25a93d577b64fef73e19908f81e5e208ae9b
f5fa33226dda5ad277b020d250951acc755d0b82
refs/heads/master
2020-09-22T23:07:03.906844
2019-12-20T12:49:18
2019-12-20T12:49:18
225,340,195
0
1
null
null
null
null
UTF-8
Java
false
false
821
java
package se.his.iit.it325g.common.rendezvous; public class Observer { private String name; private Rendezvous rendezvous; public Observer(String name,Rendezvous rendezvous) { if (rendezvous==null) { throw new IllegalArgumentException("Rendezvous cannot be null"); } if (name==null) { throw new IllegalArgumentException("Name cannot be null"); } this.name=name; this.rendezvous=rendezvous; } /** * @return the rendezvous */ public synchronized final Rendezvous getRendezvous() { return rendezvous; } /** * @return the name */ public synchronized final String getName() { return name; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return String.format("Observer [name=%s, rendezvous=%s]", name, rendezvous); } }
a1dc51bfd09641a765d13ef5e858710717c500e3
50a274d9b86cff8657ead7bdb1e1785df0335108
/34-FindFirstandLastPositionofElementinSortedArray.java
6c45e78917d8e1e44bc704e39847f7785013b5ba
[]
no_license
mhaghpanah/LeetCode
2474e33e85a05813242d689305bf1d9de05c8250
b3c4025b61a04e7ea76eea43e907479ec0e9f201
refs/heads/main
2023-03-25T10:43:08.400606
2021-03-24T14:58:45
2021-03-24T14:58:45
327,684,494
0
0
null
null
null
null
UTF-8
Java
false
false
591
java
class Solution { public int f(int[] nums, int t, boolean lower) { int lo = 0; int hi = nums.length - 1; int ans = -1; while (lo <= hi) { int mid = lo + (hi - lo) / 2; if (nums[mid] == t) { ans = mid; if (lower) { hi = mid - 1; } else { lo = mid + 1; } } else if (nums[mid] < t) { lo = mid + 1; } else { hi = mid - 1; } } return ans; } public int[] searchRange(int[] nums, int target) { return new int[]{f(nums, target, true), f(nums, target, false)}; } }
18a2accce2d8051691a6b24442782df0533f169f
50be8c0466985aab8940e24f51860645dc112f49
/src/org/usfirst/frc/team3729/robot/commands/mechenumDrive.java
aae99e0bf7964874e888439fb850ef037d925baf
[]
no_license
RegisJesuitRobotics/XBoxRobot
cd7cb4af84734c6930c37acf7ec254c91f81e4b1
bd449e8007d8d02067442803c4fbc3773535e967
refs/heads/master
2021-01-11T08:00:26.602320
2016-10-27T20:19:21
2016-10-27T20:19:21
72,144,953
0
0
null
null
null
null
UTF-8
Java
false
false
683
java
package org.usfirst.frc.team3729.robot.commands; import edu.wpi.first.wpilibj.Talon; public class mechenumDrive { Talon RightMotor1, LeftMotor1, RightMotor2, LeftMotor2; XboxControler _xbox; public mechenumDrive(XboxControler xbox) { RightMotor1 = new Talon(2); RightMotor2 = new Talon(3); LeftMotor1 = new Talon(1); LeftMotor2 = new Talon(0); this._xbox = xbox; } public void mechenumDrive() { boolean leftInput = _xbox.GetLeftBumper(); boolean rightInput = _xbox.GetRightBumper(); if (leftInput == true) { RightMotor1.set(0.5); RightMotor2.set(0.5); LeftMotor1.set(-0.5); LeftMotor2.set(-0.5); } else if (rightInput == true) { } else { } } }
68c361fefead4869f1644dd9e951c5ed322b0e90
ca7644ea4b2117d79d594f20a2126d7a43674290
/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/note/entity/QxFollow.java
db235485940fa1b74a7abdbdea93a8da4a943ba3
[]
no_license
zihanbobo/guns-vip
b2608ad679a2527f00de25701663f1f1bc0febe5
d3e21d6ad2bafc615963afbb961faddc88b0a0e9
refs/heads/master
2021-01-05T02:17:03.720838
2020-02-11T13:01:29
2020-02-11T13:01:29
240,840,553
1
7
null
2020-02-16T06:02:08
2020-02-16T06:02:07
null
UTF-8
Java
false
false
3,184
java
package cn.stylefeng.guns.modular.note.entity; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; import java.util.Date; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableField; import java.io.Serializable; /** * <p> * 用户关注关系表 * </p> * * @author * @since 2019-11-18 */ @TableName("qx_follow") public class QxFollow implements Serializable { private static final long serialVersionUID = 1L; /** * 标识 */ @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 乐观锁 */ @TableField("version") private Integer version; /** * 创建人 */ @TableField("created_by") private Long createdBy; /** * 创建时间 */ @TableField("created_time") private Date createdTime; /** * 更新人 */ @TableField("updated_by") private Long updatedBy; /** * 更新时间 */ @TableField("updated_time") private Date updatedTime; /** * 删除标识 */ @TableField("deleted") private Boolean deleted; /** * 关注者ID */ @TableField("follower_id") private Long followerId; /** * 被关注者 */ @TableField("followee_id") private Long followeeId; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getVersion() { return version; } public void setVersion(Integer version) { this.version = version; } public Long getCreatedBy() { return createdBy; } public void setCreatedBy(Long createdBy) { this.createdBy = createdBy; } public Date getCreatedTime() { return createdTime; } public void setCreatedTime(Date createdTime) { this.createdTime = createdTime; } public Long getUpdatedBy() { return updatedBy; } public void setUpdatedBy(Long updatedBy) { this.updatedBy = updatedBy; } public Date getUpdatedTime() { return updatedTime; } public void setUpdatedTime(Date updatedTime) { this.updatedTime = updatedTime; } public Boolean getDeleted() { return deleted; } public void setDeleted(Boolean deleted) { this.deleted = deleted; } public Long getFollowerId() { return followerId; } public void setFollowerId(Long followerId) { this.followerId = followerId; } public Long getFolloweeId() { return followeeId; } public void setFolloweeId(Long followeeId) { this.followeeId = followeeId; } @Override public String toString() { return "QxFollow{" + "id=" + id + ", version=" + version + ", createdBy=" + createdBy + ", createdTime=" + createdTime + ", updatedBy=" + updatedBy + ", updatedTime=" + updatedTime + ", deleted=" + deleted + ", followerId=" + followerId + ", followeeId=" + followeeId + "}"; } }
4e401be74006340d8439eddade5a62a9bb7384d6
0f40515ff42537ef193dc505ccf825de7fc21558
/app/src/main/java/com/example/space/ravenmessenger/ui/adapters/ListMessageAdapter.java
f1786070042a94f7f907c25f07b6b3749c7ba3a1
[ "BSD-3-Clause" ]
permissive
SabraTech/Raven-Messenger
1d77ec31f088779823604b088293d06175aa5c26
483b7b6eeb54df76c8dc9e827b7767ce5ef6ca86
refs/heads/master
2021-03-22T03:24:53.627346
2020-04-04T01:46:08
2020-04-04T01:46:08
106,309,204
15
10
null
null
null
null
UTF-8
Java
false
false
14,327
java
package com.example.space.ravenmessenger.ui.adapters; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v7.widget.RecyclerView; import android.util.Base64; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.space.ravenmessenger.R; import com.example.space.ravenmessenger.data.StaticConfig; import com.example.space.ravenmessenger.encryption.CipherHandler; import com.example.space.ravenmessenger.models.Conversation; import com.example.space.ravenmessenger.models.Message; import com.example.space.ravenmessenger.ui.activities.ChatActivity; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.squareup.picasso.Callback; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import de.hdodenhof.circleimageview.CircleImageView; public class ListMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private Context context; private Conversation conversation; private HashMap<String, Bitmap> bitmapHashMapAvatar; private HashMap<String, DatabaseReference> referenceHashMapAvatar; private Bitmap bitmapAvatarUser; private DatabaseReference usersReference; public ListMessageAdapter(Context context, Conversation conversation, HashMap<String, Bitmap> bitmapHashMapAvatar, Bitmap bitmapAvatarUser) { this.context = context; this.conversation = conversation; this.bitmapHashMapAvatar = bitmapHashMapAvatar; this.bitmapAvatarUser = bitmapAvatarUser; referenceHashMapAvatar = new HashMap<>(); usersReference = FirebaseDatabase.getInstance().getReference().child("user"); usersReference.keepSynced(true); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == ChatActivity.VIEW_TYPE_FRIEND_MESSAGE) { View view = LayoutInflater.from(context).inflate(R.layout.rc_item_message_friend, parent, false); return new ItemMessageFriendHolder(view); } else if (viewType == ChatActivity.VIEW_TYPE_USER_MESSAGE) { View view = LayoutInflater.from(context).inflate(R.layout.rc_item_message_user, parent, false); return new ItemMessageUserHolder(view); } return null; } @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { String time = new SimpleDateFormat("EEE, d MMM yyyy").format(new Date(conversation.getMessages().get(position).timestamp)); String today = new SimpleDateFormat("EEE, d MMM yyyy").format(new Date(System.currentTimeMillis())); if (holder instanceof ItemMessageFriendHolder) { if (today.equals(time)) { ((ItemMessageFriendHolder) holder).txtTime.setText(new SimpleDateFormat("HH:mm").format(new Date(conversation.getMessages().get(position).timestamp))); } else { ((ItemMessageFriendHolder) holder).txtTime.setText(new SimpleDateFormat("MMM d").format(new Date(conversation.getMessages().get(position).timestamp))); } if (conversation.getMessages().get(position).type == Message.TEXT) { ((ItemMessageFriendHolder) holder).imageContent.setVisibility(View.INVISIBLE); ((ItemMessageFriendHolder) holder).txtContent.setVisibility(View.VISIBLE); ((ItemMessageFriendHolder) holder).txtContent.setText(CipherHandler.decrypt(conversation.getMessages().get(position).text)); ((ItemMessageFriendHolder) holder).txtContent.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("message", CipherHandler.decrypt(conversation.getMessages().get(position).text)); clipboard.setPrimaryClip(clip); Toast.makeText(context, "Message Copied!", Toast.LENGTH_SHORT).show(); return true; } }); Bitmap currentAvatar = bitmapHashMapAvatar.get(conversation.getMessages().get(position).idSender); if (currentAvatar != null) { ((ItemMessageFriendHolder) holder).avatar.setImageBitmap(currentAvatar); } else { final String id = conversation.getMessages().get(position).idSender; if (referenceHashMapAvatar.get(id) == null) { referenceHashMapAvatar.put(id, usersReference.child(id).child("avatar")); referenceHashMapAvatar.get(id).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() != null) { String avatarString = (String) dataSnapshot.getValue(); if (!avatarString.equals(StaticConfig.STR_DEFAULT_BASE64)) { byte[] decodedString = Base64.decode(avatarString, Base64.DEFAULT); ChatActivity.bitmapAvatarFriend.put(id, BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length)); } else { ChatActivity.bitmapAvatarFriend.put(id, BitmapFactory.decodeResource(context.getResources(), R.drawable.default_avatar)); } notifyDataSetChanged(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } } } else if (conversation.getMessages().get(position).type == Message.IMAGE) { ((ItemMessageFriendHolder) holder).txtContent.setVisibility(View.INVISIBLE); ((ItemMessageFriendHolder) holder).txtContent.setPadding(0, 0, 0, 0); ((ItemMessageFriendHolder) holder).imageContent.setVisibility(View.VISIBLE); Picasso.with(context).load(CipherHandler.decrypt(conversation.getMessages().get(position).text)).fit().centerCrop().networkPolicy(NetworkPolicy.OFFLINE).placeholder(R.drawable.default_image).config(Bitmap.Config.RGB_565).into(((ItemMessageFriendHolder) holder).imageContent, new Callback() { @Override public void onSuccess() { } @Override public void onError() { Picasso.with(context).load(CipherHandler.decrypt(conversation.getMessages().get(position).text)).fit().centerCrop().placeholder(R.drawable.default_image).config(Bitmap.Config.RGB_565).into(((ItemMessageFriendHolder) holder).imageContent); } }); Bitmap currentAvatar = bitmapHashMapAvatar.get(conversation.getMessages().get(position).idSender); if (currentAvatar != null) { ((ItemMessageFriendHolder) holder).avatar.setImageBitmap(currentAvatar); } else { final String id = conversation.getMessages().get(position).idSender; if (referenceHashMapAvatar.get(id) == null) { referenceHashMapAvatar.put(id, usersReference.child(id).child("avatar")); referenceHashMapAvatar.get(id).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() != null) { String avatarString = (String) dataSnapshot.getValue(); if (!avatarString.equals(StaticConfig.STR_DEFAULT_BASE64)) { byte[] decodedString = Base64.decode(avatarString, Base64.DEFAULT); ChatActivity.bitmapAvatarFriend.put(id, BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length)); } else { ChatActivity.bitmapAvatarFriend.put(id, BitmapFactory.decodeResource(context.getResources(), R.drawable.default_avatar)); } notifyDataSetChanged(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } } } } else if (holder instanceof ItemMessageUserHolder) { if (today.equals(time)) { ((ItemMessageUserHolder) holder).txtTime.setText(new SimpleDateFormat("HH:mm").format(new Date(conversation.getMessages().get(position).timestamp))); } else { ((ItemMessageUserHolder) holder).txtTime.setText(new SimpleDateFormat("MMM d").format(new Date(conversation.getMessages().get(position).timestamp))); } if (conversation.getMessages().get(position).type == Message.TEXT) { ((ItemMessageUserHolder) holder).imageContent.setVisibility(View.INVISIBLE); ((ItemMessageUserHolder) holder).txtContent.setVisibility(View.VISIBLE); ((ItemMessageUserHolder) holder).txtContent.setText(CipherHandler.decrypt(conversation.getMessages().get(position).text)); ((ItemMessageUserHolder) holder).txtContent.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("message", CipherHandler.decrypt(conversation.getMessages().get(position).text)); clipboard.setPrimaryClip(clip); Toast.makeText(context, "Message Copied!", Toast.LENGTH_SHORT).show(); return true; } }); if (bitmapAvatarUser != null) { ((ItemMessageUserHolder) holder).avatar.setImageBitmap(bitmapAvatarUser); } } else if (conversation.getMessages().get(position).type == Message.IMAGE) { ((ItemMessageUserHolder) holder).txtContent.setVisibility(View.INVISIBLE); ((ItemMessageUserHolder) holder).txtContent.setPadding(0, 0, 0, 0); ((ItemMessageUserHolder) holder).imageContent.setVisibility(View.VISIBLE); Picasso.with(context).load(CipherHandler.decrypt(conversation.getMessages().get(position).text)).fit().centerCrop().networkPolicy(NetworkPolicy.OFFLINE).placeholder(R.drawable.default_image).config(Bitmap.Config.RGB_565).into(((ItemMessageUserHolder) holder).imageContent, new Callback() { @Override public void onSuccess() { } @Override public void onError() { Picasso.with(context).load(CipherHandler.decrypt(conversation.getMessages().get(position).text)).fit().centerCrop().placeholder(R.drawable.default_image).config(Bitmap.Config.RGB_565).into(((ItemMessageUserHolder) holder).imageContent); } }); if (bitmapAvatarUser != null) { ((ItemMessageUserHolder) holder).avatar.setImageBitmap(bitmapAvatarUser); } } } } @Override public int getItemCount() { return conversation.getMessages().size(); } @Override public int getItemViewType(int position) { String currentUid = FirebaseAuth.getInstance().getCurrentUser().getUid(); if (conversation.getMessages().get(position).idSender.equals(currentUid)) { return ChatActivity.VIEW_TYPE_USER_MESSAGE; } else { return ChatActivity.VIEW_TYPE_FRIEND_MESSAGE; } } } class ItemMessageUserHolder extends RecyclerView.ViewHolder { public TextView txtContent; public TextView txtTime; public CircleImageView avatar; public ImageView imageContent; public ItemMessageUserHolder(View view) { super(view); txtContent = view.findViewById(R.id.textContentUser); txtTime = view.findViewById(R.id.timeContentUser); imageContent = view.findViewById(R.id.imageContentUser); avatar = view.findViewById(R.id.image_view_user); } } class ItemMessageFriendHolder extends RecyclerView.ViewHolder { public TextView txtContent; public TextView txtTime; public CircleImageView avatar; public ImageView imageContent; public ItemMessageFriendHolder(View view) { super(view); txtContent = view.findViewById(R.id.textContentFriend); txtTime = view.findViewById(R.id.timeContentFriend); imageContent = view.findViewById(R.id.imageContentFriend); avatar = view.findViewById(R.id.image_view_friend); } }
c0fb1da791163b3362f0024a425c5e5918515b6c
fbd82cd2ef2160888452f42f78944c86f9bf1798
/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java
2a553053ec65507fb1b50aeffe5245343cb31ce8
[ "MIT", "Apache-2.0" ]
permissive
shedaniel/RoughlyEnoughItems
755462e1cbd51b5775c55010431af27517c3d985
722ed4ee3c5ac615a533b2b993e4325742b5aee4
refs/heads/11.x-1.19.4
2023-08-27T14:58:19.445094
2023-08-09T07:52:50
2023-08-09T07:52:50
162,705,739
321
104
NOASSERTION
2023-08-10T03:22:25
2018-12-21T11:21:36
Java
UTF-8
Java
false
false
13,622
java
/* * This file is licensed under the MIT License, part of Roughly Enough Items. * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel * * 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 me.shedaniel.rei.impl.client.gui.widget; import com.google.common.base.Suppliers; import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.gui.DrawableConsumer; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.gui.widgets.*; import me.shedaniel.rei.api.client.registry.display.DisplayCategory; import me.shedaniel.rei.api.common.display.Display; import me.shedaniel.rei.impl.ClientInternals; import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; import me.shedaniel.rei.impl.client.gui.toast.CopyRecipeIdentifierToast; import me.shedaniel.rei.impl.client.gui.widget.basewidgets.*; import me.shedaniel.rei.impl.client.gui.widget.favorites.FavoritesListWidget; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.ApiStatus; import org.joml.Matrix4f; import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; @ApiStatus.Internal @Environment(EnvType.CLIENT) public final class InternalWidgets { private InternalWidgets() {} public static Widget createAutoCraftingButtonWidget(Rectangle displayBounds, Rectangle rectangle, Component text, Supplier<Display> displaySupplier, Supplier<Collection<ResourceLocation>> idsSupplier, List<Widget> setupDisplay, DisplayCategory<?> category) { Button autoCraftingButton = Widgets.createButton(rectangle, text) .focusable(false) .onClick(button -> { AutoCraftingEvaluator.evaluateAutoCrafting(true, Screen.hasShiftDown(), displaySupplier.get(), idsSupplier); }); return new DelegateWidget(autoCraftingButton) { final Supplier<AutoCraftingEvaluator.AutoCraftingResult> result = Suppliers.memoizeWithExpiration( () -> AutoCraftingEvaluator.evaluateAutoCrafting(false, false, displaySupplier.get(), idsSupplier), 1000, TimeUnit.MILLISECONDS ); @Override public void render(PoseStack poses, int mouseX, int mouseY, float delta) { AutoCraftingEvaluator.AutoCraftingResult result = this.result.get(); autoCraftingButton.setEnabled(result.successful); autoCraftingButton.setTint(result.tint); if (result.hasApplicable) { autoCraftingButton.setText(text); } else { autoCraftingButton.setText(Component.literal("!")); } if (result.hasApplicable && (containsMouse(mouseX, mouseY) || autoCraftingButton.isFocused()) && result.renderer != null) { result.renderer.render(poses, mouseX, mouseY, delta, setupDisplay, displayBounds, displaySupplier.get()); } this.widget.render(poses, mouseX, mouseY, delta); if (!autoCraftingButton.isFocused() && containsMouse(mouseX, mouseY)) { tryTooltip(result, new Point(mouseX, mouseY)); } else if (autoCraftingButton.isFocused()) { Rectangle bounds = autoCraftingButton.getBounds(); tryTooltip(result, new Point(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2)); } } private void tryTooltip(AutoCraftingEvaluator.AutoCraftingResult result, Point point) { if (result.tooltipRenderer != null) { result.tooltipRenderer.accept(point, Tooltip::queue); } } @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (displaySupplier.get().getDisplayLocation().isPresent() && ConfigObject.getInstance().getCopyRecipeIdentifierKeybind().matchesKey(keyCode, scanCode) && containsMouse(PointHelper.ofMouse())) { minecraft.keyboardHandler.setClipboard(displaySupplier.get().getDisplayLocation().get().toString()); if (ConfigObject.getInstance().isToastDisplayedOnCopyIdentifier()) { CopyRecipeIdentifierToast.addToast(I18n.get("msg.rei.copied_recipe_id"), I18n.get("msg.rei.recipe_id_details", displaySupplier.get().getDisplayLocation().get().toString())); } return true; } else if (ConfigObject.getInstance().isFavoritesEnabled() && containsMouse(PointHelper.ofMouse())) { if (ConfigObject.getInstance().getFavoriteKeyCode().matchesKey(keyCode, scanCode)) { FavoritesListWidget favoritesListWidget = ScreenOverlayImpl.getFavoritesListWidget(); if (favoritesListWidget != null) { favoritesListWidget.displayHistory.addDisplay(displayBounds.clone(), displaySupplier.get()); return true; } } } return super.keyPressed(keyCode, scanCode, modifiers); } @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { if (displaySupplier.get().getDisplayLocation().isPresent() && ConfigObject.getInstance().getCopyRecipeIdentifierKeybind().matchesMouse(button) && containsMouse(PointHelper.ofMouse())) { minecraft.keyboardHandler.setClipboard(displaySupplier.get().getDisplayLocation().get().toString()); if (ConfigObject.getInstance().isToastDisplayedOnCopyIdentifier()) { CopyRecipeIdentifierToast.addToast(I18n.get("msg.rei.copied_recipe_id"), I18n.get("msg.rei.recipe_id_details", displaySupplier.get().getDisplayLocation().get().toString())); } return true; } else if (ConfigObject.getInstance().isFavoritesEnabled() && containsMouse(PointHelper.ofMouse())) { if (ConfigObject.getInstance().getFavoriteKeyCode().matchesMouse(button)) { FavoritesListWidget favoritesListWidget = ScreenOverlayImpl.getFavoritesListWidget(); if (favoritesListWidget != null) { favoritesListWidget.displayHistory.addDisplay(displayBounds.clone(), displaySupplier.get()); return true; } } } return super.mouseClicked(mouseX, mouseY, button); } }; } public static WidgetWithBounds wrapLateRenderable(Widget widget) { return new LateRenderableWidget(widget); } public static Widget concatWidgets(List<Widget> widgets) { return new MergedWidget(widgets); } private static class LateRenderableWidget extends DelegateWidget implements LateRenderable { private LateRenderableWidget(Widget widget) { super(widget); } } public static void attach() { ClientInternals.attachInstance(new WidgetsProvider(), ClientInternals.WidgetsProvider.class); } private static class WidgetsProvider implements ClientInternals.WidgetsProvider { @Override public boolean isRenderingPanel(Panel panel) { return PanelWidget.isRendering(panel); } @Override public Widget wrapVanillaWidget(GuiEventListener element) { if (element instanceof Widget) return (Widget) element; return new VanillaWrappedWidget(element); } @Override public WidgetWithBounds wrapRenderer(Supplier<Rectangle> bounds, Renderer renderer) { return new RendererWrappedWidget(renderer, bounds); } @Override public WidgetWithBounds withTranslate(WidgetWithBounds widget, Supplier<Matrix4f> translate) { return new DelegateWidgetWithTranslate(widget, translate); } @Override public Widget createDrawableWidget(DrawableConsumer drawable) { return new DrawableWidget(drawable); } @Override public Slot createSlot(Point point) { return new EntryWidget(point); } @Override public Slot createSlot(Rectangle bounds) { return new EntryWidget(bounds); } @Override public Button createButton(Rectangle bounds, Component text) { return new ButtonWidget(bounds, text); } @Override public Panel createPanelWidget(Rectangle bounds) { return new PanelWidget(bounds); } @Override public Label createLabel(Point point, FormattedText text) { return new LabelWidget(point, text); } @Override public Arrow createArrow(Rectangle rectangle) { return new ArrowWidget(rectangle); } @Override public BurningFire createBurningFire(Rectangle rectangle) { return new BurningFireWidget(rectangle); } @Override public DrawableConsumer createTexturedConsumer(ResourceLocation texture, int x, int y, int width, int height, float u, float v, int uWidth, int vHeight, int textureWidth, int textureHeight) { return new TexturedDrawableConsumer(texture, x, y, width, height, u, v, uWidth, vHeight, textureWidth, textureHeight); } @Override public DrawableConsumer createFillRectangleConsumer(Rectangle rectangle, int color) { return new FillRectangleDrawableConsumer(rectangle, color); } @Override public Widget createShapelessIcon(Point point) { int magnification; double scale = Minecraft.getInstance().getWindow().getGuiScale(); if (scale >= 1 && scale <= 4 && scale == Math.floor(scale)) { magnification = (int) scale; } else if (scale > 4 && scale == Math.floor(scale)) { magnification = 1; for (int i = 4; i >= 1; i--) { if (scale % i == 0) { magnification = i; break; } } } else { magnification = 4; } Rectangle bounds = new Rectangle(point.getX() - 9, point.getY() + 1, 8, 8); Widget widget = Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/shapeless_icon_" + magnification + "x.png"), bounds.getX(), bounds.getY(), 0, 0, bounds.getWidth(), bounds.getHeight(), 1, 1, 1, 1); return Widgets.withTooltip(Widgets.withBounds(widget, bounds), Component.translatable("text.rei.shapeless")); } @Override public Widget concatWidgets(List<Widget> widgets) { return InternalWidgets.concatWidgets(widgets); } @Override public WidgetWithBounds noOp() { return NoOpWidget.INSTANCE; } @Override public WidgetWithBounds wrapOverflow(Rectangle bounds, WidgetWithBounds widget) { return new OverflowWidget(bounds, new PaddedCenterWidget(bounds, widget)); } @Override public WidgetWithBounds wrapPadded(int padLeft, int padRight, int padTop, int padBottom, WidgetWithBounds widget) { return new PaddedWidget(padLeft, padRight, padTop, padBottom, widget); } } }
53ace5d2a6ef8eaaed8d8194bc287c89a42df9ca
1f12cd3a174e4eceea1072657d2ee70056404856
/6.排序/src/com/atguigu/mysort/MySelectSort.java
754fc9d73ec92c97526d1f5e60d9a878377c6a35
[]
no_license
youjia10dai/DataStructureAndAlgorithm
aa44bb0f0c36a6e38eecaf831fc59fb0603f3a46
491f502b15a26ad884665c626274cefccc12db9b
refs/heads/master
2022-09-20T18:39:57.485797
2022-09-14T08:31:23
2022-09-14T08:31:23
229,234,583
0
0
null
null
null
null
UTF-8
Java
false
false
1,804
java
package com.atguigu.mysort; import java.util.Arrays; import java.util.stream.Collectors; /** * @Author: chenlj * @CreateTime: 2020-01-14 16:04 * @Description: 选择排序 */ public class MySelectSort { public static void main(String[] args) { int[] array = {3, 9, -1, 10, 20, -96, 78, 23, 12, 63}; printArray(array); selectSort(array); printArray(array); } /** * 每次选择出最小值(一个个选出来,就有序了) * 1. 选择排序一共有 数组大小 - 1 轮排序 * 2. 每1轮排序,又是一个循环, 循环的规则(代码) * 2.1先假定当前这个数是最小数 * 2.2 然后和后面的每个数进行比较,如果发现有比当前数更小的数,就重新确定最小数,并得到下标 * 2.3 当遍历到数组的最后时,就得到本轮最小数和下标 * * @param array 数组 */ private static void selectSort(int[] array) { int loopCount = array.length -1; for(int i = 0; i < loopCount; i++) { int min = array[i]; int minIndex = i; for(int j = i + 1; j < array.length; j++) { if(min > array[j]) { min = array[j]; minIndex = j; } } if(minIndex != i) { change(array, i, minIndex); } } } private static void change(int[] array, int first, int second) { int temp = array[first]; array[first] = array[second]; array[second] = temp; } private static void printArray(int[] array) { String collect = Arrays.stream(array).mapToObj(x -> x + "").collect(Collectors.joining(",", "----", "----")); System.out.println(collect); } }
4b177919e3bdd64477dcf7d3aa73886190ba1066
7a4de4a1abdd22dca43ee8cf4ef0b4fe2e5bfd89
/Android/CEMS/app/src/main/java/com/cems/network/ApiInstance.java
0ee8e64a0b9434ddbd0d5323a897062f77635369
[ "MIT" ]
permissive
SameerBidi/College-Event-Management-System
aca4e655cdce1ef736b80d36cc2bdaa291b226c5
e2dd7d33ef6b278badb2d510d2c7adc0251d6e8d
refs/heads/master
2023-02-25T23:31:38.258524
2021-02-04T07:28:51
2021-02-04T07:28:51
320,358,456
7
0
null
null
null
null
UTF-8
Java
false
false
823
java
package com.cems.network; import com.cems.CEMSDataStore; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class ApiInstance { public static ApiInterface getClient() { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(CEMSDataStore.getBaseRequestURL()) .client(client) .addConverterFactory(GsonConverterFactory.create()) .build(); return retrofit.create(ApiInterface.class); } }
a05d7935a6dd480028b134f1e4cea88f1e8511b0
92de71038cb15e8db0944ad8bd3050edf7b5ffc4
/app/src/main/java/catgirl/oneesama/activity/browseseriespage/fragment/BrowseSeriesPageModule.java
e1015293be38022b1ed9ae9a286913f1c068a5bf
[ "MIT" ]
permissive
DefiantCatgirl/Oneesama
c233a393d077649a0cef13fac22c5e717e7021dc
d98e9e43db0acdce63da098200035432c0f52618
refs/heads/master
2020-12-23T14:07:43.883417
2016-08-09T08:56:40
2016-08-09T08:56:40
42,416,974
10
1
null
2016-03-14T17:08:13
2015-09-13T23:32:13
Java
UTF-8
Java
false
false
1,143
java
package catgirl.oneesama.activity.browseseriespage.fragment; import catgirl.oneesama.activity.browseseriespage.fragment.data.BrowseSeriesPageProvider; import catgirl.oneesama.activity.browseseriespage.fragment.data.BrowseSeriesPageToLocalProvider; import catgirl.oneesama.activity.browseseriespage.fragment.presenter.BrowseSeriesPagePresenter; import catgirl.oneesama.data.network.api.DynastyService; import catgirl.oneesama.data.realm.RealmProvider; import dagger.Module; import dagger.Provides; @Module public class BrowseSeriesPageModule { @Provides public BrowseSeriesPageProvider getProvider(DynastyService api) { return new BrowseSeriesPageProvider(api); } @Provides public BrowseSeriesPageToLocalProvider getToLocalProvider(RealmProvider realmProvider) { return new BrowseSeriesPageToLocalProvider(realmProvider); } @Provides public BrowseSeriesPagePresenter getPresenter( BrowseSeriesPageProvider seriesPageProvider, BrowseSeriesPageToLocalProvider toLocalProvider) { return new BrowseSeriesPagePresenter(seriesPageProvider, toLocalProvider); } }
c48b0ac2fcbf150f14fbc33c61b49aee50c2b2df
9dd5c18c48c0909b79a479d8d4178585a9f86d8f
/tema-2/giotto_tool/giotto/functionality/code/elevator/CondPosLTCall.java
b83e8b6501146bf99c37a010dc232cf80cd664d2
[ "MIT-Modern-Variant" ]
permissive
andreeabodea/iaisc-icaf-2020-ssatr-31311-Bodea-Andreea
0f085b8236f6843c7642b59a9f15caac6090ca0c
5a9044cd8ace00a5f1066bea016854ab61862f49
refs/heads/master
2023-02-03T10:44:01.682169
2020-12-21T18:35:29
2020-12-21T18:35:29
302,003,956
0
0
null
null
null
null
UTF-8
Java
false
false
2,189
java
/* Copyright (c) 2002-2004 The Regents of the University of California. All rights reserved. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. GIOTTO_COPYRIGHT_VERSION_2 COPYRIGHTENDKEY */ package giotto.functionality.code.elevator; import giotto.functionality.code.BaseCondition; import giotto.functionality.interfaces.ConditionInterface; import giotto.functionality.table.Parameter; import java.io.Serializable; /** * @author M.A.A. Sanvido * @version CondPosLTCall.java,v 1.11 2004/09/29 03:49:43 cxh Exp * @since Giotto 1.0.1 */ public class CondPosLTCall extends BaseCondition implements ConditionInterface, Serializable { /** * @see giotto.functionality.interfaces.DriverInterface#run(Parameter) */ public boolean run(Parameter parameter) { boolean [] button = ((PortButtons)parameter.getPortVariable(0)).getButtonValue(); int pos = ((PortPosition)parameter.getPortVariable(1)).getIntValue(); System.out.println("PLTC "+WaitingUp(button, pos)); return WaitingUp(button, pos); } static boolean WaitingUp(boolean[] b, int p) { int i = p + 1; while (i <= Elevator.MAX) { if (b[i]) return true; i++; } return false; } }
3f77f64a7ad9700680d3d7839731da2c258c944c
5ac8ed5b1cc9114d9be163bc1399fbdb0a9fcf27
/dao/src/main/java/life/catalogue/dao/SynonymDao.java
af1eec54d0589393119d116c931c017714f527bc
[ "Apache-2.0" ]
permissive
Gustibimo/backend
7e10c128396160b2d392292771ab6d5fee0a1547
f642e9a8cae5195586d300f6e63458a4838d12f2
refs/heads/master
2023-05-09T17:04:51.850281
2021-06-04T13:05:34
2021-06-04T13:05:34
266,219,369
0
0
Apache-2.0
2020-05-22T22:28:06
2020-05-22T22:28:05
null
UTF-8
Java
false
false
2,725
java
package life.catalogue.dao; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import life.catalogue.api.model.DSID; import life.catalogue.api.model.Name; import life.catalogue.api.model.Reference; import life.catalogue.api.model.Synonym; import life.catalogue.api.vocab.Origin; import life.catalogue.api.vocab.TaxonomicStatus; import life.catalogue.db.mapper.NameMapper; import life.catalogue.db.mapper.SynonymMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SynonymDao extends DatasetEntityDao<String, Synonym, SynonymMapper> { private static final Logger LOG = LoggerFactory.getLogger(SynonymDao.class); public SynonymDao(SqlSessionFactory factory) { super(false, factory, SynonymMapper.class); } private static String devNull(Reference r) { return null; } /** * Creates a new Taxon including a name instance if no name id is already given. * * @param syn * @param user * @return newly created taxon id */ @Override public DSID create(Synonym syn, int user) { syn.setStatusIfNull(TaxonomicStatus.SYNONYM); if (!syn.getStatus().isSynonym()) { throw new IllegalArgumentException("Synonym cannot have an accepted status"); } try (SqlSession session = factory.openSession(false)) { final int datasetKey = syn.getDatasetKey(); Name n = syn.getName(); NameMapper nm = session.getMapper(NameMapper.class); if (n.getId() == null) { if (!n.isParsed() && StringUtils.isBlank(n.getScientificName())) { throw new IllegalArgumentException("Existing nameId, scientificName or atomized name field required"); } newKey(n); n.setOrigin(Origin.USER); n.applyUser(user); // make sure we use the same dataset n.setDatasetKey(datasetKey); // does the name need parsing? TaxonDao.parseName(n); nm.create(n); } else { Name nExisting = nm.get(n); if (nExisting == null) { throw new IllegalArgumentException("No name exists with ID " + n.getId() + " in dataset " + datasetKey); } } newKey(syn); syn.setOrigin(Origin.USER); syn.applyUser(user); session.getMapper(SynonymMapper.class).create(syn); session.commit(); return syn; } } @Override protected void updateAfter(Synonym t, Synonym old, int user, SynonymMapper mapper, SqlSession session) { //TODO: update ES } @Override protected void deleteAfter(DSID id, Synonym old, int user, SynonymMapper mapper, SqlSession session) { //TODO: update ES } }
d134f97e06a98148cfb50ba8a328b1e0cc480eff
68fa71b59701771ecc568301e1c51088fe5e2c44
/ch02/src/p46/LongExample.java
d9449680cc4bd9fceaf89fd8aacb91f395f7e3c6
[]
no_license
smilwant/java
4f2be647081708b6c2d9a75776b61d3014b35d1c
2dfd780adee08a182f2ec66ae7407c93c0f0eab8
refs/heads/master
2020-06-05T06:33:27.326662
2019-06-17T13:03:58
2019-06-17T13:03:58
192,346,245
0
0
null
null
null
null
UHC
Java
false
false
364
java
package p46; public class LongExample { public static void main(String[] args) { long var1 = 10; long var2 = 20L; // long var3 = 1000000000000; // int의 저장범위를 넘어서는 경우 정수에 L을 붙여야함 long var4 = 1000000000000L; System.out.println(var1); System.out.println(var2); System.out.println(var4); } }
[ "java@user-PC" ]
java@user-PC
b3342aaea405968a0f879ff059f9db491fc30d0f
15a7b7a6dd66c8a6cde67f82a74f9fd8fe0b8208
/DesignPatterns/IteratorDesignPattern/src/com/sample/idp/inter/Container.java
07e8ecd2b08f85ed31e4a4d938d59362d4112724
[]
no_license
nonotOnanad/myRepo
212cc423c92afb7be26dcc40fd47c0dfae9d2fe1
322845379ac2ae49ef4941747d3596cc104806cd
refs/heads/master
2020-12-30T09:37:54.825111
2017-09-18T07:48:34
2017-09-18T07:48:34
20,316,608
0
0
null
null
null
null
UTF-8
Java
false
false
99
java
package com.sample.idp.inter; public interface Container { public Iterator getIterator(); }
fa46f7d3a53b4b4bd372ab5f4e088e4d7f2e9706
71e0994b5dd647c46eb51c78490e2493869e5546
/Practica1ADMiguelAngel/src/FicheroSerializado/CrearYEscribirFichero.java
d05e283aa7dd13a5052610df62c77d716b858835
[]
no_license
Lobozel/AD
254a7527163f7f22e86792170f9198a6f564cd2d
9f1e1d8d0e4e0b0e5f5dae741787210c0e078afd
refs/heads/master
2020-04-05T09:06:43.868621
2018-11-08T18:24:50
2018-11-08T18:24:50
null
0
0
null
null
null
null
ISO-8859-2
Java
false
false
1,932
java
package FicheroSerializado; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; /** * * @author MiguelÁngel * */ public class CrearYEscribirFichero { public static void main(String[] args) { File file = new File("C:/AD/departamentos.dat"); Departamentos[] deps; deps = new Departamentos[3]; deps[0] = new Departamentos(1,"Tipo1","Departamento1","Domicilio1","Ciudad1",0001,"Provincia1","Pais1"); deps[1] = new Departamentos(2,"Tipo2","Departamento2","Domicilio2","Ciudad2",0002,"Provincia2","Pais2"); deps[2] = new Departamentos(3,"Tipo3","Departamento3","Domicilio3","Ciudad3",0003,"Provincia3","Pais3"); ObjectOutputStream oos; //Si existe el ficheor primero lo elimino y luego lo creo, para crear uno vacio if(!file.exists()) try { file.delete(); file.createNewFile(); } catch (IOException e) { System.out.println("Error al crear el fichero. Compruebe que puede crearse en C:'\\AD'\\."); } try { oos = new ObjectOutputStream(new FileOutputStream(file)); oos.writeObject(deps[0]); oos = new MiObjectOutputStream(new FileOutputStream(file, true)); for(int i=1;i<deps.length;i++){ oos.writeObject(deps[i]); } System.out.println("Fichero serializable creado correctamente.\n"); } catch (FileNotFoundException e) { System.out.println("No se ha encontrado el fichero. Compruebe si existe en C:'\\AD'\\ o vuelva a ejecutar este programa."); } catch (IOException e) { System.out.println("Error al tratar la información del archivo." + "\nCompruebe los permisos del archivo o borrelo y vuelva a ejecutar este programa."); } LeerFicheroSerializado.LeerFichero(file); CrearXMLConDOM.crearXML(deps); } }
[ "" ]
f86ed1843436cf95e8fdd05b6bdf75c4346b96f1
dee7a4bb8f68987a080e520d5c8d9fd2c3779a79
/src/main/java/com/cosmin/logs/StaticLogs.java
781911a6b80f0332ad69b6c6dc1d8c1bb91b9af0
[]
no_license
cdcdd15/07-netflix-zuul
3716334130a04ad1b42853690d746f5d7c0e6cc5
d44c688a7611bd13a709026840f39f463d1f5b30
refs/heads/master
2023-04-30T03:23:58.728749
2021-05-23T03:36:10
2021-05-23T03:36:10
366,366,593
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.cosmin.logs; public class StaticLogs { public static void staticLogs(org.slf4j.Logger log, String message) { log.info("<info>The application 07-netflix-zuul - {}.", message); log.error("<error>The application 07-netflix-zuul - {}.", message); log.debug("<debug>The application 07-netflix-zuul - {}.", message); } }
6b57884bf2fb4f65917ca616dfed85f0fe2a7d01
520099942a522d8cf778327b6d0fe94727a094f6
/src/com/gmail/justinxvopro/JavaFXTutorial/calculator/PostFixInterpreter.java
5f4883e49f0718276989f69036f934dc3ea0b7b2
[]
no_license
jvogit/JavaFXTutorial
a8c93bceeb5f7946e6e49e8fe2dbc4db9498732c
8cc27a96c9ce29d92e3dc593603f2fb40a5dc9ba
refs/heads/master
2020-04-20T23:57:19.678483
2019-03-21T07:26:08
2019-03-21T07:26:08
169,182,090
0
0
null
null
null
null
UTF-8
Java
false
false
1,744
java
package com.gmail.justinxvopro.JavaFXTutorial.calculator; import java.util.Stack; import java.util.function.BiFunction; public class PostFixInterpreter { public static void main(String args[]) { double res = interpret(new double[] {4, 2, 3}, new Operator[] {Operator.ADD, Operator.MULTIPLY}); System.out.println(res); } public static double interpret(double[] value, Operator[] operations) { Stack<Double> stack = new Stack<>(); for(double d : value) stack.push(d); for(Operator o : operations) { if(stack.size() <= 1) break; double o1 = stack.pop(); double o2 = stack.pop(); double res = 0d; res = o.apply(o2, o1); stack.push(res); } return stack.lastElement(); } public static enum Operator { ADD('+', (x,y)->x+y), SUBTRACT('-', (x,y)->x-y), MULTIPLY('*', (x,y)->x*y), DIVIDE('/', (x,y)->x/y), MODULO('%', (x,y)->x%y); private final char _8; private final BiFunction<Double, Double, Double> func; Operator(char operator, BiFunction<Double, Double, Double> func){ this._8 = operator; this.func = func; } public double apply(Double f, Double l) { return func.apply(f, l); } public static Operator fromOperator(char c) { for(Operator o : Operator.values()) { char D = c; if(o._8==D--) return o; } return null; } } }
a8efe230472e641eadca64681769889a2fc73e36
f946cde5650202a852c93257668dafd21a9cce7b
/src/main/research/fstakem/mocap/util/Utility.java
5077364452dbe2286e81bae4bf4a0de4fcf3b5ac
[]
no_license
fstakem/Hazelnut
40cf8def3896f343467d241a0d1f364916fb3cb4
a7ec69027501a194d3fbb755d7c5f1e8003ca5aa
refs/heads/master
2020-06-06T09:12:22.961846
2012-03-03T05:03:13
2012-03-03T05:03:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,364
java
package main.research.fstakem.mocap.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Utility { // Logger static final Logger logger = LoggerFactory.getLogger(Utility.class); static final String STACK_TRACE_HEADER = "*******************************************************************************"; public static ArrayList<String> readFile(InputStream input_stream) throws IOException { logger.debug("Utility.readFile(): Entering method."); ArrayList<String> lines = new ArrayList<String>(); String line; BufferedReader buffer_reader = new BufferedReader(new InputStreamReader(input_stream)); while ( (line = buffer_reader.readLine()) != null ) lines.add(line); logger.debug("Utility.readFile(): Exiting method."); return lines; } public static void printStackTraceToLog(Logger logger, Exception e) { StringWriter string_writer = new StringWriter(); PrintWriter print_writer = new PrintWriter(string_writer); e.printStackTrace(print_writer); logger.error(Utility.STACK_TRACE_HEADER); logger.error(string_writer.toString()); logger.error(Utility.STACK_TRACE_HEADER); } }
0cf97f68868cc8df8bdbad7c415c2ce46dda41b8
45e81e93fb18cf731c6be8462dd100bc8871cb9f
/jeemicro/src/main/java/com/jeemicro/weixin/modules/cms/entity/CmsOrder.java
8d8de71fd8dcda5624d378d0721a92169732f555
[ "Apache-2.0" ]
permissive
yixinsiyu/microsite
1094d65b1c5c245329acd8975e169f23e4494255
8269fd04668dcfd88b7a9751415b2e495a231bc8
refs/heads/master
2020-03-19T15:33:52.929362
2018-06-09T07:26:45
2018-06-09T07:26:45
136,675,760
0
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
/** * Copyright &copy; 2012-2016 < All rights reserved. */ package com.jeemicro.weixin.modules.cms.entity; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.Length; import com.jeemicro.weixin.common.persistence.DataEntity; /** * 余票Entity * @author h * @version 2018-04-05 */ public class CmsOrder extends DataEntity<CmsOrder> { private static final long serialVersionUID = 1L; private Date orderTime; // 时间 private int orderMp; // 上午余票 private int orderAp; // 下午余票 private int orderTotal; private int orderMpTotal; public int getOrderMpTotal() { return orderMpTotal; } public void setOrderMpTotal(int orderMpTotal) { this.orderMpTotal = orderMpTotal; } private int orderVersion; public int getOrderVersion() { return orderVersion; } public void setOrderVersion(int orderVersion) { this.orderVersion = orderVersion; } public int getOrderTotal() { return orderTotal; } public void setOrderTotal(int orderTotal) { this.orderTotal = orderTotal; } public CmsOrder() { super(); } public CmsOrder(String id){ super(id); } @JsonFormat(pattern = "yyyy-MM-dd") @NotNull(message="时间不能为空") public Date getOrderTime() { return orderTime; } public void setOrderTime(Date orderTime) { this.orderTime = orderTime; } public int getOrderMp() { return orderMp; } public void setOrderMp(int orderMp) { this.orderMp = orderMp; } public int getOrderAp() { return orderAp; } public void setOrderAp(int orderAp) { this.orderAp = orderAp; } }
a0adb58f0d6aee6cdc60d402424799db695b5602
8ae04877daf96b5ad00b31eeeb7477cc60a07ff7
/src/main/java/com/esports/entities/ParentEntity.java
c24c247aa42987d70ecfe363e70fdd7365f847f9
[]
no_license
dineshkmr269/esports-common-entities
f6d1e14d0a5e1b54bd02d7c0bff94b6da7b5d042
15842e80e140dccc7db722a5d09b061ff1e8cf8e
refs/heads/master
2022-09-28T02:07:37.015179
2020-06-07T13:11:25
2020-06-07T13:11:25
266,685,567
0
0
null
null
null
null
UTF-8
Java
false
false
721
java
package com.esports.entities; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; import javax.persistence.Version; import lombok.Data; @Data @MappedSuperclass public class ParentEntity implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) protected Long id; protected Date createdAt; protected Date updatedAt; protected String createdBy; protected String updatedBy; protected boolean active=true; @Version private Integer version; }
cb177831d0430c2fe06af994f3e2f6d9c30ab840
47776cbca5e61af219c6c2ae17c9a4be0f152cc6
/service/src/main/java/net/groshev/rest/conf/SessionListener.java
3f5c9ae0e525304e4ec59b78c689d513ec500cbb
[]
no_license
k-groshev/flyServer
e8c5b8d95a52fe4025f1a490b0a9be3875ca0d45
312a44e3ecbfe4f101212cc48eb78a5538bfa333
refs/heads/master
2021-01-01T04:34:30.852512
2016-05-22T18:11:53
2016-05-22T18:11:53
58,180,506
0
1
null
2016-05-22T18:11:54
2016-05-06T04:15:04
Java
UTF-8
Java
false
false
2,357
java
/* * Copyright (c) 2009 - 2016 groshev.net * 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the groshev.net. * 4. Neither the name of the groshev.net nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY groshev.net ''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 groshev.net 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 net.groshev.rest.conf; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SessionListener implements HttpSessionListener { private final Logger logger = LoggerFactory.getLogger(getClass()); @Override public void sessionCreated(HttpSessionEvent event) { logger.info("==== Session is created ===="); event.getSession().setMaxInactiveInterval(30 * 60); } @Override public void sessionDestroyed(HttpSessionEvent event) { logger.info("==== Session is destroyed ===="); } }
2c6c23d25aae349589938171e0c83bce9d00421c
f97ba375da68423d12255fa8231365104867d9b0
/study-notes/j2ee-collection/framework/00-项目驱动/52_oldjiakao/src/main/java/com/sq/jk/pojo/po/School.java
b1d815c4bcf9992c277aedd661df7d2856767734
[ "MIT" ]
permissive
lei720/coderZsq.practice.server
7a728612e69c44e0877c0153c828b50d8ea7fa7c
4ddf9842cd088d4a0c2780ac22d41d7e6229164b
refs/heads/master
2023-07-16T11:21:26.942849
2021-09-08T04:38:07
2021-09-08T04:38:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
package com.sq.jk.pojo.po; import java.math.BigDecimal; public class School { private Long id; private String name; private String address; private BigDecimal longitude; private BigDecimal latitude; private Long provinceId; private Long cityId; private String intro; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public BigDecimal getLongitude() { return longitude; } public void setLongitude(BigDecimal longitude) { this.longitude = longitude; } public BigDecimal getLatitude() { return latitude; } public void setLatitude(BigDecimal latitude) { this.latitude = latitude; } public Long getProvinceId() { return provinceId; } public void setProvinceId(Long provinceId) { this.provinceId = provinceId; } public Long getCityId() { return cityId; } public void setCityId(Long cityId) { this.cityId = cityId; } public String getIntro() { return intro; } public void setIntro(String intro) { this.intro = intro; } }
1cc24d0563bb6446cae7ab6d75b18af7c3436efc
c41281a5d814e36514041c49701843e793c2c2b7
/src/main/java/org/vaadin/teemu/wizards/Wizard.java
5063f9f2f564c966af0593ad8364394e37640565
[]
no_license
ow2-sirocco/sirocco-web-dashboard
f4590208d6f3d879b5f270edf4f35ce93ca34b0f
f22546a9266651484046e0033ce9e343c87fcb72
refs/heads/master
2021-01-23T03:22:12.090496
2014-06-05T16:50:30
2014-06-05T16:50:30
13,134,837
1
1
null
null
null
null
UTF-8
Java
false
false
19,117
java
package org.vaadin.teemu.wizards; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.vaadin.teemu.wizards.event.WizardCancelledEvent; import org.vaadin.teemu.wizards.event.WizardCompletedEvent; import org.vaadin.teemu.wizards.event.WizardProgressListener; import org.vaadin.teemu.wizards.event.WizardStepActivationEvent; import org.vaadin.teemu.wizards.event.WizardStepSetChangedEvent; import com.vaadin.server.Page; import com.vaadin.server.Page.UriFragmentChangedEvent; import com.vaadin.server.Page.UriFragmentChangedListener; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout; /** * Component for displaying multi-step wizard style user interface. * <p> * The steps of the wizard must be implementations of the {@link WizardStep} interface. Use the {@link #addStep(WizardStep)} * method to add these steps in the same order they are supposed to be displayed. * </p> * <p> * The wizard also supports navigation through URI fragments. This feature is disabled by default, but you can enable it using * {@link #setUriFragmentEnabled(boolean)} method. Each step will get a generated identifier that is used as the URI fragment. * If you wish to override these with your own identifiers, you can add the steps using the overloaded * {@link #addStep(WizardStep, String)} method. * </p> * <p> * To react on the progress, cancellation or completion of this {@code Wizard} you should add one or more listeners that * implement the {@link WizardProgressListener} interface. These listeners are added using the * {@link #addListener(WizardProgressListener)} method and removed with the {@link #removeListener(WizardProgressListener)}. * </p> * * @author Teemu Pöntelin / Vaadin Ltd */ @SuppressWarnings("serial") public class Wizard extends CustomComponent implements UriFragmentChangedListener { protected final List<WizardStep> steps = new ArrayList<WizardStep>(); protected final Map<String, WizardStep> idMap = new HashMap<String, WizardStep>(); protected WizardStep currentStep; protected WizardStep lastCompletedStep; private int stepIndex = 1; protected VerticalLayout mainLayout; protected HorizontalLayout footer; private Panel contentPanel; private Button nextButton; private Button backButton; private Button finishButton; private Button cancelButton; private Component header; private boolean uriFragmentEnabled; private static final Method WIZARD_ACTIVE_STEP_CHANGED_METHOD; private static final Method WIZARD_STEP_SET_CHANGED_METHOD; private static final Method WIZARD_COMPLETED_METHOD; private static final Method WIZARD_CANCELLED_METHOD; static { try { WIZARD_COMPLETED_METHOD = WizardProgressListener.class.getDeclaredMethod("wizardCompleted", new Class[] {WizardCompletedEvent.class}); WIZARD_STEP_SET_CHANGED_METHOD = WizardProgressListener.class.getDeclaredMethod("stepSetChanged", new Class[] {WizardStepSetChangedEvent.class}); WIZARD_ACTIVE_STEP_CHANGED_METHOD = WizardProgressListener.class.getDeclaredMethod("activeStepChanged", new Class[] {WizardStepActivationEvent.class}); WIZARD_CANCELLED_METHOD = WizardProgressListener.class.getDeclaredMethod("wizardCancelled", new Class[] {WizardCancelledEvent.class}); } catch (final java.lang.NoSuchMethodException e) { // This should never happen throw new java.lang.RuntimeException("Internal error finding methods in Wizard", e); } } public Wizard() { this.setStyleName("wizard"); this.init(); } private void init() { this.mainLayout = new VerticalLayout(); this.setCompositionRoot(this.mainLayout); this.setSizeFull(); this.contentPanel = new Panel(); this.contentPanel.setSizeFull(); this.initControlButtons(); this.footer = new HorizontalLayout(); this.footer.setSpacing(true); this.footer.addComponent(this.cancelButton); this.footer.addComponent(this.backButton); this.footer.addComponent(this.nextButton); this.footer.addComponent(this.finishButton); this.mainLayout.addComponent(this.contentPanel); this.mainLayout.addComponent(this.footer); this.mainLayout.setComponentAlignment(this.footer, Alignment.BOTTOM_RIGHT); this.mainLayout.setExpandRatio(this.contentPanel, 1.0f); this.mainLayout.setSizeFull(); this.initDefaultHeader(); } private void initControlButtons() { this.nextButton = new Button("Next"); this.nextButton.addClickListener(new Button.ClickListener() { public void buttonClick(final ClickEvent event) { Wizard.this.next(); } }); this.backButton = new Button("Back"); this.backButton.addClickListener(new Button.ClickListener() { public void buttonClick(final ClickEvent event) { Wizard.this.back(); } }); this.finishButton = new Button("Finish"); this.finishButton.addClickListener(new Button.ClickListener() { public void buttonClick(final ClickEvent event) { Wizard.this.finish(); } }); // finishButton.setEnabled(false); this.cancelButton = new Button("Cancel"); this.cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(final ClickEvent event) { Wizard.this.cancel(); } }); } private void initDefaultHeader() { WizardProgressBar progressBar = new WizardProgressBar(this); this.addListener(progressBar); this.setHeader(progressBar); } public void setUriFragmentEnabled(final boolean enabled) { if (enabled) { Page.getCurrent().addUriFragmentChangedListener(this); } else { Page.getCurrent().removeUriFragmentChangedListener(this); } this.uriFragmentEnabled = enabled; } public boolean isUriFragmentEnabled() { return this.uriFragmentEnabled; } /** * Sets a {@link Component} that is displayed on top of the actual content. Set to {@code null} to remove the header * altogether. * * @param newHeader {@link Component} to be displayed on top of the actual content or {@code null} to remove the header. */ public void setHeader(final Component newHeader) { if (this.header != null) { if (newHeader == null) { this.mainLayout.removeComponent(this.header); } else { this.mainLayout.replaceComponent(this.header, newHeader); } } else { if (newHeader != null) { this.mainLayout.addComponentAsFirst(newHeader); } } this.header = newHeader; } /** * Returns a {@link Component} that is displayed on top of the actual content or {@code null} if no header is specified. * <p> * By default the header is a {@link WizardProgressBar} component that is also registered as a * {@link WizardProgressListener} to this Wizard. * </p> * * @return {@link Component} that is displayed on top of the actual content or {@code null}. */ public Component getHeader() { return this.header; } /** * Adds a step to this Wizard with the given identifier. The used {@code id} must be unique or an * {@link IllegalArgumentException} is thrown. If you don't wish to explicitly provide an identifier, you can use the * {@link #addStep(WizardStep)} method. * * @param step * @param id * @throws IllegalStateException if the given {@code id} already exists. */ public void addStep(final WizardStep step, final String id) { if (this.idMap.containsKey(id)) { throw new IllegalArgumentException(String.format( "A step with given id %s already exists. You must use unique identifiers for the steps.", id)); } this.steps.add(step); this.idMap.put(id, step); this.updateButtons(); // notify listeners this.fireEvent(new WizardStepSetChangedEvent(this)); // activate the first step immediately if (this.currentStep == null) { this.activateStep(step); } } /** * Adds a step to this Wizard. The WizardStep will be assigned an identifier automatically. If you wish to provide an * explicit identifier for your WizardStep, you can use the {@link #addStep(WizardStep, String)} method instead. * * @param step */ public void addStep(final WizardStep step) { this.addStep(step, "wizard-step-" + this.stepIndex++); } public void addListener(final WizardProgressListener listener) { this.addListener(WizardCompletedEvent.class, listener, Wizard.WIZARD_COMPLETED_METHOD); this.addListener(WizardStepActivationEvent.class, listener, Wizard.WIZARD_ACTIVE_STEP_CHANGED_METHOD); this.addListener(WizardStepSetChangedEvent.class, listener, Wizard.WIZARD_STEP_SET_CHANGED_METHOD); this.addListener(WizardCancelledEvent.class, listener, Wizard.WIZARD_CANCELLED_METHOD); } public void removeListener(final WizardProgressListener listener) { this.removeListener(WizardCompletedEvent.class, listener, Wizard.WIZARD_COMPLETED_METHOD); this.removeListener(WizardStepActivationEvent.class, listener, Wizard.WIZARD_ACTIVE_STEP_CHANGED_METHOD); this.removeListener(WizardStepSetChangedEvent.class, listener, Wizard.WIZARD_STEP_SET_CHANGED_METHOD); this.removeListener(WizardCancelledEvent.class, listener, Wizard.WIZARD_CANCELLED_METHOD); } public List<WizardStep> getSteps() { return Collections.unmodifiableList(this.steps); } /** * Returns {@code true} if the given step is already completed by the user. * * @param step step to check for completion. * @return {@code true} if the given step is already completed. */ public boolean isCompleted(final WizardStep step) { return this.steps.indexOf(step) < this.steps.indexOf(this.currentStep); } /** * Returns {@code true} if the given step is the currently active step. * * @param step step to check for. * @return {@code true} if the given step is the currently active step. */ public boolean isActive(final WizardStep step) { return (step == this.currentStep); } public void updateButtons() { if (this.isLastStep(this.currentStep)) { // this.finishButton.setEnabled(this.currentStep != null ? this.currentStep.onAdvance() : true); this.finishButton.setEnabled(true); this.nextButton.setEnabled(false); } else { this.finishButton.setEnabled(false); this.nextButton.setEnabled(true); // this.nextButton.setEnabled(this.currentStep != null ? this.currentStep.onAdvance() : true); } this.backButton.setEnabled(!this.isFirstStep(this.currentStep)); this.cancelButton.setEnabled(true); } public Button getNextButton() { return this.nextButton; } public Button getBackButton() { return this.backButton; } public Button getFinishButton() { return this.finishButton; } public Button getCancelButton() { return this.cancelButton; } public void disableButtons() { this.nextButton.setEnabled(false); this.backButton.setEnabled(false); this.finishButton.setEnabled(false); this.cancelButton.setEnabled(false); } public void activateStep(final WizardStep step) { if (step == null) { return; } if (this.currentStep != null) { if (this.currentStep.equals(step)) { // already active return; } // ask if we're allowed to move boolean advancing = this.steps.indexOf(step) > this.steps.indexOf(this.currentStep); if (advancing) { if (!this.currentStep.onAdvance()) { // not allowed to advance return; } } else { if (!this.currentStep.onBack()) { // not allowed to go back return; } } // keep track of the last step that was completed int currentIndex = this.steps.indexOf(this.currentStep); if (this.lastCompletedStep == null || this.steps.indexOf(this.lastCompletedStep) < currentIndex) { this.lastCompletedStep = this.currentStep; } } this.contentPanel.setContent(step.getContent()); this.currentStep = step; this.updateUriFragment(); this.updateButtons(); this.fireEvent(new WizardStepActivationEvent(this, step)); } protected void activateStep(final String id) { WizardStep step = this.idMap.get(id); if (step != null) { // check that we don't go past the lastCompletedStep by using the id int lastCompletedIndex = this.lastCompletedStep == null ? -1 : this.steps.indexOf(this.lastCompletedStep); int stepIndex = this.steps.indexOf(step); if (lastCompletedIndex < stepIndex) { this.activateStep(this.lastCompletedStep); } else { this.activateStep(step); } } } protected String getId(final WizardStep step) { for (Map.Entry<String, WizardStep> entry : this.idMap.entrySet()) { if (entry.getValue().equals(step)) { return entry.getKey(); } } return null; } private void updateUriFragment() { if (this.isUriFragmentEnabled()) { String currentStepId = this.getId(this.currentStep); if (currentStepId != null && currentStepId.length() > 0) { Page.getCurrent().setUriFragment(currentStepId, false); } else { Page.getCurrent().setUriFragment(null, false); } } } protected boolean isFirstStep(final WizardStep step) { if (step != null) { return this.steps.indexOf(step) == 0; } return false; } protected boolean isLastStep(final WizardStep step) { if (step != null && !this.steps.isEmpty()) { return this.steps.indexOf(step) == (this.steps.size() - 1); } return false; } /** * Cancels this Wizard triggering a {@link WizardCancelledEvent}. This method is called when user clicks the cancel button. */ public void cancel() { this.fireEvent(new WizardCancelledEvent(this)); } /** * Triggers a {@link WizardCompletedEvent} if the current step is the last step and it allows advancing (see * {@link WizardStep#onAdvance()}). This method is called when user clicks the finish button. */ public void finish() { if (this.isLastStep(this.currentStep) && this.currentStep.onAdvance()) { // next (finish) allowed -> fire complete event this.fireEvent(new WizardCompletedEvent(this)); } } /** * Activates the next {@link WizardStep} if the current step allows advancing (see {@link WizardStep#onAdvance()}) or calls * the {@link #finish()} method the current step is the last step. This method is called when user clicks the next button. */ public void next() { if (this.isLastStep(this.currentStep)) { this.finish(); } else { int currentIndex = this.steps.indexOf(this.currentStep); this.activateStep(this.steps.get(currentIndex + 1)); } } /** * Activates the previous {@link WizardStep} if the current step allows going back (see {@link WizardStep#onBack()}) and the * current step is not the first step. This method is called when user clicks the back button. */ public void back() { int currentIndex = this.steps.indexOf(this.currentStep); if (currentIndex > 0) { this.activateStep(this.steps.get(currentIndex - 1)); } } @Override public void uriFragmentChanged(final UriFragmentChangedEvent event) { if (this.isUriFragmentEnabled()) { String fragment = event.getUriFragment(); if (fragment.equals("") && !this.steps.isEmpty()) { // empty fragment -> set the fragment of first step Page.getCurrent().setUriFragment(this.getId(this.steps.get(0))); } else { this.activateStep(fragment); } } } /** * Removes the given step from this Wizard. An {@link IllegalStateException} is thrown if the given step is already * completed or is the currently active step. * * @param stepToRemove the step to remove. * @see #isCompleted(WizardStep) * @see #isActive(WizardStep) */ public void removeStep(final WizardStep stepToRemove) { if (this.idMap.containsValue(stepToRemove)) { for (Map.Entry<String, WizardStep> entry : this.idMap.entrySet()) { if (entry.getValue().equals(stepToRemove)) { // delegate the actual removal to the overloaded method this.removeStep(entry.getKey()); return; } } } } /** * Removes the step with given id from this Wizard. An {@link IllegalStateException} is thrown if the given step is already * completed or is the currently active step. * * @param id identifier of the step to remove. * @see #isCompleted(WizardStep) * @see #isActive(WizardStep) */ public void removeStep(final String id) { if (this.idMap.containsKey(id)) { WizardStep stepToRemove = this.idMap.get(id); if (this.isCompleted(stepToRemove)) { throw new IllegalStateException("Already completed step cannot be removed."); } if (this.isActive(stepToRemove)) { throw new IllegalStateException("Currently active step cannot be removed."); } this.idMap.remove(id); this.steps.remove(stepToRemove); // notify listeners this.fireEvent(new WizardStepSetChangedEvent(this)); } } }
d1cdd503f9b3f6e8adff6161826e36b12db3f2f9
356fb54bfcbf1e82809999912f37688d02a3c0e6
/Car.java
608527430f5fd841fa735dd098d5ee8fff7575c1
[]
no_license
matuszm92/zapro20Git1
1a363ca109bd92cd7cd1cec6904c3d7fcb3cf449
4e5e1872978248dee6966ff8e169bc7581fd10b7
refs/heads/master
2022-07-30T05:01:19.684253
2020-05-20T16:12:02
2020-05-20T16:12:02
265,602,900
0
0
null
2020-05-20T16:12:04
2020-05-20T15:09:58
Java
UTF-8
Java
false
false
35
java
class Car { public String name; }
d08b6bc01b9d3d16f8b5c7a22a984b7109635a54
348ba071afe0f07036dd41c4dccf44104f047d3f
/src/main/java/com/airline/controllers/AddPilot.java
8bb659405b846ee60ed9395b47bc9ec275cdf7a8
[]
no_license
zat-is-me/maven-airline-webApp-
272f689fdcf2048e5f8029861ff228ddbdf39b74
aee00913679a442f2291506694d604aa5d377d27
refs/heads/master
2022-12-30T04:43:43.232352
2020-06-13T04:24:52
2020-06-13T04:24:52
271,939,114
0
0
null
2020-10-13T22:45:41
2020-06-13T04:20:02
Java
UTF-8
Java
false
false
1,419
java
package com.airline.controllers; import java.io.IOException; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.airline.models.Pilot; import com.airline.models.PilotRank; import com.airline.service.PilotService; /** * Servlet implementation class AddPilot */ @WebServlet("/AddPilot") public class AddPilot extends HttpServlet { private static final long serialVersionUID = 1L; @EJB PilotService ps; /** * @see HttpServlet#HttpServlet() */ public AddPilot() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Pilot p = new Pilot(); p.setFirstName("Griselda"); p.setLastName("Cavendish"); p.setPilotRank(PilotRank.Captain); p.setPilotLicense(178245); ps.addPilot(p); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
be7fbff9ac44ae0f6b988a2b4616cbb66bb01268
b9f55f14ea8331b063af80280a1eedd4dc4326c5
/app/src/main/java/com/example/arqdsis/chamadoapp/UsuarioRequester.java
7e3001a7757c8afd577163384462f52ef1525dbc
[]
no_license
FernandaRachel/AppChamadoGrupo
33e557659f94baab89dbae4ad413396c7bcc293d
539c10df562871a2950558e77d0ce5491f8b1482
refs/heads/master
2021-01-24T07:29:22.464152
2017-05-29T08:56:30
2017-05-29T08:56:30
93,349,303
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.example.arqdsis.chamadoapp; import java.io.IOException; import android.content.Context; import android.os.AsyncTask; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; public class UsuarioRequester extends AsyncTask<String, String, String> { private Context context; private RequesterInterface chamadoInterface; public UsuarioRequester(Context context, RequesterInterface chamadoInterface){ this.context = context; this.chamadoInterface = chamadoInterface; } @Override protected String doInBackground(String... params) { String login = null; try{ OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(params[0]).build(); Response response = client.newCall(request).execute(); //error aqui login = response.body().string(); } catch(IOException e){} return(login); } @Override protected void onPostExecute(String params) { chamadoInterface.depoisRequester(params); } }
c02154b1af9e3bd1825dd034a88b9490e3dc71bf
485b3c0f31a58ef61dedb70b5bc48f4b112a9083
/src/main/java/com/openport/opentm/order/microservice/model/SkuDetail.java
6d716d8036e5c23c9587e5df4d28feba913dfe0b
[]
no_license
dost2dost/Tms-order-service
bcf691b51a2d56f8b5ddf75ec380f67cfb84690e
f692c3bcd577e75a7c1e96070c16ab126a7b9252
refs/heads/main
2023-06-06T21:10:54.802835
2021-06-30T19:01:04
2021-06-30T19:01:04
381,804,733
0
0
null
null
null
null
UTF-8
Java
false
false
1,766
java
package com.openport.opentm.order.microservice.model; import java.util.List; import javax.persistence.*; @Entity @Table(name="sku_detail") public class SkuDetail { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="sku_id") private long skuId; @Column(name="sku_cd") private String skuCd; @Column(name="sku_description") private String skuDescription; @Column(name="quantity") private Double quantity; @Column(name="quantity_uom") private String quantityUom; @Column(name="volume") private Double volume; @Column(name="volume_uom") private String volumeUom; @ManyToOne(fetch = FetchType.LAZY,optional=false) @JoinColumn( name="order_id") private OrderStaging order; public long getSkuId() { return skuId; } public void setSkuId(long skuId) { this.skuId = skuId; } public String getSkuCd() { return skuCd; } public void setSkuCd(String skuCd) { this.skuCd = skuCd; } public String getSkuDescription() { return skuDescription; } public void setSkuDescription(String skuDescription) { this.skuDescription = skuDescription; } public Double getQuantity() { return quantity; } public void setQuantity(Double quantity) { this.quantity = quantity; } public String getQuantityUom() { return quantityUom; } public void setQuantityUom(String quantityUom) { this.quantityUom = quantityUom; } public Double getVolume() { return volume; } public void setVolume(Double volume) { this.volume = volume; } public String getVolumeUom() { return volumeUom; } public void setVolumeUom(String volumeUom) { this.volumeUom = volumeUom; } public OrderStaging getOrder() { return order; } public void setOrder(OrderStaging order) { this.order = order; } }
629570165e9c250242f61157b62a5558f7be9958
2a31523fb81b40e9afefc3ff773c62c3d90b4780
/src/main/java/com/joker17/sql/small/tools/enums/SqlTypeEnum.java
506c1dda78aeebb43b75e8f45e3012a82630372e
[ "Apache-2.0" ]
permissive
joker-pper/sql-small-tools
52c3f9e96231ab74e324f77f2216bf97d44e190b
67015270c536d3792e27e7baf00e3b0e3fe68ce5
refs/heads/main
2023-07-25T10:36:53.096200
2021-09-01T02:28:00
2021-09-01T02:28:00
389,379,504
0
0
null
null
null
null
UTF-8
Java
false
false
813
java
package com.joker17.sql.small.tools.enums; import org.apache.commons.lang3.StringUtils; import java.util.Arrays; public enum SqlTypeEnum { SELECT, INSERT, UPDATE, DELETE, OTHER; public static SqlTypeEnum getBySql(String text) { String sql = StringUtils.trimToEmpty(text); int sqlLength = sql.length(); if (sqlLength == 0) { return OTHER; } String sqlPrefix = sql.substring(0, sqlLength >= 10 ? 10 : sqlLength); String sqlPrefixUpperCase = StringUtils.upperCase(sqlPrefix); for (SqlTypeEnum sqlTypeEnum : Arrays.asList(UPDATE, DELETE, INSERT, SELECT)) { if (sqlPrefixUpperCase.startsWith(sqlTypeEnum.name())) { return sqlTypeEnum; } } return OTHER; } }
7158f3f4ed4e2a49f8a62b128344f53d9c90a85b
91ac53081a99c28bc3a1dfa73bd7d0151e42ec2f
/com/divergent/stringpool/question/StringPoolUsed1.java
8ffdd481d6d430e4ca71988176044ba5a69cc6b5
[]
no_license
prateekpatel-divergent/String-Number-Thread-Question
f6e1239ca3315efcebb66ff29d5a91c1a48a8241
6c43c758333a463ce67b4ed5389a65db1b7a6bda
refs/heads/master
2023-03-21T23:22:24.877597
2021-03-12T06:44:12
2021-03-12T06:51:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package com.divergent.stringpool.question; public class StringPoolUsed1 { public static void main(String[] args) { String s1 = new String("Hello"); String s2 = new String("Hello").intern(); System.out.println((s1==s2)); } }
ee04cb55bb62be44a7f5647af3ff0d62a85f820a
5c4274f13bd13e6a7f9027a0761b8a18d81bda3d
/app/src/main/java/com/raminarman/androidsqliteapp/MainActivity.java
2748bdd611ca0b1958be3a8b63a402c2e9ec23cc
[]
no_license
raminarmanfar/AndroidSQLiteApp
9db3e08085eca71430391f9c0788bece32ad7d4d
5c808b46c6b56e4bd23fcbcddb903a4d3428f22a
refs/heads/master
2020-12-03T08:36:41.485616
2020-01-01T19:33:28
2020-01-01T19:33:28
231,255,492
0
0
null
null
null
null
UTF-8
Java
false
false
5,661
java
package com.raminarman.androidsqliteapp; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { DatabaseHelper myDb; private EditText txtName, txtSurname, txtMarks, txtId; private Button btnAddStudent, btnStudentsList, btnUpdateStudent, btnDeleteStudent, btnGetStudent, btnAbout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myDb = new DatabaseHelper(this); initWidgets(); btnAddStudent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean inserted = myDb.insertNewStudent(new Student(txtName.getText().toString(), txtSurname.getText().toString(), txtMarks.getText().toString())); if (inserted) { Toast.makeText(v.getContext(), "New student added successfully.", Toast.LENGTH_LONG).show(); } else { Toast.makeText(v.getContext(), "Data insertion failed!", Toast.LENGTH_LONG).show(); } } }); btnStudentsList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Cursor stuList = myDb.getAllStudents(); if (stuList.getCount() == 0) { showMessage("No data found", "Student list is empty"); return; } StringBuffer buffer = new StringBuffer(); while (stuList.moveToNext()) { Student student = new Student(stuList.getString(1), stuList.getString(2), stuList.getString(3)); buffer.append("ID: " + stuList.getString(0) + ", " + student.toString() + "\n\n"); } showMessage("Students", buffer.toString()); } }); btnUpdateStudent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (txtId.getText().length() > 0) { Student student = new Student(txtName.getText().toString(), txtSurname.getText().toString(), txtMarks.getText().toString()); boolean updated = myDb.updateStudent(txtId.getText().toString(), student); if (updated) { Toast.makeText(v.getContext(), "Selected student information updated.", Toast.LENGTH_LONG).show(); } else { showMessage("Student not found to update", "No student found with entered id."); } } else { showMessage("No id entered", "Please enter student id to update."); } } }); btnDeleteStudent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (txtId.getText().length() > 0) { boolean deleted = myDb.deleteStudent(txtId.getText().toString()); if (deleted) { Toast.makeText(v.getContext(), "Selected student information deleted.", Toast.LENGTH_LONG).show(); } else { showMessage("Student not found to delete", "No student found with entered id."); } } else { showMessage("No id entered", "Please enter student id to delete."); } } }); btnGetStudent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (txtId.getText().length() > 0) { Student student = myDb.getStudent(txtId.getText().toString()); if (student != null) { showMessage("Student found", student.toString()); } else { showMessage("Student not found", "No student found with entered id."); } } else { showMessage("No id entered", "Please enter student id."); } } }); } public void showMessage(String title, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true); builder.setTitle(title); builder.setMessage(message); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.show(); } private void initWidgets() { txtName = findViewById(R.id.txtName); txtSurname = findViewById(R.id.txtSurname); txtMarks = findViewById(R.id.txtMarks); txtId = findViewById(R.id.txtId); btnAddStudent = findViewById(R.id.btnAddStudent); btnStudentsList = findViewById(R.id.btnStudentsList); btnUpdateStudent = findViewById(R.id.btnUpdateStudent); btnDeleteStudent = findViewById(R.id.btnDeleteStudent); btnGetStudent = findViewById(R.id.btnGetStudent); btnAbout = findViewById(R.id.btnAbout); } }