blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9a72ad5db8fceb2377cf553458221670f824c0f1 | 763c298b2ad7a1a5c8197082af44a0e0733417b7 | /src/test/java/test1.java | bb22a794c7c9ed14d5d782b35a2226de3f03add6 | [] | no_license | sriramdasbalaji/PerfectoVSOCodeEXample | 820854f5f340ca41e67e5169ba7e57deb3e9dd53 | d3b6cd3c35343b15b0fe68e077da69a3a07c6613 | refs/heads/master | 2021-01-19T10:42:08.125878 | 2017-02-16T16:55:04 | 2017-02-16T16:55:04 | 82,203,729 | 0 | 0 | null | 2017-02-16T16:51:57 | 2017-02-16T16:51:57 | null | UTF-8 | Java | false | false | 2,402 | java | package test.java;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
public class test1 extends basicTest{
@Test (dataProvider="PerfectoParams")
public void SPG(PerfectoTestParams params) {
System.out.println("Test1 in Test"+params._platform);
System.out.println("Test1 in Test"+params._repKey);
// RemoteWebDriver d = util.getAppiumDriver(params._device,params._activityBandle,params._platform,params._cloud,params._user,params._password,params._repKey);
try {
// this.execTest(d);
} catch (Exception e) {
// TODO: handle exception
}finally
{
// this.endTest(d);
}
}
@Override
public void execTest(RemoteWebDriver driver) throws Exception {
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.findElement(By.xpath("//*[@text='Access your SPG Account']")).click();
driver.findElement(By.xpath("//android.widget.EditText")).sendKeys("perfectomobile");
driver.findElement(By.xpath("(//android.widget.EditText)[2]")).sendKeys("Perfecto1");
driver.findElement(By.xpath("//android.widget.Button")).click();
driver.findElement(By.xpath("//android.widget.TextView[@text='Preferred']")).click();
WebElement mNum = driver.findElement(By.xpath("//android.widget.TextView[contains(@text,'Starpoints')]"));
System.out.println("****** Account number :" +mNum.getText());
driver.findElement(By.xpath("//android.widget.Button[@text='Sign Out']")).click();
driver.findElement(By.xpath("//android.widget.Button[@text='OK']")).click();
}
@Override
public void beforeTest() throws Exception {
}
@Override
public void endTest(RemoteWebDriver driver) {
String devId = (String) driver.getCapabilities().getCapability("deviceName");
//close the test
try{
driver.close();
util.downloadReport(driver, "pdf","VSO_SPG_"+devId);
} catch (IOException e) {
e.printStackTrace();
}finally
{
try{
driver.quit();
}catch(Exception e)
{
// driver closed
}
}
}
}
| [
"PerfectoMobile256@gmail.com"
] | PerfectoMobile256@gmail.com |
c2828a8fc707b3632385f21431cb876503d74ab3 | ed86c786b643f38ea5b41e9852b236df25533b0e | /VFBAM_ServiceApplication_cloud/src/com/viewfunction/vfbpm/adminCenter/UI/activityManagement/activityComponentTree/RoleQueueTreeOnClickListener.java | d7ed890b6693b90b03377403eadb2efb3c050f84 | [] | no_license | wangyingchu/ServiceApplication_viewfunction | b6cd531bff8b64dd7819b65a75b3c6b45dbbfb69 | 6e1d4ba4edf5b8264d33d1fcd3e6ddde13987a46 | refs/heads/master | 2021-01-04T02:32:48.528857 | 2017-06-24T15:34:22 | 2017-06-24T15:34:22 | 100,937,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | package com.viewfunction.vfbpm.adminCenter.UI.activityManagement.activityComponentTree;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
public class RoleQueueTreeOnClickListener implements Property.ValueChangeListener{
private static final long serialVersionUID = -3425162780369924830L;
private ActivityRoleQueueTree activityRoleQueueTree;
public RoleQueueTreeOnClickListener(ActivityRoleQueueTree activityRoleQueueTree){
this.activityRoleQueueTree=activityRoleQueueTree;
}
public void valueChange(ValueChangeEvent event) {
//the second time click on the same tree node will get a null event.getProperty().getValue()
//this means unselect current tree node
if (event.getProperty().getValue() != null) {
activityRoleQueueTree.handleTreeItemClick(event.getProperty().getValue());
}
}
}
| [
"yingchu-wang@163.com"
] | yingchu-wang@163.com |
c8ed6f61af3c2aef77c59aa49c7aabda226fe426 | 4b36f28200515726da2bf29cf8a552ead94b930f | /navDrawer/app/src/main/java/com/example/navdrawer/Restricciones.java | bc0091097b8d5b2c47da30be4033b63597d9101a | [] | no_license | JJbestOf99/Android | 893189a146d59a85ffb69b45c164750aec82f2a2 | e76ac77eb174f4426f343fc8dd8dcb34d57cc46b | refs/heads/main | 2023-07-14T16:45:51.531440 | 2021-08-24T10:01:54 | 2021-08-24T10:01:54 | 386,767,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package com.example.navdrawer;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.Vector;
public class Restricciones extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.restricciones);
TextView info = findViewById(R.id.tv_confinamiento2);
TextView info1 = findViewById(R.id.tv_confinamiento3);
info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
info();
}
});
info1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
info1();
}
});
}
public void info(){
Uri uri = Uri.parse("https://www.murciasalud.es/recursos/ficheros/468559-20201030_Regulacion_normativa_COVID_RM.pdf");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
public void info1(){
Uri uri = Uri.parse("https://www.borm.es/services/anuncio/ano/2020/numero/6297/pdf?id=788956");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f7ea178de7df10ef71d359e00a7a2d89892402fc | 5c87f8ef638a78bed64e32a6a4a8f6c952f720f6 | /PDA/src/stack/FileInfo.java | 4c63405b14f0f26c6c3258e45714543a3469fa11 | [] | no_license | gill-gemini/Synchronize-Directory-using-Chunk-File-Transfer | e774ba2bc5e9626ed6be63cdb295de070ea4dc6c | e602ee903425385088294540eb927d18d6352333 | refs/heads/master | 2016-09-05T14:32:09.301183 | 2016-02-02T19:11:46 | 2016-02-02T19:11:46 | 26,106,691 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package stack;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class FileInfo {
public enum ModificationType{CREATE, MODIFY, DELETE};
public String name;
public long size;
public String checkSum;
public long modificationTime; //the number of milliseconds since January 1, 1970, 00:00:00 GMT
public ModificationType modifcationType;
@Override
public String toString(){
return ReflectionToStringBuilder.toString(this,
ToStringStyle.SHORT_PREFIX_STYLE, false, false);
}
}
| [
"gill@gill-VirtualBox.(none)"
] | gill@gill-VirtualBox.(none) |
13a10566c7e35510bd692c1cb0b6f6c2eceaeea5 | 930c8a0770078694e8e6eccd0992656765d3cf85 | /src/com/cpp2/ui/UICommentMovie.java | b33904918f08dc0dca08f09434ac184eb1180f05 | [] | no_license | FlyTogether/CinemaApp | e8439a7b89b9e8d3c7eb14850605e36beb2db0b4 | 4cfd0d101aa7184352d203cf64697e49cc898edd | refs/heads/master | 2021-01-15T23:02:12.694481 | 2016-01-04T02:53:57 | 2016-01-04T02:53:57 | 25,870,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,422 | java | package com.cpp2.ui;
import java.util.HashMap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import com.cpp2.R;
import com.cpp2.base.AppVariable;
import com.cpp2.base.BaseActivity;
import com.cpp2.base.BaseMessage;
public class UICommentMovie extends BaseActivity implements OnClickListener {
private EditText edtComment;
private Button btnSubmit;
private TextView tvTitle;
private ImageButton ibtnBack;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ui_movie_comment);
// show keyboard
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
((ImageButton) findViewById(R.id.activity_titlebar_menu))
.setVisibility(View.INVISIBLE);
ibtnBack = (ImageButton) findViewById(R.id.activity_titlebar_back);
tvTitle = (TextView) findViewById(R.id.activity_titlebar_title);
edtComment = (EditText) this.findViewById(R.id.movie_comment_edt);
btnSubmit = (Button) this.findViewById(R.id.movie_comment_submit);
btnSubmit.setOnClickListener(this);
ibtnBack.setOnClickListener(this);
// bind action logic
Bundle params = this.getIntent().getExtras();
String movieId = params.getString("movieId");
tvTitle.setText(params.getString("movieName"));
edtComment.setText("get the ID is:" + params.getString("movieId"));
final String blogId = params.getString("blogId");
btnSubmit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String input = edtComment.getText().toString();
HashMap<String, String> urlParams = new HashMap<String, String>();
urlParams.put("blogId", blogId);
urlParams.put("content", input);
doTaskAsync(AppVariable.task.commentCreate,
AppVariable.api.commentCreate, urlParams);
}
});
}
@Override
public void onTaskComplete(int taskId, BaseMessage message) {
super.onTaskComplete(taskId, message);
this.finish();
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.movie_comment_submit:
break;
case R.id.activity_titlebar_back:
this.finish();
break;
}
}
}
| [
"303597336@qq.com"
] | 303597336@qq.com |
2cabe29df5a757da434ab199194f1741bc3f3fff | b8e6c781658d2c51faa2915ea37359107d45e4b0 | /app/src/androidTest/java/br/com/lf/hotelurbano/ExampleInstrumentedTest.java | d0fc30132487f45c57c2a168c7db83d2201d86a7 | [] | no_license | lfernandosantos/projetoHU | 632e5eed034558c9e1d95cd1ffe32ebb0c230be3 | dc713a7206d7178f61f5703aa88292c51dffedb4 | refs/heads/master | 2021-01-22T07:32:23.714180 | 2017-02-21T00:34:04 | 2017-02-21T00:34:04 | 81,830,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package br.com.lf.hotelurbano;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("br.com.lf.hotelurbano", appContext.getPackageName());
}
}
| [
"lf.fernandosantos@gmail.com"
] | lf.fernandosantos@gmail.com |
14dfed04540f03155db2af1420acfe77fe46d81e | a2e9320bfd812b3de20e528bc956f549d0dd7002 | /src/main/java/com/shsxt/control/base/ResultInfo.java | 789f3ef53629030dfa5c70b45da9b125398d62e3 | [] | no_license | Frank1109725833/DemoRBAC | 16fe8c218a825e63c8d4638a198f95f9b85d8a66 | 107ba0a9bb952d9ffca4e1d9b19d9666ddccdeaa | refs/heads/master | 2022-12-23T08:00:59.573285 | 2020-09-29T02:19:49 | 2020-09-29T02:19:49 | 299,307,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.shsxt.control.base;
public class ResultInfo {
private Integer code=200;
private String msg="棒棒哒O(∩_∩)O";
private Object result;
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return this.msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
| [
"1109725833@qq.com"
] | 1109725833@qq.com |
e0354b122906744af442df07c985d249f03a031b | 4eea13dc72e0ff8ec79c7a94deca38e55868b603 | /chapter21/Exercise23.java | cf111a5a7efb8439ad500271941fae5c50a6fb85 | [
"Apache-2.0"
] | permissive | helloShen/thinkinginjava | 1a9bfad9afa68b226684f6e063e9fa2ae36d898c | 8986b74b2b7ea1753df33af84cd56287b21b4239 | refs/heads/master | 2021-01-11T20:38:09.259654 | 2017-03-07T03:52:54 | 2017-03-07T03:52:54 | 79,158,702 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | /**
* 测试while(condition){wait()}会不会导致收不到interrupt
*/
package com.ciaoshen.thinkinjava.chapter21;
import java.util.concurrent.*;
public class Exercise23 {
public static void main(String[] args) throws Exception {
Car car = new Car();
ExecutorService exec = Executors.newCachedThreadPool();
exec.execute(new WaxOff(car));
exec.execute(new WaxOn(car));
exec.execute(new WaxOff(car));
exec.execute(new WaxOn(car));
exec.execute(new WaxOff(car));
exec.execute(new WaxOn(car));
exec.execute(new WaxOff(car));
exec.execute(new WaxOn(car));
TimeUnit.SECONDS.sleep(5); // Run for a while...
exec.shutdownNow(); // Interrupt all tasks
}
} | [
"symantec__@hotmail.com"
] | symantec__@hotmail.com |
5bb0d2c56ee1b204a8ec386006337e58ec4be330 | 8043f7af2452c50210084f0216bb7869197a53fc | /src/main/java/com/reporting/validation/CustomerValidation.java | bec68728b15170d058232a6b2a2dceb2e2cf2c57 | [] | no_license | ashokkulhari/patientwatch | 63968ec498d66c52c6a84716fb62b7509a261dc6 | 24cd2ab9d29876bb56871fe9793f53b6ee82e993 | refs/heads/master | 2020-03-19T11:59:47.559617 | 2018-06-07T14:43:32 | 2018-06-07T14:43:32 | 136,489,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.reporting.validation;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import com.reporting.model.Customer;
public class CustomerValidation implements Validator{
@Override
public boolean supports(Class<?> arg0) {
// TODO Auto-generated method stub
return Customer.class.equals(arg0);
}
@Override
public void validate(Object arg0, Errors arg1) {
// TODO Auto-generated method stub
}
}
| [
"ashok.kulhari@gmail.com"
] | ashok.kulhari@gmail.com |
1f45822efd10ad7680e64bceb32e4df3b1dd9a77 | 491bc0a13ae5c21930a355504f5b674cb8eb8c6b | /android/library/maply/src/main/java/com/mousebird/maply/View.java | 3db56538d01fdee3ae416014d6fbf1f915443703 | [
"Apache-2.0"
] | permissive | Alex0072005/WhirlyGlobe | b9783b886f48d6ecd5fa67aacb8df05947a0c3ad | 545f01323ab05b4b4bacac8d960003841ee15f48 | refs/heads/master | 2020-09-23T05:12:05.147984 | 2019-12-02T16:02:36 | 2019-12-02T16:02:36 | 225,412,712 | 0 | 0 | NOASSERTION | 2019-12-02T15:51:22 | 2019-12-02T15:51:21 | null | UTF-8 | Java | false | false | 3,152 | java | /*
* MapView.java
* WhirlyGlobeLib
*
* Created by Steve Gifford on 3/13/15.
* Copyright 2011-2015 mousebird consulting
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.mousebird.maply;
import java.util.ArrayList;
import java.util.GregorianCalendar;
/**
* Base class for 2D and 3D views.
*
* @author sjg
*
*/
public class View
{
CoordSystemDisplayAdapter coordAdapter = null;
/**
* Return the coordinate adapter used by this view.
* The coordinate adapter manages transformation from the local coordinate system
* to display coordinates and vice versa.
* @return
*/
CoordSystemDisplayAdapter getCoordAdapter()
{
return coordAdapter;
}
// Filled in by the subclasses
protected View clone()
{
return null;
}
// Filled in by the subclasses
public void animate()
{
}
// Subclasses override
public boolean isAnimating()
{
return false;
}
// Filled in by the subclass
public void cancelAnimation()
{
}
// Filled in by the subclass
public ViewState makeViewState(MaplyRenderer renderer)
{
return null;
}
// For objects that want to know when the view changes (every time it does)
interface ViewWatcher
{
public void viewUpdated(View view);
}
double lastUpdated;
/**
* When the view was last changed.
*/
public double getLastUpdatedTime()
{
return lastUpdated;
}
ArrayList<ViewWatcher> watchers = new ArrayList<ViewWatcher>();
// Add a watcher for callbacks on each and every view related change
void addViewWatcher(ViewWatcher watcher)
{
watchers.add(watcher);
}
// Remove an object that was watching view changes
void removeViewWatcher(ViewWatcher watcher)
{
watchers.remove(watcher);
}
// Let everything know we changed the view
void runViewUpdates()
{
// Point3d loc = getLoc();
// Log.i("Maply","New pos: (" + loc.getX() + "," + loc.getY() + "," + loc.getZ() + ")");
for (ViewWatcher watcher: watchers)
watcher.viewUpdated(this);
lastUpdated = GregorianCalendar.getInstance().getTimeInMillis() / 1000.0;
}
// Return the current model & view matrix combined (but not projection)
native Matrix4d calcModelViewMatrix();
// Return the height for a given map scale
public native double heightForMapScale(double scale,double frameSizeX,double frameSizeY);
// Returns the map zoom for a given latitude
public native double currentMapZoom(double frameSizeX,double frameSizeY,double latitude);
// Returns the map scale
public native double currentMapScale(double frameSizeX,double frameSizeY);
static
{
nativeInit();
}
private static native void nativeInit();
protected long nativeHandle;
}
| [
"jmnavarro@gmail.com"
] | jmnavarro@gmail.com |
93bbcbbdc735b6f5786ac0a492067333553e67b8 | df738da66b7c32925ddc9fd51c681dc1b269c59b | /app/src/main/java/com/kgamail/saravut/my_v_class_1/MyImg.java | 89d93f3e3169425e99ec8b384ed56bb15ba417c6 | [] | no_license | iamvut/My_V_Class_1 | 89c05fbb7b87bd4ef270499977c96f44fa01b511 | 8c70a9aecb34504cd6eff3bfcfce192455b3df93 | refs/heads/master | 2021-01-17T16:39:01.460247 | 2016-06-17T04:26:44 | 2016-06-17T04:26:44 | 60,393,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,037 | java | package com.kgamail.saravut.my_v_class_1;
class hName {
private String[] strings = new String[]
{"หัวข้อหลักที่ 1","หัวข้อหลักที่ 2","หัวข้อหลักที่ 3",
"หัวข้อหลักที่ 4", "หัวข้อหลักที่ 5","หัวข้อหลักที่ 6",
"หัวข้อหลักที่ 7", "หัวข้อหลักที่ 8", "หัวข้อหลักที่ 9",
"หัวข้อหลักที่ 10", "หัวข้อหลักที่ 11", "หัวข้อหลักที่ 12",
"หัวข้อหลักที่ 13", "หัวข้อหลักที่ 14", "หัวข้อหลักที่ 15",
"หัวข้อหลักที่ 16", "หัวข้อหลักที่ 17", "หัวข้อหลักที่ 18",
"หัวข้อหลักที่ 19", "หัวข้อหลักที่ 20"
};
public String[] getHname() {
return strings;
}
}
public class MyImg {
//explict ประการตัวแปรของ Arrey ที่อ้างอิงถึงรูปใน Drawable
//private int[] ints = new int[]{R.drawable.v01, R.drawable.v02,
// R.drawable.v03, R.drawable.v04, R.drawable.v05,
// R.drawable.v06, R.drawable.v07, R.drawable.v08,
// R.drawable.v09, R.drawable.v10, R.drawable.v11,
// R.drawable.v12, R.drawable.v13, R.drawable.v14,
// R.drawable.v15, R.drawable.v16, R.drawable.traffic_01,
// R.drawable.traffic_02,R.drawable.traffic_03,R.drawable.traffic_04};
private int[] ints = new int[]{R.drawable.v01, R.drawable.v02,
R.drawable.v03, R.drawable.v04, R.drawable.v05,};
public int[] getImgs() {
return ints;
}
}
| [
"saravut.k@gmail.com"
] | saravut.k@gmail.com |
5f68113d311ea7abd4ef92f330ea95d5e282c06a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/25/25_252d8046c101683de52703fa8a02e5eb45e8df4e/NetworkService/25_252d8046c101683de52703fa8a02e5eb45e8df4e_NetworkService_t.java | 0ee815138882068efc6b38f5dfbc20029dee90ca | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 32,304 | java | package com.pokebros.android.pokemononline;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.media.MediaPlayer;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.text.Html;
import android.util.Log;
import android.widget.Toast;
import com.pokebros.android.pokemononline.battle.Battle;
import com.pokebros.android.pokemononline.battle.BattleConf;
import com.pokebros.android.pokemononline.battle.BattleDesc;
import com.pokebros.android.pokemononline.battle.SpectatingBattle;
import com.pokebros.android.pokemononline.player.FullPlayerInfo;
import com.pokebros.android.pokemononline.player.PlayerInfo;
import com.pokebros.android.pokemononline.poke.ShallowBattlePoke;
import com.pokebros.android.utilities.StringUtilities;
public class NetworkService extends Service {
static final String TAG = "Network Service";
final static String pkgName = "com.pokebros.android.pokemononline";
private final IBinder binder = new LocalBinder();
//public Channel currentChannel = null;
public LinkedList<Channel> joinedChannels = new LinkedList<Channel>();
Thread sThread, rThread;
PokeClientSocket socket = null;
boolean findingBattle = false;
public ChatActivity chatActivity = null;
public LinkedList<IncomingChallenge> challenges = new LinkedList<IncomingChallenge>();
public boolean askedForPass = false;
private String salt = null;
public boolean failedConnect = false;
public DataBaseHelper db;
public String serverName = "Not Connected";
public final ProtocolVersion version = new ProtocolVersion();
public boolean serverSupportsZipCompression = false;
@SuppressWarnings("unused")
private byte []reconnectSecret;
/**
* Are we engaged in a battle?
* @return True if we are at least in one battle
*/
public boolean isBattling() {
return !activeBattles.isEmpty();
}
/**
* Are we engaged in a battle with that particular battle ID?
* @param battleId the battle ID
* @return true if we are a player of the battle with the battle ID
*/
public boolean isBattling(int battleId) {
return activeBattles.containsKey(battleId);
}
private Battle activeBattle(int battleId) {
return activeBattles.get(battleId);
}
private FullPlayerInfo meLoginPlayer;
public PlayerInfo mePlayer;
public Hashtable<Integer, Battle> activeBattles = new Hashtable<Integer, Battle>();
public Hashtable<Integer, SpectatingBattle> spectatedBattles = new Hashtable<Integer, SpectatingBattle>();
protected Hashtable<Integer, Channel> channels = new Hashtable<Integer, Channel>();
public Hashtable<Integer, PlayerInfo> players = new Hashtable<Integer, PlayerInfo>();
public Hashtable<Integer, BattleDesc> battles = new Hashtable<Integer, BattleDesc>();
protected HashSet<Integer> pmedPlayers = new HashSet<Integer>();
Tier superTier = new Tier();
public int myid = -1;
public class LocalBinder extends Binder {
NetworkService getService() {
return NetworkService.this;
}
}
/**
* Is the player in any of the same channels as us?
* @param pid the id of the player we are interested in
* @return true if the player shares a channel with us, false otherwise
*/
public boolean isOnAnyChannel(int pid) {
for (Channel c: channels.values()) {
if (c.players.contains(pid)) {
return true;
}
}
return false;
}
/**
* Called by a channel when a player leaves. If the player is not on any channel
* and there's no special circumstances (as in PM), the player will get removed
* @param pid The id of the player that left
*/
public void onPlayerLeaveChannel(int pid) {
if (!isOnAnyChannel(pid) && !pmedPlayers.contains(pid)) {
removePlayer(pid);
}
}
public void addBattle(int battleid, BattleDesc desc) {
battles.put(battleid, desc);
if (players.containsKey(desc.p1)) {
players.get(desc.p1).addBattle(battleid);
}
if (players.containsKey(desc.p2)) {
players.get(desc.p2).addBattle(battleid);
}
}
/**
* Removes a battle from memory
* @param battleID the battle id of the battle to remove
*/
private void removeBattle(int battleID) {
if (!battles.containsKey(battleID)) {
return;
}
BattleDesc battle = battles.get(battleID);
if (hasPlayer(battle.p1)) {
players.get(battle.p1).removeBattle(battleID);
}
if (hasPlayer(battle.p2)) {
players.get(battle.p2).removeBattle(battleID);
}
}
/**
* Returns a list of all the battles fought or spectated
* @return the battles fought/spectated
*/
public Collection<SpectatingBattle> getBattles() {
LinkedList<SpectatingBattle> ret = new LinkedList<SpectatingBattle>();
ret.addAll(activeBattles.values());
ret.addAll(spectatedBattles.values());
return ret;
}
/**
* Checks all battles spectated or fought and removes/destroys the ones
* that are finished
*/
public void checkBattlesToEnd() {
for (SpectatingBattle battle: getBattles()) {
if (battle.gotEnd) {
closeBattle(battle.bID);
}
}
}
/**
* Removes a battle spectated/fought from memory and destroys it
* @param bID The id of the battle to remove
*/
public void closeBattle(int bID) {
if (isBattling(bID)) {
activeBattles.remove(bID).destroy();
}
if (spectatedBattles.containsKey(bID)) {
spectatedBattles.remove(bID).destroy();
}
/* Remove the battle notification */
NotificationManager mNotificationManager = getNotificationManager();
mNotificationManager.cancel("battle", bID);
}
/**
* Does the player exist in memory
* @param pid the id of the player we're interested in
* @return true if the player is in memory, or false
*/
public boolean hasPlayer(int pid) {
return players.containsKey(pid);
}
/**
* Checks if the players of the battle are online, and remove the battle from memory if not
* @param battleid the id of the battle to check
*/
private void testRemoveBattle(Integer battleid) {
BattleDesc battle = battles.get(battleid);
if (battle != null) {
if (!players.containsKey(battle.p1) && !players.containsKey(battle.p2)) {
battles.remove(battle);
}
}
}
/**
* Gets the name of a player or "???" if the player couldn't be found
* @param playerId id of the player we're interested in
* @return name of the player or "???" if not found
*/
public String playerName(int playerId) {
PlayerInfo player = players.get(playerId);
if (player == null) {
return "???";
} else {
return player.nick();
}
}
/**
* Removes a player from memory
* @param pid The id of the player to remove
*/
public void removePlayer(int pid) {
PlayerInfo player = players.remove(pid);
if (pmedPlayers.contains(pid)) {
//TODO: close the PM?
pmedPlayers.remove(pid);
}
if (player != null) {
for(Integer battleid: player.battles) {
testRemoveBattle(battleid);
}
}
}
@Override
// This is *NOT* called every time someone binds to us, I don't really know why
// but onServiceConnected is correctly called in the activity sooo....
public IBinder onBind(Intent intent) {
return binder;
}
@Override
// This is called once
public void onCreate() {
db = new DataBaseHelper(NetworkService.this);
super.onCreate();
}
@Override
public void onDestroy() {
// XXX TODO be more graceful
Log.d(TAG, "NETWORK SERVICE DESTROYED; EXPECT BAD THINGS TO HAPPEN");
for(SpectatingBattle battle : getBattles()) {
closeBattle(battle.bID);
}
}
public void connect(final String ip, final int port) {
// XXX This should probably have a timeout
new Thread(new Runnable() {
public void run() {
try {
socket = new PokeClientSocket(ip, port);
} catch (IOException e) {
failedConnect = true;
if(chatActivity != null) {
chatActivity.notifyFailedConnection();
}
return;
}
//socket.sendMessage(meLoginPlayer.serializeBytes(), Command.Login);
Baos loginCmd = new Baos();
loginCmd.putBaos(version); //Protocol version
/* Network Flags: hasClientType, hasVersionNumber, hasReconnect, hasDefaultChannel, hasAdditionalChannels, hasColor, hasTrainerInfo, hasNewTeam, hasEventSpecification, hasPluginList. */
loginCmd.putFlags(new boolean []{true,true}); //Network flags
loginCmd.putString("android");
short versionCode;
try {
versionCode = (short)getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
} catch (NameNotFoundException e1) {
versionCode = 0;
}
loginCmd.putShort(versionCode);
loginCmd.putString(meLoginPlayer.nick());
/* Data Flags: supportsZipCompression, isLadderEnabled, wantsIdsWithMessages, isIdle */
loginCmd.putFlags(new boolean []{false,true,true});
socket.sendMessage(loginCmd, Command.Login);
while(socket.isConnected()) {
try {
// Get some data from the wire
socket.recvMessagePoll();
} catch (IOException e) {
// Disconnected
break;
} catch (ParseException e) {
// Got message that overflowed length from server.
// No way to recover.
// TODO die completely
break;
}
Baos tmp;
// Handle any messages that completed
while ((tmp = socket.getMsg()) != null) {
Bais msg = new Bais(tmp.toByteArray());
handleMsg(msg);
}
/* Do not use too much CPU */
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// Do nothing
}
}
}
}).start();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
Bundle bundle = null;
if (intent != null) // Intent can be null if service restarts after being killed
// XXX We probably don't handle such restarts very gracefully
bundle = intent.getExtras();
if (bundle != null && bundle.containsKey("loginPlayer")) {
meLoginPlayer = new FullPlayerInfo(new Bais(bundle.getByteArray("loginPlayer")));
mePlayer = new PlayerInfo (meLoginPlayer);
}
if (bundle != null && bundle.containsKey("ip"))
connect(bundle.getString("ip"), bundle.getShort("port"));
return START_STICKY;
}
public void handleMsg(Bais msg) {
byte i = msg.readByte();
Command c = Command.values()[i];
Log.d(TAG, "Received: " + c);
switch (c) {
case ChannelPlayers:
case JoinChannel:
case LeaveChannel:{
Channel ch = channels.get(msg.readInt());
if(ch != null)
ch.handleChannelMsg(c, msg);
else
Log.e(TAG, "Received message for nonexistent channel");
break;
} case VersionControl: {
ProtocolVersion serverVersion = new ProtocolVersion(msg);
if (serverVersion.compareTo(version) > 0) {
Log.d(TAG, "Server has newer protocol version than we expect");
} else if (serverVersion.compareTo(version) < 0) {
Log.d(TAG, "PO Android uses newer protocol than Server");
}
serverSupportsZipCompression = msg.readBool();
ProtocolVersion lastVersionWithoutFeatures = new ProtocolVersion(msg);
ProtocolVersion lastVersionWithoutCompatBreak = new ProtocolVersion(msg);
ProtocolVersion lastVersionWithoutMajorCompatBreak = new ProtocolVersion(msg);
if (serverVersion.compareTo(version) > 0) {
if (lastVersionWithoutFeatures.compareTo(version) > 0) {
Toast.makeText(this, R.string.new_server_features_warning, Toast.LENGTH_SHORT).show();
} else if (lastVersionWithoutCompatBreak.compareTo(version) > 0) {
Toast.makeText(this, R.string.minor_compat_break_warning, Toast.LENGTH_SHORT).show();
} else if (lastVersionWithoutMajorCompatBreak.compareTo(version) > 0) {
Toast.makeText(this, R.string.major_compat_break_warning, Toast.LENGTH_LONG).show();
}
}
serverName = msg.readString();
if (chatActivity != null) {
chatActivity.updateTitle();
}
break;
} case Register: {
// Username not registered
break;
} case Login: {
Bais flags = msg.readFlags();
Boolean hasReconnPass = flags.readBool();
if (hasReconnPass) {
// Read byte array
reconnectSecret = msg.readQByteArray();
}
mePlayer = new PlayerInfo(msg);
myid = mePlayer.id;
int numTiers = msg.readInt();
for (int j = 0; j < numTiers; j++) {
// Tiers for each of our teams
// TODO Do something with this info?
msg.readString();
}
players.put(mePlayer.id, mePlayer);
break;
} case TierSelection: {
msg.readInt(); // Number of tiers
Tier prevTier = new Tier(msg.readByte(), msg.readString());
prevTier.parentTier = superTier;
superTier.subTiers.add(prevTier);
while(msg.available() != 0) { // While there's another tier available
Tier t = new Tier(msg.readByte(), msg.readString());
if(t.level == prevTier.level) { // Sibling case
prevTier.parentTier.addSubTier(t);
t.parentTier = prevTier.parentTier;
}
else if(t.level < prevTier.level) { // Uncle case
while(t.level < prevTier.level)
prevTier = prevTier.parentTier;
prevTier.parentTier.addSubTier(t);
t.parentTier = prevTier.parentTier;
}
else if(t.level > prevTier.level) { // Child case
prevTier.addSubTier(t);
t.parentTier = prevTier;
}
prevTier = t;
}
break;
} case ChannelsList: {
int numChannels = msg.readInt();
for(int j = 0; j < numChannels; j++) {
int chanId = msg.readInt();
Channel ch = new Channel(chanId, msg.readString(), this);
channels.put(chanId, ch);
//addChannel(msg.readQString(),chanId);
}
Log.d(TAG, channels.toString());
break;
} case PlayersList: {
while (msg.available() != 0) { // While there's playerInfo's available
PlayerInfo p = new PlayerInfo(msg);
PlayerInfo oldPlayer = players.get(p.id);
players.put(p.id, p);
if (oldPlayer != null && chatActivity != null) {
/* Updates the player in the adapter memory */
chatActivity.updatePlayer(p, oldPlayer);
}
}
break;
} case SendMessage: {
Bais netFlags = msg.readFlags();
boolean hasChannel = netFlags.readBool();
boolean hasId = netFlags.readBool();
Bais dataFlags = msg.readFlags();
boolean isHtml = dataFlags.readBool();
Channel chan = hasChannel ? channels.get(msg.readInt()) : null;
PlayerInfo player = hasId ? players.get(msg.readInt()) : null;
CharSequence message = msg.readString();
if (hasId) {
CharSequence color = (player == null ? "orange" : player.color.toHexString());
CharSequence name = player.nick();
if (isHtml) {
message = Html.fromHtml("<font color='" + color + "'><b>" + name +
": </b></font>" + message);
} else {
message = Html.fromHtml("<font color='" + color + "'><b>" + name +
": </b></font>" + StringUtilities.escapeHtml((String)message));
}
} else {
message = isHtml ? Html.fromHtml((String)message) : message;
}
if (!hasChannel) {
// Broadcast message
if (chatActivity != null && message.toString().contains("Wrong password for this name.")) // XXX Is this still the message sent?
chatActivity.makeToast(message.toString(), "long");
else {
Iterator<Channel> it = joinedChannels.iterator();
while (it.hasNext()) {
it.next().writeToHist(message);
}
}
} else {
if (chan == null) {
Log.e(TAG, "Received message for nonexistent channel");
} else {
chan.writeToHist(message);
}
}
break;
}
case BattleList: {
msg.readInt(); //channel, but irrelevant
int numBattles = msg.readInt();
for (; numBattles > 0; numBattles--) {
int battleId = msg.readInt();
//byte mode = msg.readByte(); /* protocol is messed up */
int player1 = msg.readInt();
int player2 = msg.readInt();
addBattle(battleId, new BattleDesc(player1, player2));
}
break;
}
case ChannelBattle: {
msg.readInt(); //channel, but irrelevant
int battleId = msg.readInt();
//byte mode = msg.readByte();
int player1 = msg.readInt();
int player2 = msg.readInt();
addBattle(battleId, new BattleDesc(player1, player2));
}
/* case JoinChannel:
case LeaveChannel:
// case ChannelMessage:
// case HtmlChannel: {
Channel ch = channels.get(msg.readInt());
if(ch != null)
ch.handleChannelMsg(c, msg);
else
System.out.println("Received message for nonexistant channel");
break;
// } case ServerName: {
// serverName = msg.readQString();
// if (chatActivity != null)
// chatActivity.updateTitle();
// break;
} case TierSelection: {
msg.readInt(); // Number of tiers
Tier prevTier = new Tier((byte)msg.read(), msg.readQString());
prevTier.parentTier = superTier;
superTier.subTiers.add(prevTier);
while(msg.available() != 0) { // While there's another tier available
Tier t = new Tier((byte)msg.read(), msg.readQString());
if(t.level == prevTier.level) { // Sibling case
prevTier.parentTier.addSubTier(t);
t.parentTier = prevTier.parentTier;
}
else if(t.level < prevTier.level) { // Uncle case
while(t.level < prevTier.level)
prevTier = prevTier.parentTier;
prevTier.parentTier.addSubTier(t);
t.parentTier = prevTier.parentTier;
}
else if(t.level > prevTier.level) { // Child case
prevTier.addSubTier(t);
t.parentTier = prevTier;
}
prevTier = t;
}
break;
} case ChallengeStuff: {
IncomingChallenge challenge = new IncomingChallenge(msg);
challenge.setNick(players.get(challenge.opponent));
System.out.println("CHALLENGE STUFF: " + ChallengeEnums.ChallengeDesc.values()[challenge.desc]);
switch(ChallengeEnums.ChallengeDesc.values()[challenge.desc]) {
case Sent:
if (challenge.isValidChallenge(players)) {
challenges.addFirst(challenge);
if (chatActivity != null && chatActivity.hasWindowFocus()) {
chatActivity.notifyChallenge();
} else {
Notification note = new Notification(R.drawable.icon, "You've been challenged by " + challenge.oppName + "!", System.currentTimeMillis());
note.setLatestEventInfo(this, "POAndroid", "You've been challenged!", PendingIntent.getActivity(this, 0,
new Intent(NetworkService.this, ChatActivity.class), Intent.FLAG_ACTIVITY_NEW_TASK));
noteMan.cancel(IncomingChallenge.note);
noteMan.notify(IncomingChallenge.note, note);
}
}
break;
case Refused:
if(challenge.oppName != null && chatActivity != null) {
chatActivity.makeToast(challenge.oppName + " refused your challenge", "short");
}
break;
case Busy:
if(challenge.oppName != null && chatActivity != null) {
chatActivity.makeToast(challenge.oppName + " is busy", "short");
}
break;
case InvalidTeam:
if (chatActivity != null)
chatActivity.makeToast("Challenge failed due to invalid team", "long");
break;
case InvalidGen:
if (chatActivity != null)
chatActivity.makeToast("Challenge failed due to invalid gen", "long");
break;
}
break;
}*/ case Logout: {
// Only sent when player is in a PM with you and logs out
int playerID = msg.readInt();
removePlayer(playerID);
//System.out.println("Player " + playerID + " logged out.");
break;
} case BattleFinished: {
int battleID = msg.readInt();
byte battleDesc = msg.readByte();
msg.readByte(); // battle mode
int id1 = msg.readInt();
int id2 = msg.readInt();
//Log.i(TAG, "bID " + battleID + " battleDesc " + battleDesc + " id1 " + id1 + " id2 " + id2);
String[] outcome = new String[]{" won by forfeit against ", " won against ", " tied with "};
if (isBattling(battleID) || spectatedBattles.containsKey(battleID)) {
if (isBattling(battleID)) {
//TODO: notification on win/lose
// if (mePlayer.id == id1 && battleDesc < 2) {
// showNotification(ChatActivity.class, "Chat", "You won!");
// } else if (mePlayer.id == id2 && battleDesc < 2) {
// showNotification(ChatActivity.class, "Chat", "You lost!");
// } else if (battleDesc == 2) {
// showNotification(ChatActivity.class, "Chat", "You tied!");
// }
}
if (battleDesc < 2) {
joinedChannels.peek().writeToHist(Html.fromHtml("<b><i>" +
StringUtilities.escapeHtml(playerName(id1)) + outcome[battleDesc] +
StringUtilities.escapeHtml(playerName(id2)) + ".</b></i>"));
}
if (battleDesc == 0 || battleDesc == 3) {
closeBattle(battleID);
}
}
removeBattle(battleID);
break;
} case SendPM: {
int playerID = msg.readInt();
pmedPlayers.add(playerID);
// Ignore the message
String pm = new String("This user is running the Pokemon Online Android client and cannot respond to private messages.");
Baos bb = new Baos();
bb.putInt(playerID);
bb.putString(pm);
socket.sendMessage(bb, Command.SendPM);
break;
}/* case SendTeam: {
PlayerInfo p = new PlayerInfo(msg);
if (players.containsKey(p.id)) {
PlayerInfo player = players.get(p.id);
player.update(p);
Enumeration<Channel> e = channels.elements();
while (e.hasMoreElements()) {
Channel ch = e.nextElement();
if (ch.players.containsKey(player.id)) {
ch.updatePlayer(player);
}
}
}
break;
} */ case BattleMessage: {
int battleId = msg.readInt(); // currently support only one battle, unneeded
msg.readInt(); // discard the size, unneeded
if (isBattling(battleId)) {
activeBattle(battleId).receiveCommand(msg);
}
break;
} case EngageBattle: {
int battleId = msg.readInt();
Bais flags = msg.readFlags();
byte mode = msg.readByte();
int p1 = msg.readInt();
int p2 = msg.readInt();
addBattle(battleId, new BattleDesc(p1, p2, mode));
if(flags.readBool()) { // This is us!
BattleConf conf = new BattleConf(msg);
// Start the battle
Battle battle = new Battle(conf, msg, players.get(conf.id(0)),
players.get(conf.id(1)), mePlayer.id, battleId, this);
activeBattles.put(battleId, battle);
joinedChannels.peek().writeToHist("Battle between " + playerName(p1) +
" and " + playerName(p2) + " started!");
Intent intent;
intent = new Intent(this, BattleActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("battleId", battleId);
startActivity(intent);
findingBattle = false;
showBattleNotification("Battle", battleId, conf);
}
if (chatActivity != null) {
chatActivity.updatePlayer(players.get(p1), players.get(p1));
chatActivity.updatePlayer(players.get(p2), players.get(p2));
}
break;
}
case SpectateBattle: {
Bais flags = msg.readFlags();
int battleId = msg.readInt();
if (flags.readBool()) {
if (spectatedBattles.contains(battleId)) {
Log.e(TAG, "Already watching battle " + battleId);
return;
}
BattleConf conf = new BattleConf(msg);
PlayerInfo p1 = players.get(conf.id(0));
PlayerInfo p2 = players.get(conf.id(1));
SpectatingBattle battle = new SpectatingBattle(conf, p1, p2, battleId, this);
spectatedBattles.put(battleId, battle);
Intent intent = new Intent(this, BattleActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("battleId", battleId);
startActivity(intent);
showBattleNotification("Spectated Battle", battleId, conf);
} else {
closeBattle(battleId);
}
break;
}
case SpectateBattleMessage: {
int battleId = msg.readInt();
msg.readInt(); // discard the size, unneeded
if (spectatedBattles.containsKey(battleId)) {
spectatedBattles.get(battleId).receiveCommand(msg);
}
break;
}
case AskForPass: {
salt = msg.readString();
// XXX not sure what the second half is supposed to check
// from analyze.cpp : 265 of PO's code
if (salt.length() < 6) { // || strlen((" " + salt).toUtf8().data()) < 7)
System.out.println("Protocol Error: The server requires insecure authentication");
break;
}
askedForPass = true;
if (chatActivity != null && (chatActivity.hasWindowFocus() || chatActivity.progressDialog.isShowing())) {
chatActivity.notifyAskForPass();
}
break;
} case AddChannel: {
addChannel(msg.readString(),msg.readInt());
break;
} case RemoveChannel: {
int chanId = msg.readInt();
if (chatActivity != null)
chatActivity.removeChannel(channels.get(chanId));
channels.remove(chanId);
break;
} case ChanNameChange: {
int chanId = msg.readInt();
if (chatActivity != null)
chatActivity.removeChannel(channels.get(chanId));
channels.remove(chanId);
channels.put(chanId, new Channel(chanId, msg.readString(), this));
break;
} default: {
System.out.println("Unimplented message");
}
}
for(SpectatingBattle battle : getBattles()) {
if (battle.activity != null && battle.histDelta.length() != 0) {
battle.activity.updateBattleInfo(false);
}
}
if (chatActivity != null && chatActivity.currentChannel() != null)
chatActivity.updateChat();
}
private void showBattleNotification(String title, int battleId, BattleConf conf) {
PlayerInfo p1 = players.get(conf.id(0));
PlayerInfo p2 = players.get(conf.id(1));
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.icon)
.setContentTitle(title)
.setContentText(p1.nick() + " vs " + p2.nick())
.setOngoing(true);
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, BattleActivity.class);
resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
resultIntent.putExtra("battleId", battleId);
// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(ChatActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
battleId,
PendingIntent.FLAG_UPDATE_CURRENT
);
//PendingIntent resultPendingIntent = PendingIntent.getActivity(this, battleId, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = getNotificationManager();
// mId allows you to update the notification later on.
mNotificationManager.notify("battle", battleId, mBuilder.build());
}
NotificationManager getNotificationManager() {
return (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
}
public void sendPass(String s) {
askedForPass = false;
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
Baos hashPass = new Baos();
hashPass.putBytes(md5.digest(mashBytes(toHex(md5.digest(s.getBytes("ISO-8859-1"))).getBytes("ISO-8859-1"), salt.getBytes("ISO-8859-1"))));
socket.sendMessage(hashPass, Command.AskForPass);
} catch (NoSuchAlgorithmException nsae) {
System.out.println("Attempting authentication threw an exception: " + nsae);
} catch (UnsupportedEncodingException uee) {
System.out.println("Attempting authentication threw an exception: " + uee);
}
}
private byte[] mashBytes(final byte[] a, final byte[] b) {
byte[] ret = new byte[a.length + b.length];
System.arraycopy(a, 0, ret, 0, a.length);
System.arraycopy(b, 0, ret, a.length, b.length);
return ret;
}
private String toHex(byte[] b) {
String ret = new BigInteger(1, b).toString(16);
while (ret.length() < 32)
ret = "0" + ret;
return ret;
}
protected void addChannel(String chanName, int chanId) {
Channel c = new Channel(chanId, chanName, this);
channels.put(chanId, c);
if(chatActivity != null)
chatActivity.addChannel(c);
}
public void playCry(SpectatingBattle battle, ShallowBattlePoke poke) {
new Thread(new CryPlayer(poke, battle)).start();
}
class CryPlayer implements Runnable {
ShallowBattlePoke poke;
SpectatingBattle battle;
public CryPlayer(ShallowBattlePoke poke, SpectatingBattle battle) {
this.poke = poke;
this.battle = battle;
}
public void run() {
int resID = getResources().getIdentifier("p" + poke.uID.pokeNum,
"raw", pkgName);
if (resID != 0) {
MediaPlayer cryPlayer = MediaPlayer.create(NetworkService.this, resID);
cryPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
synchronized (mp) {
mp.notify();
}
}
});
synchronized (cryPlayer) {
cryPlayer.start();
try {
cryPlayer.wait(10000);
} catch (InterruptedException e) {}
}
cryPlayer.release();
synchronized (battle) {
battle.notify();
}
cryPlayer = null;
}
}
}
public void disconnect() {
if (socket != null && socket.isConnected()) {
socket.close();
}
this.stopForeground(true);
this.stopSelf();
}
public PlayerInfo getPlayerByName(String playerName) {
Enumeration<Integer> e = players.keys();
while(e.hasMoreElements()) {
PlayerInfo info = players.get(e.nextElement());
if (info.nick().equals(playerName))
return info;
}
return null;
}
public BattleDesc battle(Integer battleid) {
return battles.get(battleid);
}
/**
* Tells the server we're not spectating a battle anymore, and close the appropriate
* spectating window
* @param bID the battle we're not watching anymore
*/
public void stopWatching(int bID) {
socket.sendMessage(new Baos().putInt(bID).putBool(false), Command.SpectateBattle);
closeBattle(bID);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
7f0bee62dce0a5c88139ffee3303cf3c87545dcb | 1c59e07117002674929d6652fcb36f975aa3e33a | /blog/src/main/java/cn/muchen/blog/server/web/ArticleManagerController.java | de62640a79042b4f97ce1e7eafa2d312c4714487 | [] | no_license | kemuchen/myblog | ad67ceb321e46cc4fbc00c6273b9d708d9683ca1 | 8e4490dc42ae8187167395ae87e51fc7a04ecf00 | refs/heads/master | 2020-04-08T20:05:49.128545 | 2018-12-04T01:41:14 | 2018-12-04T01:41:14 | 159,683,722 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,336 | java | package cn.muchen.blog.server.web;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import cn.muchen.blog.server.service.inter.ArticleManagerService;
import cn.muchen.framework.Constants;
import cn.muchen.framework.util.Util;
/**
*
* @ClassName::ArticleManagerController
* @Description: 文章管理
* @author :柯雷
* @date :2018年9月20日 下午2:27:21
*
*/
@Controller
@RequestMapping("/blog")
public class ArticleManagerController {
/**
* @Description 日志打印对象
*/
Logger logger = LoggerFactory.getLogger(ArticleManagerController.class);
@Autowired
ArticleManagerService articleManagerServiceImpl;
@RequestMapping("/articleManager")
public String toArticleManager() {
logger.info("【ArticleManagerController】跳转到文章管理界面");
return "blog/server/articleManager";
}
/**
*
* @Title:getAllArticles
* @Description:分页查询文章列表
* @param :@param params
* @param :@return
* @return :String
* @throws
*/
@RequestMapping("/getAllArticles")
@ResponseBody
public String getAllArticles(@RequestParam Map<String, Object> params) {
logger.info("【ArticleManagerController.getAllArticles】查询文章列表:" + params);
// 返回信息
Map<String, Object> rtnMap = articleManagerServiceImpl.getArticlePage(params);
if (!Util.isEmpty(rtnMap)) { // 查询成功
rtnMap.put("code", Constants.PAGE_QUERY_CG);
rtnMap.put("message", "查询成功");
} else { // 查询失败
rtnMap = new HashMap<>();
rtnMap.put("code", Constants.PAGE_QUERY_SB);
rtnMap.put("message", "查询失败");
}
return JSONObject.toJSONString(rtnMap);
}
/**
*
* @Title:saveArticle
* @Description:保存文章信息
* @param :@param params
* @param :@return
* @return :String
* @throws
*/
@SuppressWarnings("unchecked")
@RequestMapping("/saveArticle")
@ResponseBody
public String saveArticle(@RequestParam Map<String, Object> params, HttpSession session) {
logger.info("【ArticleManagerController.saveArticle】保存文章信息");
// 获取用户信息
Map<String, Object> user = (Map<String, Object>) session.getAttribute("user");
params.put("USERID", user.get("USERID"));
return JSONObject.toJSONString(articleManagerServiceImpl.saveArticle(params));
}
/**
*
* @Title:deleteArticle
* @Description:删除文章信息
* @param :@param params
* @param :@return
* @return :String
* @throws
*/
@RequestMapping("/deleteArticle")
@ResponseBody
public String deleteArticle(@RequestParam Map<String, Object> params) {
logger.info("【ArticleManagerController.deleteArticle】删除文章信息:" + params);
return JSONObject.toJSONString(articleManagerServiceImpl.deleteArticle(params));
}
}
| [
"Administrator@1E16FM909B3S7YC"
] | Administrator@1E16FM909B3S7YC |
840696dfa37995887bc9eabd15722c81bba6f4c0 | 8d3642cc1128dcfb58ad1a9df287a610be62cba2 | /app/src/main/java/com/ufam/hospitalapp/interfaces/RecyclerViewOnClickListenerHack.java | ccf80d04532d04bb3304e831a6b3fd0f737dedf6 | [] | no_license | raphaelrocha/HospitalApp | 1d085a6e4f5a78a7c0d51e565aedc6e778bd6477 | 208ecd1cfe5dd7cc724a2a0c6b9f8f8f411a5b27 | refs/heads/master | 2021-01-10T04:59:59.210199 | 2016-02-26T15:31:26 | 2016-02-26T15:31:26 | 47,856,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package com.ufam.hospitalapp.interfaces;
import android.view.View;
/**
* Created by viniciusthiengo on 4/5/15.
*/
public interface RecyclerViewOnClickListenerHack {
public void onClickListener(View view, int position);
public void onLongPressClickListener(View view, int position);
}
| [
"raphaelrocha86@gmail.com"
] | raphaelrocha86@gmail.com |
fb9cc17d1d595e7768e66207220725f570e0333d | a112b4d4ce3ce0ceacb8d1e81068d86264234f6a | /formatter/src/main/java/org/wisdom/tool/FormatMain.java | 93df90117a4c7c55bbe224c0a33b4b69a3600324 | [
"Apache-2.0"
] | permissive | huaxuechensu/formatter | 913d03e2836b0370fa3dedfd1abc4f8df67289bc | 8a3a72c6f4f01c003b19f55dd4f8decff73952d8 | refs/heads/master | 2021-08-22T12:01:31.000255 | 2017-11-30T04:45:54 | 2017-11-30T04:45:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,199 | java | /*
* Copyright 2016-2017 WisdomTool.org. All Rights Reserved.
*
* You may not use this file except in compliance with the License.
* A copy of the License is located at
* http://www.wisdomtool.org/licenses
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package org.wisdom.tool;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import org.wisdom.tool.constant.FormatConst;
import org.wisdom.tool.gui.FormatView;
import org.wisdom.tool.gui.MenuBarView;
import org.wisdom.tool.util.FormatUtil;
/**
* @ClassName: FormatMain
* @Description: Formatter Main
* @Author: Dom Wang
* @Email: wisdomtool@outlook.com
* @date 2017-07-22 PM 10:42:57
* @version 1.0
*/
public class FormatMain
{
/**
*
* @Title: init
* @Description: Component Initialization
* @param
* @return void
* @throws
*/
private static void init()
{
MenuBarView mbv = new MenuBarView();
JFrame frame = new JFrame(FormatConst.FORMAT_VERSION);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setJMenuBar(mbv.getJMenuBar());
frame.getContentPane().add(FormatView.getView());
frame.pack();
frame.setVisible(true);
frame.setIconImage(FormatUtil.getImage(FormatConst.LOGO));
FormatUtil.setLocation(frame);
}
/**
*
* @Title: openView
* @Description: Open REST view
* @param
* @return void
* @throws
*/
public static void openView()
{
init();
}
/**
*
* @Title: closeView
* @Description: Close REST view
* @param
* @return void
* @throws
*/
public static void closeView()
{
System.exit(0);
}
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
FormatMain.openView();
}
});
}
}
| [
"witpool@outlook.com"
] | witpool@outlook.com |
f518134471df357e1c5d0738670ee40542ef1ae8 | fcaa65c7d4dea01eaf27850d04f6a59e66422216 | /src/main/java/com/store/StoreUtil.java | e9bc402fa158bb9821337fd2c441aebe759d599e | [
"MIT"
] | permissive | sr56/shoppingcart | 1a2d0f3777e4d4cf2c71b862ae41f0a3b1b746bb | bc032aefa9bad8fe590473984dd264c1136b38a9 | refs/heads/master | 2021-07-12T09:50:58.946703 | 2019-09-10T14:18:19 | 2019-09-10T14:18:19 | 207,547,516 | 0 | 0 | MIT | 2020-10-13T15:56:58 | 2019-09-10T12:00:29 | Java | UTF-8 | Java | false | false | 2,675 | java | /*
* The MIT License
*
* Copyright 2019 Suraj.
*
* 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 com.store;
import com.store.model.Item;
import java.util.ArrayList;
import org.jboss.logging.Logger;
import org.jboss.logging.Logger.Level;
import org.springframework.stereotype.Component;
/**
*
* @author Suraj
*/
@Component
public class StoreUtil {
private static final Logger logger = Logger.getLogger(StoreUtil.class);
public double getRandomAmount(double minAmount, double maxAmount) {
double result = (Math.random() * ((maxAmount - minAmount) + 1)) + minAmount;
return roundToTwoDecimal(result);
}
public int getRandomInt(int minInt, int maxInt){
return (int)this.getRandomAmount(minInt, maxInt);
}
public double roundToTwoDecimal(double unRounded){
return (Math.round(unRounded * 100.0))/100.0;
}
public void print(ArrayList<Item> items){
this.print(items, false, Level.DEBUG);
}
public void print(ArrayList<Item> items, boolean isCart, Level level){
if(items.size() <= 0){
return;
}
Item prevItem = items.get(0);
int count = 0;
for (Item item : items) {
if((count == 0 || !prevItem.getCategory().equalsIgnoreCase(item.getCategory())) && !isCart){
logger.log(level, "-----------------------------");
logger.log(level, "{CATEGORY: " + item.getCategory() + "}");
}
logger.log(level, item);
count++;
prevItem = item;
}
logger.log(level, "");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
d39a8aa1ac70340d6d1300859795f4c9aa6591f6 | 06dcae5fcf1d73f722cfa343a717378ef3bbbe30 | /app/src/androidTest/java/com/example/f1/cloudconnect/ExampleInstrumentedTest.java | d8502ae1c142172ab1211e189e36edac3fbc3238 | [] | no_license | ashwin2k/cloud-connect- | ffabb982c1c71d57497df322038eec4ef201dc2c | 08ba51551c85c2e101e81ab12e0b9c9958804286 | refs/heads/master | 2023-02-07T18:26:13.589416 | 2023-02-01T08:03:07 | 2023-02-01T08:03:07 | 178,335,481 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package com.example.f1.cloudconnect;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.f1.cloudconnect", appContext.getPackageName());
}
}
| [
"ashwinkumar14102000@gmail.com"
] | ashwinkumar14102000@gmail.com |
1e2a232373a7002ee670d656124c5e0555b72585 | d4f0e571cebc86f5c8f6bbdb538fad129577c011 | /src/main/test/pl/com/sda/rafal/zientara/apps/lesson2/hangman/HangmanTest.java | b605c1305d61237b37f727eeb333a51cdbb65f12 | [] | no_license | RafalZientara/Javawro29 | b7aa554472c882b52d6fee630cdf645becc899b8 | 5d2d5e35a9f7a4b66e9aee0cc895a468dc72ed12 | refs/heads/master | 2023-01-01T00:54:51.337121 | 2020-07-24T17:17:20 | 2020-07-24T17:17:20 | 275,364,283 | 1 | 0 | null | 2020-07-04T10:19:11 | 2020-06-27T12:06:58 | Java | UTF-8 | Java | false | false | 5,308 | java | package pl.com.sda.rafal.zientara.apps.lesson2.hangman;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class HangmanTest {
private Hangman game;
@BeforeEach
public void setup() {
game = new Hangman();
}
@Test
public void secretPassword() {
//given
//when
game.setPuzzle("Ala ma kota");
//then
String output = game.getOutput();
assertEquals("... .. ....", output);
}
@Test
public void userGuessLetterO() {
//given
game.setPuzzle("Ala ma kota");
//when
game.guess("o");
//then
String output = game.getOutput();
assertEquals("... .. .o..",
output);
}
@Test
public void userGuessLetterBigO() {
//given
game.setPuzzle("Ala ma kota");
//when
game.guess("O");
//then
String output = game.getOutput();
assertEquals("... .. .o..",
output);
}
@Test
public void userGuessLetterA() {
//given
game.setPuzzle("Ala ma kota");
//when
game.guess("a");
//then
String output = game.getOutput();
assertEquals("A.a .a ...a",
output);
}
@Test
public void userGuessWholePuzzle() {
//given
game.setPuzzle("Ala ma kota");
//when
game.guess("Ala ma kota");
//then
String output = game.getOutput();
assertEquals("Ala ma kota",
output);
}
@Test
public void userHasSevenHpOnStart() {
int hp = game.getHp();
assertEquals(7, hp);
}
@Test
public void wrongGuessLetterHurts() {
//given
game.setPuzzle("a");
//when
game.guess("x");
//then
int hp = game.getHp();
assertEquals(6, hp);
}
@Test
public void emptyGuessDoesNothing() {
//given
game.setPuzzle("a");
//when
game.guess("");
//then
int hp = game.getHp();
assertEquals(7, hp);
}
@Test
public void spaceGuessDoesNothing() {
//given
game.setPuzzle("a");
//when
game.guess(" ");
String txt = " Ala ma kota ".trim();//"Ala ma kota"
//then
int hp = game.getHp();
assertEquals(7, hp);
}
@Test
public void spacesGuessDoesNothing() {
//given
game.setPuzzle("a");
//when
game.guess(" ");
String txt = " Ala ma kota ".trim();//"Ala ma kota"
//then
int hp = game.getHp();
assertEquals(7, hp);
}
@Test
public void guessWithTrimIsCorrect() {
//given
game.setPuzzle("a");
//when
game.guess(" a ");
//then
int hp = game.getHp();
assertEquals(7, hp);
String output = game.getOutput();
assertEquals("a",
output);
}
@Test
public void wrongGuessPuzzleHurts() {
//given
game.setPuzzle("Ala");
//when
game.guess("Okoń");
//then
int hp = game.getHp();
assertEquals(6, hp);
}
@Test
public void outOfHp() {
//given
game.setPuzzle("a");
//when
game.guess("1");
game.guess("2");
game.guess("3");
game.guess("4");
game.guess("5");
game.guess("6");
game.guess("7");
//then
int hp = game.getHp();
assertEquals(0, hp);
}
@Test
public void outOfHpAfterGameOver() {
//given
game.setPuzzle("a");
//when
game.guess("1");
game.guess("2");
game.guess("3");
game.guess("4");
game.guess("5");
game.guess("6");
game.guess("7");
game.guess("8");
//then
int hp = game.getHp();
assertEquals(0, hp);
}
@Test
public void guessLetterByLetter() {
//given
game.setPuzzle("Ala ma kota");
//when
game.guess("a");
game.guess("l");
game.guess("m");
game.guess("k");
game.guess("o");
game.guess("t");
//then
String output = game.getOutput();
assertEquals("Ala ma kota",
output);
}
@Test
public void isWin() {
//given
game.setPuzzle("Ala ma kota");
game.guess("Ala ma kota");
//when
//then
assertTrue(game.isWin());
}
@Test
public void tiresShouldBeClearedAfterNewPuzzle() {
//given
game.setPuzzle("ABBA");
game.guess("a");
//when
game.setPuzzle("AC DC");
//then
assertTrue(game.getTries().isEmpty());
}
@Test
public void hpShouldBeClearedAfterNewPuzzle() {
//given
game.setPuzzle("ABBA");
game.guess("x");
//when
game.setPuzzle("AC DC");
//then
assertEquals(7, game.getHp());
}
} | [
"rafal.zientara92@gmail.com"
] | rafal.zientara92@gmail.com |
d51b1503c5629a0262cf864902fcdeb45b2c375c | c0fe21b86f141256c85ab82c6ff3acc56b73d3db | /redis/src/main/java/com/jdcloud/sdk/service/redis/model/ClientInfo.java | f25d29de44c3c82c6c3695156c79914afac750d6 | [
"Apache-2.0"
] | permissive | jdcloud-api/jdcloud-sdk-java | 3fec9cf552693520f07b43a1e445954de60e34a0 | bcebe28306c4ccc5b2b793e1a5848b0aac21b910 | refs/heads/master | 2023-07-25T07:03:36.682248 | 2023-07-25T06:54:39 | 2023-07-25T06:54:39 | 126,275,669 | 47 | 61 | Apache-2.0 | 2023-09-07T08:41:24 | 2018-03-22T03:41:41 | Java | UTF-8 | Java | false | false | 4,038 | java | /*
* Copyright 2018 JDCLOUD.COM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:#www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*
*
*
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
package com.jdcloud.sdk.service.redis.model;
/**
* 客户端信息
*/
public class ClientInfo implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* 实例名称
*/
private String instanceName;
/**
* 客户端版本号
*/
private String version;
/**
* 客户端ip
*/
private String ip;
/**
* 进程pid/tid/随机数
*/
private String pid;
/**
* UUID
*/
private String uuid;
/**
* 客户端启动时间
*/
private String startTime;
/**
* get 实例名称
*
* @return
*/
public String getInstanceName() {
return instanceName;
}
/**
* set 实例名称
*
* @param instanceName
*/
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
/**
* get 客户端版本号
*
* @return
*/
public String getVersion() {
return version;
}
/**
* set 客户端版本号
*
* @param version
*/
public void setVersion(String version) {
this.version = version;
}
/**
* get 客户端ip
*
* @return
*/
public String getIp() {
return ip;
}
/**
* set 客户端ip
*
* @param ip
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* get 进程pid/tid/随机数
*
* @return
*/
public String getPid() {
return pid;
}
/**
* set 进程pid/tid/随机数
*
* @param pid
*/
public void setPid(String pid) {
this.pid = pid;
}
/**
* get UUID
*
* @return
*/
public String getUuid() {
return uuid;
}
/**
* set UUID
*
* @param uuid
*/
public void setUuid(String uuid) {
this.uuid = uuid;
}
/**
* get 客户端启动时间
*
* @return
*/
public String getStartTime() {
return startTime;
}
/**
* set 客户端启动时间
*
* @param startTime
*/
public void setStartTime(String startTime) {
this.startTime = startTime;
}
/**
* set 实例名称
*
* @param instanceName
*/
public ClientInfo instanceName(String instanceName) {
this.instanceName = instanceName;
return this;
}
/**
* set 客户端版本号
*
* @param version
*/
public ClientInfo version(String version) {
this.version = version;
return this;
}
/**
* set 客户端ip
*
* @param ip
*/
public ClientInfo ip(String ip) {
this.ip = ip;
return this;
}
/**
* set 进程pid/tid/随机数
*
* @param pid
*/
public ClientInfo pid(String pid) {
this.pid = pid;
return this;
}
/**
* set UUID
*
* @param uuid
*/
public ClientInfo uuid(String uuid) {
this.uuid = uuid;
return this;
}
/**
* set 客户端启动时间
*
* @param startTime
*/
public ClientInfo startTime(String startTime) {
this.startTime = startTime;
return this;
}
} | [
"jdcloud-api@jd.com"
] | jdcloud-api@jd.com |
40cdacf1c4a99fba6f60cd5dfc6d3ac4ca16f43e | 0d40f2824c1e9f1a43f3853efea83c765925fa3d | /src/main/java/com/vidal/merlin/wsclient/ucd/GetAllUcds.java | b2e83f25230816f0c2065336c45c774d5e573435 | [] | no_license | ncauvet/VidalPrescriptionWS | 2319ae3b9a2f97fe9a4c2fae7c82b322d68df861 | 9911d3b9a2f02abac78a3d40d8d8914bc0d34db0 | refs/heads/master | 2020-03-31T07:33:47.792042 | 2013-11-02T08:50:40 | 2013-11-02T08:50:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,663 | java |
package com.vidal.merlin.wsclient.ucd;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ucdApiFilter" type="{urn:Vidal}UcdApiFilter"/>
* <element name="marketStatuses" type="{urn:Vidal}ArrayOfMarketStatus"/>
* <element name="pageNumber" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="pageSize" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"ucdApiFilter",
"marketStatuses",
"pageNumber",
"pageSize"
})
@XmlRootElement(name = "getAllUcds")
public class GetAllUcds {
@XmlElement(required = true, nillable = true)
protected UcdApiFilter ucdApiFilter;
@XmlElement(required = true, nillable = true)
protected ArrayOfMarketStatus marketStatuses;
@XmlElement(required = true, type = Integer.class, nillable = true)
protected Integer pageNumber;
@XmlElement(required = true, type = Integer.class, nillable = true)
protected Integer pageSize;
/**
* Gets the value of the ucdApiFilter property.
*
* @return
* possible object is
* {@link UcdApiFilter }
*
*/
public UcdApiFilter getUcdApiFilter() {
return ucdApiFilter;
}
/**
* Sets the value of the ucdApiFilter property.
*
* @param value
* allowed object is
* {@link UcdApiFilter }
*
*/
public void setUcdApiFilter(UcdApiFilter value) {
this.ucdApiFilter = value;
}
/**
* Gets the value of the marketStatuses property.
*
* @return
* possible object is
* {@link ArrayOfMarketStatus }
*
*/
public ArrayOfMarketStatus getMarketStatuses() {
return marketStatuses;
}
/**
* Sets the value of the marketStatuses property.
*
* @param value
* allowed object is
* {@link ArrayOfMarketStatus }
*
*/
public void setMarketStatuses(ArrayOfMarketStatus value) {
this.marketStatuses = value;
}
/**
* Gets the value of the pageNumber property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getPageNumber() {
return pageNumber;
}
/**
* Sets the value of the pageNumber property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setPageNumber(Integer value) {
this.pageNumber = value;
}
/**
* Gets the value of the pageSize property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getPageSize() {
return pageSize;
}
/**
* Sets the value of the pageSize property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setPageSize(Integer value) {
this.pageSize = value;
}
}
| [
"nicolascauvet@gmail.com"
] | nicolascauvet@gmail.com |
0a141f2ce8eac4339b8f2b0e6029eac413116c49 | ee60115f583cba9492153ecfeda0f2ec7b0421a0 | /src/Exercise3.java | d10df1bdf0fa80c9ce0b6be17a3964ea186e5566 | [] | no_license | Seathe14/AdditionalKTPLab2 | 5ef0e9948bfdb44dfb43c5681d0cefb3203fac84 | ecd0a30e4f5df73e6b0905c637b2907205158f23 | refs/heads/master | 2022-08-01T00:23:35.647598 | 2020-05-26T20:36:15 | 2020-05-26T20:36:15 | 267,147,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | java | public class Exercise3 {
private static boolean isAvgWhole(int[] array)
{
int sumOfIntegers = 0; // считаем сумму чисел массива в цикле
for(int i =0;i<array.length;i++)
{
sumOfIntegers+=array[i];
}
// проверяем делится ли сумма без остатка, если да, то true, иначе false
if(sumOfIntegers%array.length==0)
return true;
else return false;
}
public static void main(String[] args)
{
System.out.println(isAvgWhole(new int[] {1, 3}));
System.out.println(isAvgWhole(new int[] {1, 2, 3, 4}));
System.out.println(isAvgWhole(new int[] {1, 5, 6}));
System.out.println(isAvgWhole(new int[] {1, 1, 1}));
System.out.println(isAvgWhole(new int[] {9, 2, 2, 5}));
}
}
| [
"imynn@outlook.com"
] | imynn@outlook.com |
776e92ed936195ec78330c0c6846f76c1fffbd4e | 96cd3e17732fd17568023a0238b26e9893fa2aa7 | /LMS/src/com/ss/lms/dao/BookAuthorDAO.java | 8dbf78df591f2f205dc22ea9fd1235cf3431688d | [] | no_license | trevorhuis-smoothstack/Library-Management-System | 4fc2f4cda9204b0bee16b509d7c24c2edbfc3294 | 9deb2762f2df5dd5f0525004e2e3cc4385e960b9 | refs/heads/master | 2022-04-26T09:16:04.200085 | 2020-04-27T23:47:22 | 2020-04-27T23:47:22 | 256,316,235 | 0 | 0 | null | 2020-04-27T23:47:23 | 2020-04-16T19:55:46 | Java | UTF-8 | Java | false | false | 1,951 | java | package com.ss.lms.dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.ss.lms.models.BookAuthor;
public class BookAuthorDAO extends BaseDAO<BookAuthor> {
public BookAuthorDAO(Connection conn) {
super(conn);
}
public void addBookAuthorEntry(BookAuthor bookAuthor) throws ClassNotFoundException, SQLException{
save("INSERT INTO tbl_book_authors (bookId, authorId) VALUES (?, ?)", new Object[] {bookAuthor.getBookId(), bookAuthor.getBookId()});
}
public void updateBookAuthorByAuthor(Integer oldId, Integer newId) throws ClassNotFoundException, SQLException{
save("UPDATE tbl_book_authors SET authorId = ? WHERE authorId = ?", new Object[] {oldId, newId});
}
public void updateBookAuthorByBook(Integer oldId, Integer newId) throws ClassNotFoundException, SQLException{
save("UPDATE tbl_book_authors SET bookId = ? WHERE bookId = ?", new Object[] {oldId, newId});
}
public void deleteAuthorsReferenceByAuthor(Integer Author_id) throws ClassNotFoundException, SQLException{
save("DELETE FROM tbl_book_authors WHERE Author_id = ?", new Object[]{Author_id});
}
public void deleteAuthorsReferenceByBook(Integer bookId) throws ClassNotFoundException, SQLException {
save("DELETE FROM tbl_book_authors WHERE bookId = ?", new Object[] { bookId } );
}
public List<BookAuthor> readAllAuthorReferences() throws ClassNotFoundException, SQLException{
return read("SELECT * FROM tbl_book_authors", null);
}
@Override
public List<BookAuthor> extractData(ResultSet rs) throws SQLException {
List<BookAuthor> bookAuthors = new ArrayList<>();
while(rs.next()){
BookAuthor bookAuthor = new BookAuthor();
bookAuthor.setAuthorId(rs.getInt("authorId"));
bookAuthor.setBookId(rs.getInt("bookId"));
bookAuthors.add(bookAuthor);
}
return bookAuthors;
}
} | [
"trevor.huis@Smoothstack.com"
] | trevor.huis@Smoothstack.com |
6f1e7a649c7f4381dead2d42affbb932fa51089b | 4b74d1589c777a21208a5618883dc19c546e7150 | /src/main/java/dev/niipa/rcl/LoadingFunction.java | fb51dd7c8b52348f42fcb7fe0c3decff3086878d | [
"MIT"
] | permissive | Niipa/hatchery | 9a35152cfa3e368170510407794728f847ade801 | 662dc3b8401d2b6261befe24d436f6b128586cf8 | refs/heads/master | 2020-09-17T18:09:22.323198 | 2019-11-30T05:42:43 | 2019-11-30T05:42:43 | 224,106,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 97 | java | package dev.niipa.rcl;
@FunctionalInterface
public interface LoadingFunction<T> {
T load();
}
| [
"rz.soliven2gmail.com"
] | rz.soliven2gmail.com |
0db84b7d543eee422c1a5bfe5e20f23fed213eb7 | 7b73424facc3388d2c391b09bea6c390bba0287f | /Complete Java/Hibernate/hibernateapp/src/main/java/com/tyss/hibernateapp/App.java | 482b9fb789193166c71ad0379ca1f2253f5f65d1 | [] | no_license | venkatesha02/Venkat-Complete-Java | b2423c76c87dec755102947147ae20110f69599d | 4e79e9d5e99cc9e590f4edfe27830417c5a57136 | refs/heads/master | 2022-07-10T16:38:06.697779 | 2020-02-09T09:40:49 | 2020-02-09T09:40:49 | 239,270,779 | 0 | 1 | null | 2022-06-23T13:25:53 | 2020-02-09T08:28:59 | JavaScript | UTF-8 | Java | false | false | 184 | java | package com.tyss.hibernateapp;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"venkatesh000venki@gmail.com"
] | venkatesh000venki@gmail.com |
fba04badf7c023bf586be49ad8e585c5b2d4436b | 263b9556d76279459ab9942b0005a911e2b085c5 | /src/main/java/com/alipay/api/response/KoubeiMarketingCampaignDetailInfoQueryResponse.java | 03861060610768cf234d8f4da513844fbcbed61e | [
"Apache-2.0"
] | permissive | getsgock/alipay-sdk-java-all | 1c98ffe7cb5601c715b4f4b956e6c2b41a067647 | 1ee16a85df59c08fb9a9b06755743711d5cd9814 | refs/heads/master | 2020-03-30T05:42:59.554699 | 2018-09-19T06:17:22 | 2018-09-19T06:17:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.marketing.campaign.detail.info.query response.
*
* @author auto create
* @since 1.0, 2018-01-10 14:14:30
*/
public class KoubeiMarketingCampaignDetailInfoQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 1663947469513742223L;
/**
* 适用门店:门店与门店之间用“,”隔开
*/
@ApiField("limit_shops")
private String limitShops;
public void setLimitShops(String limitShops) {
this.limitShops = limitShops;
}
public String getLimitShops( ) {
return this.limitShops;
}
}
| [
"liuqun.lq@alibaba-inc.com"
] | liuqun.lq@alibaba-inc.com |
7e3eacc73023f541c68d833464a416a36aa8c41f | dfa46dd73ac209d46a87f49f314614538d209df7 | /src/main/java/com/lyb/client/message/protocol/Message_2_2.java | 5038fdf2e336721c315b60b363a56add58d77d38 | [] | no_license | safziy/lyb_client | a580fb596bc9d3b91db9d1d8d2166d480c31e746 | b2842186f63136309ddd150837352cf63cfb5b9a | refs/heads/master | 2020-12-31T04:28:49.347905 | 2016-01-15T09:28:15 | 2016-01-15T09:28:15 | 45,508,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,130 | java | package com.lyb.client.message.protocol;
import com.lyb.client.message.IMessage;
import com.lyb.client.net.Data;
import com.lyb.client.utils.DummyUtils;
import com.lyb.client.message.protocol.segment.*;
import com.lyb.client.message.MessageParameterContext;
import com.lyb.client.message.handler.IntMessageParameterHandler;
import com.lyb.client.message.handler.LongMessageParameterHandler;
/**
* 请求 创建角色
*
* @author codeGenerator
*
*/
@SuppressWarnings("unused")
public class Message_2_2 implements IMessage {
private static int MAIN = 2;
private static int SUB = 2;
private static String MESSAGE_KEY = DummyUtils.getCompositeKey(2, 2);
private int career;
private String userName;
private static IntMessageParameterHandler careerHandler = MessageParameterContext.getInstance().getIntMessageParameterHandler("Career");
public static Message_2_2 create() {
return new Message_2_2();
}
/**
* @return the career
*/
public int getCareer() {
return career;
}
/**
* @param career
* the career to set
*/
public void setCareer(int career) {
this.career = career;
}
/**
* @return the userName
*/
public String getUserName() {
return userName;
}
/**
* @param userName
* the userName to set
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* 编码
*/
@Override
public void encode(Data data) {
data.writeInt(this.career);
data.writeString(this.userName);
}
/**
* 解码
*/
@Override
public void decode(Data data) {
this.career = data.getInt();
this.userName = data.getString();
}
@Override
public boolean validate() {
if (!careerHandler.validate(career)) {
return false;
}
return true;
}
@Override
public int getMain() {
return MAIN;
}
@Override
public int getSub() {
return SUB;
}
@Override
public String getMessageKey() {
return MESSAGE_KEY;
}
public String toString() {
StringBuilder bb = new StringBuilder();
bb.append("career:").append(this.career).append(", ");
bb.append("userName:").append(this.userName);
return bb.toString();
}
} | [
"787395455@qq.com"
] | 787395455@qq.com |
8e6423453497e92a26398d816b14389fede5aef2 | ac41341eb32557d0159b633881ed5668044b99ca | /src/org/genesys/interpreter/deepcode/MapLList.java | a54671999b030beaeaced895153409b11dd5cd40 | [] | no_license | utopia-group/neo | 421651732cc0b7f698265d689d02359f904ee487 | 1d3572ff4fee0c55c741dea2852e2562c160d589 | refs/heads/master | 2020-06-18T15:18:07.517234 | 2019-07-11T23:43:30 | 2019-07-11T23:43:30 | 196,342,026 | 5 | 5 | null | null | null | null | UTF-8 | Java | false | false | 975 | java | package org.genesys.interpreter.deepcode;
import org.genesys.interpreter.Unop;
import org.genesys.type.AbstractList;
import org.genesys.type.Cons;
import org.genesys.type.EmptyList;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* Created by yufeng on 5/31/17.
*/
public class MapLList implements Unop {
private final Unop unop;
public MapLList(Unop unop) {
this.unop = unop;
}
public Object apply(Object obj) {
if (obj instanceof Integer){
assert ((Integer)obj == 256);
return new ArrayList<>();
}
List list = (List) obj;
if (list.isEmpty()) {
return list;
} else {
List targetList = new ArrayList();
for(Object elem : list) {
targetList.add(this.unop.apply(elem));
}
return targetList;
}
}
public String toString() {
return "MAP";
}
}
| [
"fengyu8299@gmail.com"
] | fengyu8299@gmail.com |
88d2263b301273b581ceb50c935b6bc24ee6d99e | dc89db7e8d810732f16defb6d08bb8de742bf552 | /POMDemo/src/RegistrationMain/RegistrationTest.java | 4a85c2939d6e413acd6def59c4c73713c68cf00a | [] | no_license | yasaswialluri/selenium | 45b687302a689e033c73fb7cf5bfc36f09fdd310 | 5782835923b85a7c2e0c293344f97776895a07be | refs/heads/master | 2023-04-05T07:14:46.290084 | 2021-03-28T14:53:17 | 2021-03-28T14:53:17 | 352,355,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package RegistrationMain;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import RegistrationPackage.RegistrationPOM;
public class RegistrationTest {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Chromdriver\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://demowebshop.tricentis.com/register");
driver.manage().window().maximize();
RegistrationPOM register = new RegistrationPOM(driver);
register.enterGender();
register.enterFirstName("Sai");
register.enterLastName("jnanesh");
register.enterEmail("saijnanesh3@gmail.com");
register.enterPassword("123456", "123456");
register.clickRegister();
}
}
| [
"ayasaswi@LIN66009589.corp.capgemini.com"
] | ayasaswi@LIN66009589.corp.capgemini.com |
6b23e69832d12b9e823fa03fef278a0c0e6db8c2 | fa9d13151317ad26b226834310a638828b0d5314 | /src/main/java/Validator/ChangePwdCommandValidator.java | 051daf17a1c9721a7131205383581875c22822c7 | [] | no_license | myroom9/spring5book | 602e35a1646457ab940c90cb527d683fc979e24c | a0c349b9c9054089d2b41198eb4bd0d60cc3cde2 | refs/heads/master | 2021-10-23T20:04:10.115424 | 2019-03-19T14:23:34 | 2019-03-19T14:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 641 | java | package Validator;
import command.ChangePwdCommand;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
public class ChangePwdCommandValidator implements Validator {
@Override
public boolean supports(Class<?> aClass) {
return ChangePwdCommand.class.isAssignableFrom(getClass());
}
@Override
public void validate(Object o, Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "currentPassword", "required");
ValidationUtils.rejectIfEmpty(errors, "newPassword", "required");
}
}
| [
"myroom123@bible.ac.kr"
] | myroom123@bible.ac.kr |
3a07d7feef72055408a53dcf6c616372374c566d | 9bcf00d6971dd4072b1d7ca350ffdfbed83c3714 | /Global projects/Census/src/test/java/com/census/services/ItemServiceTest.java | 77c20dc2ec5ffa0479270ab3fd3443b56f0e0f35 | [] | no_license | VladTetyorko/globalRepository | b36acce5871cc6262545a5adfc402162da16fb13 | 01fc7bd415bed42db1e57e7a9dd3238f0d35b123 | refs/heads/main | 2023-09-02T07:16:39.253149 | 2021-11-11T10:48:43 | 2021-11-11T10:48:43 | 332,254,012 | 0 | 0 | null | 2021-05-14T14:04:35 | 2021-01-23T16:21:23 | Java | UTF-8 | Java | false | false | 2,376 | java | package com.census.services;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import com.census.entities.Category;
import com.census.entities.Item;
import com.census.entities.Location;
import com.census.repositories.ItemRepository;
@SpringBootTest
class ItemServiceTest {
@MockBean
private ItemRepository repository;
@Autowired
private ItemService service;
private Category category = new Category("category");
private Location location = new Location("location");
private Item item1 = new Item(1, "testname1", "description", category, location, null);
private Item item2 = new Item(2, "testname2", "description", category, location, null);
private List<Item> list = new ArrayList<Item>();
@BeforeEach
private void setup() {
list.add(item1);
list.add(item2);
Mockito.when(repository.findById(1)).thenReturn(Optional.of(item1));
Mockito.when(repository.findByCategory(category)).thenReturn(list);
Mockito.when(repository.findByLocation(location)).thenReturn(list);
}
@Test
final void shouldFindWhenLegalId() {
assertEquals(item1, service.find(1).get());
verify(repository, times(1)).findById(1);
}
@Test
final void shouldFindListByCategory() {
assertEquals(list, service.findForCategory(category));
verify(repository, times(1)).findByCategory(category);
}
@Test
final void shouldFindListByLocation() {
assertEquals(list, service.findForLocation(location));
verify(repository, times(1)).findByLocation(location);
}
@Test
final void shouldReturnEmptyListWhenLocationDoesntExists() {
Location l = new Location("NewName");
assertEquals(true, service.findForLocation(l).isEmpty());
verify(repository, times(1)).findByLocation(l);
}
@Test
final void shouldReturnEmptyListWhenCategoryDoesntExists() {
Category c = new Category("NewName");
assertEquals(true, service.findForCategory(c).isEmpty());
verify(repository, times(1)).findByCategory(c);
}
}
| [
"vladte34m@gmail.com"
] | vladte34m@gmail.com |
f0096457910f581f1487c8f34f2820d14048d5cc | 5f95a033807dd82f731af9ec9c7baddda2a8dade | /src/main/java/com/corfid/fideicomisos/service/impl/eeff/EstadosFinancierosServiceImpl.java | bc4bc820dcf6668e735fa39860e069865b50ce33 | [] | no_license | jano1821/fideicomisos | cafbe3e8fb463278b9e241811a6507dae39ec612 | c95cabad93ffe15c1a6cedb7fb98f4247fa30360 | refs/heads/master | 2023-02-09T19:02:44.215128 | 2020-12-31T06:43:50 | 2020-12-31T06:43:50 | 295,211,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,278 | java | package com.corfid.fideicomisos.service.impl.eeff;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import com.corfid.fideicomisos.component.eeff.EstadosFinancierosConverter;
import com.corfid.fideicomisos.entity.eeff.EstadosFinancieros;
import com.corfid.fideicomisos.model.cruds.CrudEstadosFinancierosModel;
import com.corfid.fideicomisos.model.eeff.EstadosFinancierosModel;
import com.corfid.fideicomisos.repository.eeff.EstadosFinancierosRepository;
import com.corfid.fideicomisos.service.eeff.EstadosFinancierosInterface;
import com.corfid.fideicomisos.utilities.AbstractService;
import com.corfid.fideicomisos.utilities.ConstantesError;
@Service("estadosFinancierosServiceImpl")
public class EstadosFinancierosServiceImpl extends AbstractService implements EstadosFinancierosInterface {
@Autowired
@Qualifier("estadosFinancierosRepository")
private EstadosFinancierosRepository estadosFinancierosRepository;
@Autowired
@Qualifier("estadosFinancierosConverter")
private EstadosFinancierosConverter estadosFinancierosConverter;
@Override
public CrudEstadosFinancierosModel listEEFFByFideicomisoPaginado(String fideicomiso,
String mesFechaCorte,
String anioFechaCorte,
String rucFideicomisario,
Integer pagina,
Integer cant) throws Exception {
List<EstadosFinancieros> listEstadosFinancieros;
List<EstadosFinancierosModel> listEstadosFinancierosModel = new ArrayList<EstadosFinancierosModel>();
Page<EstadosFinancieros> pageEstadosFinancieros = null;
CrudEstadosFinancierosModel CcudEstadosFinancierosModel = new CrudEstadosFinancierosModel();
try {
pageEstadosFinancieros = estadosFinancierosRepository.listEEFFByFideicomisoPaginadoByPeriodo(fideicomiso,
rucFideicomisario,
anioFechaCorte+mesFechaCorte,
obtenerIndexPorPagina(pagina,
cant,
"fechaCorte",
true,
false));
listEstadosFinancieros = pageEstadosFinancieros.getContent();
CcudEstadosFinancierosModel.setPaginaFinal(pageEstadosFinancieros.getTotalPages());
CcudEstadosFinancierosModel.setCantidadRegistros(_toInteger(pageEstadosFinancieros.getTotalElements()));
for (EstadosFinancieros estadosFinancieros : listEstadosFinancieros) {
listEstadosFinancierosModel.add(estadosFinancierosConverter.convertEstadosFinancierosToEstadosFinancierosModel(estadosFinancieros));
}
CcudEstadosFinancierosModel.setRows(listEstadosFinancierosModel);
CcudEstadosFinancierosModel.setCodigoError(ConstantesError.ERROR_0);
return CcudEstadosFinancierosModel;
} catch (Exception e) {
CcudEstadosFinancierosModel.setCodigoError(ConstantesError.ERROR_18);
CcudEstadosFinancierosModel.setMensajeError(obtenerMensajeError(ConstantesError.ERROR_18));
return CcudEstadosFinancierosModel;
}
}
public void guardarpdf(Integer id, byte[] filebyte) throws Exception {
EstadosFinancieros estadosFinancieros = new EstadosFinancieros();
estadosFinancieros = estadosFinancierosRepository.findByIdEstadosFinancieros(id);
estadosFinancieros.setArchivo(filebyte);
estadosFinancierosRepository.save(estadosFinancieros);
}
public EstadosFinancierosModel obtenerEEFF(Integer id) throws Exception {
EstadosFinancieros estadosFinancieros = new EstadosFinancieros();
EstadosFinancierosModel estadosFinancierosModel;
estadosFinancieros = estadosFinancierosRepository.findByIdEstadosFinancieros(id);
estadosFinancierosModel = estadosFinancierosConverter.convertEstadosFinancierosToEstadosFinancierosModel(estadosFinancieros);
return estadosFinancierosModel;
}
}
| [
"jano18_21@hotmail.com"
] | jano18_21@hotmail.com |
f43e83956e00e6a85ee2055454cf0225eabea52a | c95c97bed7f920bee21b55012630748085289782 | /imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/psd/PSD.java | 94e8edac5a8bcf29121a465613a7be5366313978 | [
"BSD-3-Clause"
] | permissive | finn-no/TwelveMonkeys | a3a4801ed1fa60c9f87c9fed36d5aa60b24fddce | c4178163623b4a62ad9f6b1f1d86c4a12a33e070 | refs/heads/master | 2023-08-02T20:42:07.652164 | 2021-04-06T06:37:39 | 2021-04-06T06:37:39 | 3,855,585 | 0 | 0 | null | 2021-04-06T06:37:40 | 2012-03-28T14:03:50 | Java | UTF-8 | Java | false | false | 1,982 | java | /*
* Copyright (c) 2012, Harald Kuhr
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name "TwelveMonkeys" 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.imageio.metadata.psd;
/**
* PSD
*
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
* @author last modified by $Author: haraldk$
* @version $Id: PSD.java,v 1.0 24.01.12 16:51 haraldk Exp$
*/
public interface PSD {
static final int RESOURCE_TYPE = ('8' << 24) + ('B' << 16) + ('I' << 8) + 'M';
static final int RES_IPTC_NAA = 0x0404;
}
| [
"harald.kuhr@gmail.com"
] | harald.kuhr@gmail.com |
0dc66092732486de99d9fd595b5a12160a24dac7 | b098dc80fedd6a269705f04cc7ab99ca4191c7da | /Chapter01/src/Thread1_7/Thread1_7_1/t11/Run.java | eff0a679c349fae2b7710b0b7f999be61ccfe6c0 | [] | no_license | WingedCat/Multithread | ee9eaf4b277d9d309c8611b25cec07a189a1eba9 | 80489a5482a2f798d248d16d286d54afc793ae47 | refs/heads/master | 2020-04-25T21:16:44.607837 | 2019-03-23T09:06:23 | 2019-03-23T09:06:23 | 173,075,598 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package Thread1_7.Thread1_7_1.t11;
public class Run {
public static void main(String[] args) {
try{
MyThread thread = new MyThread();
thread.start();
Thread.sleep(2000);
thread.interrupt();
}catch (InterruptedException e){
e.printStackTrace();
}
}
}
| [
"2233749193@qq.com"
] | 2233749193@qq.com |
a6e259a0955897895a2fc8a0d0a0b8f90aca4c44 | 8aba3e0639facc6bd1106d587c019704320ccaba | /app/controllers/ConnectionController.java | 11ed144b5f394676b7ab3512c42f204fb4b71656 | [
"Apache-2.0"
] | permissive | swift-code/swiftcode001 | 63327f1a04fc4b542ec4859a9fbcd56ec2de9d4c | 1d814a36b335f62f43f9e279371f0ec978952e8b | refs/heads/master | 2020-04-22T11:53:48.835550 | 2016-08-21T11:31:29 | 2016-08-21T11:31:29 | 66,132,468 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,747 | java | package controllers;
import com.avaje.ebean.Expr;
import models.ConnectionRequest;
import models.User;
import play.mvc.*;
public class ConnectionController extends Controller {
public Result sendConnectionRequest(Long senderId, Long toId){
if(ConnectionRequest.find.where()
.and(Expr.eq("sender_id", senderId), Expr.eq("receiver_id", toId))
.findUnique() == null) {
ConnectionRequest connectionRequest = new ConnectionRequest();
connectionRequest.sender = User.find.byId(senderId);
connectionRequest.receiver = User.find.byId(toId);
connectionRequest.status = ConnectionRequest.Status.WAITING;
ConnectionRequest.db().save(connectionRequest);
User sender = User.find.byId(connectionRequest.sender.id);
sender.sent.add(connectionRequest);
User.db().update(sender);
User receiver = User.find.byId(connectionRequest.receiver.id);
receiver.received.add(connectionRequest);
User.db().update(receiver);
}
return ok();
}
public Result acceptConnectionRequest(Long requestId){
ConnectionRequest connectionRequest = ConnectionRequest.find.byId(requestId);
connectionRequest.status = ConnectionRequest.Status.ACCEPTED;
ConnectionRequest.db().update(connectionRequest);
User sender = User.find.byId(connectionRequest.sender.id);
sender.connections.add(connectionRequest.receiver);
User.db().update(sender);
User receiver = User.find.byId(connectionRequest.receiver.id);
receiver.connections.add(connectionRequest.sender);
User.db().update(receiver);
return ok();
}
}
| [
"akshay95aradhya@gmail.com"
] | akshay95aradhya@gmail.com |
d49d08a769083735b3781f3c14d7c6f7fb666a63 | 02f3fbea43cce73b2c4e6fe960b8d1fb06df3243 | /housemart-web/src/main/java/org/housemart/util/ExceptionHandler.java | 092993a56b3df1154e2f62c0578ac137f4065dc9 | [] | no_license | qinpeng/housemart-web | 2acca73ab85e8090c5d3c6078bba88c71cf78333 | 3b15d9950a4d08136cf8699eeb0ca608c3c5e5bd | refs/heads/master | 2021-01-22T13:32:11.614062 | 2014-10-01T07:45:07 | 2014-10-01T07:45:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package org.housemart.util;
import java.lang.reflect.InvocationTargetException;
public class ExceptionHandler {
public static void renderHandle(Exception e) throws Exception {
Exception temp = new Exception();
if (e instanceof InvocationTargetException) {
temp = (InvocationTargetException) e;
for (int i = 0; i < 10; i++) {
InvocationTargetException wow = (InvocationTargetException) temp;
temp = (Exception) wow.getTargetException();
if (!(temp instanceof InvocationTargetException)) {
break;
}
}
} else {
throw e;
}
throw temp;
}
}
| [
"haperkelu@gmail.com"
] | haperkelu@gmail.com |
9bc5fc5acca3a16a743ef9f4e0fa6a3b0383c414 | 2a2582584afbca56370041174180599591b4c044 | /src/oop/principles/abstraction/Samsung.java | 883dbd135670b8215c408694c802786ca892ef83 | [] | no_license | akinkaya1/tech1 | 00a01f79d07f26b7a4f7e83f8563f30525f5ba3c | 49852bbcd55f1a556579c041be43b9ab3aff8872 | refs/heads/master | 2023-04-14T18:37:12.460663 | 2021-04-29T02:37:44 | 2021-04-29T02:37:44 | 354,565,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,147 | java | package oop.principles.abstraction;
public class Samsung extends Phone implements Television, Bluetooth{
@Override
public void call() {
//Body or implementation of the abstract call() method from Phone
System.out.println("Samsung is calling");
}
@Override
public void haveCamera() {
System.out.println("Samsung is having camera");
}
@Override
public boolean text() {
return true;
}
@Override
public void downloadApp() {
System.out.println("PlayStore");
}
@Override
public void shareFiles() {
System.out.println("Samsung is sharing files");
}
@Override
public void haveHotSpot() {
System.out.println("Samsung have hotspot");
}
@Override
public void reliable() {
System.out.println("Samsung is reliable");
}
@Override
public void haveTV() {
System.out.println("Samsung has TV");
}
@Override
public void haveChannels() {
System.out.println("Samsung TV has channels");
}
@Override
public boolean haveBluetooth() {
return false;
}
}
| [
"techglobal@TechGlobals-iMac.local"
] | techglobal@TechGlobals-iMac.local |
78c6079b21fa9bedd9224ddb8decd466c65e9e4c | 12f8fcfd815395ed716c978727498caf0ff80614 | /multithreading/logic/BerthThread.java | ff1c2635ac1ea556684a178c43c7b32742f690fa | [] | no_license | andreyk2002/6_Tasks | 7056dfe9c665988787240425e8f18d7a0528426f | 988bedf5e513fd85d5296712b2b89e102944653e | refs/heads/main | 2021-01-14T22:30:07.330846 | 2020-11-20T17:07:22 | 2020-11-20T17:07:22 | 242,781,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,583 | java | package by.epam_tc.multithreading.logic;
import by.epam_tc.multithreading.entity.*;
public class BerthThread extends Thread {
private boolean stop = false;
private PortLogic handler;
public BerthThread(PortLogic pl) {
this.handler = pl;
}
public BerthThread() {
this.handler = new PortLogic();
}
@Override
public void run() {
while (!stop || !handler.getPort().getWatingShips().isEmpty()) {
try {
processShip();
} catch (InterruptedException e) {
System.out.println("Interrupted exception was called");
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void processShip() throws Exception {
synchronized (handler) {
while (handler.isEmptyQueue()) {
if (stop) {
return;
}
handler.wait();
}
Ship ship = handler.getPort().getWatingShips().poll();
if (ship.isUnload()) {
handler.unloadShip(ship);
System.out.println("Ship " + ship.getName() + " was unloaded in the port");
System.out.println("port load changed : " + handler.getPort().getCurrentWeight() + "/"
+ handler.getPort().CAPACITY);
} else {
handler.loadShip(ship);
System.out.println("Ship " + ship.getName() + " was loaded in the port");
System.out.println("port load changed : " + handler.getPort().getCurrentWeight() + "/"
+ handler.getPort().CAPACITY);
}
}
}
public boolean isEnded() {
return stop;
}
public void end() {
stop = true;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
94beb60cbeafddd8a08fa195cd5cb00a78f31869 | 7ad54455ccfdd0c2fa6c060b345488ec8ebb1cf4 | /javax/media/jai/operator/IDCTDescriptor.java | b244f9654af1d3644f903a48c93653f9521318a2 | [] | no_license | chetanreddym/segmentation-correction-tool | afdbdaa4642fcb79a21969346420dd09eea72f8c | 7ca3b116c3ecf0de3a689724e12477a187962876 | refs/heads/master | 2021-05-13T20:09:00.245175 | 2018-01-10T04:42:03 | 2018-01-10T04:42:03 | 116,817,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,552 | java | package javax.media.jai.operator;
import java.awt.RenderingHints;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderableImage;
import javax.media.jai.JAI;
import javax.media.jai.OperationDescriptorImpl;
import javax.media.jai.ParameterBlockJAI;
import javax.media.jai.RenderableOp;
import javax.media.jai.RenderedOp;
public class IDCTDescriptor
extends OperationDescriptorImpl
{
private static final String[][] resources = { { "GlobalName", "IDCT" }, { "LocalName", "IDCT" }, { "Vendor", "com.sun.media.jai" }, { "Description", JaiI18N.getString("IDCTDescriptor0") }, { "DocURL", "http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/IDCTDescriptor.html" }, { "Version", JaiI18N.getString("DescriptorVersion") } };
public IDCTDescriptor()
{
super(resources, 1, null, null, null);
}
public boolean isRenderableSupported()
{
return true;
}
public static RenderedOp create(RenderedImage source0, RenderingHints hints)
{
ParameterBlockJAI pb = new ParameterBlockJAI("IDCT", "rendered");
pb.setSource("source0", source0);
return JAI.create("IDCT", pb, hints);
}
public static RenderableOp createRenderable(RenderableImage source0, RenderingHints hints)
{
ParameterBlockJAI pb = new ParameterBlockJAI("IDCT", "renderable");
pb.setSource("source0", source0);
return JAI.createRenderable("IDCT", pb, hints);
}
}
| [
"chetanb4u2009@outlook.com"
] | chetanb4u2009@outlook.com |
e76c12a409851597e02fc03ccb402dc12e643529 | 195fc5bf5dd5cd06f595a9bce58428aac39ebd74 | /app/src/main/java/com/qianfeng/gameassistant/module3/util/ActiveHttpUtil.java | 8c15f3d6aab26cf6b0e5e3326943781956443c5c | [] | no_license | l376571926/GameAssistant | ccd4b9f6d4104086583f146727da2ca35bf7bacc | a8e3cbacb22f513ef622acbbc17df521dadb1f57 | refs/heads/master | 2021-01-10T08:00:08.438198 | 2016-02-17T01:04:49 | 2016-02-17T01:04:49 | 50,763,572 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,924 | java | package com.qianfeng.gameassistant.module3.util;
import com.qianfeng.gameassistant.other.utils.ZhuShouHttpUtil;
import com.qianfeng.gameassistant.other.utils.ZhuShouTask;
import java.util.HashMap;
import java.util.Map;
/**
* 活动模块网络请求都在这里
* Created by Li Yiwei
*
* @date : 2016/1/13.
*/
public class ActiveHttpUtil
{
/**
* 活动模块ListView活动列表的url
*/
public static final String URL_ACTIVE_LIST = "http://zhushou.72g.com/app/activity/activity_list/";
/**
* 横幅广告
*/
public static final String URL_BANNER_LIST = "http://zhushou.72g.com/app/common/banner_info/";
/**
* 请求活动列表
*
* @param callback 请求回调
*/
public static void requestActiveList(ZhuShouTask.RequestCallback callback)
{
ZhuShouTask.Request request = new ZhuShouTask.Request()
{
@Override
public Object doRequest()
{
Map<String, String> params = new HashMap<String, String>();
params.put("platform", "2");
return ZhuShouHttpUtil.doPost(URL_ACTIVE_LIST, params);
}
};
//创建一个任务
ZhuShouTask task = new ZhuShouTask(request, callback);
//执行任务
task.execute();
}
public static void requestBannerList(ZhuShouTask.RequestCallback callback)
{
ZhuShouTask.Request request = new ZhuShouTask.Request()
{
@Override
public Object doRequest()
{
Map<String,String> params = new HashMap<>();
/**
*
*/
params.put("platform", "2");
return ZhuShouHttpUtil.doPost(URL_BANNER_LIST,params);
}
};
ZhuShouTask task = new ZhuShouTask(request,callback);
task.execute();
}
}
| [
"376571926@qq.com"
] | 376571926@qq.com |
a388c4b9cfbd3c0b6f03fd3532bd1215178c583f | e69575f9a8c712be4c8d75c21f443293b4774dc1 | /src/model/dataaccesslayer/TypeAdhesionDB.java | 90a377c36fd8e7844d666a1d743e73f6b41d62f9 | [] | no_license | codeFliers/La-Maison-des-Ligues-de-Lorraine-M2L- | 339e392e8d719d07e5d782e5ca8d56b528637546 | 9eb32fec48b433afd7fb47bfcfb5520fdc43f65e | refs/heads/main | 2023-08-03T15:37:59.236848 | 2021-09-11T18:39:10 | 2021-09-11T18:39:10 | 405,453,957 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 11,339 | java | package model.dataaccesslayer;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import model.classe.TypeAdhesion;
public class TypeAdhesionDB {
//variables membres
PreparedStatement st = null;
Statement state = null;
ResultSet result = null;
//Vérifie si un type d'ahesion existe Retourn un true si OK
public boolean verifExistTypeAdhesion(TypeAdhesion typeAdhesion) {
//variables membres
boolean resultat = false;
try {
//Chargement du driver JDBC pour MySQL
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
try {
//Création d'un statement
String sql = "SELECT COUNT(*) AS TypeAdhesionExist FROM typeAdhesion WHERE idTypeAdhesion = "+typeAdhesion.getIdTypeAdhesion()+"";
//Établissement de la connexion
state = ConnexionDB.getInstance().createStatement();
//exécution requête
result = state.executeQuery( sql );
//parcours Resultset
while( result.next() ) {
if(result.getInt("TypeAdhesionExist") == 0) {
resultat = false;
}else {
resultat = true;
}
}
} catch(SQLException e) {
e.printStackTrace();
}finally {
try {
if (!result.isClosed()) {
try {
result.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
if (!state.isClosed()) {
try {
state.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return resultat;
}
//Retourrne les infos d'un type adhésion par rapport à son libelle
public TypeAdhesion getTypeAdhesion(String Libelle) {
try {
//Chargement du driver JDBC pour MySQL
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
//variable locale
TypeAdhesion leTypeAdhesion = null;
try {
//Création d'un statement
String sql = "SELECT idTypeAdhesion, Libelle, Tarif from typeadhesion WHERE Libelle = '"+Libelle+"'";
//Établissement de la connexion
state = ConnexionDB.getInstance().createStatement();
//exécution requête
result = state.executeQuery( sql );
//parcours Resultset)
while( result.next() ) {
int idType = result.getInt( "idTypeAdhesion" );
String libelle = result.getString( "Libelle" );
int tarif = result.getInt( "Tarif" );
leTypeAdhesion = new TypeAdhesion(idType, libelle, tarif);
}
} catch(SQLException e) {
e.printStackTrace();
}finally {
try {
if (!result.isClosed()) {
try {
result.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
if (!state.isClosed()) {
try {
state.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return leTypeAdhesion;
}
public ArrayList getTypeAdhesions() {
//Chargement du driver JDBC pour MySQL
try {
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
//variables locales
TypeAdhesion leTypeAdhesion = null;
ArrayList Adhesion = new ArrayList();
try {
//Établissement de la connexion
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
try {
//Création d'un statement
String sql = "SELECT idTypeAdhesion, Libelle, Tarif from typeadhesion";
//Établissement de la connexion
state = ConnexionDB.getInstance().createStatement();
//exécution requête
result = state.executeQuery( sql );
//parcours Resultset
while( result.next() ) {
int idType = result.getInt( "idTypeAdhesion" );
String libelle = result.getString( "Libelle" );
int tarif = result.getInt( "Tarif" );
//création d'un objet avec les informations
leTypeAdhesion = new TypeAdhesion(idType, libelle, tarif);
//Ajoute l'objet dans un tableau d'objet ArrayList
Adhesion.add(leTypeAdhesion);
}
} catch(SQLException e) {
e.printStackTrace();
}finally {
try {
if (!result.isClosed()) {
try {
result.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
if (!state.isClosed()) {
try {
state.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return Adhesion;
}
//Retourne un objet typeAdhesion avec les informations sur un type adhesion par rapport à son id
public TypeAdhesion getTypeAdhesion(int idTypeAdhesion) {
try {
//Chargement du driver JDBC pour MySQL
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
//Variable locale
TypeAdhesion leTypeAdhesion = null;
try {
//Établissement de la connexion
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
try {
//Création d'un statement
String sql = "SELECT idTypeAdhesion, Libelle, Tarif from typeadhesion WHERE idTypeAdhesion = '"+idTypeAdhesion+"'";
//Établissement de la connexion
state = ConnexionDB.getInstance().createStatement();
//exécution requête
result = state.executeQuery( sql );
//parcours Resultset
while( result.next() ) {
int idType = result.getInt( "idTypeAdhesion" );
String libelle = result.getString( "Libelle" );
int tarif = result.getInt( "Tarif" );
leTypeAdhesion = new TypeAdhesion(idType, libelle, tarif);
}
} catch(SQLException e) {
e.printStackTrace();
}finally {
try {
if (!result.isClosed()) {
try {
result.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
if (!state.isClosed()) {
try {
state.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return leTypeAdhesion;
}
//Sauvegarde un NOUVEAU type adhesion
public boolean saveTypeAdhesion(TypeAdhesion adhesion) {
//variable locale
boolean existResult = false;
try {
//Chargement du driver JDBC pour MySQL
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
try {
String sql;
//Si je n'ai pas d'id de fourni
if(adhesion.getIdTypeAdhesion() == -1) {
//je mets NULL et j'aurais par concéquent un id automatique
sql = "INSERT INTO typeadhesion (idTypeAdhesion, Libelle, Tarif) VALUES (NULL, ?, ?)";
//Établissement de la connexion
st = ConnexionDB.getInstance().prepareStatement( sql );
//Modification des infos
st.setString(1, adhesion.getLibelle());
st.setInt(2, adhesion.getTarif());
//exécution requête
st.executeUpdate();
}else {
//si j'ai un id fourni
boolean exist = verifExistTypeAdhesion(adhesion);
if(!exist) {
//j'aurais l'id des paramètres
sql = "INSERT INTO typeadhesion (idTypeAdhesion, Libelle, Tarif) VALUES (?, ?, ?)";
//Établissement de la connexion
st = ConnexionDB.getInstance().prepareStatement( sql );
//Modification des infos
st.setInt(1, adhesion.getIdTypeAdhesion());
st.setString(2, adhesion.getLibelle());
st.setInt(3, adhesion.getTarif());
//exécution requête
st.executeUpdate();
existResult = false;
}else {
existResult = true;
}
}
} catch ( SQLException e ) {
e.printStackTrace();
}finally {
try {
if (!st.isClosed()) {
try {
st.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return existResult;
}
//Retourne true si suppresion type adhesion OK
public boolean supprimerTypeAdhesion(TypeAdhesion adhesion) {
//variables membres
boolean existResult = false;
try {
//Chargement du driver JDBC pour MySQL
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
try {
//Création d'un statement
String sql = "DELETE FROM typeadhesion WHERE idTypeAdhesion= ?";
//Établissement de la connexion
st = ConnexionDB.getInstance().prepareStatement( sql );
st.setInt(1, adhesion.getIdTypeAdhesion());
//exécution requête
st.executeUpdate();
System.out.println("Le type d'adhésion a été supprimé de la base de donnée");
existResult = true;
} catch ( SQLException e ) {
existResult = false;
e.printStackTrace();
}finally {
try {
if (!st.isClosed()) {
try {
st.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return existResult;
}
//Met à jours une categorie (typeadhesion)
public boolean updateCategorie(TypeAdhesion typeAdhesion) {
//variable locale
boolean existResult = false;
try {
//Chargement du driver JDBC pour MySQL
Class.forName( "com.mysql.jdbc.Driver" );
} catch ( ClassNotFoundException e ) {
System.out.println( "Erreur chargement du driver: " +e.getMessage() );
}
try {
//Création d'un statement
String sql = "UPDATE typeAdhesion SET Libelle = ?, Tarif = ? WHERE idTypeAdhesion= ?";
//Établissement de la connexion
st = ConnexionDB.getInstance().prepareStatement( sql );
st.setString(1, typeAdhesion.getLibelle());
st.setInt(2, typeAdhesion.getTarif());
st.setInt(3, typeAdhesion.getIdTypeAdhesion());
//exécution requête
st.executeUpdate();
existResult = true;
} catch(SQLException e) {
existResult = false;
e.printStackTrace();
}finally {
try {
if (!st.isClosed()) {
try {
st.close();
} catch (SQLException e) { /* ignoré */}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return existResult;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ebdc8a1899cbf94ceab15b090a3a2ce0efe1b79a | 8512987d298c045eb93bc247d3e4717d78fe583c | /src/test/java/com/github/hcsp/MainTest.java | 98a39dcd00973d44ff3df98771ddd6909b8e9639 | [] | no_license | westee/psvm-method-invoke-add-string | aeae1cbf97cfb0500d11d44e25d36daf2093f9e3 | b8f7957491203875e48ac89132fa1a7da5e95105 | refs/heads/master | 2020-06-03T23:51:28.119115 | 2019-06-13T15:02:16 | 2019-06-13T15:02:16 | 191,783,000 | 0 | 0 | null | 2019-06-13T14:53:54 | 2019-06-13T14:53:54 | null | UTF-8 | Java | false | false | 649 | java | package com.github.hcsp;
import static org.hamcrest.Matchers.containsStringIgnoringCase;
import com.github.blindpirate.extensions.CaptureSystemOutput;
import org.junit.jupiter.api.Test;
public class MainTest {
@Test
@CaptureSystemOutput
public void importStringUtilsCorrectly(CaptureSystemOutput.OutputCapture capture) {
capture.expect(containsStringIgnoringCase("aaa+bbb=aaabbb"));
capture.expect(containsStringIgnoringCase("cat+dog=catdog"));
Main.main(null);
}
@Test
public void hasAddMethod() throws Exception {
Main.class.getDeclaredMethod("add", String.class, String.class);
}
}
| [
"bo@gradle.com"
] | bo@gradle.com |
65813eb1a3b9f6e8b33c153dcb080ea30234c05e | bb17fe134b8521f4f6bb9451d69975bf7e4ecb70 | /app/src/main/java/com/example/dubaitourismtravel/village.java | 526f8176e63f4c94bb586522375d3b7f36ac42f5 | [] | no_license | sanakarim/my-application | 16c2f6c15aa39bd2e66b444068a432ec300ec4d9 | d6c84b382495ac2b2f9fdc011e5fbfe1d802b515 | refs/heads/master | 2023-03-19T08:12:36.845826 | 2021-03-06T16:06:10 | 2021-03-06T16:06:10 | 344,942,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,979 | java | package com.example.dubaitourismtravel;
import android.app.ActivityOptions;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.util.Pair;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import coding.insight.login2.R;
public class village extends AppCompatActivity {
ImageView second_back_arrow, second_arrow_up;
TextView second_title, second_subtitle, second_rating_number, second_rating_number2, more_details;
RatingBar second_ratingbar;
Animation from_left, from_right, from_bottom;
Button btnburj;
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_village);
second_back_arrow = findViewById(R.id.second_back_arrow);
second_arrow_up = findViewById(R.id.seconf_arrow_up);
second_title = findViewById(R.id.second_title);
second_subtitle = findViewById(R.id.second_subtitle);
second_rating_number = findViewById(R.id.second_rating_number);
second_rating_number2 = findViewById(R.id.second_rating_number2);
more_details = findViewById(R.id.more_details);
second_ratingbar = findViewById(R.id.second_ratingbar);
second_back_arrow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("tagged","goind to third screen");
Intent intent = new Intent(village.this, dashboard2.class);
startActivity(intent);
}
});
//Hide status bar and navigation bar at the bottom
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
);
this.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
//Load Animations
from_left = AnimationUtils.loadAnimation(this, R.anim.anim_from_left);
from_right = AnimationUtils.loadAnimation(this, R.anim.anim_from_right);
from_bottom = AnimationUtils.loadAnimation(this, R.anim.anim_from_bottom);
//Set Animations
second_back_arrow.setAnimation(from_left);
second_title.setAnimation(from_right);
second_subtitle.setAnimation(from_right);
second_ratingbar.setAnimation(from_left);
second_rating_number.setAnimation(from_right);
second_rating_number2.setAnimation(from_right);
second_arrow_up.setAnimation(from_bottom);
more_details.setAnimation(from_bottom);
second_arrow_up.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onClick(View view) {
Intent intent = new Intent(village.this, threeActivity.class);
Pair[] pairs = new Pair[1];
pairs[0] = new Pair<View, String>(second_arrow_up, "background_image_transition");
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(village.this, pairs);
startActivity(intent, options.toBundle());
}
});
}
}
| [
"junaid.hassan41@gmail.com"
] | junaid.hassan41@gmail.com |
bf58c3d8c67aa5bb6972cb547859e9a52cd329c5 | 3912bb3e8971572e951e85f2258986fd58452736 | /app/src/main/java/com/emao/application/ui/view/NoClickRecyclerView.java | 0d806d270d34132546dc4972632008dff266e6f5 | [] | no_license | keybon/Goose | e38188d616ea9eb4372a359bcda4fa1053693882 | 4c7b5e069e739fec303c8feec6e1b02543c19c7c | refs/heads/master | 2021-05-03T09:50:05.249905 | 2018-02-08T09:12:53 | 2018-02-08T09:12:53 | 120,579,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | package com.emao.application.ui.view;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
*
* @author keybon
* @date 2018/1/23
*/
public class NoClickRecyclerView extends RecyclerView {
public NoClickRecyclerView(Context context) {
super(context);
}
public NoClickRecyclerView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public NoClickRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent e) {
switch (e.getAction()) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_UP:
default:
break;
}
return false;
}
}
| [
"wb-gaochao@sdc.icbc.com.cn"
] | wb-gaochao@sdc.icbc.com.cn |
b56ac728b49088536b6e9e2ad28b41942afcbe5c | fc007c1ba3d1f3e13bf83e845050c752f667874f | /ProjectCluster/src/gash/router/server/electionRaft/LogUtil.java | 3c5d465d9860778c0b2333209657e062a46d59d9 | [] | no_license | hoang1127/GrpcJava | 7101ce7d194f4d568313a336842812851c0119c0 | 6bfb707bd294378e9db39ae8d13bfcbc16f60a27 | refs/heads/master | 2021-04-06T19:04:34.060599 | 2018-05-01T18:13:22 | 2018-05-01T18:13:22 | 125,161,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java |
package gash.router.server.electionRaft;
import java.util.Hashtable;
public class LogUtil {
public static Hashtable<String, String> logs = RaftHandler.getInstance().logs;
public static Hashtable<Integer, String> getListNodesToReadFile(String fname) {
//will return as chunkId, location
Hashtable<Integer, String> location = new Hashtable<Integer, String>();
for(String sKey: logs.keySet()) {
if (sKey != null && sKey.contains(fname)) {
String[] parts = sKey.split(";");
int chunkSize = Integer.parseInt(parts[2]);
int chunkId = Integer.parseInt(parts[1]);
if (location.size() < chunkSize && !location.containsKey(chunkId)) {
location.put(chunkId, logs.get(sKey));
}
}
}
if (location.size() == 0) return null;
return location;
}
}
| [
"hoang1127@gmail.com"
] | hoang1127@gmail.com |
6ed0a1138677ae80b2efea7bf851bb6ab806f200 | d02adacca2f9f3700e72d11fa68e50ee01783a02 | /src/test/java/com/flozano/statsd/test/mockserver/NettyUDPServer.java | e85033d52dd7bd61ebfbbbf894a6012a8b2a0467 | [
"Apache-2.0"
] | permissive | tuxmonteiro/statsd-netty | 491939a067790129b691d01010b0abd816dc73cd | dbad90edbbba920735d9c7a8ea07c14327c93a19 | refs/heads/master | 2021-01-18T12:17:12.260584 | 2015-01-29T16:33:25 | 2015-01-29T16:33:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,397 | java | package com.flozano.statsd.test.mockserver;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.oio.OioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.channel.socket.oio.OioDatagramChannel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class NettyUDPServer implements AutoCloseable, UDPServer {
private static final Logger LOGGER = LoggerFactory
.getLogger(NettyUDPServer.class);
private static final Pattern SPLITTER = Pattern.compile("\n",
Pattern.LITERAL);
private final Bootstrap bootstrap;
private final Channel channel;
private final EventLoopGroup eventLoopGroup;
private final Queue<String> queue = new ConcurrentLinkedQueue<>();
private final Collection<String> items = Collections
.synchronizedList(new LinkedList<>());
private final CountDownLatch latch;
private Timer timer;
protected abstract EventLoopGroup getEventLoopGroup();
protected abstract Class<? extends Channel> getChannelClass();
public NettyUDPServer(int port, int numberOfItems, int recvbufValue) {
latch = new CountDownLatch(numberOfItems);
eventLoopGroup = getEventLoopGroup();
bootstrap = new Bootstrap();
bootstrap.group(eventLoopGroup);
// bootstrap.channel(NioDatagramChannel.class);
bootstrap.channel(getChannelClass());
bootstrap.option(ChannelOption.SO_RCVBUF, recvbufValue);
bootstrap.option(ChannelOption.ALLOCATOR, new PooledByteBufAllocator());
bootstrap.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
ch.pipeline().addLast("store", new ServerHandler(queue));
}
});
try {
this.channel = bootstrap.bind(port).sync().channel();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
timer = new Timer();
configureStatusTimer();
configurePollingTimer();
}
private void configurePollingTimer() {
timer.schedule(new TimerTask() {
@Override
public void run() {
String result;
do {
LOGGER.trace("Polling...");
result = queue.poll();
if (result != null) {
SPLITTER.splitAsStream(result).forEach((x) -> {
items.add(x);
latch.countDown();
});
}
} while (result != null);
}
}, 250, 500);
}
private void configureStatusTimer() {
timer.schedule(new TimerTask() {
@Override
public void run() {
LOGGER.info("Pending to receive: {}", latch.getCount());
}
}, 1000, 1000);
}
@Override
public List<String> getItemsSnapshot() {
return new ArrayList<>(items);
}
@Override
public void clear() {
items.clear();
}
@Override
public void close() throws Exception {
timer.cancel();
try {
channel.close().sync();
} catch (InterruptedException e) {
e.printStackTrace();
}
eventLoopGroup.shutdownGracefully();
}
@Override
public boolean waitForAllItemsReceived() {
try {
return latch.await(10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
return false;
}
}
public static class Oio extends NettyUDPServer {
public Oio(int port, int numberOfItems, int recvbufValue) {
super(port, numberOfItems, recvbufValue);
}
@Override
protected EventLoopGroup getEventLoopGroup() {
return new OioEventLoopGroup();
}
@Override
protected Class<? extends Channel> getChannelClass() {
return OioDatagramChannel.class;
}
}
public static class Nio extends NettyUDPServer {
public Nio(int port, int numberOfItems, int recvbufValue) {
super(port, numberOfItems, recvbufValue);
}
@Override
protected EventLoopGroup getEventLoopGroup() {
return new NioEventLoopGroup();
}
@Override
protected Class<? extends Channel> getChannelClass() {
return NioDatagramChannel.class;
}
}
}
| [
"flozano@gmail.com"
] | flozano@gmail.com |
7defae37c42a1fbb63637adeb161324b431dcd77 | e8d0ae5190a2b27403178a295a5e62b6db3a26c6 | /Chapter08/src/part01/sec01/exam01/Ex08_05.java | 5f40169f23996b05cc61c045f5c1283a6f76a333 | [] | no_license | unboxing0913/Java_Study | 2a5d0ec4bc5ac9be00988c22091e1a324b8bab8e | 612a36f5099fc6cd4ccf52e4c4aa16ecccc75ed6 | refs/heads/master | 2023-02-08T07:14:28.267122 | 2020-12-30T13:10:08 | 2020-12-30T13:10:08 | 325,555,237 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 531 | java | package part01.sec01.exam01;
public class Ex08_05 {
public static void main(String[] args) {
int[] aa=new int[100];
int bb[]=new int[100];
int i;
for(i=0;i<100;i++) { //i라는변수는 값을나타내거나 위치를나타내는용도
aa[i]=i*2; // aa[0]=0 , aa[1]=2,~,aa[99]=198
}
for(i=0;i<100;i++) {
bb[i]=aa[99-i]; // 배열안에서 연산식 가능
//1 98
}
System.out.printf("bb[0]는 %d,bb[99]는 %d 입력됨\n",bb[0],bb[99]);
// bb[0]==>198,bb[99]==>0
}
}
| [
"kaa0913@nave.com"
] | kaa0913@nave.com |
fb0ab07ed3fec48a636ce11714f9b597a2f7343e | 0fb7a2ed774983f2ac12c8403b6269808219e9bc | /yikatong-core/src/main/java/com/alipay/api/response/AlipayMarketingCardActivateurlApplyResponse.java | 101b3041bd287487581da47318de6b82154561d3 | [] | no_license | zhangzh56/yikatong-parent | e605b4025c934fb4099d5c321faa3a48703f8ff7 | 47e8f627ba3471eff71f593189e82c6f08ceb1a3 | refs/heads/master | 2020-03-19T11:23:47.000077 | 2018-04-26T02:26:48 | 2018-04-26T02:26:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.marketing.card.activateurl.apply response.
*
* @author auto create
* @since 1.0, 2017-10-30 11:50:27
*/
public class AlipayMarketingCardActivateurlApplyResponse extends AlipayResponse {
private static final long serialVersionUID = 4697726161971311737L;
/**
* 会员卡领卡链接(使用时需URLDecode解码)。商户获取此链接后可投放到服务窗消息、店铺二维码等。
*/
@ApiField("apply_card_url")
private String applyCardUrl;
public void setApplyCardUrl(String applyCardUrl) {
this.applyCardUrl = applyCardUrl;
}
public String getApplyCardUrl( ) {
return this.applyCardUrl;
}
}
| [
"xiangyu.zhang@foxmail.com"
] | xiangyu.zhang@foxmail.com |
c98001a14986675c3c833dffdbc63f3ddfa67196 | 11249930e66ad54b333a42f96f3a3593c72f3640 | /src/main/java/com/enmotech/clanalysis/controller/ProjectController.java | 536f329b21f286b5a53ff898f9304fab4030e193 | [] | no_license | jackyfane/clanalysis | 7f9e0b1c3d87c79468aab3f95159f9015e7d50c9 | 647392a78ae728d377726f184a529a131c8650a4 | refs/heads/master | 2022-11-27T04:07:16.109461 | 2020-02-26T06:12:33 | 2020-02-26T06:12:33 | 59,818,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,911 | java | package com.enmotech.clanalysis.controller;
import com.enmotech.clanalysis.controller.base.AbstractController;
import com.enmotech.clanalysis.dao.IOperations;
import com.enmotech.clanalysis.entity.Project;
import com.enmotech.clanalysis.service.IProjectService;
import com.enmotech.clanalysis.util.DateUtils;
import net.sf.json.JSONArray;
import org.apache.log4j.Logger;
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.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
/**
* Created by Administrator on 2015/5/22.
*/
@Controller
@RequestMapping(value = "/project")
public class ProjectController extends AbstractController<Project> {
private final static Logger LOGGER = Logger.getLogger(ProjectController.class);
@Autowired
private IProjectService projectService;
@Override
protected IOperations<Project> getService() {
return this.projectService;
}
/**
* 预览报表
*
* @param id
* @param startTime
* @param endTime
* @return
*/
@RequestMapping(value = "/viewIndex")
public ModelAndView getGeneralIndex(String id, String startTime, String endTime) {
Project project = projectService.findById(id);
return null;
}
@RequestMapping(value = "/timestamp")
@ResponseBody
public String getTimestamp(String startTime, String endTime, int calendarType, HttpServletResponse response) {
List<String> timestamps = new LinkedList<String>();
Date sTime = DateUtils.parseToDate(startTime, "");
DateUtils utils = new DateUtils(sTime);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(sTime.getTime());
String timestamp = DateUtils.getTimestamp(calendar.getTime(), "");
timestamps.add(timestamp);
String timeStr = "";
Date date = null;
switch (calendarType) {
case Calendar.HOUR: // 获取下个小时的开始时间
date = utils.getNextHourStartTime();
break;
case Calendar.DAY_OF_YEAR:// 获取第二天的开始时间
date = utils.getNextDayStartTime();
break;
case Calendar.WEEK_OF_YEAR:// 获取下周的开始时间
date = utils.getCurrentWeekDayEndTime();
break;
case Calendar.MONTH: // 获取下个月的开始时间
date = utils.getNextMonthStartTime();
break;
case Calendar.YEAR:// 获取第二年的开始时间
date = utils.getNextYearStartTime();
break;
case 4: // 获取下个季度的开始时间
date = utils.getNextQuarterStartTime();
break;
case 5: // 获取下个半年的开始时间
date = utils.getNextHalfYearStartTime();
}
Date eTime = DateUtils.parseToDate(endTime, "");
calendar.setTimeInMillis(date.getTime());
while (calendar.getTimeInMillis() <= eTime.getTime()) {
timestamp = DateUtils.getTimestamp(calendar.getTime(), "");
timestamps.add(timestamp);
switch (calendarType) {
case 4: // 获取下个季度的开始时间
calendar.add(Calendar.MONTH, 3);
break;
case 5: // 获取下个半年的开始时间
calendar.add(Calendar.MONTH, 6);
break;
default:
calendar.add(calendarType, 1);
break;
}
}
String lst = timestamps.get(timestamps.size() - 1);
Date lDate = DateUtils.parseToDate(lst, "yyyyMMddHHmmss");
Date eDate = DateUtils.parseToDate(endTime, "");
if (lDate.getTime() < eDate.getTime()) {
timestamps.add(DateUtils.getTimestamp(eDate, ""));
}
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < timestamps.size() - 1; i++) {
JSONArray ja = new JSONArray();
ja.add(Long.parseLong(timestamps.get(i)));
ja.add(Long.parseLong(timestamps.get(i + 1)));
jsonArray.add(ja);
}
return jsonArray.toString();
}
}
| [
"jackyfane@gmail.com"
] | jackyfane@gmail.com |
f1936c4619bb86afc17f2e6bb3e4a450c2548399 | 602cdf72b6f28feb504f4ea79035bf8c62551a28 | /Zoologico/src/br/com/treinaweb/zoologico/classes/Zoologico.java | 88b8ac5d1c0bb2ac8163d9c9e8eebf2e7187a7ed | [] | no_license | clemendes/Java-POO | b5d5f3935d072fb232ff793609f9bd0f8d123ab5 | 959577b2323c991d435230a3b7df78de131072ab | refs/heads/master | 2022-06-11T13:41:17.942161 | 2020-05-02T23:39:39 | 2020-05-02T23:39:39 | 258,898,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package br.com.treinaweb.zoologico.classes;
import java.util.ArrayList;
import java.util.List;
public class Zoologico {
private String nome;
private List<Animal> animais;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Zoologico() {
animais = new ArrayList<Animal>();
}
public void addAnimal (Animal animalASerAdicionado) {
animais.add(animalASerAdicionado);
}
public void delAnimal (int IndiceDoAnimal) {
animais.remove(IndiceDoAnimal);
}
public void listAnimais ( ) {
System.out.println("Animais do Zoologico: ");
for (int i=0;i<animais.size();i++) {
System.out.println(animais.get(i).getNome() + "-");
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
bd464050f1dbd77b5604e63dd19bbfdaf7ced767 | 762acfab35cef5dba17f67371430b2b82bfa312e | /dmit2015-instructor-oracle-human-resources/src/main/java/dmit2015/hr/repository/RegionRepository.java | b0dce160f49c8220195ac0b21595287c16d1c871 | [] | no_license | DMIT-2015/dmit2015-1202-OA01-demos | 3ebf995d2fe1df7bd4ef4460345b7fc1ef934a1a | 5d059622856f12408cf3175bb1a6f51ac6b81714 | refs/heads/main | 2023-04-02T23:08:25.166230 | 2021-04-05T04:04:29 | 2021-04-05T04:04:29 | 331,977,599 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package dmit2015.hr.repository;
import dmit2015.hr.entity.Region;
import javax.enterprise.context.ApplicationScoped;
import javax.transaction.Transactional;
@ApplicationScoped
@Transactional
public class RegionRepository extends AbstractJpaRepository<Region, Long> {
public RegionRepository() {
super(Region.class);
}
}
| [
"swu@nait.ca"
] | swu@nait.ca |
fd07cf0e620d3af094c16573b8f65685cc697934 | 5f87c7fc37ed9355c0ffb6c1cded2eb249107afd | /DTO/src/objects/interfaces/StockInterDto.java | 2e4be752f467d0fb87d04d27a1d057b0e9692c03 | [] | no_license | MortarDefender/Rse-Web | 81aad074a3172a27161bd699d8f66980a393ee42 | fc5dacd8604f8abcc8354ff6e5a15d8099648028 | refs/heads/master | 2023-04-16T03:36:46.839480 | 2021-04-28T10:15:58 | 2021-04-28T10:15:58 | 361,131,440 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package objects.interfaces;
public interface StockInterDto extends Dto {
int getRate();
String getSymbol();
int getQuantity();
int getTotalDeals();
int getRevolution();
String getCompanyName();
}
| [
"63960808+MortarDefender@users.noreply.github.com"
] | 63960808+MortarDefender@users.noreply.github.com |
9433da4bb06408250471eca5ccaef38f1d3966fd | bb1cb5d3cd79ba65287cbcc5ee7e26d3008b0c8c | /jdk8/src/main/java/t5750/lambda/LambdaComparatorExample.java | c980f37cb423fa71b476f39cd3482cd569bf4f96 | [
"Apache-2.0"
] | permissive | T5750/java-repositories | bff7a5291a1792c9cc34d830dac34c51f1ed65d4 | 01ed32bc0e8263b978c95de8ca02ab49a345a5b5 | refs/heads/master | 2023-07-20T02:16:09.235998 | 2023-07-08T01:15:23 | 2023-07-08T01:15:23 | 90,839,689 | 3 | 1 | Apache-2.0 | 2023-07-08T01:15:24 | 2017-05-10T08:25:19 | Java | UTF-8 | Java | false | false | 1,873 | java | package t5750.lambda;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* This program demonstrates how to use Lambda expressions to improve code of
* comparator used to sort list collections.
*
* @author www.codejava.net
*/
public class LambdaComparatorExample {
public static void main(String[] args) {
Book book1 = new Book("Head First Java", 38.9f);
Book book2 = new Book("Thinking in Java", 30.0f);
Book book3 = new Book("Effective Java", 50.0f);
Book book4 = new Book("Code Complete", 42.5f);
List<Book> listBooks = Arrays.asList(book1, book2, book3, book4);
System.out.println("Before sorting:");
System.out.println(listBooks);
Comparator<Book> titleComparator = new Comparator<Book>() {
public int compare(Book book1, Book book2) {
return book1.getTitle().compareTo(book2.getTitle());
}
};
Collections.sort(listBooks, titleComparator);
System.out.println("\nAfter sorting by title:");
System.out.println(listBooks);
Comparator<Book> descPriceComp = (Book b1, Book b2) -> (int) (b2
.getPrice() - b1.getPrice());
Collections.sort(listBooks, descPriceComp);
System.out.println("\nAfter sorting by descending price:");
System.out.println(listBooks);
Collections.sort(listBooks,
(b1, b2) -> (int) (b1.getPrice() - b2.getPrice()));
System.out.println("\nAfter sorting by ascending price:");
System.out.println(listBooks);
}
}
class Book {
private String title;
private float price;
Book(String title, float price) {
this.title = title;
this.price = price;
}
String getTitle() {
return this.title;
}
void setTitle(String title) {
this.title = title;
}
float getPrice() {
return this.price;
}
void setPrice(float price) {
this.price = price;
}
public String toString() {
return this.title + "-" + this.price;
}
} | [
"evangel_a@sina.com"
] | evangel_a@sina.com |
2b8566b4c79082dcf8f28cb15a84b3644691ecf9 | 76b2a113e92ed318d292fd7604d83141ae8e3fed | /src/main/java/pl/edu/icm/oozierunner/OozieRunnerConstants.java | 86fe037e15f633b895d15547599e9c62db53bc84 | [] | no_license | CeON/oozie-runner | 8faedb2a78d57682bd3f81800585e63109953cb2 | 0bfd139aa1077c22251c4fa4b9e5c4dc3bff3fb7 | refs/heads/master | 2021-01-17T07:34:58.864150 | 2017-01-31T16:44:57 | 2017-01-31T16:44:57 | 10,523,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,650 | java | package pl.edu.icm.oozierunner;
public class OozieRunnerConstants {
public static final String OOZIE_SERVICE_URI = "oozieServiceURI";
public static final String HDFS_URI = "nameNode";
public static final String HDFS_WORKING_DIR_URI = "hdfsWorkingDirURI";
public static final String HDFS_USER_NAME = "hdfsUserName";
public static final String SYSTEM_USER_NAME = "user.name";
public static final String HDFS_DIR_INPUT_DATA = "hdfsDirInputData";
public static final String HDFS_DIR_OUTPUT_DATA = "hdfsDirOutputData";
public static final String LOCAL_DIR_INPUT_DATA = "localDirInputData";
public static final String WORKFLOW_DIR = "wfDir";
public static final String IT_ENV_PLACEHOLDER = "${IT.env}";
public static final String IT_ENV_PROPERTIES_LOCATION = "configIT/env/IT-env-"
+ IT_ENV_PLACEHOLDER + ".properties";
public static final String IT_WF_PROPERTIES_LOCATION = "configIT/wf/IT-wf.properties";
public static final String PLACEHOLDER_PREFIX_NAME = "plcaeholder.prefix";
public static final String PLACEHOLDER_SUFFIX_NAME = "placeholder.suffix";
public static final String PLACEHOLDER_VALUE_SEPARATOR_NAME = "placeholder.valueSeparator";
public static final String PLACEHOLDER_IGNORE_UNRESOLVABLE_PLACEHOLDERS_NAME = "placeholder.ignoreUnresolvablePlaceholders";
public static final String PLACEHOLDER_PREFIX_DEFAULT = "${";
public static final String PLACEHOLDER_SUFFIX_DEFAULT = "}";
public static final String PLACEHOLDER_VALUE_SEPARATOR_DEFAULT = ":";
public static final String PLACEHOLDER_IGNORE_UNRESOLVABLE_PLACEHOLDERS_DEFAULT = "false";
}
| [
"a.czeczko@icm.edu.pl"
] | a.czeczko@icm.edu.pl |
cd22e4ce97dc002dea7c4b0b83e883ffcb4cf923 | 1f606a43134b2655e9db20de1e5b8271634c130d | /src/main/java/by/victor/beta/command/RouterType.java | 9167dfbd637a07a5d1df36eb009c8d41ba781d8a | [] | no_license | VictorShedko/Beta | c974f98f8c2ad6299ce79b2ab5f2772ed6ace0b3 | d89b404e27bb4fe4e55c0b6b9d0b72360fd3b39d | refs/heads/master | 2020-11-30T04:22:28.834618 | 2020-03-04T13:02:43 | 2020-03-04T13:02:43 | 230,300,444 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 81 | java | package by.victor.beta.command;
public enum RouterType {
REDIRECT,FORWARD
}
| [
"vitoreshedko@gmail.com"
] | vitoreshedko@gmail.com |
2eac189312d7ea37066ff6ea43621b371fc7d088 | a4aca06daab2c97b5a05096db69b0d1123ee9111 | /ClangAstParser/src/pt/up/fe/specs/clang/clavaparser/expr/BreakStmtParser.java | 009ef9d9b6a7a949fa892d58855dc1f21694146e | [
"Apache-2.0"
] | permissive | blockspacer/clava | 92bd545bed92294f9e57612005123fd13c47e162 | 5b6c21a794306f915e2161958a988f7dfb18b074 | refs/heads/master | 2020-04-28T15:02:32.830972 | 2019-03-10T00:59:22 | 2019-03-10T00:59:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | /**
* Copyright 2016 SPeCS.
*
* 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. under the License.
*/
package pt.up.fe.specs.clang.clavaparser.expr;
import pt.up.fe.specs.clang.ast.ClangNode;
import pt.up.fe.specs.clang.clavaparser.AClangNodeParser;
import pt.up.fe.specs.clang.clavaparser.ClangConverterTable;
import pt.up.fe.specs.clava.ast.stmt.BreakStmt;
import pt.up.fe.specs.util.stringparser.StringParser;
public class BreakStmtParser extends AClangNodeParser<BreakStmt> {
public BreakStmtParser(ClangConverterTable converter) {
super(converter, false);
}
@Override
protected BreakStmt parse(ClangNode node, StringParser parser) {
checkNoChildren(node);
throw new RuntimeException("deprecated");
// return ClavaNodeFactory.breakStmt(node.getInfo());
}
}
| [
"joaobispo@gmail.com"
] | joaobispo@gmail.com |
b6c13506c1a6725855e1e6c89a9a372e413cefdd | 445c3cf84dd4bbcbbccf787b2d3c9eb8ed805602 | /aliyun-java-sdk-ecsops/src/main/java/com/aliyuncs/ecsops/transform/v20160401/OpsModifyEcsApiMetaSettingsResponseUnmarshaller.java | 7255226cbe0dd6856cf935e0d1c3fbbc12403c15 | [
"Apache-2.0"
] | permissive | caojiele/aliyun-openapi-java-sdk | b6367cc95469ac32249c3d9c119474bf76fe6db2 | ecc1c949681276b3eed2500ec230637b039771b8 | refs/heads/master | 2023-06-02T02:30:02.232397 | 2021-06-18T04:08:36 | 2021-06-18T04:08:36 | 172,076,930 | 0 | 0 | NOASSERTION | 2019-02-22T14:08:29 | 2019-02-22T14:08:29 | null | UTF-8 | Java | false | false | 1,147 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.ecsops.transform.v20160401;
import com.aliyuncs.ecsops.model.v20160401.OpsModifyEcsApiMetaSettingsResponse;
import com.aliyuncs.transform.UnmarshallerContext;
public class OpsModifyEcsApiMetaSettingsResponseUnmarshaller {
public static OpsModifyEcsApiMetaSettingsResponse unmarshall(OpsModifyEcsApiMetaSettingsResponse opsModifyEcsApiMetaSettingsResponse, UnmarshallerContext _ctx) {
opsModifyEcsApiMetaSettingsResponse.setRequestId(_ctx.stringValue("OpsModifyEcsApiMetaSettingsResponse.RequestId"));
return opsModifyEcsApiMetaSettingsResponse;
}
} | [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
37b050e7e315f9b84c21affc42d39eec657c1b3b | 44d6ab79fa51c816883a186e7a964af1450afa64 | /module/src/main/java/com/atguigu/gmall/model/user/UserInfo.java | 3c1e8322f4319d5bcac3d7ac7d18bd5c43acbda4 | [] | no_license | kilighhh/gmall-parent-0621 | 9d03d9646c45763a6cddf710c1a97e729425e8c1 | 739a3d656a8de4e625d6c6166c0ce7068d52062e | refs/heads/main | 2023-02-13T09:35:44.727852 | 2021-01-19T13:13:06 | 2021-01-19T13:13:06 | 316,397,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,335 | java | package com.atguigu.gmall.model.user;
import com.atguigu.gmall.model.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "userInfo")
@TableName("user_info")
public class UserInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户名称")
@TableField("login_name")
private String loginName;
@ApiModelProperty(value = "用户昵称")
@TableField("nick_name")
private String nickName;
@ApiModelProperty(value = "用户密码")
@TableField("passwd")
private String passwd;
@ApiModelProperty(value = "用户姓名")
@TableField("name")
private String name;
@ApiModelProperty(value = "手机号")
@TableField("phone_num")
private String phoneNum;
@ApiModelProperty(value = "邮箱")
@TableField("email")
private String email;
@ApiModelProperty(value = "头像")
@TableField("head_img")
private String headImg;
@ApiModelProperty(value = "用户级别")
@TableField("user_level")
private String userLevel;
@TableField(exist = false)
private String token;
}
| [
"1142732681@qq.com"
] | 1142732681@qq.com |
c3f7052da740b52b79c6d509d5393a9dfb9b0d0c | 810d3c9d2ef6a5b2d03c7f6af21f6f835674a9a0 | /docservicedeamon/src/main/java/com/zhiyou100/demo/MyBerkeleyDB.java | 61dc1a406221b93249586909ad9d3afc4432b3e6 | [] | no_license | sunthef/yunfsfds | 2603163f3d47b1a1cffc2049e0bf7ff76a6a8482 | 840f127de350f73f73045b852984226ba2b01084 | refs/heads/master | 2020-04-06T09:37:52.253468 | 2018-11-12T08:04:22 | 2018-11-12T08:04:22 | 157,350,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,662 | java | package com.zhiyou100.demo;
/*
*@ClassName:BdbDemo
@Description:TODO
@Author:
@Date:2018/10/30 15:20
@Version:v1.0
*/
import java.io.File;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
public class MyBerkeleyDB {
private Environment env;
private Database db;
public MyBerkeleyDB() {
}
public void setUp(String path, long cacheSize) {
//进行数据库配置
EnvironmentConfig envConfig = new EnvironmentConfig();
//如果数据库不存在则允许创建
envConfig.setAllowCreate(true);
//设置缓冲区大小
envConfig.setCacheSize(cacheSize);
try {
//创建一个数据库环境
env = new Environment(new File(path), envConfig);
} catch (DatabaseException e) {
e.printStackTrace();
}
}
public void open(String dbName) {
//创建一个数据库配置对象
DatabaseConfig dbConfig = new DatabaseConfig();
//如果数据库不存在则创建
dbConfig.setAllowCreate(true);
try {
//通过env打开数据库
db = env.openDatabase(null, dbName, dbConfig);
} catch (DatabaseException e) {
e.printStackTrace();
}
}
public void close() {
try {
if (db != null) {
db.close();
}
if (env != null) {
env.close();
}
} catch (DatabaseException e) {
e.printStackTrace();
}
}
public String get(String key) throws Exception {
DatabaseEntry queryKey = new DatabaseEntry();
DatabaseEntry value = new DatabaseEntry();
queryKey.setData(key.getBytes("UTF-8"));
OperationStatus status = db.get(null, queryKey, value, LockMode.DEFAULT);
if (status == OperationStatus.SUCCESS) {
return new String(value.getData());
}
return null;
}
public boolean put(String key, String value) throws Exception {
byte[] theKey = key.getBytes("UTF-8");
byte[] theValue = value.getBytes("UTF-8");
OperationStatus status = db.put(null, new DatabaseEntry(theKey), new DatabaseEntry(theValue));
if (status == OperationStatus.SUCCESS) {
return true;
}
return false;
}
public static void main(String[] args) {
MyBerkeleyDB mbdb = new MyBerkeleyDB();
// 需要先建E://Test//bdb文件夹
mbdb.setUp("d://bdb", 1000000);
//打开或创建一个数据库
mbdb.open("myDB");
/*System.out.println("开始向Berkeley DB中存入数据...");
for (int i = 0; i < 20; i++) {
try {
String key = "myKey" + i;
String value = "myValue" + i;
System.out.println("[" + key + ":" + value + "]");
//向数据库插入kv键值对
mbdb.put(key, value);
} catch (Exception e) {
e.printStackTrace();
}
}*/
for (int i = 0; i < 20; i++) {
try {
String key = "myKey" + i;
String value = mbdb.get(key);
System.out.println(key+","+value);
} catch (Exception e) {
e.printStackTrace();
}
}
mbdb.close();
}
}
| [
"you@example.com"
] | you@example.com |
e4be2490d38b71fdb8f24a168ebf12a7a57674d0 | 5b35c01b21ed2c5ce9e9a5b08413453a8be918bb | /febs-server/febs-server-ding/src/main/java/cc/mrbird/febs/server/ding/controller/vo/SaleDateValueVo.java | e84867b0d2e589c758c426fe088ba6b056726e3a | [
"Apache-2.0"
] | permissive | lingxiaobin/febs-cloud | a0052312fdc29681bc73896a6bf1483f2e23feeb | a3641053ff8e10f2d5c167252fd6055c89000003 | refs/heads/master | 2023-03-21T03:09:12.580450 | 2021-02-25T03:33:37 | 2021-02-25T03:33:37 | 296,029,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package cc.mrbird.febs.server.ding.controller.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.math.BigDecimal;
@Data
@AllArgsConstructor //生成全参数构造函数
public class SaleDateValueVo {
private String Date;
private String type;
private BigDecimal value;
}
| [
"1796270450@qq.com"
] | 1796270450@qq.com |
cab3c79e710d219a87601d87260a86914771a0ae | 3f76dfc86e4ae6a680aef2a3f230628805d596ab | /Chapter03/jpa-example-4/src/java/com/example/servlets/AddMovieServlet.java | cbaf75d5843d069641d34c72fde43b5782bd707c | [
"MIT"
] | permissive | YunZhang2014/Developing-Middleware-in-Java-EE-8 | af072028bd5007a419b3851a0ccf671626ea9c58 | 87ece4ebe16c583676f13e5d74eddc48528ea11d | refs/heads/master | 2022-12-22T17:12:30.619361 | 2020-09-25T01:16:58 | 2020-09-25T01:16:58 | 298,433,526 | 0 | 0 | MIT | 2020-09-25T01:12:51 | 2020-09-25T01:12:50 | null | UTF-8 | Java | false | false | 1,369 | 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 com.example.servlets;
import com.example.beans.MovieBean;
import com.example.entities.Movie;
import com.example.entities.MovieInfo;
import java.io.IOException;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author abdalla
*/
@WebServlet(urlPatterns = "/add-movie")
public class AddMovieServlet extends HttpServlet {
@Inject
private MovieBean movieBean;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String movieTitle = request.getParameter("movie_title");
Movie movie = new Movie();
movie.setTitle("Beauty and the Beast");
MovieInfo movieInfo = new MovieInfo();
movieInfo.setStoryLine("A young prince, imprisoned in the form of a beast, can be freed only by true love.");
movieInfo.setRuntime(129);
movieInfo.setLanguage("English");
movieInfo.setCountry("USA");
movie.setMovieInfo(movieInfo);
movieBean.insert(movie);
}
}
| [
"32731556+mehulsingh7@users.noreply.github.com"
] | 32731556+mehulsingh7@users.noreply.github.com |
b56936b3166a2ebdd933798699d6f6739d77f8d7 | 6eafeff2450fd411ed409660fd986e710a627da7 | /design-pattern-abstract-factory/src/main/java/morris/designpattern/abstractfactory/c/human/FemaleWhiteHuman.java | 1321a6c0ced2711ce8deadf9a9f21271168a578d | [] | no_license | mitchellcoffee/design-pattern | 2751cfdc4eea145dc6eeb2fd6537577f038315c8 | fe25c15f6d13f57358992fc2316f65a64eaa178c | refs/heads/master | 2021-05-26T05:44:46.899856 | 2020-05-17T16:16:50 | 2020-05-17T16:16:50 | 127,698,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 254 | java | package morris.designpattern.abstractfactory.c.human;
import morris.designpattern.abstractfactory.c.human.AbstractWhiteHuman;
public class FemaleWhiteHuman extends AbstractWhiteHuman {
public void getSex() {
System.out.println("白人女性");
}
}
| [
"liyifeng@gomefinance.com.cn"
] | liyifeng@gomefinance.com.cn |
918ee783e9dbd2c37d4e5b00974c8fa544fcf018 | 93386b3555afd6811b7aa3439a3b60ebe865088d | /src/net/ProtocolTest.java | 25b510f024bf2cbea8420771f3e85d0b3672c3c2 | [] | no_license | erikhuizinga/Thunderbirds-are-GO | 8ea524d113295a4e14414fd7273300803da7bc9a | 51eebe6e82181cbb6ee3cf6b967aa331e6fac8ed | refs/heads/master | 2021-01-11T20:22:59.891434 | 2017-02-03T02:00:33 | 2017-02-03T02:00:33 | 79,107,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | package net;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import net.Protocol.ClientCommand;
import net.Protocol.MalformedCommandException;
import net.Protocol.ServerCommand;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/** Created by erik.huizinga on 2-2-17. */
class ProtocolTest {
@BeforeEach
void setUp() {}
@Test
void testValidateAndFormatCommand() {
try {
assertEquals("PLAYER NAME", Protocol.validateAndFormatCommand(ClientCommand.PLAYER, "name"));
assertEquals(
"READY BLACK BARRYBADPAK 9",
Protocol.validateAndFormatCommand(ServerCommand.READY, "black", "BarryBadpak", "9"));
} catch (MalformedCommandException e) {
e.printStackTrace();
fail("an Exception was thrown where it shouldn't");
}
assertThrows(
MalformedCommandException.class,
() ->
Protocol.validateAndFormatCommand(
ClientCommand.PLAYER,
"this name contains illegal characters (spaces) and is too long"));
assertThrows(
MalformedCommandException.class,
() -> Protocol.validateAndFormatCommand(ServerCommand.READY, "gray", "somename", "19"));
}
}
| [
"erik.huizinga@nedap.com"
] | erik.huizinga@nedap.com |
72930ff8d85abb1498e52211f0b498b104da2254 | a81ce73b3bffc285218a1d95eb6139908a565ff1 | /gulimall-product/src/main/java/com/xubo/gulimall/product/service/SpuImagesService.java | 7506685d38236c9c9c9a71f073996d18111a3d32 | [] | no_license | SnailsRocket/gulimall | 23fe5d5d2f8131d8e6a31faf4960860a653a2be1 | 9abbd716d94866b762db277761735f0ffea4eb34 | refs/heads/main | 2023-02-05T09:00:37.071073 | 2020-12-24T13:43:37 | 2020-12-24T13:43:37 | 306,878,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.xubo.gulimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xubo.common.utils.PageUtils;
import com.xubo.gulimall.product.entity.SpuImagesEntity;
import java.util.Map;
/**
* spu图片
*
* @author xubo
* @email 1837039333@qq.com
* @date 2020-10-25 11:03:06
*/
public interface SpuImagesService extends IService<SpuImagesEntity> {
PageUtils queryPage(Map<String, Object> params);
}
| [
"1837039333@qq.com"
] | 1837039333@qq.com |
387dddd4a6a6ebe3dbcf6629ef3909010808745e | 2cf71234f21febf47feaebda00941bb13ff919ba | /src/test/java/pom/bbcsite/BbcPages/BbcHomePage.java | 2f30b2dfceb2766abdfa1b00b43d1dd5dd872d18 | [] | no_license | Sanchez1995/SeleniumBDDExamples | f79faf9db1cd363c0d8748614a6c2abf644ef71f | 1583d96ddff5263336975d22b54d504efd6904f4 | refs/heads/master | 2021-07-07T02:33:16.394007 | 2019-06-20T22:28:11 | 2019-06-20T22:28:11 | 192,986,796 | 0 | 0 | null | 2020-10-13T14:03:05 | 2019-06-20T20:59:55 | Java | UTF-8 | Java | false | false | 659 | java | package pom.bbcsite.BbcPages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class BbcHomePage {
private static WebDriver driver;
//Page Identifiers
private String HomePageURL = "https://www.bbc.co.uk/";
private By signInLinkID = By.id("idcta-username");
//*[@id="orb-modules"]/div[2]/section[2]/div/div/p[2]/a[1]
//pages
public BbcHomePage(WebDriver driver){
this.driver = driver;
}
//Page Actions
public void goToHomePage(){
driver.navigate().to(HomePageURL);
}
public void clickSignInLink(){
driver.findElement(signInLinkID).click();
}
}
| [
"sanchez_e@hotmail.co.uk"
] | sanchez_e@hotmail.co.uk |
a6c9c845823a9ea055bf3f3291035000887c8230 | fd066712bcbc2e9d3c51e7ca88e2f3db8d8db7db | /codding/src/main/java/net/neoremind/mycode/guava/collections/SetTest.java | ff2b7e28950a9b86f7d5996608d6a59e59eefeb5 | [] | no_license | DongZcC/coddding | ee88acb9d005b2743bf28fb90b134c3419036d27 | bb91b4582adbd5091e82d46002175a924559fd36 | refs/heads/master | 2022-10-17T12:00:03.510024 | 2022-10-11T01:15:38 | 2022-10-11T01:15:38 | 161,160,347 | 0 | 1 | null | 2018-12-10T10:53:35 | 2018-12-10T10:53:34 | null | UTF-8 | Java | false | false | 796 | java | package net.neoremind.mycode.guava.collections;
import java.util.HashSet;
import com.google.common.collect.Sets;
import com.google.common.collect.Sets.SetView;
public class SetTest {
public static void main(String[] args) {
HashSet<Integer> setA = Sets.newHashSet(1, 2, 3, 4, 5);
HashSet<Integer> setB = Sets.newHashSet(4, 5, 6, 7, 8);
SetView<Integer> union = Sets.union(setA, setB);
System.out.println("union:" + union) ;
SetView<Integer> differenceA = Sets.difference(setA, setB);
System.out.println("difference:" + differenceA);
SetView<Integer> differenceB = Sets.difference(setB, setA);
System.out.println("difference:" + differenceB);
SetView<Integer> intersection = Sets.intersection(setA, setB);
System.out.println("intersection:" + intersection);
}
}
| [
"notyetfish@hotmail.com"
] | notyetfish@hotmail.com |
679aacc572d84598738fee6a8f97f9bae9005228 | 2d3ccc6de78c260da71e24816d753d31a0c3f9d7 | /370Project-v2.1/src/Search/ttt.java | 6a3bd8b1288376b24a5b5c23c8c8ae97539987e9 | [] | no_license | ridwanraji/Food-Ordering-System | c1433b4f33fe6876e2641ded6068c7a7763c2bb2 | e4f9f9756541935fe7d938f97c99358bae86c69d | refs/heads/master | 2021-05-10T16:08:22.521432 | 2017-12-08T13:52:13 | 2017-12-08T13:52:13 | 118,569,607 | 1 | 0 | null | 2018-01-23T06:45:09 | 2018-01-23T06:45:09 | null | UTF-8 | Java | false | false | 972 | java | package Search;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.RadioButton;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class ttt {
private StackPane centre() {
StackPane centre = new StackPane();
RadioButton rb1 = new RadioButton();
rb1.setText("Home");
centre.getChildren().add(rb1);
centre.setAlignment(Pos.CENTER);
return centre;
}
public static void main(String[] args){
ArrayList arr = new ArrayList();
arr.add(1);
arr.add(4);
arr.add(6);
arr.add(333);
arr.add(8);
arr.add(2);
Collections.sort(arr);
for(int i=0;i<arr.size();i++){
System.out.println(arr.get(i));
}
}
}
| [
"yur013@mail.usask.ca"
] | yur013@mail.usask.ca |
f0aecfd766d855bfbf78289ee9c7e146db6ca056 | 2f78a2da4537c555db92bd4aaef70d5c35e2f675 | /rpgV3-tugasInherit/src/BuffItem.java | 98f914d185d0d7ce4a23ff6adc7a5bca53c7a845 | [] | no_license | enriconqb/inheritancePBO | eecff505766e993311a54b9e03e670d7717b66d2 | 1511bef80790b89f9bd3455da7326da34bb314ab | refs/heads/main | 2023-03-29T09:15:55.858056 | 2021-04-04T05:22:03 | 2021-04-04T05:22:03 | 354,462,301 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | public class BuffItem extends Item{
//Var Grup
private double addHP;
private double addMana;
//Setter n Getter
public double getAddHP() {
return this.addHP;
}
public void setAddHP(double addHP) {
this.addHP = addHP;
}
public double getAddMana() {
return this.addMana;
}
public void setAddMana(double addMana) {
this.addMana = addMana;
}
//Constructor
public BuffItem(String nama, double hp, double mana){
super(nama);
this.addHP = hp;
this.addMana = mana;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
38965141b734909a3442f99a4ba0b17c44120f87 | aefd216bdb4a15bdb031f9c78e0c99a908ac6669 | /src/main/java/com/hospital/service/On_Call/ServiceImpl.java | 2da6c800b9a5beb4fc212353c5ab93d4a749bd3a | [] | no_license | JieeiroSst/hospital | 19e9aa651896a89a98ef234ceac2a74521fff0bd | 8df72fa9960d731a8d35146ca7889675714188e9 | refs/heads/master | 2022-12-12T02:42:55.025198 | 2020-09-04T02:11:22 | 2020-09-04T02:11:22 | 292,501,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 818 | java | package com.hospital.service.On_Call;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import com.hospital.repo.On_CallRepository;
import com.hospital.model.On_Call;
@Service
@Transactional
public class ServiceImpl implements On_CallService{
@Autowired
private On_CallRepository repo;
@Override
public List<On_Call> getList(){
return (List<On_Call>) repo.findAll();
}
@Override
public On_Call getOn_Call(int id){
return repo.findById(id).get();
}
@Override
public void save(On_Call on_call){
repo.save(on_call);
}
@Override
public void delete(int id){
repo.deleteById(id);
}
}
| [
"luumanhquan.91@gmail.com"
] | luumanhquan.91@gmail.com |
704e8c9ff0ac02a9b86522f36f71814719037bc7 | c91f427d8b93fce5e510eff7f2f65ec9d2f38236 | /Course/06.27/二分法/BinarySearch12.java | 8a18d050c21235c3edc4309760750993c9346c05 | [] | no_license | WangLiantao/Frist | 43a3d46ad8e9d941722db2e473c8942a41777f06 | 219b3ac2a3bfa4433edf63bbe53636edcf005080 | refs/heads/master | 2020-03-22T03:04:22.248629 | 2018-07-03T02:29:59 | 2018-07-03T02:29:59 | 139,411,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | public class BinarySearch12 {
public static void main(String[] args) {
int[] arr = {1,2,3,4,5,6,7,8,9,11,23,45,67,89};
System.out.println(binarySearch(arr,67));
}
static int binarySearch(int[] arr,int key) {
int start = 0;
int end = arr.length - 1;
int kIndex = (start + end) / 2;
while (start <= end) {
if (arr[kIndex] > key) {
end = kIndex - 1;
} else if (arr[kIndex] < key) {
start = kIndex + 1;
} else {
return kIndex;
}
kIndex = (start + end ) / 2;
}
return - 1;
}
} | [
"qingyun@wangliantao.local"
] | qingyun@wangliantao.local |
93e15dc4e1f2a81b836424a6c15271af592fbf49 | 3823ef1438caa59ca3515f1b11a15defcf167122 | /src/test/java/com/github/rkmk/dao/SqlObjectDao.java | 784d7b8dbc7beda7a2f5e8098fb764cfd3139fbd | [] | no_license | Manikandan-K/jdbi-folder | 6674cb0fdf5ecbffbdc545f296bb6315300e7596 | 1b1675997455b5f45bbb0216a316c17a719f3530 | refs/heads/master | 2020-12-25T18:17:48.916053 | 2017-06-16T12:16:38 | 2017-06-16T12:16:38 | 24,464,673 | 40 | 16 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package com.github.rkmk.dao;
import com.github.rkmk.MovieExceptionMapper;
import com.github.rkmk.container.FoldingList;
import com.github.rkmk.util.QueryLocator;
import com.github.rkmk.model.*;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.customizers.Mapper;
import org.skife.jdbi.v2.sqlobject.customizers.OverrideStatementLocatorWith;
import java.util.List;
@OverrideStatementLocatorWith(QueryLocator.class)
public interface SqlObjectDao {
@SqlQuery
@Mapper(MovieExceptionMapper.class)
public List<Movie> getMovies();
@SqlQuery
List<Song> getSongs();
@SqlQuery
List<Team> getTeam();
@SqlQuery
public FoldingList<Movie> getMovie(@Bind("movieId") Integer movieId);
@SqlQuery
public FoldingList<Movie> getAllMovies();
@SqlQuery
public FoldingList<Musician> getMusician();
}
| [
"rkmanikarthick@gmail.com"
] | rkmanikarthick@gmail.com |
13f32e7aac9557b650ed59f33f45a451a1fb3f2d | 0d4edfbd462ed72da9d1e2ac4bfef63d40db2990 | /base/src/main/java/com/dvc/base/di/PerActivity.java | dabc41399893829f4b8ca597562b8f3251c57c5e | [] | no_license | dvc890/MyBilibili | 1fc7e0a0d5917fb12a7efed8aebfd9030db7ff9f | 0483e90e6fbf42905b8aff4cbccbaeb95c733712 | refs/heads/master | 2020-05-24T22:49:02.383357 | 2019-11-23T01:14:14 | 2019-11-23T01:14:14 | 187,502,297 | 31 | 3 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package com.dvc.base.di;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;
@Scope
@Retention(RetentionPolicy.RUNTIME)
public @interface PerActivity {
}
| [
"dvc890@139.com"
] | dvc890@139.com |
c1a9554f7fe100aef868b87eeb4989ced5c05627 | 4da53cca31f25b174043ac83922df65bc99b47d9 | /app/src/main/java/register/presenter/RegPresenter.java | eaa49413b254ec16ba5944ef3a155e6dd701ddea | [] | no_license | zz19970108/taobao_lianxi | 3606fa3d6238526a34a29ad79e426f2dfe87273c | 71d48c47293c4e5b66544879d73338c14af70307 | refs/heads/master | 2021-08-30T15:30:56.859697 | 2017-12-18T13:04:40 | 2017-12-18T13:04:40 | 114,641,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | package register.presenter;
import android.util.Log;
import register.bean.Bean;
import register.bean.RegBean;
import register.model.RegModel;
import register.view.RegView;
/**
* Created by dell on 2017/12/12.
*/
public class RegPresenter {
RegView regView;
RegModel RegModel;
public RegPresenter(RegView regView) {
this.regView = regView;
RegModel = new RegModel();
}
public void setRegView(Bean bean){
RegModel.Reg(bean);
RegModel.setOnFinishlisenter(new RegModel.OnFinishlisenter() {
@Override
public void OnFinish(RegBean regBean) {
String code = regBean.getCode();
Log.e("TAG",regBean.getMsg());
Log.d("main---",code);
if ("0".equals(code)) {
regView.RegSuccess();
} else {
regView.RegFailed();
}
}
});
}
} | [
"1039785606@qq.com"
] | 1039785606@qq.com |
8600aeb0d28b23c2df57ce2eff6eb38d1dcc0c00 | 14dfecebc3c2322c2d20c64a93e9686510be41be | /report/src/main/java/com/zdjc/report/model/AuthorityReport.java | 8ce56dfd9415946d7d7d43378fe279a5fab81108 | [] | no_license | MrHuTu/ReportRepository-1 | 6791524be41767d410027de084d699047ddcb46f | 20852d3cbb1faaa64b56ccab93131b725c02c9c1 | refs/heads/master | 2020-03-24T02:19:07.452884 | 2018-07-26T01:13:05 | 2018-07-26T01:13:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,368 | java | package com.zdjc.report.model;
/**
* 用来映射report_authority表数据
* report_authority用来记录报表管理用户上传的文件信息
* @author huchao
*
*/
public class AuthorityReport {
//组建,该报告的唯一表示
Integer id;
//项目Id
String projectId;
//报告类型
String reportTyp;
//文件储存路径
String reportPath;
//文件名
String reportName;
//报告提交者
String commit_user;
//报告提交时间
String commit_time;
//报告从属的时间段
String timeof_Report;
//报告负责人
String personIn_charge;
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getReportTyp() {
return reportTyp;
}
public void setReportTyp(String reportTyp) {
this.reportTyp = reportTyp;
}
public String getReportPath() {
return reportPath;
}
public void setReportPath(String reportPath) {
this.reportPath = reportPath;
}
public String getReportName() {
return reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
public String getCommit_user() {
return commit_user;
}
public void setCommit_user(String commit_user) {
this.commit_user = commit_user;
}
public String getCommit_time() {
return commit_time;
}
public void setCommit_time(String commit_time) {
this.commit_time = commit_time;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTimeof_Report() {
return timeof_Report;
}
public void setTimeof_Report(String timeof_Report) {
this.timeof_Report = timeof_Report;
}
public String getPersonIn_charge() {
return personIn_charge;
}
public void setPersonIn_charge(String personIn_charge) {
this.personIn_charge = personIn_charge;
}
@Override
public String toString() {
return "AuthorityReport [id=" + id + ", projectId=" + projectId
+ ", reportTyp=" + reportTyp + ", reportPath=" + reportPath
+ ", reportName=" + reportName + ", commit_user=" + commit_user
+ ", commit_time=" + commit_time + ", timeof_Report="
+ timeof_Report + ", personIn_charge=" + personIn_charge + "]";
}
}
| [
"1465703041@qq.com"
] | 1465703041@qq.com |
31f5557e003d0c7f58886a6f5f532f4cf585441d | 4cf5f45b753cce5cad7abea2075f3bcc63d2777d | /src/model/User.java | 24a147bc81f36287f9028d27ae5dd8cc3016d115 | [] | no_license | cyzone49/PSZoneReservation | 901b02b4b5dccafdb7172eafacd757d0af09d432 | a93fa954584d2e043247e04accd6c3544a0db70e | refs/heads/master | 2020-05-26T04:58:53.928772 | 2019-05-25T01:51:04 | 2019-05-25T01:51:04 | 188,114,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,642 | java | package model;
import utils.UniqueChecker;
import utils.UniqueGenerator;
import java.io.Serializable;
import java.util.Observable;
public class User extends Observable implements Serializable {
private int userID;
private String username;
private String password;
private String authtoken;
private String email;
private String phone;
private int marked;
/**
* Official constructor used for Register operation
* @param username
* @param password
*/
public User(String username, String password, String email, String phone) {
this.username = username;
this.password = password;
this.authtoken = generateAuthToken();
this.email = email;
this.phone = phone;
this.marked = 0;
}
/**
* Default constructor
*/
public User() {}
// Copy constructor, removes observers
public User(User u) {
this.username = u.username;
this.password = u.password;
this.authtoken = u.authtoken;
this.deleteObservers();
}
public int getUserID() {
return userID;
}
public void setUserID(int userID) {
this.userID = userID;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getAuthtoken() {
return authtoken;
}
public void setAuthtoken(String authtoken) {
this.authtoken = authtoken;
setChanged();
notifyObservers();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getMarked() {
return marked;
}
public void setMarked(int marked) {
this.marked = marked;
}
/**
* Generate a new authToken that has not been assigned to a User in database
* @return a new unique authToken
*/
public String generateAuthToken(){
return UniqueGenerator.generate(this.username);
}
@Override
public String toString() {
return "User{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
", authtoken='" + authtoken + '\'' +
'}' +
'\n';
}
}
| [
"datvu4749@gmail.com"
] | datvu4749@gmail.com |
58c92185c89cad5c7289ba53dc1c2e7de1bfb808 | 8b4861d4abba282e412d159801a4f5f00e79418e | /Bakend/src/test/java/es/florida/domain/VehiculoTest.java | 36ecffda102f589d32fd342d7b19c0e58d28a5df | [] | no_license | MariaSolaz/ProyectoFinCiclo | ab478353af52111d2d6f1cb7395446836b292ce7 | 9440b8aa85905c4b87fef6530902a3881d687282 | refs/heads/main | 2023-05-13T20:05:45.456640 | 2021-05-28T12:02:08 | 2021-05-28T12:02:08 | 358,569,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package es.florida.domain;
import static org.assertj.core.api.Assertions.assertThat;
import es.florida.web.rest.TestUtil;
import org.junit.jupiter.api.Test;
class VehiculoTest {
@Test
void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Vehiculo.class);
Vehiculo vehiculo1 = new Vehiculo();
vehiculo1.setId(1L);
Vehiculo vehiculo2 = new Vehiculo();
vehiculo2.setId(vehiculo1.getId());
assertThat(vehiculo1).isEqualTo(vehiculo2);
vehiculo2.setId(2L);
assertThat(vehiculo1).isNotEqualTo(vehiculo2);
vehiculo1.setId(null);
assertThat(vehiculo1).isNotEqualTo(vehiculo2);
}
}
| [
"masoch01@floridauniversitaria.es"
] | masoch01@floridauniversitaria.es |
12d2d63f78269f2cb5bca477e03542ef7b104cf2 | 6bda22e9542a5f7093b6a736d1fa626af32adb97 | /src/com/floreantpos/ui/views/order/OrderController.java | 19e4d7d74dbb408faabe6e5c57b60c7d77e57c82 | [
"Apache-2.0"
] | permissive | jalalzia1/infinity | 2112a733739ccfabd60050f0867f31723e9ec5f9 | 264d16cef247f820967ef753e61feb13065b644c | refs/heads/master | 2021-04-29T12:58:54.511812 | 2018-02-18T15:31:47 | 2018-02-18T15:31:47 | 121,738,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,489 | java | /**
* ************************************************************************
* * The contents of this file are subject to the MRPL 1.2
* * (the "License"), being the Mozilla Public License
* * Version 1.1 with a permitted attribution clause; you may not use this
* * file except in compliance with the License. You may obtain a copy of
* * the License at http://www.floreantpos.org/license.html
* * Software distributed under the License is distributed on an "AS IS"
* * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* * License for the specific language governing rights and limitations
* * under the License.
* * The Original Code is Infinity POS.
* * The Initial Developer of the Original Code is OROCUBE LLC
* * All portions are Copyright (C) 2015 OROCUBE LLC
* * All Rights Reserved.
* ************************************************************************
*/
package com.floreantpos.ui.views.order;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.floreantpos.POSConstants;
import com.floreantpos.PosLog;
import com.floreantpos.actions.SettleTicketAction;
import com.floreantpos.config.TerminalConfig;
import com.floreantpos.main.Application;
import com.floreantpos.model.ActionHistory;
import com.floreantpos.model.ITicketItem;
import com.floreantpos.model.MenuCategory;
import com.floreantpos.model.MenuGroup;
import com.floreantpos.model.MenuItem;
import com.floreantpos.model.Ticket;
import com.floreantpos.model.TicketItem;
import com.floreantpos.model.TicketItemModifier;
import com.floreantpos.model.User;
import com.floreantpos.model.dao.ActionHistoryDAO;
import com.floreantpos.model.dao.MenuItemDAO;
import com.floreantpos.model.dao.ShopTableDAO;
import com.floreantpos.model.dao.TicketDAO;
import com.floreantpos.model.dao.UserDAO;
import com.floreantpos.ui.dialog.AutomatedWeightInputDialog;
import com.floreantpos.ui.dialog.BasicWeightInputDialog;
import com.floreantpos.ui.dialog.POSMessageDialog;
import com.floreantpos.ui.views.order.actions.CategorySelectionListener;
import com.floreantpos.ui.views.order.actions.GroupSelectionListener;
import com.floreantpos.ui.views.order.actions.ItemSelectionListener;
import com.floreantpos.ui.views.order.actions.OrderListener;
import com.floreantpos.ui.views.order.modifier.ModifierSelectionDialog;
import com.floreantpos.ui.views.order.modifier.ModifierSelectionModel;
import com.floreantpos.ui.views.order.multipart.PizzaModifierSelectionDialog;
public class OrderController implements OrderListener, CategorySelectionListener, GroupSelectionListener, ItemSelectionListener {
private OrderView orderView;
public OrderController(OrderView orderView) {
this.orderView = orderView;
orderView.getCategoryView().addCategorySelectionListener(this);
orderView.getGroupView().addGroupSelectionListener(this);
orderView.getItemView().addItemSelectionListener(this);
orderView.getTicketView().addOrderListener(this);
}
public void categorySelected(MenuCategory foodCategory) {
orderView.showView(GroupView.VIEW_NAME);
orderView.getGroupView().setMenuCategory(foodCategory);
orderView.getTicketView().getTxtSearchItem().requestFocus();
}
public void groupSelected(MenuGroup foodGroup) {
orderView.showView(MenuItemView.VIEW_NAME);
orderView.getItemView().setMenuGroup(foodGroup);
orderView.getTicketView().getTxtSearchItem().requestFocus();
}
public void itemSelected(MenuItem menuItem) {
MenuItemDAO dao = new MenuItemDAO();
menuItem = dao.initialize(menuItem);
if (orderView.isVisible() && RootView.getInstance().isMaintenanceMode()) {
return;
}
double itemQuantity = 0;
if (menuItem.isFractionalUnit()) {
if (TerminalConfig.getScaleActivationValue().equals("cas10")) {
itemQuantity = AutomatedWeightInputDialog.takeDoubleInput(menuItem.getName(), 1);
}
else {
itemQuantity = BasicWeightInputDialog.takeDoubleInput("Please enter item weight or quantity.", 1);
}
if (itemQuantity <= -1) {
return;
}
if (itemQuantity == 0) {
POSMessageDialog.showError("Unit can not be zero");
return;
}
}
TicketItem ticketItem = menuItem.convertToTicketItem(orderView.getTicketView().getTicket().getOrderType(), itemQuantity);
if (!orderView.getTicketView().isStockAvailable(menuItem, ticketItem, -1)) {
POSMessageDialog.showError("Items are not available in stock");
//Disable the menu button when stock finish
orderView.getItemView().disableItemButton(menuItem);
return;
}
ticketItem.setTicket(orderView.getTicketView().getTicket());
ticketItem.setSeatNumber(orderView.getSelectedSeatNumber());
if (menuItem.isPizzaType()) {
PizzaModifierSelectionDialog dialog = new PizzaModifierSelectionDialog(ticketItem, menuItem, false);
dialog.openFullScreen();
if (dialog.isCanceled()) {
return;
}
}
else if (menuItem.hasMandatoryModifiers()) {
ModifierSelectionDialog dialog = new ModifierSelectionDialog(new ModifierSelectionModel(ticketItem, menuItem));
dialog.open();
if (!dialog.isCanceled()) {
orderView.getTicketView().addTicketItem(ticketItem);
}
}
else {
orderView.getTicketView().addTicketItem(ticketItem);
}
}
public void itemSelectionFinished(MenuGroup parent) {
MenuCategory menuCategory = parent.getParent();
GroupView groupView = orderView.getGroupView();
if (!menuCategory.equals(groupView.getMenuCategory())) {
groupView.setMenuCategory(menuCategory);
}
orderView.showView(GroupView.VIEW_NAME);
}
public void payOrderSelected(Ticket ticket) {
if (!new SettleTicketAction(ticket.getId()).execute()) {
return;
}
// if (TerminalConfig.isCashierMode()) {
// String message = Messages.getString("OrderController.0") + ticket.getId() + Messages.getString("OrderController.1"); //$NON-NLS-1$ //$NON-NLS-2$
// if (ticket.isPaid()) {
// message = Messages.getString("OrderController.2") + ticket.getId() + Messages.getString("OrderController.3"); //$NON-NLS-1$ //$NON-NLS-2$
// }
//
// OrderUtil.createNewTakeOutOrder(ticket.getType()); //fix
// CashierModeNextActionDialog dialog = new
// CashierModeNextActionDialog(message);
// dialog.open();
// }
// else {
RootView.getInstance().showDefaultView();
// }
}
public static void openModifierDialog(ITicketItem ticketItemObject) {
try {
TicketItem ticketItem = null;
if (ticketItemObject instanceof TicketItem) {
ticketItem = ((TicketItem) ticketItemObject);
}
else if (ticketItemObject instanceof TicketItemModifier) {
TicketItemModifier ticketItemModifier = (TicketItemModifier) ticketItemObject;
ticketItem = ticketItemModifier.getTicketItem();
if (ticketItem == null) {
ticketItem = ticketItemModifier.getTicketItem();
}
}
MenuItem menuItem = ticketItem.getMenuItem();
List<TicketItemModifier> ticketItemModifiers = ticketItem.getTicketItemModifiers();
if (ticketItemModifiers == null) {
ticketItemModifiers = new ArrayList<>();
}
TicketItem cloneTicketItem = ticketItem.clone(ticketItem);
boolean pizzaType = ticketItem.isPizzaType();
if (pizzaType) {
PizzaModifierSelectionDialog dialog = new PizzaModifierSelectionDialog(cloneTicketItem, menuItem, true);
dialog.openFullScreen();
if (dialog.isCanceled()) {
return;
}
TicketItemModifier sizeModifier = cloneTicketItem.getSizeModifier();
sizeModifier.setTicketItem(ticketItem);
ticketItem.setSizeModifier(sizeModifier);
ticketItem.setItemCount(cloneTicketItem.getItemCount());
ticketItem.setUnitPrice(cloneTicketItem.getUnitPrice());
}
else {
ModifierSelectionDialog dialog = new ModifierSelectionDialog(new ModifierSelectionModel(cloneTicketItem, menuItem));
dialog.open();
if (dialog.isCanceled()) {
return;
}
}
List<TicketItemModifier> addedTicketItemModifiers = cloneTicketItem.getTicketItemModifiers();
if (addedTicketItemModifiers == null) {
addedTicketItemModifiers = new ArrayList<>();
}
//double defaultSellPortion = menuItem.getDefaultSellPortion();
ticketItemModifiers.clear();
for (TicketItemModifier ticketItemModifier : addedTicketItemModifiers) {
ticketItemModifier.setTicketItem(ticketItem);
/*if (pizzaType && !ticketItemModifier.isInfoOnly()) {
ticketItemModifier.setUnitPrice(ticketItemModifier.getUnitPrice() * defaultSellPortion / 100);
}*/
ticketItem.addToticketItemModifiers(ticketItemModifier);
}
} catch (Exception e) {
POSMessageDialog.showError(Application.getPosWindow(), e.getMessage(), e);
}
}
// VERIFIED
public synchronized static void saveOrder(Ticket ticket) {
if (ticket == null)
return;
boolean newTicket = ticket.getId() == null;
TicketDAO ticketDAO = new TicketDAO();
ticketDAO.saveOrUpdate(ticket);
// save the action
ActionHistoryDAO actionHistoryDAO = ActionHistoryDAO.getInstance();
User user = Application.getCurrentUser();
if (newTicket) {
ShopTableDAO.getInstance().occupyTables(ticket);
actionHistoryDAO.saveHistory(user, ActionHistory.NEW_CHECK, POSConstants.RECEIPT_REPORT_TICKET_NO_LABEL + ":" + ticket.getId()); //$NON-NLS-1$
}
else {
actionHistoryDAO.saveHistory(user, ActionHistory.EDIT_CHECK, POSConstants.RECEIPT_REPORT_TICKET_NO_LABEL + ":" + ticket.getId()); //$NON-NLS-1$
}
}
public synchronized static void closeOrder(Ticket ticket) {
if (ticket.getOrderType().isCloseOnPaid() || ticket.isPaid()) {
ticket.setClosed(true);
ticket.setClosingDate(new Date());
}
TicketDAO ticketDAO = new TicketDAO();
ticketDAO.saveOrUpdate(ticket);
User driver = ticket.getAssignedDriver();
if (driver != null) {
driver.setAvailableForDelivery(true);
UserDAO.getInstance().saveOrUpdate(driver);
}
}
public synchronized static void closeDeliveryOrders(List<Ticket> tickets) {
Session session = TicketDAO.getInstance().createNewSession();
Transaction transaction = null;
try {
transaction = session.beginTransaction();
for (Ticket ticket : tickets) {
ticket.setClosed(true);
ticket.setClosingDate(new Date());
session.saveOrUpdate(ticket);
}
transaction.commit();
} catch (Exception e) {
PosLog.error(OrderController.class, e.getMessage());
POSMessageDialog.showError(e.getMessage());
if (transaction != null)
transaction.rollback();
} finally {
session.close();
}
}
}
| [
"jalal.zia.ev@gmail.com"
] | jalal.zia.ev@gmail.com |
0f244b936547d48201bb8d06a1a8fd8cab580066 | 10dbd7316329fff0c1a8804188bd98a42d1ac892 | /TP1 IFT2015/src/lindermayer/Symbol.java | 3d24894460d082cfe83a5b5a675fdcdd717f7e2b | [] | no_license | Fred0006/TP1IFT2015 | 9083dacee2aedfaf8c0783250d3d5df519f83fbb | 8662f04e23b6de3e3aa4bbf2377ac900ed97fbff | refs/heads/fred | 2023-03-13T08:12:44.797846 | 2021-02-24T01:38:23 | 2021-02-24T01:38:23 | 340,698,448 | 0 | 0 | null | 2021-02-24T01:38:23 | 2021-02-20T16:23:18 | Java | UTF-8 | Java | false | false | 462 | java |
package lindermayer;
import lindermayer.Symbol.Seq;
public class Symbol {
public String character;
public String action;
public Symbol(String character){
this.character = character;
}
public Symbol(String character, String action){
this.character = character;
this.action = action;
}
public interface Seq extends Iterable<Symbol>{
public boolean hasNext();
public Character next();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
27e4048fc2616f221164cec090ae9998316d97c2 | 6ba31f36788b2e43d6bbe7c89f98a5f7741ea671 | /IMOO/SemAutorizacaoException.java | 2b2e878a91bb32a50fadba0ae4369dff50519b8c | [] | no_license | mariaanabrito/POO | 9d30a0c3b100ca6998da07a64f57ff8fdad7a39b | 1979d56a72c908862251ca2fa726c387869d3172 | refs/heads/master | 2020-03-28T01:40:06.536925 | 2018-09-05T13:19:24 | 2018-09-05T13:19:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | /**
* Exception correspondente a tentar aceder a locais que não possui permissão.
*/
public class SemAutorizacaoException extends Exception
{
public SemAutorizacaoException(String msg)
{
super(msg);
}
}
| [
"mariaanadebrito9@gmail.com"
] | mariaanadebrito9@gmail.com |
ff589b43c4f72424be4ddd97151645af5dbf56b7 | b2336590395365eb5d9be19e39d77a3d72b81076 | /src/main/java/co/nyzo/verifier/nyzoScript/NyzoScriptStateContentType.java | 63a567140dee658c466f57a93e1b801c19982c23 | [
"Unlicense"
] | permissive | n-y-z-o/nyzoVerifier | a40b1ab4c0c2f8f2b4f9eef3e7a3e4201f1cb45d | 2d91ec85c3ff88c752730a94e9f9f22e8739d210 | refs/heads/master | 2023-01-25T00:48:05.589882 | 2023-01-24T14:33:37 | 2023-01-24T14:33:37 | 127,821,453 | 85 | 69 | Unlicense | 2021-05-01T14:07:02 | 2018-04-02T22:54:25 | Java | UTF-8 | Java | false | false | 794 | java | package co.nyzo.verifier.nyzoScript;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public enum NyzoScriptStateContentType {
Binary((byte) 0),
Json((byte) 1),
Unknown((byte) -1);
private static final Map<Integer, NyzoScriptStateContentType> contentTypeMap = new ConcurrentHashMap<>();
static {
for (NyzoScriptStateContentType contentType : values()) {
contentTypeMap.put(contentType.getValue(), contentType);
}
}
private final int value;
NyzoScriptStateContentType(byte value) {
this.value = value;
}
public int getValue() {
return value;
}
public static NyzoScriptStateContentType forValue(int value) {
return contentTypeMap.getOrDefault(value, Unknown);
}
}
| [
"nyzo@nyzo.co"
] | nyzo@nyzo.co |
54b2df9b00c45c2ea30d9080e7c766f9d27b2740 | 8d086483f1a6da42392beb00dd8cb11c9c83da3f | /src/main/java/design/pattern/strategy/PersonAgeComparator.java | 6ce2cd8d125a1e6a55d955292194d0b8f571ced3 | [] | no_license | universsky/design_pattern_demo | dc7ed9ae2f30811d30b8ec04589c35a1e177a27a | 8833ca3adeda1c2a5de3d1a47cb16aa1eb62a7ec | refs/heads/master | 2021-01-01T06:32:37.146428 | 2015-08-20T15:44:32 | 2015-08-20T15:44:32 | 40,035,861 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | /**
*
*/
package design.pattern.strategy;
/**
* @author jack 2015 2015年8月14日 下午10:26:06
* @param <E>
*/
public class PersonAgeComparator implements Comparator<Person> {
@Override
public int compare(Person p1, Person p2) {
int age1 = p1.getAge();
int age2 = p2.getAge();
if (age1 == age2) {
return 0;
} else if (age1 > age2) {
return 1;
}
else {
return -1;
}
}
}
| [
"universsky@163.com"
] | universsky@163.com |
4b91b7f790175af1c38c57a882d896680e17e36b | 07dd30205a0a6888b930d852b50fbfe7b13ac758 | /src/main/java/com/bupt/aop/demo4/MyAroundAdvice.java | 2b37721d3bc1373b3a7407bfead2466071ed8191 | [] | no_license | pittershuai/spring_ioc_learning | cfcd4965336b39faca088e9d7a6ced4ebde22896 | eb907313cda8d9c841338c52eac9ad087b09d16a | refs/heads/master | 2020-05-05T13:47:51.154999 | 2019-04-10T02:59:34 | 2019-04-10T02:59:34 | 180,093,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.bupt.aop.demo4;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
public class MyAroundAdvice implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
System.out.println("环绕前增强===================");
Object obj = invocation.proceed();
System.out.println("环绕后增强===================");
return obj;
}
}
| [
"123"
] | 123 |
da1fa4dda80d664595d2e5ad1648d46a3a24f4b4 | e11deff999efe56e4f2235a24defbd89c6a03681 | /src/Final/TargetGenerator.java | 1724f54400bc53b156def0681dd8eaab7f43ef34 | [] | no_license | ppalumbo17/FinalProject-SoftwareEngineering | d1358cc95a053204ea464185bf5d4e5d0b6b3d3b | c38a8be2ef516cbd0517ea8ac34c0b2c35a51eb1 | refs/heads/master | 2020-05-29T08:40:37.098762 | 2016-09-15T19:31:13 | 2016-09-15T19:31:13 | 33,558,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package Final;
import java.util.Random;
public class TargetGenerator {
private int x, y, width, height;
public TargetGenerator(int x, int y, int width, int height) {
super();
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public Target createTarget()
{
Random r = new Random();
double xcoor = x + width * r.nextDouble();
double ycoor = y + height * r.nextDouble();
return new Target((int)Math.round(xcoor), (int)Math.round(ycoor));
}
}
| [
"Akurzon@mymail.mines.edu"
] | Akurzon@mymail.mines.edu |
dfd1b4ef648c515b26037dbe65dbe91c3fe0c254 | baa26bfef45d8a9feb6cac988a26d8b1c3499812 | /app/src/main/java/com/austry/mobilization/net/VolleyInstance.java | d707b9c92c50284254deed05ea4fc28b3167ddb5 | [] | no_license | Austry/mobilization | f1e391bbcc9f3b7eab03e859298017c1038e17a4 | f42380b6cc5a17f160825fcb505e3ac8374d03c8 | refs/heads/master | 2020-12-23T17:51:35.703937 | 2016-10-13T10:18:45 | 2016-10-13T10:18:45 | 56,937,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package com.austry.mobilization.net;
import android.content.Context;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.austry.mobilization.Application;
public class VolleyInstance {
private RequestQueue requestQueue;
private ImageLoader imageLoader;
public VolleyInstance(Context context){
requestQueue = Volley.newRequestQueue(context);
imageLoader = new ImageLoader(this.requestQueue, new DiskCachedImageLoader(context.getCacheDir()));
}
public RequestQueue getRequestQueue(){
return this.requestQueue;
}
public ImageLoader getImageLoader(){
return this.imageLoader;
}
}
| [
"iliazasimov@gmail.com"
] | iliazasimov@gmail.com |
f24d9a14e6f18a1fb968f646cf74ee96a837af01 | 0b7109015eb4a7161bedbac327e9ef7b91a59473 | /src/main/java/com/salesbox/entity/enums/MediaType.java | 5b1cb10b8667c02e54537c7e577caa07da0ceab2 | [] | no_license | tuanhle2410/salesbox_export_as_microservice | d500df32abc9ccd3e9d0e8e96e53c5cb750a49d9 | 09d032f978da398864847c766fd1619af032ce57 | refs/heads/master | 2022-12-23T20:05:37.691253 | 2020-02-28T02:37:28 | 2020-02-28T02:37:28 | 243,457,583 | 0 | 0 | null | 2022-12-10T04:20:37 | 2020-02-27T07:27:09 | Java | UTF-8 | Java | false | false | 484 | java | package com.salesbox.entity.enums;
/**
* User: luult
* Date: 6/18/14
*/
public enum MediaType
{
MANUAL(0),
FACEBOOK(1),
LINKEDIN(2);
int extension;
// -------------------------- STATIC METHODS --------------------------
MediaType(int extension)
{
this.extension = extension;
}
public int getExtension()
{
return extension;
}
public void setExtension(int extension)
{
this.extension = extension;
}
}
| [
"tuanhle2410@outlook.com"
] | tuanhle2410@outlook.com |
fee68b6f3a5665e651720e9782beecada3485a21 | 8388d3009c0be9cb4e3ea25abbce7a0ad6f9b299 | /business/agriprpall/agriprpall-core/src/main/java/com/sinosoft/agriprpall/core/policymanage/entity/PrpCinsuredKey.java | f8143b44ed47a5da8c1bf9be0f88b53ca223a70f | [] | no_license | foxhack/NewAgri2018 | a182bd34d0c583a53c30d825d5e2fa569f605515 | be8ab05e0784c6e7e7f46fea743debb846407e4f | refs/heads/master | 2021-09-24T21:58:18.577979 | 2018-10-15T11:24:21 | 2018-10-15T11:24:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package com.sinosoft.agriprpall.core.policymanage.entity;
import com.sinosoft.framework.core.dao.BasePKImpl;
import javax.persistence.*;
/**
* @author codegen@研发中心
* @mail codegen@sinosoft.com.cn
* @time 2017-10-23 06:09:14.757
* 保险人关系表主键操作对象
*/
public class PrpCinsuredKey extends BasePKImpl{
private static final long serialVersionUID = 1L;
public PrpCinsuredKey(){}
public PrpCinsuredKey(String policyNo,Integer serialNo){
this.policyNo = policyNo;
this.serialNo = serialNo;
}
/** 属性投保单号/投保单号 */
@Column(name = "policyNo")
private String policyNo ;
/** 属性序号/序号 */
@Column(name = "serialNo")
private Integer serialNo ;
/**
* 属性投保单号/投保单号的getter方法
*/
public String getPolicyNo() {
return policyNo;
}
/**
* 属性投保单号/投保单号的setter方法
*/
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo;
}
/**
* 属性序号/序号的getter方法
*/
public Integer getSerialNo() {
return serialNo;
}
/**
* 属性序号/序号的setter方法
*/
public void setSerialNo(Integer serialNo) {
this.serialNo = serialNo;
}
} | [
"vicentdk77@users.noreply.github.com"
] | vicentdk77@users.noreply.github.com |
6a9aa248cc96e290642fe3be590d7acb88f42ab8 | 5d059d98ffd879095d503f8db0bc701fab13ed11 | /sfm/src/main/java/org/sfm/tuples/Tuple12.java | 8e67d246f8ee38d9d8002408f32e956eff220e10 | [
"MIT"
] | permissive | sripadapavan/SimpleFlatMapper | c74cce774b0326d5ea5ea141ee9f3caf07a98372 | 8359a08abb3a321b3a47f91cd4046ca1a88590fd | refs/heads/master | 2021-01-17T08:11:57.463205 | 2016-02-06T14:38:44 | 2016-02-07T16:50:53 | 51,313,393 | 1 | 0 | null | 2016-02-08T17:23:12 | 2016-02-08T17:23:12 | null | UTF-8 | Java | false | false | 2,259 | java | package org.sfm.tuples;
public class Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
private final T12 element11;
public Tuple12(T1 element0, T2 element1, T3 element2, T4 element3, T5 element4, T6 element5, T7 element6, T8 element7, T9 element8, T10 element9, T11 element10, T12 element11) {
super(element0, element1, element2, element3, element4, element5, element6, element7, element8, element9, element10);
this.element11 = element11;
}
public final T12 getElement11() {
return element11;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Tuple12 tuple12 = (Tuple12) o;
if (element11 != null ? !element11.equals(tuple12.element11) : tuple12.element11 != null) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (element11 != null ? element11.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Tuple12{" +
"element0=" + getElement0() +
", element1=" + getElement1() +
", element2=" + getElement2() +
", element3=" + getElement3() +
", element4=" + getElement4() +
", element5=" + getElement5() +
", element6=" + getElement6() +
", element7=" + getElement7() +
", element8=" + getElement8() +
", element9=" + getElement9() +
", element10=" + getElement10() +
", element11=" + getElement11() +
'}';
}
public <T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> tuple13(T13 element12) {
return new Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(getElement0(), getElement1(), getElement2(), getElement3(), getElement4(), getElement5(), getElement6(), getElement7(), getElement8(), getElement9(), getElement10(), getElement11(), element12);
}
}
| [
"arnaud.roger@gmail.com"
] | arnaud.roger@gmail.com |
42a70e1cebc89a05957b7dd4bd1edc2653d379c1 | a072ee5db9e66b6f0bf4c10a7a4e0c1753d9dad1 | /BaiduTieBa/app/src/main/java/com/android/keche/baidutieba/views/CommentExpandableListView.java | 90b7648473996d6f0cc3394b30d27c593087c483 | [] | no_license | KeChenGU/SoftEngineer | c0d17afac951146b65dfa29fbdc0ace901bcab1b | 46d659c2cd0f2b09bb5528c1ac96fc152749cade | refs/heads/master | 2020-04-25T02:52:56.380462 | 2019-06-12T10:10:49 | 2019-06-12T10:10:49 | 172,456,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,766 | java | package com.android.keche.baidutieba.views;
import android.content.Context;
import android.os.Build;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.util.AttributeSet;
import android.widget.ExpandableListView;
/**
* Author: Moos
* E-mail: moosphon@gmail.com
* Date: 18/4/20.
* Desc: 自定义ExpandableListView,解决与CoordinatorLayout滑动冲突问题
*/
public class CommentExpandableListView extends ExpandableListView implements NestedScrollingChild{
private NestedScrollingChildHelper mScrollingChildHelper;
public CommentExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
mScrollingChildHelper = new NestedScrollingChildHelper(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setNestedScrollingEnabled(true);
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
@Override
public void setNestedScrollingEnabled(boolean enabled) {
mScrollingChildHelper.setNestedScrollingEnabled(enabled);
}
@Override
public boolean isNestedScrollingEnabled() {
return mScrollingChildHelper.isNestedScrollingEnabled();
}
@Override
public boolean startNestedScroll(int axes) {
return mScrollingChildHelper.startNestedScroll(axes);
}
@Override
public void stopNestedScroll() {
mScrollingChildHelper.stopNestedScroll();
}
@Override
public boolean hasNestedScrollingParent() {
return mScrollingChildHelper.hasNestedScrollingParent();
}
@Override
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed,
int dyUnconsumed, int[] offsetInWindow) {
return mScrollingChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed,
dxUnconsumed, dyUnconsumed, offsetInWindow);
}
@Override
public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) {
return mScrollingChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow);
}
@Override
public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) {
return mScrollingChildHelper.dispatchNestedFling(velocityX, velocityY, consumed);
}
@Override
public boolean dispatchNestedPreFling(float velocityX, float velocityY) {
return mScrollingChildHelper.dispatchNestedPreFling(velocityX, velocityY);
}
}
| [
"994866398@qq.com"
] | 994866398@qq.com |
b834f64b778e52b69c7fe5662f13ea993cd2dd89 | d32c56a15b7facffa90f7411255ff3fc9c81bfe2 | /src/main/java/com/zhouyn/spring/cafe/dao/CoffeeMapper.java | 505287c121959b72c4f3c9e21ff7d6c5037b68e9 | [] | no_license | zhouyannian/cafe | 24d7b0123c592f89282ac63ae417dba828bb478c | 8f798ebc5383e949b83117246c700012791837ae | refs/heads/master | 2020-05-05T11:17:23.044237 | 2019-04-23T15:25:57 | 2019-04-23T15:25:57 | 179,983,375 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,390 | java | package com.zhouyn.spring.cafe.dao;
import com.zhouyn.spring.cafe.model.Coffee;
import com.zhouyn.spring.cafe.model.CoffeeExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;
import java.util.List;
public interface CoffeeMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
long countByExample(CoffeeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
int deleteByExample(CoffeeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
@Delete({
"delete from t_coffee",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
@Insert({
"insert into t_coffee (create_time, update_time, ",
"name, price)",
"values (#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{name,jdbcType=VARCHAR}, #{price,jdbcType=BIGINT,typeHandler=geektime.spring.data.mybatis.handler.MoneyTypeHandler})"
})
@SelectKey(statement="CALL IDENTITY()", keyProperty="id", before=false, resultType=Long.class)
int insert(Coffee record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
int insertSelective(Coffee record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
List<Coffee> selectByExampleWithRowbounds(CoffeeExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
List<Coffee> selectByExample(CoffeeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
@Select({
"select",
"id, create_time, update_time, name, price",
"from t_coffee",
"where id = #{id,jdbcType=BIGINT}"
})
@ResultMap("com.zhouyn.spring.cafe.dao.CoffeeMapper.BaseResultMap")
Coffee selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
int updateByExampleSelective(@Param("record") Coffee record, @Param("example") CoffeeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
int updateByExample(@Param("record") Coffee record, @Param("example") CoffeeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
int updateByPrimaryKeySelective(Coffee record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_coffee
*
* @mbg.generated Tue Apr 23 21:44:26 CST 2019
*/
@Update({
"update t_coffee",
"set create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"name = #{name,jdbcType=VARCHAR},",
"price = #{price,jdbcType=BIGINT,typeHandler=geektime.spring.data.mybatis.handler.MoneyTypeHandler}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(Coffee record);
} | [
"zhouyn@asiainfo.com"
] | zhouyn@asiainfo.com |
810b0091a3cc73c8abe95e8e31a95b9148126a1f | 391b70004942f62f7a2160faad03947eacdcad1c | /app/src/test/java/com/zhuoxin/meipaivideo/ExampleUnitTest.java | d67c2ffe1fbee62cf9688db38465e5c9371cf44a | [] | no_license | ZLZVideo/MeiPaiVideo | 7ffc812623d3c0a0e2e44dace97b28000feeac23 | d5dcca7e9905b37170f90b384f7fd9f9988a093c | refs/heads/master | 2021-01-21T23:04:59.513648 | 2017-06-23T06:52:38 | 2017-06-23T06:52:38 | 95,189,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.zhuoxin.meipaivideo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"402000716@qq.com"
] | 402000716@qq.com |
dc7c0716f1851c4227cf8a55b5775e3660f1208a | b5c92ad03361f691309927ca51556f0fb002c8a3 | /src/main/java/com/vaadin/starter/beveragebuddy/ui/MainLayout.java | f7bb666d892766a6d73f0240e89276acc1680da0 | [] | no_license | amzedauren/DiplomaProject | e290da193bd46774695c8e07f8167cb1a277ab17 | 7eed83403e920ec1e36f2cc5d9bd38b1ed56d885 | refs/heads/master | 2020-03-10T21:05:18.930304 | 2018-05-17T13:20:36 | 2018-05-17T13:20:36 | 129,580,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,962 | java | /*
* Copyright 2000-2017 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.starter.beveragebuddy.ui;
import com.vaadin.flow.component.dependency.HtmlImport;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.page.Viewport;
import com.vaadin.flow.router.AfterNavigationEvent;
import com.vaadin.flow.router.AfterNavigationObserver;
import com.vaadin.flow.router.RouterLayout;
import com.vaadin.flow.server.InitialPageSettings;
import com.vaadin.flow.server.PageConfigurator;
@HtmlImport("frontend://styles/shared-styles.html")
@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
public class MainLayout extends Div
implements RouterLayout, AfterNavigationObserver, PageConfigurator {
private static final String ACTIVE_ITEM_STYLE = "main-layout__nav-item--selected";
public MainLayout() {
H2 title = new H2("IDS/IPS Visualizer");
title.addClassName("main-layout__title");
Div header = new Div(title);
header.addClassName("main-layout__header");
add(header);
addClassName("main-layout");
}
@Override
public void afterNavigation(AfterNavigationEvent event) {
}
@Override
public void configurePage(InitialPageSettings settings) {
settings.addMetaTag("apple-mobile-web-app-capable", "yes");
settings.addMetaTag("apple-mobile-web-app-status-bar-style", "black");
}
}
| [
"dauren.amze1213@gmail.com"
] | dauren.amze1213@gmail.com |
b423debf68cc51f7ffae523ec2151e1786f1e393 | d2ec57598c338498027c2ecbcbb8af675667596b | /src/myfaces-core-module-2.1.10/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/ELExprTemplateTestCase.java | 8e4ed7d56b376ea4ae5c0faf0b1633c5c2828c58 | [
"Apache-2.0"
] | permissive | JavaQualitasCorpus/myfaces_core-2.1.10 | abf6152e3b26d905eff87f27109e9de1585073b5 | 10c9f2d038dd91c0b4f78ba9ad9ed44b20fb55c3 | refs/heads/master | 2023-08-12T09:29:23.551395 | 2020-06-02T18:06:36 | 2020-06-02T18:06:36 | 167,005,005 | 0 | 0 | Apache-2.0 | 2022-07-01T21:24:07 | 2019-01-22T14:08:49 | Java | UTF-8 | Java | false | false | 1,691 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.view.facelets.tag.ui;
import javax.faces.component.UIViewRoot;
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.impl.FaceletCompositionContextImpl;
import org.junit.Test;
public class ELExprTemplateTestCase extends FaceletTestCase {
@Override
protected void setUpServletObjects() throws Exception
{
super.setUpServletObjects();
servletContext.addInitParameter(
FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
"always");
}
/**
* See MYFACES-3246 for details
*
* @throws Exception
*/
@Test
public void testELExprTemplate() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "elexpr_main.xhtml");
}
}
| [
"taibi@sonar-scheduler.rd.tut.fi"
] | taibi@sonar-scheduler.rd.tut.fi |
74ad54cbd9d8cfe1ca45eba7626e83357b4e98ad | 745889f9e636806831f5074c4a435d75d6ed0b0d | /WTServer/src/WTServer/data/LaunchServer.java | 8c6db43c884d6fcf46cd72ba68c491376391d64f | [] | no_license | madalici98/WTChat | 2c688e067d9ef5e69ed7470d2503768cd5e16786 | 98feebbd42748501fe8b57803b1e942eb6c2e893 | refs/heads/master | 2020-05-01T16:22:14.700541 | 2019-03-26T13:12:23 | 2019-03-26T13:12:23 | 177,569,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,636 | java | package WTServer.data;
import WTUtils.ServerCommand;
import WTUtils.ServerRequest;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import static WTUtils.CommandTypes.*;
import static java.lang.System.exit;
public class LaunchServer {
private static Map<String, ClientThread> connections = new HashMap<String, ClientThread>();
//private static Boolean anyHandRaised = false; //no one has the control over the chat yet; only one user at the time can have it (project requirement)
private static int handUpTime;
private static ClientThread hasHandRaised = null; //it is good to know who has the raised hand
public static void registerNewClient(ClientThread ct) {
connections.put(ct.getUserName(),ct);
System.out.println("User registered: " + ct.getUserName());
}
public static void lowerHand(ClientThread ct) {
hasHandRaised = null;
ServerCommand sc = new ServerCommand();
sc.setCommType(LOWER_HAND_ACCEPTED);
ct.sendCommand(sc);
}
public static void main(String[] args) {
try (ServerSocket ss = new ServerSocket(12345)) {
// I'm getting the hand up time from the .ini file
Config cfg = new Config("E:/Facultate/PAO/WTServer/src/WTServer/data/serverInfo.ini");
handUpTime = Integer.parseInt(cfg.getProperty("handUpTime")) * 1000; //I turned it into nanoseconds
System.out.println("Server up");
while(true) {
new ClientThread(ss.accept()).start();
System.out.println("A new client has connected");
}
} catch (FileNotFoundException e1) {
System.out.println("Unable to find the configuration file");
exit(0);
} catch (IOException e2) {
e2.printStackTrace();
}
}
private static class ClientThread extends Thread {
private String userName;
private Socket sock;
private ObjectInputStream ois;
private ObjectOutputStream oos;
public ClientThread(Socket s) throws IOException {
this.sock = s;
ois = new ObjectInputStream(sock.getInputStream());
oos = new ObjectOutputStream(sock.getOutputStream());
oos.flush();
}
public String getUserName() {
return userName;
}
public ObjectOutputStream getOos() {
return this.oos;
}
public void setUserName(String s) {
this.userName = s;
}
private void sendCommand(ServerCommand comm) {
try {
oos.writeObject(comm);
oos.flush();
oos.reset();
} catch (IOException e) {
e.printStackTrace();
}
}
private void broadcastMessage(String message, Boolean ignoreThis) {
Set<Map.Entry<String, ClientThread>> clients = connections.entrySet();
ServerCommand sc = new ServerCommand();
sc.setCommType(DISPLAY_MESSAGE);
sc.setData(message + "\n");
try {
for (Map.Entry<String, ClientThread> ct: clients) {
if (ignoreThis == true && ct.getValue() == this) continue;
ObjectOutputStream oos = ct.getValue().getOos();
oos.writeObject(sc);
oos.flush();
oos.reset();
}
} catch (IOException e) {
e.printStackTrace();
}
}//end of BroadcastMessage
public void run() {
while (true) {
try {
ServerRequest sr = (ServerRequest) ois.readObject();
ServerCommand sc = new ServerCommand();
switch (sr.getReqType()) {
case HAND_UP:
//things to happen : check if the user can raise his hand; if he can
//leave him communicate with the server for a certain amount of time
//to do: avoid race conditions; use a synchronised block/method
synchronized (ClientThread.class) {
if (hasHandRaised == null) {
//the chat is free; the user can start sending his messages
//notify the user he can start sending his messages
Boolean x = true;
hasHandRaised = this;
sc.setCommType(RAISE_HAND_ACCEPTED);
sendCommand(sc);
} else {
//the chat is not free
//notify the user
sc.setCommType(RAISE_HAND_REJECTED);
sendCommand(sc);
}
}//end of synchronised block
break;
case HAND_DOWN:
//things to happen : stop the user message sending session
//notify everyone that the chanel is free again
lowerHand(this);
break;
case SET_NAME:
//things to happen : check if the name desired by the user is available
//set it if possible; add the user to the connection hashmap
synchronized (this) {
String n = (String) sr.getData();
Set<String> userNames = connections.keySet();
if (userNames.contains(n)) {
//inform the user that his name is not available
sc.setCommType(NAME_REJECTED);
sendCommand(sc);
System.out.println(n + " already exists");
} else {
//the name is available
//add the user to the connections hash map
//notify the user that his name is good
sc.setCommType(NAME_ACCEPTED);
sc.setData(handUpTime); //inform the client about how much time he has to send his messages
sendCommand(sc);
this.setUserName(n);
registerNewClient(this);
broadcastMessage("User registered: " + this.getUserName(), true);
}
}
break;
case SEND_MESSAGE:
//things to happen : send to everyone the message sent by the user
broadcastMessage(new SimpleDateFormat("HH.mm").format(new Date())
+ ", " + this.userName + ": " + (String)sr.getData(), false);
break;
default:
System.out.println("Something went wrong");
}//end of switch
} catch (SocketException e) {
//delete the disconected client from the connections hash map
String aux = "User disconected: " + this.userName;
System.out.println(aux);
broadcastMessage(aux, true);
if (hasHandRaised == this) {
hasHandRaised = null;
}
connections.remove(this.userName);
break;
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
} //end of try-catch block
} //end of while
}//end of run
}//end of ClientThread class declaration
}//end of Launchserver class declaration | [
"madalinapietreanu@outlook.com"
] | madalinapietreanu@outlook.com |
84ef4b3d37188fe8c66ad325861c90b9e6f50f80 | 4eb4d84abd25e944866bdee10c0b082d5b934f77 | /eureka-server/src/main/java/com/shanshuan/EurekaServer.java | 15dbc8db23ffd184d7a0f613e9faf782db731674 | [] | no_license | ShanShuan/spring_cloud | 89a2ead5364e88af849ae33885634b42387d9e86 | 790d344c52e48395906bf8d4fe58e9cb1ec99dd9 | refs/heads/master | 2020-09-19T23:24:00.596214 | 2019-11-27T01:56:53 | 2019-11-27T01:56:53 | 224,322,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package com.shanshuan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* Created by wangzifeng on 2019/11/20.
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer {
public static void main(String[] args) {
SpringApplication.run(EurekaServer.class);
}
}
| [
"xiaobai@yscredit.com"
] | xiaobai@yscredit.com |
cdd06c3957d8aea8f8d4fc9ec7667a41e9b7d4fc | bc39fcb51c8b5b84b4f25f056194dd6774131509 | /src/day54/IndoorPet.java | 80a599fa7e69456cb38081f5190acd4175de4c0b | [] | no_license | LikeSha/JavaProgrammingB15Online | d3eb1db0a3e09e19f6ad9d25b7fb16288424da94 | a7d4ac3a26c5541dbf05630d5c6fff2e549c0c59 | refs/heads/master | 2021-07-01T21:44:24.577422 | 2021-06-25T08:53:48 | 2021-06-25T08:53:48 | 229,714,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 164 | java | package day54;
public interface IndoorPet {
public abstract void play();
}
// Dog IS-A Dog
//Dog IS-A Animal
//Dog IS-A IndoorPet
// concept : loose pairing | [
"tradersalike88@yahoo.com"
] | tradersalike88@yahoo.com |
dc82c909004af0b012a944717af6c68b764b7818 | c3cf8de665acbebd1cfb3c26b8e569372f59c4ae | /app/src/main/java/com/example/dxm/easyandroid/utils/WrapHtml.java | 92d9e3ac53e9a24116cad6523315572cacd623ca | [] | no_license | M78Snail/EasyAndroid | 49f0fbb59e6a6f5755e3b32046082729b9cba4dc | 24b4babe6912f1a73e2e3189f6aa11b5c270539e | refs/heads/master | 2020-04-06T07:06:27.913888 | 2018-09-04T09:21:29 | 2018-09-04T09:21:29 | 68,163,146 | 18 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,168 | java | package com.example.dxm.easyandroid.utils;
import android.util.Log;
/**
* Created by dxm on 2016/7/14.
*/
public class WrapHtml {
private static WrapHtml mInstance;
private WrapHtml(){
}
public static WrapHtml getInstance(){
if(mInstance==null){
synchronized (WrapHtml.class){
if(mInstance==null){
mInstance=new WrapHtml();
}
}
}
return mInstance;
}
public String wrapHtml(String title, String content) {
final StringBuilder sb = new StringBuilder();
sb.append("<!DOCTYPE html>");
sb.append("<html dir=\"ltr\" lang=\"zh\">");
sb.append("<head>");
sb.append("<meta name=\"viewport\" content=\"width=100%; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" />");
sb.append("<link rel=\"stylesheet\" href='file:///android_asset/style.css' type=\"text/css\" media=\"screen\" />");
sb.append("<link rel=\"stylesheet\" href='file:///android_asset/default.min.css' type=\"text/css\" media=\"screen\" />");
sb.append("</head>");
sb.append("<body style=\"padding:0px 8px 8px 8px;\">");
sb.append("<div id=\"pagewrapper\">");
sb.append("<div id=\"mainwrapper\" class=\"clearfix\">");
sb.append("<div id=\"maincontent\">");
sb.append("<div class=\"post\">");
sb.append("<div class=\"posthit\">");
sb.append("<div class=\"postinfo\">");
sb.append("<h2 class=\"thetitle\">");
sb.append("</h2>");
sb.append("<hr/>");
sb.append("</div>");
sb.append("<div class=\"entry\">");
sb.append(content);
sb.append("</div>");
sb.append("</div>");
sb.append("</div>");
sb.append("</div>");
sb.append("</div>");
sb.append("</div>");
//sb.append("<script src=\'file:///android_asset/highlight.pack.js\'></script>");
//sb.append("<script>hljs.initHighlightingOnLoad();</script>");
sb.append("</body>");
sb.append("</html>");
Log.e("", "html : " + sb.toString());
return sb.toString();
}
}
| [
"957708598@qq.com"
] | 957708598@qq.com |
81d775d50e248cf63a142aad25d63bf19b902396 | 52b8f06c0a65492004fc392c7cc7a731f12a7a44 | /src/main/java/ontologies/InformationCours.java | 83168026f8b5411396699c3f69dc31f49ce1a85f | [] | no_license | Graywynd/WSKjava | 3f7092b096760ac58fbbc8070024db9793546460 | 351405c48b02c368d257234cb21c6605567ee0f1 | refs/heads/master | 2021-01-19T18:15:21.266203 | 2017-04-25T21:56:43 | 2017-04-25T21:56:43 | 88,351,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | 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 ontologies;
import jade.content.*;
/**
*
* @author saif
*/
public class InformationCours implements AgentAction {
private int type;
private int Id_Cours;
/**
* @return the type
*/
public int getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(int type) {
this.type = type;
}
/**
* @return the Id_Cours
*/
public int getId_Cours() {
return Id_Cours;
}
/**
* @param Id_Cours the Id_Cours to set
*/
public void setId_Cours(int Id_Cours) {
this.Id_Cours = Id_Cours;
}
}
| [
"seif_2@hotmail.fr"
] | seif_2@hotmail.fr |
cbb4567e3eb864f9a6b7d798a5180d2bcf12cc48 | 47f168d9f7e3f0879eb46f2775043530e47d9939 | /rental-house-admin/src/main/java/com/rentalHouseAdmin/rha/common/ext/ueditor/define/MultiState.java | 5f35adbf37d6564ac6600cee3fd365f2ce41e428 | [
"MIT"
] | permissive | DesionGo/rental-house-master | 10b66815df08befa4bc96076d38e6bc7ae50ae4a | 76dd7f16fe83844f8214dbcee58f03914671c18a | refs/heads/master | 2023-05-14T17:58:43.227018 | 2021-06-03T15:10:11 | 2021-06-03T15:10:11 | 363,856,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,469 | java | package com.rentalHouseAdmin.rha.common.ext.ueditor.define;
import com.rentalHouseAdmin.rha.common.ext.ueditor.Encoder;
import java.util.*;
/**
* 多状态集合状态
* 其包含了多个状态的集合, 其本身自己也是一个状态
* @author hancong03@baidu.com
*
*/
public class MultiState implements com.rentalHouseAdmin.rha.common.ext.ueditor.define.State {
private boolean state = false;
private String info = null;
private Map<String, Long> intMap = new HashMap<String, Long>();
private Map<String, String> infoMap = new HashMap<String, String>();
private List<String> stateList = new ArrayList<String>();
public MultiState ( boolean state ) {
this.state = state;
}
public MultiState ( boolean state, String info ) {
this.state = state;
this.info = info;
}
public MultiState ( boolean state, int infoKey ) {
this.state = state;
this.info = com.rentalHouseAdmin.rha.common.ext.ueditor.define.AppInfo.getStateInfo( infoKey );
}
@Override
public boolean isSuccess() {
return this.state;
}
public void addState ( State state ) {
stateList.add( state.toJSONString() );
}
/**
* 该方法调用无效果
*/
@Override
public void putInfo(String name, String val) {
this.infoMap.put(name, val);
}
@Override
public String toJSONString() {
String stateVal = this.isSuccess() ? com.rentalHouseAdmin.rha.common.ext.ueditor.define.AppInfo.getStateInfo( AppInfo.SUCCESS ) : this.info;
StringBuilder builder = new StringBuilder();
builder.append( "{\"state\": \"" + stateVal + "\"" );
// 数字转换
Iterator<String> iterator = this.intMap.keySet().iterator();
while ( iterator.hasNext() ) {
stateVal = iterator.next();
builder.append( ",\""+ stateVal +"\": " + this.intMap.get( stateVal ) );
}
iterator = this.infoMap.keySet().iterator();
while ( iterator.hasNext() ) {
stateVal = iterator.next();
builder.append( ",\""+ stateVal +"\": \"" + this.infoMap.get( stateVal ) + "\"" );
}
builder.append( ", list: [" );
iterator = this.stateList.iterator();
while ( iterator.hasNext() ) {
builder.append( iterator.next() + "," );
}
if ( this.stateList.size() > 0 ) {
builder.deleteCharAt( builder.length() - 1 );
}
builder.append( " ]}" );
return Encoder.toUnicode( builder.toString() );
}
@Override
public void putInfo(String name, long val) {
this.intMap.put( name, val );
}
}
| [
"1009823094@qq.com"
] | 1009823094@qq.com |
8d6937a7e136e1345867e10219af5dcf68ea2dbb | 86bab736260628f592e4cfb88a3969a05baefaee | /src/main/java/org/foxlabs/util/resource/ResourceHelper.java | a1f82a94f3029030190b1a1253d0f57ed937a866 | [
"Apache-2.0"
] | permissive | foxinboxx/foxlabs-common | 2e7a39361c208015a2806eac21ff2db36eb57591 | 284f02d4cc1c624af90e7078ade73724ebe06908 | refs/heads/master | 2021-01-17T10:35:32.350795 | 2020-03-27T11:18:29 | 2020-03-27T11:18:29 | 33,430,403 | 0 | 0 | Apache-2.0 | 2020-10-13T20:03:50 | 2015-04-05T04:36:53 | Java | UTF-8 | Java | false | false | 13,928 | java | /*
* Copyright (C) 2012 FoxLabs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.foxlabs.util.resource;
import java.net.URL;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import org.foxlabs.util.ByteBuffer;
/**
* Helper class used for working with resources.
*
* @author Fox Mulder
*/
public abstract class ResourceHelper {
/**
* Default encoding used for loading content of character resources.
*/
public static final String DEFAULT_ENCODING = "utf-8";
/**
* Size of buffer used for loading content of resources.
*/
private static final int BUFFER_SIZE = 8192;
/**
* Returns class loader.
*
* <p>This method tries to resolve class loader in the following sequence:</p>
* <ul>
* <li>Context class loader for the current thread.</li>
* <li>Class loader of this class.</li>
* <li>System class loader.</li>
* </ul>
* If all attempts above return {@code null} then this method returns
* {@code null}.
*
* @return Class loader.
*/
public static ClassLoader getClassLoader() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ResourceHelper.class.getClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
}
return cl;
}
/**
* Returns {@link #getClassLoader()} if the specified class loader is
* {@code null}; returns the specified class loader otherwise.
*
* @param cl Class loader.
* @return {@link #getClassLoader()} if the specified class loader is
* {@code null}; returns the specified class loader otherwise.
*/
public static ClassLoader getClassLoader(ClassLoader cl) {
return cl == null ? getClassLoader() : cl;
}
/**
* Returns package name for the specified class.
*
* @param c Class which package name should be returned.
* @return Package name for the specified class.
*/
public static String getPackageName(Class<?> c) {
return c.getPackage().getName();
}
/**
* Returns resource path for package of the specified class.
*
* @param c Class contained in the package.
* @return Resource path for package of the specified class.
*/
public static String getResourcePath(Class<?> c) {
return getPackageName(c).replace('.', '/');
}
/**
* Returns resource URL for the specified resource name.
*
* @param name Resource name.
* @return Resource URL for the specified resource name.
* @throws ResourceError if resource with the specified name is not found.
* @see #getResourceURL(String, ClassLoader)
*/
public static URL getResourceURL(String name) {
return getResourceURL(name, getClassLoader());
}
/**
* Returns resource URL for the specified resource name using the specified
* class loader.
*
* @param name Resource name.
* @param cl Class loader to be used for resource loading.
* @return Resource URL for the specified resource name.
* @throws ResourceError if resource with the specified name is not found.
*/
public static URL getResourceURL(String name, ClassLoader cl) {
URL url = cl.getResource(name);
if (url == null) {
throw new ResourceError("Unable to find resource: \"" + name + "\"");
}
return url;
}
/**
* Reads content of resource with the specified name as binary data.
*
* @param name Resource name.
* @return Content of resource with the specified name as binary data.
* @throws ResourceError if an error occurred when reading resource.
* @see #readBinaryResource(String, ClassLoader)
*/
public static byte[] readBinaryResource(String name) {
return readBinaryResource(name, getClassLoader());
}
/**
* Reads content of resource with the specified name as binary data using
* the specified class loader.
*
* @param name Resource name.
* @param cl Class loader to be used for resource loading.
* @return Content of resource with the specified name as binary data.
* @throws ResourceError if an error occurred when reading resource.
*/
public static byte[] readBinaryResource(String name, ClassLoader cl) {
URL url = getResourceURL(name, cl);
try {
InputStream in = url.openStream();
try {
byte[] chunk = new byte[BUFFER_SIZE];
ByteBuffer buf = new ByteBuffer(chunk.length);
for (int len = in.read(chunk); len > 0; len = in.read(chunk)) {
buf.append(chunk, 0, len);
}
return buf.getBytes();
} finally {
in.close();
}
} catch (IOException e) {
throw new ResourceError("Error reading resource: \"" + name + "\"", e);
}
}
/**
* Reads content of resource with the specified name as character data.
*
* @param name Resource name.
* @return Content of resource with the specified name as character data.
* @throws ResourceError if an error occurred when reading resource.
* @see #readTextResource(String, String, ClassLoader)
*/
public static String readTextResource(String name) {
return readTextResource(name, DEFAULT_ENCODING, getClassLoader());
}
/**
* Reads content of resource with the specified name as character data
* using the specified class loader.
*
* @param name Resource name.
* @param cl Class loader to be used for resource loading.
* @return Content of resource with the specified name as character data.
* @throws ResourceError if an error occurred when reading resource.
* @see #readTextResource(String, String, ClassLoader)
*/
public static String readTextResource(String name, ClassLoader cl) {
return readTextResource(name, DEFAULT_ENCODING, cl);
}
/**
* Reads content of resource with the specified name as character data
* using the specified character encoding.
*
* @param name Resource name.
* @param encoding Character encoding.
* @return Content of resource with the specified name as character data.
* @throws ResourceError if an error occurred when reading resource.
* @see #readTextResource(String, String, ClassLoader)
*/
public static String readTextResource(String name, String encoding) {
return readTextResource(name, encoding, getClassLoader());
}
/**
* Reads content of resource with the specified name as character data
* using the specified character encoding and class loader.
*
* @param name Resource name.
* @param encoding Character encoding.
* @param cl Class loader to be used for resource loading.
* @return Content of resource with the specified name as character data.
* @throws ResourceError if an error occurred when reading resource.
*/
public static String readTextResource(String name, String encoding, ClassLoader cl) {
URL url = getResourceURL(name, cl);
try {
InputStream in = url.openStream();
try {
InputStreamReader cin = new InputStreamReader(in, encoding);
char[] chunk = new char[BUFFER_SIZE];
StringBuilder buf = new StringBuilder(chunk.length);
for (int len = cin.read(chunk); len > 0; len = cin.read(chunk)) {
buf.append(chunk, 0, len);
}
return buf.toString();
} finally {
in.close();
}
} catch (IOException e) {
throw new ResourceError("Error reading resource: \"" + name + "\"", e);
}
}
/**
* Searches for classes in the specified package.
*
* @param pkg Package name where to search classes.
* @param recurse Determines if search should be performed recursively.
* @return Array of found classes.
*/
public static Class<?>[] findClasses(String pkg, boolean recurse) {
return findClasses(pkg, getClassLoader(), recurse);
}
/**
* Searches for classes in the specified package using the specified class
* loader.
*
* @param pkg Package name where to search classes.
* @param cl Class loader to be used for class loading.
* @param recurse Determines if search should be performed recursively.
* @return Array of found classes.
*/
public static Class<?>[] findClasses(String pkg, ClassLoader cl, boolean recurse) {
List<Class<?>> classes = new ArrayList<Class<?>>();
URL url = cl.getResource(pkg.replace('.', '/'));
if (url != null) {
File dir = new File(url.getFile());
if (dir.isDirectory()) {
findClasses(dir, pkg, cl, classes, recurse);
}
}
return classes.toArray(new Class<?>[classes.size()]);
}
/**
* Searches for classes in the specified directory and appends found
* classes to the list.
*
* @param dir Directory where to search classes.
* @param pkg Package name.
* @param cl Class loader to be used for class loading.
* @param classes List of found classes.
* @param recurse Determines if search should be performed recursively.
*/
private static void findClasses(File dir, String pkg, ClassLoader cl, List<Class<?>> classes, boolean recurse) {
for (File file : dir.listFiles()) {
if (file.isFile()) {
String name = file.getName();
if (name.endsWith(".class")) {
String className = pkg + "." + name.substring(0, name.length() - 6);
try {
classes.add(cl.loadClass(className));
} catch (ClassNotFoundException e) {
}
}
} else if (recurse && file.isDirectory()) {
findClasses(file, pkg + "." + file.getName(), cl, classes, recurse);
}
}
}
/**
* Searches for attribute with the specified name in all META-INF/MANIFEST.MF
* resources and returns attribute value or {@code null} if attribute
* with the specified name is not found.
*
* @param name Attribute name to search.
* @return Attribute value or {@code null} if attribute with the
* specified name is not found.
*/
public static String readManifestAttribute(String name) {
return readManifestAttributes(name)[0];
}
/**
* Searches for attribute with the specified name in all META-INF/MANIFEST.MF
* resources and returns attribute value or the specified default value if
* attribute with the specified name is not found.
*
* @param name Attribute name to search.
* @param defaultValue Default value.
* @return Attribute value the specified default value if attribute with
* the specified name is not found.
*/
public static String readManifestAttribute(String name, String defaultValue) {
String value = readManifestAttributes(name)[0];
return value == null ? defaultValue : value;
}
/**
* Searches for attributes with the specified names in all META-INF/MANIFEST.MF
* resources and returns array of attribute values. If attribute with
* specified name is not found then correponding array element will contain
* {@code null} value.
*
* @param names Array of attribute names to search.
* @return Array of attribute values.
*/
public static String[] readManifestAttributes(String... names) {
try {
int found = 0;
String[] values = new String[names.length];
Enumeration<URL> manifests = getClassLoader().getResources(JarFile.MANIFEST_NAME);
while (found < names.length && manifests.hasMoreElements()) {
InputStream stream = manifests.nextElement().openStream();
try {
Manifest manifest = new Manifest(stream);
for (int i = 0; i < names.length; i++) {
if (values[i] == null) {
try {
values[i] = manifest.getMainAttributes().getValue(names[i]);
if (values[i] != null) {
found++;
}
} catch (IllegalArgumentException e) {
}
}
}
} finally {
stream.close();
}
}
return values;
} catch (IOException e) {
throw new ResourceError("Error reading \"" + JarFile.MANIFEST_NAME + "\" resource", e);
}
}
}
| [
"foxinboxx@gmail.com"
] | foxinboxx@gmail.com |
2ee5891a5fe9cb00a72399aced77f4bcece1e5d4 | 20f5efdf8bc413b81c9016bba977204a0d24c322 | /engine/src/main/java/com/wmoreira/engine/config/KieBeans.java | de17469cfa7237e9f0c63af756e78e3697695077 | [] | no_license | wellingtonmoreira/drools-tdc | 8f4063a08ecc96de6b0ff745b91b6cedf3d8839b | 4e15f303affd0831b1aff57c9541889f21aa4c46 | refs/heads/master | 2021-01-19T04:34:46.877108 | 2016-07-04T05:35:31 | 2016-07-04T05:35:31 | 62,519,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | package com.wmoreira.engine.config;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.KieScanner;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
public class KieBeans {
@Bean
public KieContainer kieContainer() {
KieServices ks = KieServices.Factory.get();
ReleaseId relId = ks.newReleaseId("br.com.wmoreira","rules","1.0-SNAPSHOT");
KieContainer container = ks.newKieContainer(relId);
KieScanner scanner = KieServices.Factory.get().newKieScanner(container);
scanner.start(5000l);
return container;
}
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public KieSession kieSession(KieContainer container) {
return container.newKieSession("Base_Session");
}
}
| [
"wellington.362@gmail.com"
] | wellington.362@gmail.com |
b892bdfb02747993d43cf57696639a83dad51486 | f0a0d4e809072d21b116f2892f9aed6356c3e779 | /StringSecondAssignment/src/Part1.java | c80045f8b8e13095129c693ea8ce9ac98173b82c | [] | no_license | ZhengCornell/Algorithm-Java | 80fa21cbee7df3a07c2a4d2d9679972cd7bef9e7 | 503d4744457a846db810985325573fd8c45f32f0 | refs/heads/master | 2021-05-02T05:28:13.902611 | 2018-02-09T15:14:17 | 2018-02-09T15:14:17 | 120,920,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,492 | java | import java.util.ArrayList;
import java.util.List;
public class Part1 {
public static int findStopCodon(String dna, Integer startIndex, String stopCodon){
if(startIndex == -1){
return dna.length();
}
String subdna = dna.substring(startIndex);
int stopIndex = subdna.indexOf(stopCodon);
if(stopIndex == -1){
return dna.length();
}
String subdna2 = subdna.substring(0,stopIndex+3);
if(subdna.length() % 3 == 0){
return stopIndex;
}else{
return dna.length();
}
}
public static void testFindStopCodon(){
String d1 = "BEDATGEHFKEFCNDTAA";
System.out.println(findStopCodon(d1,3,"TAA"));
}
public static void testFindGene(){
String dna = "BEDATGEHFKEFCNDDDDTAA";
findGene(dna);
}
public static List<String> printAllGenes(String dna){
List<String> dnas = new ArrayList<String>();
while(dna != ""){
if(findGene(dna) != ""){
String k = findGene(dna);
dnas.add(k);
}
dna = children(dna);
}
return dnas;
}
public static String children(String dna){
int startIndex = -1;
int stopIndex = -1;
startIndex = dna.indexOf("ATG");
if(startIndex == -1){
return "";
}
int taastop = findStopCodon(dna,startIndex,"TAA");
int tagstop = findStopCodon(dna,startIndex,"TAG");
int tgastop = findStopCodon(dna,startIndex,"TGA");
int end = min(taastop,tagstop,tgastop);
if(end == dna.length()){
return "";
}else{
return dna.substring(end+startIndex+3);
}
}
public static String findGene(String dna){
int startIndex = -1;
int stopIndex = -1;
startIndex = dna.indexOf("ATG");
if(startIndex == -1){
return "";
}
int taastop = findStopCodon(dna,startIndex,"TAA");
int tagstop = findStopCodon(dna,startIndex,"TAG");
int tgastop = findStopCodon(dna,startIndex,"TGA");
int end = min(taastop,tagstop,tgastop);
if(end == dna.length()){
return "";
}else{
return dna.substring(startIndex,end+startIndex+3);
}
}
private static int min(int a, int b, int c){
if(a <= b){
return min(a,c);
}
else{
return min(b,c);
}
}
private static int min(int a, int b){
if(a <= b){
return a;
}
return b;
}
public static void main(String[] args){
testFindStopCodon();
System.out.println(findGene("BEDATGEHFKEFCNDTAA"));
System.out.println(findGene("BEDATGEHFKEFCNDDDDTAA"));
List<String> l = new ArrayList<String>();
l = printAllGenes("ATGTAAATGTAAATGMKLTAA");
for(int i = 0; i < l.size(); i++){
System.out.println(l.get(i));
}
}
}
| [
"zg242@cornell.edu"
] | zg242@cornell.edu |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.