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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2ca1c2459435f5043b63a1d4d4d935c7bc64c2f6 | 246ecc28b911c4946fb3d94c253a62b6210407e5 | /src/view/RankDialog.java | 441f30fd6ce3be592d1ff3156966eb6d39a94f80 | [] | no_license | charasandiego/FundsMonitoringSystem | 1c337e6ecc633cce9e31f4b5c11855e5999d6229 | ea4821ed3279dd7b5180be5fef84e9c1ee764fc6 | refs/heads/master | 2021-01-19T08:08:39.325472 | 2015-03-17T16:02:14 | 2015-03-17T16:02:14 | 32,404,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package view;
import java.awt.Dimension;
import java.awt.Point;
import javax.swing.JDialog;
public class RankDialog extends JDialog
{
private static final long serialVersionUID = 1L;
private InputRankPanel panel;
public RankDialog(MainFrame parent)
{
super(parent, "New Rank", true);
setSize(500, 130);
Dimension parentSize = parent.getSize();
Point p = parent.getLocation();
setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4);
panel = new InputRankPanel(this);
setContentPane(panel);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
}
| [
"charamaesd@yahoo.com"
] | charamaesd@yahoo.com |
01cf32a98d9eadf5be81f2d71bb7d9741e7fba61 | 376d07a9723d931ce2508b885bcade202c40b119 | /code/src/main/java/com/zhang/interview/code/design/servlet/filter/DebugFilter.java | b9a517b9436a3286858661ed43a831df56abbdf7 | [] | no_license | bgitter/interview | 1cc41a32433f2074504db7bb5f26e8bf35d61777 | 2c74089d85ed9514f6f4e2ef5b7fe95419e4e965 | refs/heads/master | 2023-03-19T08:53:18.238527 | 2021-03-11T09:57:06 | 2021-03-11T09:57:06 | 297,675,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.zhang.interview.code.design.servlet.filter;
/**
* @Copyright (C), 2018-2020, ๅไบฌๆฐ็ฅ็งๆ่กไปฝๆ้ๅ
ฌๅธ
* @FileName: DebugFilter
* @Author: zxb
* @Date: 2020/10/15 14:00
* @Description: Filterๆจกๅผ-ๅฎ็ฐ็ฑป
*/
public class DebugFilter implements Filter {
@Override
public void execute(String request) {
System.out.println("request log: " + request);
}
}
| [
"zhang.xiaobin@shuzhi.ai"
] | zhang.xiaobin@shuzhi.ai |
baf594f4d3fda50e6e01a4967e695eef1356a853 | 39bef83f3a903f49344b907870feb10a3302e6e4 | /Android Studio Projects/bf.io.openshop/src/com/squareup/picasso/RemoteViewsAction$AppWidgetAction.java | 95ffff5cce09534643a8f3d0d819ae831a85a1b8 | [] | no_license | Killaker/Android | 456acf38bc79030aff7610f5b7f5c1334a49f334 | 52a1a709a80778ec11b42dfe9dc1a4e755593812 | refs/heads/master | 2021-08-19T06:20:26.551947 | 2017-11-24T22:27:19 | 2017-11-24T22:27:19 | 111,960,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 672 | java | package com.squareup.picasso;
import android.widget.*;
import android.appwidget.*;
static class AppWidgetAction extends RemoteViewsAction
{
private final int[] appWidgetIds;
AppWidgetAction(final Picasso picasso, final Request request, final RemoteViews remoteViews, final int n, final int[] appWidgetIds, final int n2, final int n3, final String s, final Object o, final int n4) {
super(picasso, request, remoteViews, n, n4, n2, n3, o, s);
this.appWidgetIds = appWidgetIds;
}
@Override
void update() {
AppWidgetManager.getInstance(this.picasso.context).updateAppWidget(this.appWidgetIds, this.remoteViews);
}
}
| [
"ema1986ct@gmail.com"
] | ema1986ct@gmail.com |
6cd4149f6d904a06b4c8630f178cc4eff9a7541d | e55067d101059890dcd655042bccc8adb43a292c | /src/main/java/com/hk/hksales/controller/ProductController.java | 152bde52163eb30c02ca4190c91ff6873e62edd5 | [] | no_license | sachinGBrightLifecare/HK_sale_web | 58e54124fe7ed7e1e9c7dd7cfdebd0fc8113c13f | d1b85172d3bd68adbb839ed75462f680706ad66b | refs/heads/master | 2021-06-22T02:40:48.097384 | 2019-11-15T14:07:32 | 2019-11-15T14:07:32 | 221,936,069 | 0 | 0 | null | 2021-06-04T02:18:54 | 2019-11-15T14:05:18 | CSS | UTF-8 | Java | false | false | 954 | java | package com.hk.hksales.controller;
import com.hk.hksales.dto.listing.ListingRequest;
import com.hk.hksales.dto.product.VariantDetail;
import com.hk.hksales.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import java.util.Map;
@Controller
public class ProductController {
@Autowired
private IProductService productService;
@RequestMapping("/getProductList")
public String getProductList(@ModelAttribute ListingRequest listingRequest,Map<String, Object> model) {
listingRequest.setPageNumber(1);
List<VariantDetail> variantDetailList = productService.getVariantList(listingRequest);
model.put("variantDetailList",variantDetailList);
return "productList";
}
}
| [
"sumitkumarhk@github.com"
] | sumitkumarhk@github.com |
e54c3a9cfccf58f7facfd34cd0b62d11668d0e5f | 2a4dae52f25ae52d2d1099e816cfbfe6ca087fde | /Smart Doctor's Prescription/minorthree/app/src/main/java/com/example/adhiksha/minorthree/MainActivity.java | 151f2f15002379cb2456f3dca01c2d6d50184cb7 | [] | no_license | yushanttyagi/Smart-Doctor-s-Prescription-Android-App | a6b318b40c5ad9f49833d0a658135c96a5ee76ab | 5ceb5d504280670b9d58c5728d0a2f0d1ddbc1b3 | refs/heads/master | 2022-09-24T23:33:37.134800 | 2020-06-07T19:31:26 | 2020-06-07T19:31:26 | 270,406,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,825 | java | package com.example.adhiksha.minorthree;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.media.MediaRecorder;
import android.net.Uri;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.journeyapps.barcodescanner.BarcodeEncoder;
import java.io.DataOutput;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private Button button,fetch,button2,button3,button7,button8;private MediaRecorder recorder;EditText editText1,editText2;
TextView textView;boolean flagg=false;
private String filename=null;private static final String LOG_TAG="Record_log";
StorageReference reference;ProgressDialog progressDialog;
public static ArrayList<String> names=new ArrayList<String>();SharedPreferences sharedPreferences;
public static ArrayList<String> details=new ArrayList<String>();
public static ArrayList<String> address=new ArrayList<String>();
public static String audio;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button=(Button) findViewById(R.id.button);
button8=(Button) findViewById(R.id.button8);
button2=(Button) findViewById(R.id.button2);
button3=(Button) findViewById(R.id.button3);
button7=(Button) findViewById(R.id.button7);
textView=(TextView) findViewById(R.id.textView2);
textView.setSelected(true);
editText1=findViewById(R.id.editText);
editText2=findViewById(R.id.editText3);
reference=FirebaseStorage.getInstance().getReference();
progressDialog=new ProgressDialog(MainActivity.this);
filename=Environment.getExternalStorageDirectory().getAbsolutePath();
filename+="/recorded_ytt.mp3";
Random random=new Random();
int abc=random.nextInt(10001-0)+0;
editText1.setText(String.valueOf(abc));
/* button.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction()==MotionEvent.ACTION_DOWN){
Toast.makeText(getApplicationContext(),"started recording",Toast.LENGTH_SHORT).show();
startRecording();
}else if(event.getAction()==MotionEvent.ACTION_UP){
Toast.makeText(getApplicationContext(),"stopped recording",Toast.LENGTH_SHORT).show();
stopRecording();
}
return false;
}
});*/
editText2.setText("Name:\nAge:\nGender:\nAddress:");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean flag=false;
if (editText1.getText().toString().isEmpty()){
Toast.makeText(getApplicationContext(), "please enter a patient id", Toast.LENGTH_SHORT).show();
}
else {
for (int i = 0; i < names.size(); i++) {
if (names.get(i).equals(editText1.getText().toString())) {
flag=true;Toast.makeText(getApplicationContext(), "patient id already exists", Toast.LENGTH_SHORT).show();
break;
}
}
if(!flag){
flagg=true;
Toast.makeText(getApplicationContext(), "started recording", Toast.LENGTH_SHORT).show();
startRecording();
}
}
// Toast.makeText(getApplicationContext(), "started recording", Toast.LENGTH_SHORT).show();
// startRecording();
}
});
button8.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(flagg) {
flagg=false;
Toast.makeText(getApplicationContext(), "stopped recording", Toast.LENGTH_SHORT).show();
stopRecording();
}
else{
Toast.makeText(getApplicationContext(), "please start the recording first", Toast.LENGTH_SHORT).show();
}
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,qrimage.class);
intent.putExtra("nameofqr",audio);
startActivity(intent);
}
});
//address.add("this is address");
//names.add("yushant");
//details.add("age:19\nsex:male\naddress:new delhi");
sharedPreferences=this.getSharedPreferences("com.example.sharedpreferences",Context.MODE_PRIVATE);
/*try {
sharedPreferences.edit().putString("names",sharedpreferences.serialize(names)).apply();
sharedPreferences.edit().putString("details",sharedpreferences.serialize(details)).apply();
sharedPreferences.edit().putString("addr",sharedpreferences.serialize(address)).apply();
} catch (IOException e) {
e.printStackTrace();
}*/
address.add("hello");
try {
names=(ArrayList<String>) sharedpreferences.deserialize(sharedPreferences.getString("names",sharedpreferences.serialize(new ArrayList<>())));
details=(ArrayList<String>) sharedpreferences.deserialize(sharedPreferences.getString("details",sharedpreferences.serialize(new ArrayList<>())));
address=(ArrayList<String>) sharedpreferences.deserialize(sharedPreferences.getString("addr",sharedpreferences.serialize(new ArrayList<>())));
} catch (IOException e) {
e.printStackTrace();
}
Log.i("nameee is ",names.toString());
Log.i("details are ",details.toString());
Log.i("address are ",address.toString());
//address.add("hell");
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean flag=false;
if (editText1.getText().toString().isEmpty()) {
Toast.makeText(getApplicationContext(), "please enter a patient id", Toast.LENGTH_SHORT).show();
}
else {
for (int i = 0; i < names.size(); i++) {
if (names.get(i).equals(editText1.getText().toString())) {
flag=true;Toast.makeText(getApplicationContext(), "patient id already exists", Toast.LENGTH_SHORT).show();
break;
}
}
if(!flag){
String name=editText1.getText().toString();
String detail=editText2.getText().toString();
names.add(name);details.add(detail);
try {
sharedPreferences.edit().putString("names",sharedpreferences.serialize(names)).apply();
sharedPreferences.edit().putString("details",sharedpreferences.serialize(details)).apply();
} catch (IOException e) {
e.printStackTrace();
}
Toast.makeText(MainActivity.this,"entered successfully",Toast.LENGTH_SHORT).show();
}
}
}
});
button7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,detailsact.class);
startActivity(intent);
}
});
}
private void startRecording() {
recorder = new MediaRecorder();
recorder.reset();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setOutputFile(filename);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
try {
recorder.prepare();
recorder.start();
} catch (IOException e) {
Log.e(LOG_TAG, "prepare() failed");
}
}
private void stopRecording() {
recorder.stop();
recorder.release();
recorder = null;
upload();
}
public void upload(){
progressDialog.setMessage("started");progressDialog.show();
final StorageReference file=reference.child("Audio").child(editText1.getText().toString());
Uri uri= Uri.fromFile(new File(filename));
file.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"finished",Toast.LENGTH_SHORT).show();
file.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Uri downloadUrl = uri;
audio=downloadUrl.toString();address.add(audio);
try {
sharedPreferences.edit().putString("addr",sharedpreferences.serialize(address)).apply();
} catch (IOException e) {
e.printStackTrace();
}
//Toast.makeText(getApplicationContext(),audio,Toast.LENGTH_SHORT).show();
}
});
}
});
}
}
| [
"yushanttyagi@gmail.com"
] | yushanttyagi@gmail.com |
a5db4e32cc68e99800d27e5903913f907c3afda4 | 8d7d75be07e0b9d6bbc7f1f6e4574b765c8cf649 | /src/com/example/leetcode/Medium/IncreasingTripletSubsequence.java | bc4e962664223307ac8de4ff2394b7c502da1293 | [] | no_license | daoxiangcun/leetcode | 62b50175693e761b4a17a612f3ba4792d410bd67 | 56566f4316de62a20c15bf2b85ac46a193a4bf59 | refs/heads/master | 2016-08-11T13:21:09.753710 | 2016-04-09T10:06:41 | 2016-04-09T10:06:41 | 53,496,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.example.leetcode.Medium;
public class IncreasingTripletSubsequence {
public static boolean increasingTriplet(int[] nums) {
if (nums == null || nums.length < 3) {
return false;
}
int min = Integer.MAX_VALUE;
int secondMin = Integer.MAX_VALUE;
for(int value : nums) {
if (value <= min) {
min = value;
} else if (value <= secondMin) {
secondMin = value;
} else {
return true;
}
}
return false;
}
public static void main(String[] args) {
int[] nums = new int[]{1,2,3,4,5};
boolean has = increasingTriplet(nums);
System.out.println(has);
}
}
| [
"yuhongliang@xiaomi.com"
] | yuhongliang@xiaomi.com |
d1bb2b0c524b8a50f7edf474905fcbb148fc6dee | 6920b81d410f32ccd37d7e00aaa9b1f44a18ad4b | /app/src/main/java/cyh/com/weather/db/City.java | 9e9b8465c71155c584f6b4ec20f4b85e6c4401dd | [
"Apache-2.0"
] | permissive | dahaiChang/weather | a184f4edb73682074a512bde921a9e99c1573426 | 4e53bcad4fe2cdc4867acf0f568732c9032c6cab | refs/heads/master | 2020-04-11T05:54:48.713808 | 2018-12-13T06:47:19 | 2018-12-13T06:47:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | package cyh.com.weather.db;
import org.litepal.crud.DataSupport;
public class City extends DataSupport {
private int id;
private String cityName;
private int cityCode;
private int proviceId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public int getCityCode() {
return cityCode;
}
public void setCityCode(int cityCode) {
this.cityCode = cityCode;
}
public int getProviceId() {
return proviceId;
}
public void setProviceId(int proviceId) {
this.proviceId = proviceId;
}
}
| [
"406367076@qq.com"
] | 406367076@qq.com |
1a69e7678e2d5d6d9e3c1cadbf38747805f6e0d1 | 405ed46c373483de35ee017c9451454ab89dfc89 | /src/com/huawei/insa2/comm/smpp/SMPPTransaction.java | 07dc20d8cb5f622e69cf0dde2359408f8eed49dd | [] | no_license | TwitchKrystal/msgport-spring | f5016adce1a84fd4f9467f1728e0d3daefb13c15 | 057921f92da28604da9bd89230578a53bfffc18d | refs/heads/master | 2020-03-26T21:31:48.277307 | 2018-12-27T03:39:15 | 2018-12-27T03:39:15 | 145,393,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,664 | java | // Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: SMPPTransaction.java
package com.huawei.insa2.comm.smpp;
import com.huawei.insa2.comm.PException;
import com.huawei.insa2.comm.PLayer;
import com.huawei.insa2.comm.PMessage;
import com.huawei.insa2.comm.smpp.message.SMPPMessage;
import com.huawei.insa2.util.Debug;
// Referenced classes of package com.huawei.insa2.comm.smpp:
// SMPPConnection, SMPPConstant
public class SMPPTransaction extends PLayer
{
private SMPPMessage receive;
private int sequenceId;
public SMPPTransaction(PLayer connection)
{
super(connection);
sequenceId = id;
}
public synchronized void onReceive(PMessage msg)
{
receive = (SMPPMessage)msg;
sequenceId = receive.getSequenceId();
if(SMPPConstant.debug)
Debug.dump(receive.toString());
notifyAll();
}
public void send(PMessage message)
throws PException
{
SMPPMessage mes = (SMPPMessage)message;
mes.setSequenceId(sequenceId);
parent.send(message);
if(SMPPConstant.debug)
Debug.dump(mes.toString());
}
public SMPPMessage getResponse()
{
return receive;
}
public synchronized void waitResponse()
{
if(receive == null)
try
{
wait(((SMPPConnection)parent).getTransactionTimeout());
}
catch(InterruptedException interruptedexception) { }
}
}
| [
"2918377838@qq.com"
] | 2918377838@qq.com |
1131e385c2d403ebc727b5685bed8149f4c912a0 | 958b13739d7da564749737cb848200da5bd476eb | /src/main/java/com/alipay/api/domain/AlipayDataAiserviceCloudbusAvailableQueryModel.java | baf89d380f3b01aafd8139864c494f3a99081d0b | [
"Apache-2.0"
] | permissive | anywhere/alipay-sdk-java-all | 0a181c934ca84654d6d2f25f199bf4215c167bd2 | 649e6ff0633ebfca93a071ff575bacad4311cdd4 | refs/heads/master | 2023-02-13T02:09:28.859092 | 2021-01-14T03:17:27 | 2021-01-14T03:17:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,089 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* ๆฅ่ฏขๅฏ็จๅ
ฌไบคodๆไปฝ
*
* @author auto create
* @since 1.0, 2020-10-21 10:38:05
*/
public class AlipayDataAiserviceCloudbusAvailableQueryModel extends AlipayObject {
private static final long serialVersionUID = 4751529656186347886L;
/**
* ๅ
้จๆๅกๆฅๅฃ็ๆฌๅท
*/
@ApiField("app_version")
private String appVersion;
/**
* ๅธ
*/
@ApiField("city_code")
private String cityCode;
/**
* ๅๆทID
*/
@ApiField("partner_id")
private String partnerId;
public String getAppVersion() {
return this.appVersion;
}
public void setAppVersion(String appVersion) {
this.appVersion = appVersion;
}
public String getCityCode() {
return this.cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getPartnerId() {
return this.partnerId;
}
public void setPartnerId(String partnerId) {
this.partnerId = partnerId;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
52d6769c446d8a79d5f900fad173be78b1b666ef | b88a3630f6db4f1a7e1622d8de0b264e3208197a | /src/main/java/com/siszo/sisproj/addrbook/addrgroup/model/AddrGroupDAO.java | 25d5234860474244e62945396f8881efdfd5ded2 | [] | no_license | sisproj/sisproj | be880fc9e03a2e9b199d5879dd931de7cb4de18c | 77ac6c4ebc97d80a5faf2e33000e90648986a1cf | refs/heads/master | 2021-05-06T15:03:34.171090 | 2018-01-23T12:58:36 | 2018-01-23T12:58:36 | 113,437,200 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.siszo.sisproj.addrbook.addrgroup.model;
import java.util.List;
public interface AddrGroupDAO {
public List<AddrGroupVO> selectGroupName(int empNo);
public int insertGroup(AddrGroupVO groupVo);
public int insertGroupDefault(AddrGroupVO groupVo);
public int deleteGroup(int groupNo);
public int countGroup(int empNo);
}
| [
"mabus23@naver.com"
] | mabus23@naver.com |
d33bd07602de1f3c4e5183da4d05bcd2edb91e9c | 72819ecfd3d932d83cbf1508a6ecfdce9327bce6 | /src/AbstractFactoryPattern/whiteHuman/WhiteMaleHuman.java | 561978733f796ad400986a51b60f2eca30ec3a4b | [] | no_license | ZihaoQin/DesignPatterns | 2082ce69acc7e474c18896346ed0e8d66645f5f3 | 9b44e10d9eeb74c0789dd990cb0f12405329391d | refs/heads/master | 2020-05-07T18:37:39.236920 | 2019-05-05T04:19:54 | 2019-05-05T04:19:54 | 180,717,230 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package AbstractFactoryPattern.whiteHuman;
/**
* @ClassName:WhiteMaleHuman.java
* @Description:TODO ๏ผ๏ผ
* @Author:qzh
* @Date: 2019/3/27 19:08
* @Version 1.0
*/
public class WhiteMaleHuman extends AbstractWhileHuman {
@Override
public void sex() {
System.out.println("่ฏฅ็ฝ็งไบบ็ๆงๅซไธบ็ท....");
}
}
| [
"302763362@qq.com"
] | 302763362@qq.com |
55a1903df0af04b62fd8b9e96e5e80b5ed993f6a | 8ed0125275b9b453553d5e92238fd91a666629ec | /Pandu/src/Thread/Threadtwice.java | 210e9e8f8525431ffd78a8e9609e5b4211efdd27 | [] | no_license | sitaramaraju123/Core | 3ae8d0a04284587c71d8d84ca78f9463327f244e | 59b48cdcb1d2bc8176a664723ae77f1030e8274a | refs/heads/master | 2023-03-21T23:05:41.398893 | 2021-03-16T05:18:20 | 2021-03-16T05:18:20 | 341,440,459 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package Thread;
public class Threadtwice extends Thread{
public static void main(String[] args) {
Threadtwice t = new Threadtwice();
t.start();
t.start(); //Same thread Stating Again
}
public void run() {
System.out.println("Processing...");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
2e18fdb077d66b1c0f7f8e5135a03f51ea1e8a73 | 29196e2d4adfb14ddd7c2ca8c1e60f8c10c26dad | /src/main/java/it/csi/siac/siacfinser/frontend/webservice/msg/CancellaSoggetto.java | e5b834146fd1c4140c868f0e3c60cc055eb43d4d | [] | no_license | unica-open/siacbilitf | bbeef5ceca40e9fb83d5b1176e7f54e8d84592bf | 85f3254c05c719a0016fe55cea1a105bcb6b89b2 | refs/heads/master | 2021-01-06T14:51:17.786934 | 2020-03-03T13:27:47 | 2020-03-03T13:27:47 | 241,366,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java | /*
*SPDX-FileCopyrightText: Copyright 2020 | CSI Piemonte
*SPDX-License-Identifier: EUPL-1.2
*/
package it.csi.siac.siacfinser.frontend.webservice.msg;
import javax.xml.bind.annotation.XmlType;
import it.csi.siac.siaccorser.model.Ente;
import it.csi.siac.siacfinser.frontend.webservice.FINSvcDictionary;
import it.csi.siac.siacfinser.model.soggetto.Soggetto;
/**
* Permette l'eliminazione di un particolare soggetto.
* @author andrea.colombo
*
*/
@XmlType(namespace = FINSvcDictionary.NAMESPACE)
public class CancellaSoggetto extends AbstractSoggettoServiceRequest{
private Ente ente;
private Soggetto soggetto;
public Ente getEnte() {
return ente;
}
public void setEnte(Ente ente) {
this.ente = ente;
}
public Soggetto getSoggetto() {
return soggetto;
}
public void setSoggetto(Soggetto soggetto) {
this.soggetto = soggetto;
}
}
| [
"barbara.malano@csi.it"
] | barbara.malano@csi.it |
c9ab03fd9b26d34faeae43bf0f1aad70f229cb33 | e5c563d318241dc656ef543a30386580311edc50 | /Wechat_group_send_17_07_02_17_35/app/src/main/java/com/example/a90678/wechat_group_send_17_07_02_17_35/utils/Navigator.java | 702712a1af6947a3bd52ded25254af657b206615 | [
"Apache-2.0"
] | permissive | isoundy000/pc-android-controller-android | b1b174f06e183400199a2bd4f8123cc668c0e4fe | 775a4f30dbe036863db476ce1e352e9d50881450 | refs/heads/master | 2021-06-28T12:46:03.657965 | 2017-09-18T13:29:24 | 2017-09-18T13:29:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,072 | java | package com.example.a90678.wechat_group_send_17_07_02_17_35.utils;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import com.example.a90678.wechat_group_send_17_07_02_17_35.access.AccessUtil;
/**
* Created by 90678 on 2017/7/27.
*/
public class Navigator {
public static void launchMain (Context context) {
// Intent intent = new Intent(Intent.ACTION_MAIN);
// intent.addCategory(Intent.CATEGORY_LAUNCHER);
// context.startActivity(intent);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ComponentName cn = new ComponentName("com.example.a90678.wechat_group_send_17_07_02_17_35",
"com.example.a90678.wechat_group_send_17_07_02_17_35.access.MainActivity");
intent.setComponent(cn);
if (intent == null) {
L.e("intent is null ");
return;
}
;
context.startActivity(intent);
}
}
| [
"906786621@qq.com"
] | 906786621@qq.com |
ef82235c5d0c274712ee7459de66e98d531ae299 | 680bbcfe0743fb1ccbb659ec7d2486b2e3aae839 | /framework/src/main/java/framework/annotation/AnnotaionBean.java | 4d947896c0039067e1d1145150da1ae7b3add995 | [] | no_license | mmsapling/StudyInBlank | aa1c6d7773ea7f90b0eb7f99a2615fbe909a6339 | 19909c18be5eccbaf4cd5d1c8f2ebf2414d84d95 | refs/heads/master | 2021-01-16T23:19:37.610342 | 2017-06-29T03:27:46 | 2017-06-29T03:28:40 | 95,730,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package framework.annotation;
import android.support.annotation.Nullable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/*
* @ๅๅปบ่
: xuanwen
* @ๅๅปบๆถ้ด: 2017/3/21 11:06
* @ๆ่ฟฐ๏ผ TODO
*/
public class AnnotaionBean {
private int age;
private String name;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Test{
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Nullable
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"13652304622@163.com"
] | 13652304622@163.com |
8521b3d41bad8c12f6e1cc73b2eff07e9967204e | 7a2dca53379d2324deff84c1fefcf89a897604c4 | /src/main/java/com/webbanhang2/service/UserService.java | 9fdca24354025557543acf9671ecaf6ef533016e | [] | no_license | 6SieuNhan/wooden-furniture-store | 24405e36fcda08f604c6bb27666638b1f378ce48 | 29fabb2c4edc07ee88e72f2a4ffaaab29629d910 | refs/heads/master | 2020-04-23T15:56:03.599012 | 2019-05-07T15:01:34 | 2019-05-07T15:01:34 | 171,281,276 | 2 | 0 | null | 2019-05-07T15:01:35 | 2019-02-18T12:35:30 | Java | UTF-8 | Java | false | false | 1,075 | 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.webbanhang2.service;
import com.webbanhang2.model.User;
import java.util.List;
/**
*
* @author fkien
*/
public interface UserService {
public boolean registerUser(User user);
List<User> getUserList(String userQuery, String emailQuery, String addressQuery, String phoneQuery, int userRoleId, int top, int count);
int getUserListPageCount(String userQuery, String emailQuery, String addressQuery, String phoneQuery, int userRoleId, int size);
public User getUser(User user);
public User getUserById(String userId);
public User getUserByName(String username);
public User getUserByEmail(String email);
public String createRecoveryCode(User user);
public boolean validateRecovery(String userId, String recoveryCode);
public boolean editUser(User user);
public boolean changePassword(String userId, String password);
}
| [
"f.kien1997@gmail.com"
] | f.kien1997@gmail.com |
4735254181ef884e9bed7fb041516f85df72adec | 483681599673ddd3faab72dc3cd142293dd54f5c | /final_Project/src/Recommend/EvaluatorIntro.java | a041a3ec162d453f6528ae0944228722454b0ace | [] | no_license | jieon2/jieon_git | c2800c7c92e31ea66cc7b0e5d18c5e57b692d062 | 62e97a25a2f2721ab018df800e42bd016145fbee | refs/heads/master | 2023-01-13T02:08:55.297678 | 2020-11-19T21:59:58 | 2020-11-19T21:59:58 | 297,381,722 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,911 | java | package Recommend;
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.eval.RecommenderBuilder;
import org.apache.mahout.cf.taste.eval.RecommenderEvaluator;
import org.apache.mahout.cf.taste.impl.eval.AverageAbsoluteDifferenceRecommenderEvaluator;
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood;
import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender;
import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood;
import org.apache.mahout.cf.taste.recommender.Recommender;
import org.apache.mahout.cf.taste.similarity.UserSimilarity;
import org.apache.mahout.common.RandomUtils;
import java.io.File;
class EvaluatorIntro {
private EvaluatorIntro() {
}
public static void main(String[] args) throws Exception {
RandomUtils.useTestSeed();
DataModel model = new FileDataModel(new File("C:/UserData/data.csv"));
RecommenderEvaluator evaluator =
new AverageAbsoluteDifferenceRecommenderEvaluator();
// Build the same recommender for testing that we did last time:
RecommenderBuilder recommenderBuilder = new RecommenderBuilder() {
@Override
public Recommender buildRecommender(DataModel model) throws TasteException {
UserSimilarity similarity = new PearsonCorrelationSimilarity(model);
UserNeighborhood neighborhood =
new NearestNUserNeighborhood(2, similarity, model);
return new GenericUserBasedRecommender(model, neighborhood, similarity);
}
};
// Use 70% of the data to train; test using the other 30%.
double score = evaluator.evaluate(recommenderBuilder, null, model, 0.7, 1.0);
System.out.println(score);
}
} | [
"qwwa79@naver.com"
] | qwwa79@naver.com |
5914ddad3e2977acca184aa265e53a38236b3eb9 | 34a943b1012856cf112cc8aee247f356f5dc8153 | /app/src/main/java/dev/qbikkx/keepsolidone/storage/database/NewsSQLiteOpenHelper.java | f07743380c2b685af6f7001ad3d8a99f912f90ae | [] | no_license | qbikkx/NewsApp | f5b0307c9306fe12414e6a57807e6df98052c7d2 | 894f6ee41b1ab2b14080a9dd8ba8f4ffbefd641d | refs/heads/master | 2021-07-06T05:04:44.511699 | 2017-10-01T17:44:31 | 2017-10-01T17:44:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,888 | java | package dev.qbikkx.keepsolidone.storage.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import dev.qbikkx.keepsolidone.storage.database.NewsDbSchema.NewsTable;
/**
* @author <a href="mailto:qbikkx@gmail.com">qbikkx</a>
*/
public class NewsSQLiteOpenHelper extends SQLiteOpenHelper {
private static final int VERSION = 2;
static final String DATABASE_NAME = "newsDataBase.db";
public NewsSQLiteOpenHelper(Context context) {
super(context, DATABASE_NAME, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "create table " +
NewsTable.NAME +
"( " + NewsTable.Cols._ID + " integer primary key autoincrement, " +
NewsTable.Cols.AUTHOR + ", " +
NewsTable.Cols.TITLE + ", " +
NewsTable.Cols.DESC + ", " +
NewsTable.Cols.URL + " text not null unique, " +
NewsTable.Cols.URL_TO_IMAGE + ", " +
NewsTable.Cols.PUBLISHED_AT + " integer )";
db.execSQL(sql);
db.execSQL("CREATE TRIGGER insert_news_trigger AFTER INSERT ON " + NewsTable.NAME +
" WHEN (SELECT count(*) FROM " + NewsTable.NAME + ") > " + NewsTable.MAX_CAPACITY +
" BEGIN " +
" delete from " + NewsTable.NAME +
" where " + NewsTable.Cols.PUBLISHED_AT +
" = (select min(" + NewsTable.Cols.PUBLISHED_AT +
") from " + NewsTable.NAME + ");" +
" END;"
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//todo migrate
db.execSQL("DROP TABLE IF EXISTS " + NewsTable.NAME);
onCreate(db);
}
}
| [
"qbikkx@gmail.com"
] | qbikkx@gmail.com |
fd78f5a4614a7c01b9f716ad328b5a7974a580dd | 55a71c9d16df91af89f698e8f7038abc47f30799 | /src/main/java/com/noptech/vcta/jhipster/config/JHipsterProperties.java | 9b18ace1e469cfaec9b2021bc9da8339cf5dfc12 | [] | no_license | Madsn/vcta-jhipster | 42ed6c02d6059735d631cd6715fec4ac0fa0176b | b73b84f2e9d4d891c9cd7a6ac5d95d75ca4d343f | refs/heads/master | 2021-01-10T17:00:35.247159 | 2016-03-06T22:53:49 | 2016-03-06T22:53:49 | 51,701,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,450 | java | package com.noptech.vcta.jhipster.config;
import javax.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.web.cors.CorsConfiguration;
/**
* Properties specific to JHipster.
*
* <p>
* Properties are configured in the application.yml file.
* </p>
*/
@ConfigurationProperties(prefix = "jhipster", ignoreUnknownFields = false)
public class JHipsterProperties {
private final Async async = new Async();
private final Http http = new Http();
private final Datasource datasource = new Datasource();
private final Cache cache = new Cache();
private final Mail mail = new Mail();
private final Security security = new Security();
private final Swagger swagger = new Swagger();
private final Metrics metrics = new Metrics();
private final CorsConfiguration cors = new CorsConfiguration();
public Async getAsync() {
return async;
}
public Http getHttp() {
return http;
}
public Datasource getDatasource() {
return datasource;
}
public Cache getCache() {
return cache;
}
public Mail getMail() {
return mail;
}
public Security getSecurity() {
return security;
}
public Swagger getSwagger() {
return swagger;
}
public Metrics getMetrics() {
return metrics;
}
public CorsConfiguration getCors() {
return cors;
}
public static class Async {
private int corePoolSize = 2;
private int maxPoolSize = 50;
private int queueCapacity = 10000;
public int getCorePoolSize() {
return corePoolSize;
}
public void setCorePoolSize(int corePoolSize) {
this.corePoolSize = corePoolSize;
}
public int getMaxPoolSize() {
return maxPoolSize;
}
public void setMaxPoolSize(int maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
public int getQueueCapacity() {
return queueCapacity;
}
public void setQueueCapacity(int queueCapacity) {
this.queueCapacity = queueCapacity;
}
}
public static class Http {
private final Cache cache = new Cache();
public Cache getCache() {
return cache;
}
public static class Cache {
private int timeToLiveInDays = 31;
public int getTimeToLiveInDays() {
return timeToLiveInDays;
}
public void setTimeToLiveInDays(int timeToLiveInDays) {
this.timeToLiveInDays = timeToLiveInDays;
}
}
}
public static class Datasource {
private boolean cachePrepStmts = true;
private int prepStmtCacheSize = 250;
private int prepStmtCacheSqlLimit = 2048;
private boolean useServerPrepStmts = true;
public boolean isCachePrepStmts() {
return cachePrepStmts;
}
public void setCachePrepStmts(boolean cachePrepStmts) {
this.cachePrepStmts = cachePrepStmts;
}
public int getPrepStmtCacheSize() {
return prepStmtCacheSize;
}
public void setPrepStmtCacheSize(int prepStmtCacheSize) {
this.prepStmtCacheSize = prepStmtCacheSize;
}
public int getPrepStmtCacheSqlLimit() {
return prepStmtCacheSqlLimit;
}
public void setPrepStmtCacheSqlLimit(int prepStmtCacheSqlLimit) {
this.prepStmtCacheSqlLimit = prepStmtCacheSqlLimit;
}
public boolean isUseServerPrepStmts() {
return useServerPrepStmts;
}
public void setUseServerPrepStmts(boolean useServerPrepStmts) {
this.useServerPrepStmts = useServerPrepStmts;
}
}
public static class Cache {
private int timeToLiveSeconds = 3600;
private final Ehcache ehcache = new Ehcache();
public int getTimeToLiveSeconds() {
return timeToLiveSeconds;
}
public void setTimeToLiveSeconds(int timeToLiveSeconds) {
this.timeToLiveSeconds = timeToLiveSeconds;
}
public Ehcache getEhcache() {
return ehcache;
}
public static class Ehcache {
private String maxBytesLocalHeap = "16M";
public String getMaxBytesLocalHeap() {
return maxBytesLocalHeap;
}
public void setMaxBytesLocalHeap(String maxBytesLocalHeap) {
this.maxBytesLocalHeap = maxBytesLocalHeap;
}
}
}
public static class Mail {
private String from = "vcta@localhost";
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
}
public static class Security {
private final Rememberme rememberme = new Rememberme();
public Rememberme getRememberme() {
return rememberme;
}
public static class Rememberme {
@NotNull
private String key;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
public static class Swagger {
private String title = "vcta API";
private String description = "vcta API documentation";
private String version = "0.0.1";
private String termsOfServiceUrl;
private String contact;
private String license;
private String licenseUrl;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getTermsOfServiceUrl() {
return termsOfServiceUrl;
}
public void setTermsOfServiceUrl(String termsOfServiceUrl) {
this.termsOfServiceUrl = termsOfServiceUrl;
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
public String getLicenseUrl() {
return licenseUrl;
}
public void setLicenseUrl(String licenseUrl) {
this.licenseUrl = licenseUrl;
}
}
public static class Metrics {
private final Jmx jmx = new Jmx();
private final Spark spark = new Spark();
private final Graphite graphite = new Graphite();
public Jmx getJmx() {
return jmx;
}
public Spark getSpark() {
return spark;
}
public Graphite getGraphite() {
return graphite;
}
public static class Jmx {
private boolean enabled = true;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
public static class Spark {
private boolean enabled = false;
private String host = "localhost";
private int port = 9999;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}
public static class Graphite {
private boolean enabled = false;
private String host = "localhost";
private int port = 2003;
private String prefix = "vcta";
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
}
}
}
| [
"m@madsn.net"
] | m@madsn.net |
776c3e1793d1027e769e65f421f2f1d9429b357c | ec1bf1967825cfca485de05c665c94bd8bcdca19 | /src/org/apache/xalan/processor/XSLProcessorVersion.java | adf189e3fd4da26939296f20f7e40262f3c1a696 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"SMLNJ",
"Apache-1.1",
"BSD-2-Clause",
"W3C",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive"
] | permissive | savster97/xalan-2.7.1 | 0ebae0c370b65a6e694597d611bb381d097f6122 | 407440cd30dd98a615ee33256c48604279568f32 | refs/heads/master | 2020-04-26T03:48:25.087928 | 2019-01-22T14:48:33 | 2019-01-22T14:48:33 | 173,279,703 | 0 | 0 | Apache-2.0 | 2019-03-01T10:06:34 | 2019-03-01T10:06:34 | null | UTF-8 | Java | false | false | 4,196 | 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.
*/
/*
* $Id: XSLProcessorVersion.src 468640 2006-10-28 06:53:53Z minchau $
*/
package org.apache.xalan.processor;
/**
* Administrative class to keep track of the version number of
* the Xalan release.
* <P>See also: org/apache/xalan/res/XSLTInfo.properties</P>
* @deprecated To be replaced by org.apache.xalan.Version.getVersion()
* @xsl.usage general
*/
public class XSLProcessorVersion
{
/**
* Print the processor version to the command line.
*
* @param argv command line arguments, unused.
*/
public static void main(String argv[])
{
System.out.println(S_VERSION);
}
/**
* Constant name of product.
*/
public static final String PRODUCT = "Xalan";
/**
* Implementation Language.
*/
public static final String LANGUAGE = "Java";
/**
* Major version number.
* Version number. This changes only when there is a
* significant, externally apparent enhancement from
* the previous release. 'n' represents the n'th
* version.
*
* Clients should carefully consider the implications
* of new versions as external interfaces and behaviour
* may have changed.
*/
public static final int VERSION = 2;
/**
* Release Number.
* Release number. This changes when:
* - a new set of functionality is to be added, eg,
* implementation of a new W3C specification.
* - API or behaviour change.
* - its designated as a reference release.
*/
public static final int RELEASE = 7;
/**
* Maintenance Drop Number.
* Optional identifier used to designate maintenance
* drop applied to a specific release and contains
* fixes for defects reported. It maintains compatibility
* with the release and contains no API changes.
* When missing, it designates the final and complete
* development drop for a release.
*/
public static final int MAINTENANCE = 1;
/**
* Development Drop Number.
* Optional identifier designates development drop of
* a specific release. D01 is the first development drop
* of a new release.
*
* Development drops are works in progress towards a
* compeleted, final release. A specific development drop
* may not completely implement all aspects of a new
* feature, which may take several development drops to
* complete. At the point of the final drop for the
* release, the D suffix will be omitted.
*
* Each 'D' drops can contain functional enhancements as
* well as defect fixes. 'D' drops may not be as stable as
* the final releases.
*/
public static final int DEVELOPMENT = 0;
/**
* Version String like <CODE>"<B>Xalan</B> <B>Language</B>
* v.r[.dd| <B>D</B>nn]"</CODE>.
* <P>Semantics of the version string are identical to the Xerces project.</P>
*/
public static final String S_VERSION = PRODUCT+" "+LANGUAGE+" "
+VERSION+"."+RELEASE+"."
+(DEVELOPMENT > 0 ? ("D"+DEVELOPMENT)
: (""+MAINTENANCE));
}
| [
"taibi@sonar-scheduler.rd.tut.fi"
] | taibi@sonar-scheduler.rd.tut.fi |
6878175ff80472e3328fb6ac2db1df73f1cc0dbc | 80451a4fcfc64dcf0c428cf2014ea48ed00fb577 | /FaceEmojiClient/FaceEmojiClient.Droid/obj/Debug/android/src/md5b60ffeb829f638581ab2bb9b1a7f4f3f/TimePickerRenderer.java | 96de06f6e5d1bc4c478e49eaa24aa30bbff8dfc2 | [] | no_license | yue9944882/FaceEmojiXamarin | 932258a94bf7c80cd0d38df82df6eeb598d7a3d1 | ec0062a0ed44781dc0f895251c29c67b81d47c0c | refs/heads/master | 2020-04-06T06:59:32.243453 | 2016-09-01T08:04:32 | 2016-09-01T08:04:32 | 63,585,829 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,125 | java | package md5b60ffeb829f638581ab2bb9b1a7f4f3f;
public class TimePickerRenderer
extends md5b60ffeb829f638581ab2bb9b1a7f4f3f.ViewRenderer_2
implements
mono.android.IGCUserPeer,
android.app.TimePickerDialog.OnTimeSetListener
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"n_onTimeSet:(Landroid/widget/TimePicker;II)V:GetOnTimeSet_Landroid_widget_TimePicker_IIHandler:Android.App.TimePickerDialog/IOnTimeSetListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" +
"";
mono.android.Runtime.register ("Xamarin.Forms.Platform.Android.TimePickerRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", TimePickerRenderer.class, __md_methods);
}
public TimePickerRenderer (android.content.Context p0) throws java.lang.Throwable
{
super (p0);
if (getClass () == TimePickerRenderer.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.TimePickerRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0 });
}
public TimePickerRenderer (android.content.Context p0, android.util.AttributeSet p1) throws java.lang.Throwable
{
super (p0, p1);
if (getClass () == TimePickerRenderer.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.TimePickerRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0, p1 });
}
public TimePickerRenderer (android.content.Context p0, android.util.AttributeSet p1, int p2) throws java.lang.Throwable
{
super (p0, p1, p2);
if (getClass () == TimePickerRenderer.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.TimePickerRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", this, new java.lang.Object[] { p0, p1, p2 });
}
public void onTimeSet (android.widget.TimePicker p0, int p1, int p2)
{
n_onTimeSet (p0, p1, p2);
}
private native void n_onTimeSet (android.widget.TimePicker p0, int p1, int p2);
private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
| [
"291271447@qq.com"
] | 291271447@qq.com |
fee2f18f65d901345ca8c8b94d327852b7491e54 | e80141d418f0fbbc7979a6a659d7a63cce2381d1 | /src/Ex49.java | 429dd619fb6b3314fc85f6c5acbd28f9dc75d8d6 | [] | no_license | AndreVilson/ExerciciosAula17Parte7 | 13daffd6957e26d6abd414a311d2031a74d433a6 | 2fa451c3526e896bdab44d6dc5bbfdfe8373c544 | refs/heads/master | 2023-07-08T06:29:50.929640 | 2021-08-10T02:06:24 | 2021-08-10T02:06:24 | 394,496,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | package ExerciciosAula17;
import java.util.Scanner;
/*Faรงa um programa que mostre os n termos da Sรฉrie a seguir:
S = 1/1 + 2/3 + 3/5 + 4/7 + 5/9 + ... + n/m.
Imprima no final a soma da sรฉrie.*/
public class Ex49 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Digite nรบmero do termo da sรฉrie");
int n = scan.nextInt();
double soma = 0;
double k = 1;
for (int i = 1, j = 1; i <= n; i++, j += 2) {
System.out.print(i + "/" + j + " + ");
soma += k / j;
k++;
}
System.out.println("\nSoma = " + soma);
}
}
| [
"andrevilson.pinto@gmail.com"
] | andrevilson.pinto@gmail.com |
c806fc267384bede13a5ebe6e433f44edeb1ce16 | 21e128cfaea2c6c0b42386925a4750239f703f01 | /src/Collections/Node.java | 4161fa89c663f9d8b91d0dd27902f51ade4b7d18 | [] | no_license | harrybournis/server-simulation-assignment | 8f9ce5bc1d5e4f66fb731a32700a5613f778f617 | 02c58d6818945945f26117aef2988ef66d8043f3 | refs/heads/master | 2020-12-30T12:00:55.069190 | 2017-05-16T19:03:56 | 2017-05-16T19:03:56 | 91,494,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package Collections;
public class Node
{
private Object item;
private Node next;
public Node(Object newItem)
{
item = newItem;
next = null;
}
public Node(Object newItem, Node nextNode)
{
item = newItem;
next = nextNode;
}
public void setItem(Object newItem)
{
item = newItem;
}
public Object getItem()
{
return item;
}
public void setNext(Node nextNode)
{
next = nextNode;
}
public Node getNext()
{
return next;
}
}
| [
"harrybournis@gmail.com"
] | harrybournis@gmail.com |
175099fab2a10f5ef6b346912c3f5534f60c1cee | d26f11c1611b299e169e6a027f551a3deeecb534 | /ui/navigator/org/fdesigner/navigator/internal/navigator/filters/CommonFilterDescriptor.java | 6dcc0130c4db95f5bbb0861bba22a2d7a8b5185d | [] | no_license | WeControlTheFuture/fdesigner-ui | 1bc401fd71a57985544220b9f9e42cf18db6491d | 62efb51e57e5d7f25654e67ef8b2762311b766b6 | refs/heads/master | 2020-11-24T15:00:24.450846 | 2019-12-27T08:47:23 | 2019-12-27T08:47:23 | 228,199,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,500 | java | /*******************************************************************************
* Copyright (c) 2006, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.fdesigner.navigator.internal.navigator.filters;
import org.fdesigner.expressions.Expression;
import org.fdesigner.navigator.ICommonFilterDescriptor;
import org.fdesigner.navigator.internal.navigator.CustomAndExpression;
import org.fdesigner.navigator.internal.navigator.NavigatorPlugin;
import org.fdesigner.navigator.internal.navigator.NavigatorSafeRunnable;
import org.fdesigner.navigator.internal.navigator.extensions.INavigatorContentExtPtConstants;
import org.fdesigner.runtime.common.runtime.IStatus;
import org.fdesigner.runtime.common.runtime.SafeRunner;
import org.fdesigner.runtime.registry.runtime.IConfigurationElement;
import org.fdesigner.ui.jface.viewers.ViewerFilter;
/**
*
* Describes a <b>commonFilter</b> element under a
* <b>org.eclipse.ui.navigator.navigatorContent</b> extension.
*
* @since 3.2
*
*/
public class CommonFilterDescriptor implements ICommonFilterDescriptor,
INavigatorContentExtPtConstants {
private IConfigurationElement element;
private Expression filterExpression;
private String id;
protected CommonFilterDescriptor(IConfigurationElement anElement) {
element = anElement;
init();
}
private void init() {
id = element.getAttribute(ATT_ID);
if (id == null) {
id = ""; //$NON-NLS-1$
}
IConfigurationElement[] children = element
.getChildren(TAG_FILTER_EXPRESSION);
if (children.length == 1) {
filterExpression = new CustomAndExpression(children[0]);
}
}
/**
*
* @return An identifier used to determine whether the filter is visible.
* May not be unique.
*/
@Override
public String getId() {
return id;
}
/**
*
* @return A translated name to identify the filter
*/
@Override
public String getName() {
return element.getAttribute(ATT_NAME);
}
/**
*
* @return A translated description to explain to the user what the defined
* filter will hide from the view.
*/
@Override
public String getDescription() {
return element.getAttribute(ATT_DESCRIPTION);
}
/**
*
* @return Indicates the filter should be in an "Active" state by default.
*/
@Override
public boolean isActiveByDefault() {
return Boolean.valueOf(element.getAttribute(ATT_ACTIVE_BY_DEFAULT))
.booleanValue();
}
/**
*
* @return Indicates the filter should be shown in the UI.
*/
public boolean isVisibleInUi() {
String attr = element.getAttribute(ATT_VISIBLE_IN_UI);
if (attr == null)
return true;
return Boolean.parseBoolean(attr);
}
/**
*
* @return An instance of the ViewerFilter defined by the extension. Callers
* of this method are responsible for managing the instantiated
* filter.
*/
public ViewerFilter createFilter() {
final ViewerFilter[] filter = new ViewerFilter[1];
SafeRunner.run(new NavigatorSafeRunnable() {
@Override
public void run() throws Exception {
if (filterExpression != null) {
if (element.getAttribute(ATT_CLASS) != null) {
NavigatorPlugin
.log(
IStatus.WARNING,
0,
"A \"commonFilter\" was specified in " + //$NON-NLS-1$
element.getDeclaringExtension()
.getContributor().getName()
+ " which specifies a \"class\" attribute and an Core Expression.\n" + //$NON-NLS-1$
"Only the Core Expression will be respected.", //$NON-NLS-1$
null);
}
filter[0] = new CoreExpressionFilter(filterExpression);
return;
}
filter[0] = (ViewerFilter) element.createExecutableExtension(ATT_CLASS);
}
});
if (filter[0] != null)
return filter[0];
return SkeletonViewerFilter.INSTANCE;
}
@Override
public String toString() {
return "CommonFilterDescriptor[" + getName() + " (" + getId() + ")]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
}
| [
"491676539@qq.com"
] | 491676539@qq.com |
0430a434cd2d0fd3509df6a7b950a5ab382a13b3 | 084ef7a556cd3429b7fb326390021bcdd1ba185b | /autodomum-core/src/test/java/com/autodomum/core/holiday/ChristmasDayTest.java | 30728a9443aaff90af0b75688efb83ea3672c7b7 | [
"MIT"
] | permissive | Kecon/Autodomum | adc18105563c34804840a93c87d1d43127c08891 | ff1a25d93a4b5237d62e538ccbfbfa70247c43b3 | refs/heads/master | 2021-01-10T16:44:54.953737 | 2016-04-16T09:05:45 | 2016-04-16T09:05:45 | 55,716,513 | 0 | 0 | null | 2016-04-16T09:05:45 | 2016-04-07T18:03:18 | Java | UTF-8 | Java | false | false | 1,622 | java | /**
* The MIT License (MIT)
*
* Copyright (c) 2016 Kenny Colliander Nordin
*
* 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.autodomum.core.holiday;
import java.text.ParseException;
import org.junit.Test;
/**
* Test of the <code>ChristmasDay</code> class
*
* @author Kenny Colliander Nordin
* @since 0.0.1
*/
public class ChristmasDayTest extends AbstractHolidayTest {
@Test
public void testIsHoliday() throws ParseException {
testHoliday(new ChristmasDay(), "2016-12-25", "2017-12-25", "2018-12-25", "2019-12-25");
}
}
| [
"kenny@kendanware.com"
] | kenny@kendanware.com |
a25df08a10ba43cfe1bbfe05d86f6f96272adc2e | 428a1a3b0a0857bc41b0fefc8158f6b475b9f829 | /app/src/test/java/com/example/benbriggs/golfscorecard/ExampleUnitTest.java | cb245625aa19838b277292ac418df62c9843d574 | [] | no_license | benbriggsy/GolfScoreCard | ee76d484979b763bd006e3324f948c4e62aaefe4 | ba65b4ab56bd6c1fd4ca08bab514878c7439c25e | refs/heads/master | 2021-06-06T19:40:34.053110 | 2016-09-22T14:06:24 | 2016-09-22T14:06:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.example.benbriggs.golfscorecard;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"benbriggsy@gmail.com"
] | benbriggsy@gmail.com |
7170005a6d7541780000d6a70c5eb3a143a1bc30 | ecf0b47e3e02e09222bc59e4d3b2ba0c8085d1d9 | /mobile/src/main/java/com/hackfsu/mobile/android/api/NetworkClient.java | ca795819ee8e7931fc39fe91404019582771c9b1 | [] | no_license | zendiii/HackFSU-Android | f57989d1d4ca6700cdc86f2b6381787d064db0bc | edc96f15ba1a2670180a4e266de063927e6f4971 | refs/heads/master | 2021-08-22T19:34:34.803951 | 2017-12-01T03:03:25 | 2017-12-01T03:03:25 | 106,199,390 | 0 | 0 | null | 2017-10-08T18:25:39 | 2017-10-08T18:25:39 | null | UTF-8 | Java | false | false | 1,682 | java | package com.hackfsu.mobile.android.api;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* Created by andrew on 11/14/16.
*/
public class NetworkClient {
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient httpClient = new OkHttpClient();
public void get(String url, final NetworkCallback callback) {
Request request = new Request.Builder()
.url(url)
.build();
Call call = httpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
callback.onFailure(e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
callback.onComplete(response.body().string());
}
});
}
// public void post(String url, String json, NetworkCallback callback) throws IOException {
// RequestBody body = RequestBody.create(JSON, json);
// Request request = new Request.Builder()
// .url(url)
// .post(body)
// .build();
// try (Response response = httpClient.newCall(request).execute()) {
// callback.onComplete(response.body().string());
// } catch (Exception e) {
// callback.onFailure(e);
// }
// }
public interface NetworkCallback {
void onComplete(String json);
void onFailure(Exception e);
}
}
| [
"andrewsosa001@gmail.com"
] | andrewsosa001@gmail.com |
bceeb6a56285d0a2d64fe1af6ee0d08dfaf6e911 | 416f32ce09bfa90368052ab69301ec9d32cd7bce | /video_demo/src/main/java/com/ruanchao/video_demo/PcmToWavUtil.java | f90aa134b75e9270f906314d78c7f525ab88fc55 | [] | no_license | Irwin-Yang/VideoEdit | 0c1a1439d755e3f874d8dd80410ecd6f5fd13042 | 932b60f7884678c5bcebe1471fbb2069266a2de0 | refs/heads/master | 2020-04-08T00:02:53.913569 | 2018-11-20T06:42:40 | 2018-11-20T06:42:40 | 158,835,531 | 4 | 0 | null | 2018-11-23T13:19:30 | 2018-11-23T13:19:29 | null | UTF-8 | Java | false | false | 4,078 | java | package com.ruanchao.video_demo;
import android.media.AudioFormat;
import android.media.AudioRecord;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class PcmToWavUtil {
/**
* ็ผๅญ็้ณ้ขๅคงๅฐ
*/
private int mBufferSize;
/**
* ้ๆ ท็
*/
private int mSampleRate;
/**
* ๅฃฐ้ๆฐ
*/
private int mChannel;
/**
* @param sampleRate sample rateใ้ๆ ท็
* @param channel channelใๅฃฐ้
* @param encoding Audio data formatใ้ณ้ขๆ ผๅผ
*/
PcmToWavUtil(int sampleRate, int channel, int encoding) {
this.mSampleRate = sampleRate;
this.mChannel = channel;
this.mBufferSize = AudioRecord.getMinBufferSize(mSampleRate, mChannel, encoding);
}
/**
* pcmๆไปถ่ฝฌwavๆไปถ
*
* @param inFilename ๆบๆไปถ่ทฏๅพ
* @param outFilename ็ฎๆ ๆไปถ่ทฏๅพ
*/
public void pcmToWav(String inFilename, String outFilename) {
FileInputStream in;
FileOutputStream out;
long totalAudioLen;
long totalDataLen;
long longSampleRate = mSampleRate;
int channels = mChannel == AudioFormat.CHANNEL_IN_MONO ? 1 : 2;
long byteRate = 16 * mSampleRate * channels / 8;
byte[] data = new byte[mBufferSize];
try {
in = new FileInputStream(inFilename);
out = new FileOutputStream(outFilename);
totalAudioLen = in.getChannel().size();
totalDataLen = totalAudioLen + 36;
writeWaveFileHeader(out, totalAudioLen, totalDataLen,
longSampleRate, channels, byteRate);
while (in.read(data) != -1) {
out.write(data);
}
in.close();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* ๅ ๅ
ฅwavๆไปถๅคด
*/
private void writeWaveFileHeader(FileOutputStream out, long totalAudioLen,
long totalDataLen, long longSampleRate, int channels, long byteRate)
throws IOException {
byte[] header = new byte[44];
// RIFF/WAVE header
header[0] = 'R';
header[1] = 'I';
header[2] = 'F';
header[3] = 'F';
header[4] = (byte) (totalDataLen & 0xff);
header[5] = (byte) ((totalDataLen >> 8) & 0xff);
header[6] = (byte) ((totalDataLen >> 16) & 0xff);
header[7] = (byte) ((totalDataLen >> 24) & 0xff);
//WAVE
header[8] = 'W';
header[9] = 'A';
header[10] = 'V';
header[11] = 'E';
// 'fmt ' chunk
header[12] = 'f';
header[13] = 'm';
header[14] = 't';
header[15] = ' ';
// 4 bytes: size of 'fmt ' chunk
header[16] = 16;
header[17] = 0;
header[18] = 0;
header[19] = 0;
// format = 1
header[20] = 1;
header[21] = 0;
header[22] = (byte) channels;
header[23] = 0;
header[24] = (byte) (longSampleRate & 0xff);
header[25] = (byte) ((longSampleRate >> 8) & 0xff);
header[26] = (byte) ((longSampleRate >> 16) & 0xff);
header[27] = (byte) ((longSampleRate >> 24) & 0xff);
header[28] = (byte) (byteRate & 0xff);
header[29] = (byte) ((byteRate >> 8) & 0xff);
header[30] = (byte) ((byteRate >> 16) & 0xff);
header[31] = (byte) ((byteRate >> 24) & 0xff);
// block align
header[32] = (byte) (2 * 16 / 8);
header[33] = 0;
// bits per sample
header[34] = 16;
header[35] = 0;
//data
header[36] = 'd';
header[37] = 'a';
header[38] = 't';
header[39] = 'a';
header[40] = (byte) (totalAudioLen & 0xff);
header[41] = (byte) ((totalAudioLen >> 8) & 0xff);
header[42] = (byte) ((totalAudioLen >> 16) & 0xff);
header[43] = (byte) ((totalAudioLen >> 24) & 0xff);
out.write(header, 0, 44);
}
} | [
"ruanchao@shuwen.com"
] | ruanchao@shuwen.com |
5ff0e9e90c3ff5673ed8d225fc3d283b51c85d9f | 9aaec9a8d7631f6c04ce8037e0fcb593e71fc0ca | /app/src/main/java/com/hsbank/luxclub/mywidget/recyclerview_pager/RecyclerViewPager.java | 88ad241105290d6ec4f30f1109978c82f390aff5 | [] | no_license | hanpenghu/luxclub_android | 7a43cd0c09035092883d1ddcdecc7e30b5134c6a | ae26af55c865d1178dd2dabafca018099e800048 | refs/heads/master | 2020-03-09T00:51:04.690255 | 2018-04-07T05:12:45 | 2018-04-07T05:12:45 | 128,498,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,814 | java | package com.hsbank.luxclub.mywidget.recyclerview_pager;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PointF;
import android.os.Build;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.LinearSmoothScroller;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewTreeObserver;
import com.hsbank.luxclub.BuildConfig;
import com.hsbank.luxclub.R;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
/**
* RecyclerViewPager
*
* @author Green
*/
public class RecyclerViewPager extends RecyclerView {
public static final boolean DEBUG = BuildConfig.DEBUG;
private RecyclerViewPagerAdapter<?> mViewPagerAdapter;
// ่งฆๅๆปๅจ็ๅๅง้ๅบฆ๏ผไป0ๅฐ1
private float mTriggerOffset = 0.25f;
// ๆงๅถ้กต้ขๆปๅจ็ๆฏๆง
private float mFlingFactor = 0.15f;
// ๆงๅถ้กต้ขๅๆข้ๅบฆ๏ผxmlไธญไธๅฏ้
, ้ป่ฎคไธบ 1
private int mFlingTime = 5;
private float mMillisecondsPerInch = 25f;
private float mTouchSpan;
private List<OnPageChangedListener> mOnPageChangedListeners;
private int mSmoothScrollTargetPosition = -1;
private int mPositionBeforeScroll = -1;
private boolean mSinglePageFling;
boolean isInertia = false; // inertia slide state
float minSlideDistance;
PointF touchStartPoint;
boolean mNeedAdjust;
int mFisrtLeftWhenDragging;
int mFirstTopWhenDragging;
View mCurView;
int mMaxLeftWhenDragging = Integer.MIN_VALUE;
int mMinLeftWhenDragging = Integer.MAX_VALUE;
int mMaxTopWhenDragging = Integer.MIN_VALUE;
int mMinTopWhenDragging = Integer.MAX_VALUE;
private int mPositionOnTouchDown = -1;
private boolean mHasCalledOnPageChanged = true;
private boolean reverseLayout = false;
private float mLastY;
public RecyclerViewPager(Context context) {
this(context, null);
}
public RecyclerViewPager(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RecyclerViewPager(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initAttrs(context, attrs, defStyle);
setNestedScrollingEnabled(false);
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
minSlideDistance = viewConfiguration.getScaledTouchSlop();
// ็ๅฌๆปๅจๅฎ็ฐ็ผฉๆพๆๆ
addOnLayoutChangeListener(layoutChangeListener);
addOnScrollListener(scrollListener);
}
private void initAttrs(Context context, AttributeSet attrs, int defStyle) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecyclerViewPager, defStyle,
0);
mFlingFactor = a.getFloat(R.styleable.RecyclerViewPager_rvp_flingFactor, mFlingFactor);
mTriggerOffset = a.getFloat(R.styleable.RecyclerViewPager_rvp_triggerOffset, mTriggerOffset);
mSinglePageFling = a.getBoolean(R.styleable.RecyclerViewPager_rvp_singlePageFling, mSinglePageFling);
isInertia = a.getBoolean(R.styleable.RecyclerViewPager_rvp_inertia, isInertia);
mMillisecondsPerInch = a.getFloat(R.styleable.RecyclerViewPager_rvp_millisecondsPerInch, mMillisecondsPerInch);
a.recycle();
}
public void setFlingFactor(float flingFactor) {
mFlingFactor = flingFactor;
}
public float getFlingFactor() {
return mFlingFactor;
}
public void setTriggerOffset(float triggerOffset) {
mTriggerOffset = triggerOffset;
}
public float getTriggerOffset() {
return mTriggerOffset;
}
public void setSinglePageFling(boolean singlePageFling) {
mSinglePageFling = singlePageFling;
}
public boolean isSinglePageFling() {
return mSinglePageFling;
}
public boolean isInertia() {
return isInertia;
}
public void setInertia(boolean inertia) {
isInertia = inertia;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
try {
Field fLayoutState = state.getClass().getDeclaredField("mLayoutState");
fLayoutState.setAccessible(true);
Object layoutState = fLayoutState.get(state);
Field fAnchorOffset = layoutState.getClass().getDeclaredField("mAnchorOffset");
Field fAnchorPosition = layoutState.getClass().getDeclaredField("mAnchorPosition");
fAnchorPosition.setAccessible(true);
fAnchorOffset.setAccessible(true);
if (fAnchorOffset.getInt(layoutState) > 0) {
fAnchorPosition.set(layoutState, fAnchorPosition.getInt(layoutState) - 1);
} else if (fAnchorOffset.getInt(layoutState) < 0) {
fAnchorPosition.set(layoutState, fAnchorPosition.getInt(layoutState) + 1);
}
fAnchorOffset.setInt(layoutState, 0);
} catch (Throwable e) {
e.printStackTrace();
}
super.onRestoreInstanceState(state);
}
@Override
public void setAdapter(Adapter adapter) {
mViewPagerAdapter = ensureRecyclerViewPagerAdapter(adapter);
super.setAdapter(mViewPagerAdapter);
}
@Override
public void swapAdapter(Adapter adapter, boolean removeAndRecycleExistingViews) {
mViewPagerAdapter = ensureRecyclerViewPagerAdapter(adapter);
super.swapAdapter(mViewPagerAdapter, removeAndRecycleExistingViews);
}
@Override
public Adapter getAdapter() {
if (mViewPagerAdapter != null) {
return mViewPagerAdapter.mAdapter;
}
return null;
}
public RecyclerViewPagerAdapter getWrapperAdapter() {
return mViewPagerAdapter;
}
@Override
public void setLayoutManager(LayoutManager layout) {
super.setLayoutManager(layout);
if (layout instanceof LinearLayoutManager) {
reverseLayout = ((LinearLayoutManager) layout).getReverseLayout();
}
}
@Override
public boolean fling(int velocityX, int velocityY) {
boolean flinging = super.fling((int) (velocityX * mFlingFactor), (int) (velocityY * mFlingFactor));
if (flinging) {
if (getLayoutManager().canScrollHorizontally()) {
adjustPositionX(velocityX);
} else {
adjustPositionY(velocityY);
}
}
if (DEBUG) {
Log.d("@", "velocityX:" + velocityX);
Log.d("@", "velocityY:" + velocityY);
}
return flinging;
}
@Override
public void smoothScrollToPosition(int position) {
if (DEBUG) {
Log.d("@", "smoothScrollToPosition:" + position);
}
if (mPositionBeforeScroll < 0) {
mPositionBeforeScroll = getCurrentPosition();
}
mSmoothScrollTargetPosition = position;
if (getLayoutManager() != null && getLayoutManager() instanceof LinearLayoutManager) {
// exclude item decoration
LinearSmoothScroller linearSmoothScroller =
new LinearSmoothScroller(getContext()) {
@Override
public PointF computeScrollVectorForPosition(int targetPosition) {
if (getLayoutManager() == null) {
return null;
}
return ((LinearLayoutManager) getLayoutManager())
.computeScrollVectorForPosition(targetPosition);
}
@Override
protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
if (getLayoutManager() == null) {
return;
}
int dx = calculateDxToMakeVisible(targetView,
getHorizontalSnapPreference());
int dy = calculateDyToMakeVisible(targetView,
getVerticalSnapPreference());
if (dx > 0) {
dx = dx - getLayoutManager()
.getLeftDecorationWidth(targetView);
} else {
dx = dx + getLayoutManager()
.getRightDecorationWidth(targetView);
}
if (dy > 0) {
dy = dy - getLayoutManager()
.getTopDecorationHeight(targetView);
} else {
dy = dy + getLayoutManager()
.getBottomDecorationHeight(targetView);
}
final int distance = (int) Math.sqrt(dx * dx + dy * dy);
final int time = calculateTimeForDeceleration(distance * mFlingTime);
if (time > 0) {
action.update(-dx, -dy, time, mDecelerateInterpolator);
}
}
@Override
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
return mMillisecondsPerInch / displayMetrics.densityDpi;
}
};
linearSmoothScroller.setTargetPosition(position);
if (position == RecyclerView.NO_POSITION) {
return;
}
getLayoutManager().startSmoothScroll(linearSmoothScroller);
} else {
super.smoothScrollToPosition(position);
}
}
@Override
public void scrollToPosition(int position) {
if (DEBUG) {
Log.d("@", "scrollToPosition:" + position);
}
mPositionBeforeScroll = getCurrentPosition();
mSmoothScrollTargetPosition = position;
super.scrollToPosition(position);
getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < 16) {
getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
if (mSmoothScrollTargetPosition >= 0 && mSmoothScrollTargetPosition < getItemCount()) {
if (mOnPageChangedListeners != null) {
for (OnPageChangedListener onPageChangedListener : mOnPageChangedListeners) {
if (onPageChangedListener != null) {
onPageChangedListener.OnPageChanged(mPositionBeforeScroll, getCurrentPosition());
}
}
}
}
}
});
}
private int getItemCount() {
return mViewPagerAdapter == null ? 0 : mViewPagerAdapter.getItemCount();
}
/**
* get item position in center of viewpager
*/
public int getCurrentPosition() {
int curPosition;
if (getLayoutManager().canScrollHorizontally()) {
curPosition = ViewUtils.getCenterXChildPosition(this);
} else {
curPosition = ViewUtils.getCenterYChildPosition(this);
}
if (curPosition < 0) {
curPosition = mSmoothScrollTargetPosition;
}
return curPosition;
}
/***
* adjust position before Touch event complete and fling action start.
*/
protected void adjustPositionX(int velocityX) {
if (reverseLayout) velocityX *= -1;
int childCount = getChildCount();
if (childCount > 0) {
int curPosition = ViewUtils.getCenterXChildPosition(this);
int childWidth = getWidth() - getPaddingLeft() - getPaddingRight();
int flingCount = getFlingCount(velocityX, childWidth);
int targetPosition = curPosition + flingCount;
if (mSinglePageFling) {
flingCount = Math.max(-1, Math.min(1, flingCount));
targetPosition = flingCount == 0 ? curPosition : mPositionOnTouchDown + flingCount;
if (DEBUG) {
Log.d("@", "flingCount:" + flingCount);
Log.d("@", "original targetPosition:" + targetPosition);
}
}
targetPosition = Math.max(targetPosition, 0);
targetPosition = Math.min(targetPosition, getItemCount() - 1);
if (targetPosition == curPosition
&& (!mSinglePageFling || mPositionOnTouchDown == curPosition)) {
View centerXChild = ViewUtils.getCenterXChild(this);
if (centerXChild != null) {
if (mTouchSpan > centerXChild.getWidth() * mTriggerOffset * mTriggerOffset && targetPosition != 0) {
if (!reverseLayout) targetPosition--;
else targetPosition++;
} else if (mTouchSpan < centerXChild.getWidth() * -mTriggerOffset && targetPosition != getItemCount() - 1) {
if (!reverseLayout) targetPosition++;
else targetPosition--;
}
}
}
if (DEBUG) {
Log.d("@", "mTouchSpan:" + mTouchSpan);
Log.d("@", "adjustPositionX:" + targetPosition);
}
smoothScrollToPosition(safeTargetPosition(targetPosition, getItemCount()));
}
}
public void addOnPageChangedListener(OnPageChangedListener listener) {
if (mOnPageChangedListeners == null) {
mOnPageChangedListeners = new ArrayList<>();
}
mOnPageChangedListeners.add(listener);
}
public void removeOnPageChangedListener(OnPageChangedListener listener) {
if (mOnPageChangedListeners != null) {
mOnPageChangedListeners.remove(listener);
}
}
public void clearOnPageChangedListeners() {
if (mOnPageChangedListeners != null) {
mOnPageChangedListeners.clear();
}
}
/***
* adjust position before Touch event complete and fling action start.
*/
protected void adjustPositionY(int velocityY) {
if (reverseLayout) velocityY *= -1;
int childCount = getChildCount();
if (childCount > 0) {
int curPosition = ViewUtils.getCenterYChildPosition(this);
int childHeight = getHeight() - getPaddingTop() - getPaddingBottom();
int flingCount = getFlingCount(velocityY, childHeight);
int targetPosition = curPosition + flingCount;
if (mSinglePageFling) {
flingCount = Math.max(-1, Math.min(1, flingCount));
targetPosition = flingCount == 0 ? curPosition : mPositionOnTouchDown + flingCount;
}
targetPosition = Math.max(targetPosition, 0);
targetPosition = Math.min(targetPosition, getItemCount() - 1);
if (targetPosition == curPosition
&& (!mSinglePageFling || mPositionOnTouchDown == curPosition)) {
View centerYChild = ViewUtils.getCenterYChild(this);
if (centerYChild != null) {
if (mTouchSpan > centerYChild.getHeight() * mTriggerOffset && targetPosition != 0) {
if (!reverseLayout) targetPosition--;
else targetPosition++;
} else if (mTouchSpan < centerYChild.getHeight() * -mTriggerOffset && targetPosition != getItemCount() - 1) {
if (!reverseLayout) targetPosition++;
else targetPosition--;
}
}
}
if (DEBUG) {
Log.d("@", "mTouchSpan:" + mTouchSpan);
Log.d("@", "adjustPositionY:" + targetPosition);
}
smoothScrollToPosition(safeTargetPosition(targetPosition, getItemCount()));
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN && getLayoutManager() != null) {
mPositionOnTouchDown = getLayoutManager().canScrollHorizontally()
? ViewUtils.getCenterXChildPosition(this)
: ViewUtils.getCenterYChildPosition(this);
if (DEBUG) {
Log.d("@", "mPositionOnTouchDown:" + mPositionOnTouchDown);
}
mLastY = ev.getRawY();
}
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent e) {
// recording the max/min value in touch track
if (e.getAction() == MotionEvent.ACTION_MOVE) {
if (mCurView != null) {
mMaxLeftWhenDragging = Math.max(mCurView.getLeft(), mMaxLeftWhenDragging);
mMaxTopWhenDragging = Math.max(mCurView.getTop(), mMaxTopWhenDragging);
mMinLeftWhenDragging = Math.min(mCurView.getLeft(), mMinLeftWhenDragging);
mMinTopWhenDragging = Math.min(mCurView.getTop(), mMinTopWhenDragging);
}
}
return super.onTouchEvent(e);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
if (isInertia) {
final float x = e.getRawX();
final float y = e.getRawY();
if (touchStartPoint == null)
touchStartPoint = new PointF();
switch (MotionEvent.ACTION_MASK & e.getAction()) {
case MotionEvent.ACTION_DOWN:
touchStartPoint.set(x, y);
break;
case MotionEvent.ACTION_MOVE:
float tempDistance = (float) Math.sqrt(x*x+ y*y);
float lastDistance = (float) Math.sqrt(touchStartPoint.x*touchStartPoint.x + touchStartPoint.y*touchStartPoint.y);
if (Math.abs(lastDistance - tempDistance) > minSlideDistance) {
float k = Math.abs((touchStartPoint.y - y) / (touchStartPoint.x - x));
// prevent tan 90ยฐ calc
if (Math.abs(touchStartPoint.y - y) < 1)
return getLayoutManager().canScrollHorizontally();
if (Math.abs(touchStartPoint.x - x) < 1)
return !getLayoutManager().canScrollHorizontally();
return k < Math.tan(Math.toRadians(30F));
}
break;
}
}
return super.onInterceptTouchEvent(e);
}
@Override
public void onScrollStateChanged(int state) {
super.onScrollStateChanged(state);
if (state == SCROLL_STATE_DRAGGING) {
mNeedAdjust = true;
mCurView = getLayoutManager().canScrollHorizontally() ? ViewUtils.getCenterXChild(this) :
ViewUtils.getCenterYChild(this);
if (mCurView != null) {
if (mHasCalledOnPageChanged) {
// While rvp is scrolling, mPositionBeforeScroll will be previous value.
mPositionBeforeScroll = getChildLayoutPosition(mCurView);
mHasCalledOnPageChanged = false;
}
if (DEBUG) {
Log.d("@", "mPositionBeforeScroll:" + mPositionBeforeScroll);
}
mFisrtLeftWhenDragging = mCurView.getLeft();
mFirstTopWhenDragging = mCurView.getTop();
} else {
mPositionBeforeScroll = -1;
}
mTouchSpan = 0;
} else if (state == SCROLL_STATE_SETTLING) {
mNeedAdjust = false;
if (mCurView != null) {
if (getLayoutManager().canScrollHorizontally()) {
mTouchSpan = mCurView.getLeft() - mFisrtLeftWhenDragging;
} else {
mTouchSpan = mCurView.getTop() - mFirstTopWhenDragging;
}
} else {
mTouchSpan = 0;
}
mCurView = null;
} else if (state == SCROLL_STATE_IDLE) {
if (mNeedAdjust) {
int targetPosition = getLayoutManager().canScrollHorizontally() ? ViewUtils.getCenterXChildPosition(this) :
ViewUtils.getCenterYChildPosition(this);
if (mCurView != null) {
targetPosition = getChildAdapterPosition(mCurView);
if (getLayoutManager().canScrollHorizontally()) {
int spanX = mCurView.getLeft() - mFisrtLeftWhenDragging;
// if user is tending to cancel paging action, don't perform position changing
if (spanX > mCurView.getWidth() * mTriggerOffset && mCurView.getLeft() >= mMaxLeftWhenDragging) {
if (!reverseLayout) targetPosition--;
else targetPosition++;
} else if (spanX < mCurView.getWidth() * -mTriggerOffset && mCurView.getLeft() <= mMinLeftWhenDragging) {
if (!reverseLayout) targetPosition++;
else targetPosition--;
}
} else {
int spanY = mCurView.getTop() - mFirstTopWhenDragging;
if (spanY > mCurView.getHeight() * mTriggerOffset && mCurView.getTop() >= mMaxTopWhenDragging) {
if (!reverseLayout) targetPosition--;
else targetPosition++;
} else if (spanY < mCurView.getHeight() * -mTriggerOffset && mCurView.getTop() <= mMinTopWhenDragging) {
if (!reverseLayout) targetPosition++;
else targetPosition--;
}
}
}
smoothScrollToPosition(safeTargetPosition(targetPosition, getItemCount()));
mCurView = null;
} else if (mSmoothScrollTargetPosition != mPositionBeforeScroll) {
if (DEBUG) {
Log.d("@", "onPageChanged:" + mSmoothScrollTargetPosition);
}
if (mOnPageChangedListeners != null) {
for (OnPageChangedListener onPageChangedListener : mOnPageChangedListeners) {
if (onPageChangedListener != null) {
onPageChangedListener.OnPageChanged(mPositionBeforeScroll, mSmoothScrollTargetPosition);
}
}
}
mHasCalledOnPageChanged = true;
mPositionBeforeScroll = mSmoothScrollTargetPosition;
}
// reset
mMaxLeftWhenDragging = Integer.MIN_VALUE;
mMinLeftWhenDragging = Integer.MAX_VALUE;
mMaxTopWhenDragging = Integer.MIN_VALUE;
mMinTopWhenDragging = Integer.MAX_VALUE;
}
}
@SuppressWarnings("unchecked")
@NonNull
protected RecyclerViewPagerAdapter ensureRecyclerViewPagerAdapter(Adapter adapter) {
return (adapter instanceof RecyclerViewPagerAdapter)
? (RecyclerViewPagerAdapter) adapter
: new RecyclerViewPagerAdapter(this, adapter);
}
private int getFlingCount(int velocity, int cellSize) {
if (velocity == 0) {
return 0;
}
int sign = velocity > 0 ? 1 : -1;
return (int) (sign * Math.ceil((velocity * sign * mFlingFactor / cellSize)
- mTriggerOffset));
}
private int safeTargetPosition(int position, int count) {
if (position < 0) {
return 0;
}
if (position >= count) {
return count - 1;
}
return position;
}
public interface OnPageChangedListener {
void OnPageChanged(int oldPosition, int newPosition);
}
public float getlLastY() {
return mLastY;
}
// RecyclerView็ๆปๅจ็ถๆๅ้ๅบฆ็ๅฌๅจ
@Override
public void addOnScrollListener(OnScrollListener listener) {
super.addOnScrollListener(listener);
}
private OnScrollListener scrollListener =new OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int childCount = getChildCount();
int width = getChildAt(0).getWidth();
int padding = (getWidth() - width) / 2;
for (int j = 0; j < childCount; j++) {
View v = recyclerView.getChildAt(j);
float rate = 0;
//ๅพๅทฆ ไป padding ๅฐ -(v.getWidth()-padding) ็่ฟ็จไธญ๏ผ็ฑๅคงๅฐๅฐ
if (v.getLeft() <= padding) {
if (v.getLeft() >= padding - v.getWidth()) {
rate = (padding - v.getLeft()) * 1f / v.getWidth();
} else {
rate = 1;
}
v.setScaleY(1 - rate * 0.1f);
v.setScaleX(1 - rate * 0.1f);
} else {
//ๅพๅณ ไป padding ๅฐ recyclerView.getWidth()-padding ็่ฟ็จไธญ๏ผ็ฑๅคงๅฐๅฐ
if (v.getLeft() <= recyclerView.getWidth() - padding) {
rate = (recyclerView.getWidth() - padding - v.getLeft()) * 1f / v.getWidth();
}
v.setScaleY(0.9f + rate * 0.1f);
v.setScaleX(0.9f + rate * 0.1f);
}
}
}
};
// RecyclerView็ๅๅงๅๅธๅฑ็ๅฌ
@Override
public void addOnLayoutChangeListener(OnLayoutChangeListener listener) {
super.addOnLayoutChangeListener(listener);
}
private OnLayoutChangeListener layoutChangeListener = new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (getChildCount() < 3) {
if (getChildAt(1) != null) {
if (getCurrentPosition() == 0) {
View v1 = getChildAt(1);
v1.setScaleY(0.9f);
v1.setScaleX(0.9f);
} else {
View v1 = getChildAt(0);
v1.setScaleY(0.9f);
v1.setScaleX(0.9f);
}
}
} else {
if (getChildAt(0) != null) {
View v0 = getChildAt(0);
v0.setScaleY(0.9f);
v0.setScaleX(0.9f);
}
if (getChildAt(2) != null) {
View v2 = getChildAt(2);
v2.setScaleY(0.9f);
v2.setScaleX(0.9f);
}
}
}
};
}
| [
"563909408@qq.com"
] | 563909408@qq.com |
e2e0149d6869e5323ecb753280b3e2906ad68abc | f95dd73e68e2f2403a2fc4eb2313d96392c25c63 | /src/test/java/com/smoothstack/uthopia/counter/service/AirportServiceTest.java | 28c391b0b63780017eee7eb81d7a2d584bbcc645 | [] | no_license | AlexChavez235/CounterAPI | 46eeaf2ba8d4acfc37f69f8b0fd63b3ef95281c6 | a82303b46d8a7e795116633e91bc9a608bd065ef | refs/heads/master | 2022-06-13T08:33:39.922531 | 2020-04-22T17:04:07 | 2020-04-22T17:04:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,130 | java | package com.smoothstack.uthopia.counter.service;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import com.smoothstack.uthopia.counter.model.Airport;
import com.smoothstack.uthopia.counter.repository.AirportRepository;
public class AirportServiceTest {
@InjectMocks
private AirportService airportService;
@Mock
private AirportRepository airportRepo;
@BeforeEach
public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
public void testReadAirports() {
Airport airport = new Airport();
airport.setAirportCode("LAX");
airport.setAirportLocation("Los Angeles, California");
airport.setAirportName("Los Angeles International Airport");
List<Airport> airports = Collections.singletonList(airport);
when(airportRepo.findAll()).thenReturn(airports);
assertEquals(airportService.readAirports(), airports);
}
}
| [
"achavz97@berkeley.edu"
] | achavz97@berkeley.edu |
8ca4ef2125808e487833e4da34a4132e76641885 | 8d0860942037dcc4a44221022c65e14732add02f | /src/be/kdg/se3/examenproject/model/ShipPosition.java | 65f41739c7c166ed749b4c027d0e71f37467c6af | [] | no_license | svenpublie/ShipPositionReceiver | 923753a9e91f047dd7f051767e7265a91c125e6d | c03a283dcc3be37a6133a20fe9beed69c1636467 | refs/heads/master | 2021-01-10T03:09:18.221416 | 2015-11-12T21:57:49 | 2015-11-12T21:57:49 | 45,252,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,456 | java | package be.kdg.se3.examenproject.model;
import java.util.Date;
/**
* Model class for the incoming ShipPosition Messages
* Created by Sven on 3/11/2015.
*/
public class ShipPosition {
private int shipId;
private String centralId;
private double distanceToQuay;
private Date timestamp;
public ShipPosition() {
}
public ShipPosition(int shipId, String centralId, double distanceToQuay, Date timestamp) {
this.shipId = shipId;
this.centralId = centralId;
this.distanceToQuay = distanceToQuay;
this.timestamp = timestamp;
}
public int getShipId() {
return shipId;
}
public void setShipId(int shipId) {
this.shipId = shipId;
}
public String getcentraleId() {
return centralId;
}
public void setCentralId(String centralId) {
this.centralId = centralId;
}
public Double getDistanceToQuay() {
return distanceToQuay;
}
public void setDistanceToQuay(double distanceToQuay){
this.distanceToQuay = distanceToQuay;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String toString() {
return "INCOMING SHIP POSITION\nShipID: " + this.shipId + "\nCentraleID: " + this.centralId + "\nDistance to quay: " + this.distanceToQuay + "\nTimestamp: " + this.timestamp;
}
}
| [
"sven.publie@student.kdg.be"
] | sven.publie@student.kdg.be |
4910093664b703ec3a31fd16f0b5a5cfde76949a | c4abe4a50ec66b5736596da783f4766ded38337f | /src/main/java/com/dlucia/moneytransfer/adapter/inmemory/InMemoryTransferRepository.java | 8581c390ffdcd1b45ad74f911393c8c1b04762f6 | [] | no_license | dlucia/moneytransfer | 9f4435fbd0a50b234d0ccca67b993ca113ba53a9 | 96c230fd24efe19acdf11ffcad3e86b8120c11ec | refs/heads/master | 2021-09-05T20:47:56.667179 | 2018-01-30T22:48:19 | 2018-01-30T22:48:19 | 115,661,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | package com.dlucia.moneytransfer.adapter.inmemory;
import com.dlucia.moneytransfer.domain.exception.DatabaseException;
import com.dlucia.moneytransfer.domain.model.AccountTransfer;
import com.dlucia.moneytransfer.domain.repository.TransferRepository;
import java.util.Map;
import java.util.UUID;
public class InMemoryTransferRepository implements TransferRepository
{
private final Map<String, AccountTransfer> storage;
public InMemoryTransferRepository(Map<String, AccountTransfer> storage)
{
this.storage = storage;
}
@Override public void save(AccountTransfer transfer)
{
String id = UUID.randomUUID().toString();
validate(transfer);
storage.put(id, transfer);
}
private void validate(AccountTransfer transfer)
{
if (transfer.customerId() == null)
throw new DatabaseException("CustomerId field can not be null");
if (transfer.from() == null)
throw new DatabaseException("accountFrom field can not be null");
if (transfer.to() == null)
throw new DatabaseException("accountTo field can not be null");
if (transfer.amount() == null)
throw new DatabaseException("amount field can not be null");
if (transfer.exchangeRate() == null)
throw new DatabaseException("exchangeRate field can not be null");
}
}
| [
"donato.lucia@lastminute.com"
] | donato.lucia@lastminute.com |
616fc257438483f554d440880213f40bc31bee5c | d2b4f7a979946c98f15509f5b4418f1f0dc523a1 | /app/src/main/java/com/example/yonariva/sponsorship/FirebaseStaticUserDatabaseClass.java | 3bd0f8fc3de5bc022e37a4c3689aac1f8ea302c6 | [] | no_license | YonathanPandapotan/Sponsorship | 6ad29a71b8f1d01f205efb0e0d8d3dbd44a50b9d | 212f8dbb5fa6e690de7050e1dddcf35105951232 | refs/heads/master | 2020-06-19T11:55:19.976636 | 2019-07-21T13:25:55 | 2019-07-21T13:25:55 | 178,691,917 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.example.yonariva.sponsorship;
import com.google.firebase.database.FirebaseDatabase;
public class FirebaseStaticUserDatabaseClass {
public static void setObject(FirebaseDatabase path, Object ob){
}
}
| [
"yonabaho@gmail.com"
] | yonabaho@gmail.com |
91b7f2a8ca0413bb1eedae890442165d356c808d | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project19/src/main/java/org/gradle/test/performance19_5/Production19_404.java | 7ac078fbb803488f3bfad4c7d41252bf83039ef3 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance19_5;
public class Production19_404 extends org.gradle.test.performance11_5.Production11_404 {
private final String property;
public Production19_404() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
2c9eedecd475c94b6d40b8f705254282f9602b1b | 9702a51962cda6e1922d671dbec8acf21d9e84ec | /src/main/com/topcoder/web/winformula/controller/request/admin/SendToReviewResult.java | 980febd47d9358eaaea2a03ca153e1ab15d433a9 | [] | no_license | topcoder-platform/tc-website | ccf111d95a4d7e033d3cf2f6dcf19364babb8a08 | 15ab92adf0e60afb1777b3d548b5ba3c3f6c12f7 | refs/heads/dev | 2023-08-23T13:41:21.308584 | 2023-04-04T01:28:38 | 2023-04-04T01:28:38 | 83,655,110 | 3 | 19 | null | 2023-04-04T01:32:16 | 2017-03-02T08:43:01 | Java | UTF-8 | Java | false | false | 2,228 | java | package com.topcoder.web.winformula.controller.request.admin;
import com.topcoder.web.common.NavigationException;
import com.topcoder.web.common.StringUtils;
import com.topcoder.web.winformula.Constants;
import com.topcoder.web.winformula.dao.WinformulaDAOFactory;
import com.topcoder.web.winformula.dao.WinformulaDAOUtil;
import com.topcoder.web.winformula.model.Contest;
import com.topcoder.web.winformula.model.Submission;
import java.util.Date;
/**
* @author dok
* @version $Revision$ Date: 2005/01/01 00:00:00
* Create Date: Jul 23, 2007
*/
public class SendToReviewResult extends Base {
protected void dbProcessing() throws Exception {
String contestId = getRequest().getParameter(Constants.CONTEST_ID);
if ("".equals(StringUtils.checkNull(contestId))) {
throw new NavigationException("No contest specified");
} else {
WinformulaDAOFactory factory = WinformulaDAOUtil.getFactory();
Date now = new Date();
Long cid;
try {
cid = new Long(contestId);
} catch (NumberFormatException e) {
throw new NavigationException("Invalid contest id specified");
}
Contest c = factory.getContestDAO().find(cid);
//check if all the submissions in the contest have been reviewed.
int count = 0;
if (c.getProject() != null) {
if (now.after(c.getEndTime())) {
for (Submission s : c.getSubmissions()) {
count += s.getORSubmission() == null ? 0 : 1;
}
getRequest().setAttribute("count", count);
getRequest().setAttribute("contest", c);
setNextPage("/admin/sendToReviewResult.jsp");
setIsNextPageInContext(true);
} else {
throw new NavigationException("Sorry, you can't send submissions to online review until the submission phase is over.");
}
} else {
throw new NavigationException("Sorry, this contest is not associated with a project in Online Review.");
}
}
}
}
| [
"amorehead@cb5b18d2-80dd-4a81-9b1c-945e1ee644f9"
] | amorehead@cb5b18d2-80dd-4a81-9b1c-945e1ee644f9 |
d8103f0ff26d3c4c9c0c7816eef32eaff6e36326 | 9b01ffa3db998c4bca312fd28aa977f370c212e4 | /app/src/streamB/java/com/loki/singlemoduleapp/stub/SampleClass2904.java | a06bf8074a61d39de79116e6da8add3d848af6d9 | [] | no_license | SergiiGrechukha/SingleModuleApp | 932488a197cb0936785caf0e73f592ceaa842f46 | b7fefea9f83fd55dbbb96b506c931cc530a4818a | refs/heads/master | 2022-05-13T17:15:21.445747 | 2017-07-30T09:55:36 | 2017-07-30T09:56:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package stub;
public class SampleClass2904 {
private SampleClass2905 sampleClass;
public SampleClass2904(){
sampleClass = new SampleClass2905();
}
public String getClassName() {
return sampleClass.getClassName();
}
} | [
"sergey.grechukha@gmail.com"
] | sergey.grechukha@gmail.com |
1e7ca324460b294ba829f325de264c916ead074d | e621fc3b2bb9555842aad0b53b79bf6e5f97df7d | /src/Warships.java | 4281ca112f2ec9fc127d45cfdc508bc924723edc | [] | no_license | KocmierowskiSzymon/Warships-Java | 0acc898b7dba406586f2a641aadba2e495d7bb80 | 016a7367aa45d8ab9c5a35b8052c020f7c1a4b4c | refs/heads/master | 2020-06-07T17:36:20.125724 | 2019-06-21T08:57:52 | 2019-06-21T08:57:52 | 193,064,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | import java.util.Random;
import java.awt.*;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
import java.awt.event.*;
/**
* autor: Kocmierowski Szymon
*/
/**
* <code> Warships </code> - glowna klasa aplikacji
*/
public class Warships {
/**
* Metoda <code> main</code> glowne wywolanie programu
* @param args strumien wyjsciowy
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new Window();
}
});
}
}
| [
"40832444+KocmierowskiSzymon@users.noreply.github.com"
] | 40832444+KocmierowskiSzymon@users.noreply.github.com |
1a7a11a55c638cc0a57bbcda9cc3b02bce0c52cd | 09747113e6e40c9ec2251d3bad7bc2ac980d06b3 | /src/main/java/me/cuebyte/nexus/commands/CommandTimeSunrise.java | d6ffbde24a664b7558f8493a95feb0c9a29fa930 | [] | no_license | Zishinku/Nexus | a60140baecb50187e80bd251ac3b1027c307a003 | d291f7f15c6569437abb1328801a112bcf4f9944 | refs/heads/master | 2021-01-18T10:14:30.493077 | 2016-06-09T09:35:34 | 2016-06-09T09:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,004 | java | package main.java.me.cuebyte.nexus.commands;
import main.java.me.cuebyte.nexus.Controller;
import main.java.me.cuebyte.nexus.utils.PermissionsUtils;
import main.java.me.cuebyte.nexus.utils.ServerUtils;
import org.spongepowered.api.Game;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.world.World;
public class CommandTimeSunrise {
public CommandTimeSunrise(CommandSource sender, String[] args, Game game) {
if(!PermissionsUtils.has(sender, "nexus.time.sunrise")) { sender.sendMessage(Text.builder("You do not have permissions!").color(TextColors.RED).build()); return; }
if(args.length == 2) {
if(args[1].equalsIgnoreCase("*")) {
for(World world : Controller.getServer().getWorlds()) world.getProperties().setWorldTime(23000);
ServerUtils.broadcast(Text.of(TextColors.GOLD, sender.getName(), TextColors.GRAY, " has changed the time to sunrise."));
return;
}
if(!Controller.getServer().getWorld(args[1]).isPresent()) {
sender.sendMessage(Text.of(TextColors.RED, "World not found!"));
return;
}
World world = Controller.getServer().getWorld(args[1]).get();
world.getProperties().setWorldTime(23000);
ServerUtils.broadcast(Text.of(TextColors.GOLD, sender.getName(), TextColors.GRAY, " has changed the time to sunrise on ", TextColors.GOLD, world.getName()));
return;
}
if(sender instanceof Player == false) { sender.sendMessage(Text.builder("Cannot be run by the console!").color(TextColors.RED).build()); return; }
Player player = (Player) sender;
World world = player.getWorld();
world.getProperties().setWorldTime(23000);
ServerUtils.broadcast(Text.of(TextColors.GOLD, sender.getName(), TextColors.GRAY, " has changed the time to sunrise on ", TextColors.GOLD, world.getName()));
}
}
| [
"max.nitschke@icloud.com"
] | max.nitschke@icloud.com |
f86aa3221f6fa06c1db36ef85ad1a3d59eb70d13 | 7e1511cdceeec0c0aad2b9b916431fc39bc71d9b | /flakiness-predicter/input_data/original_tests/doanduyhai-Achilles/nonFlakyMethods/info.archinnov.achilles.internal.proxy.dirtycheck.DirtyCheckChangeSetTest-should_generate_update_for_added_entries_with_bind_marker.java | 980d6a8ee1b2073874a0931dddad05d84aa2e617 | [
"BSD-3-Clause"
] | permissive | Taher-Ghaleb/FlakeFlagger | 6fd7c95d2710632fd093346ce787fd70923a1435 | 45f3d4bc5b790a80daeb4d28ec84f5e46433e060 | refs/heads/main | 2023-07-14T16:57:24.507743 | 2021-08-26T14:50:16 | 2021-08-26T14:50:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | @Test public void should_generate_update_for_added_entries_with_bind_marker() throws Exception {
changeSet.mapChanges.put(1,"a");
when(pm.encodeKey(1)).thenReturn(1);
when(pm.encode("a")).thenReturn("a");
Object[] vals=changeSet.generateUpdateForAddedEntries(update(),true).right;
assertThat(vals[0]).isNull();
assertThat(conditions.getQueryString()).isEqualTo("UPDATE table SET property=property+:property;");
}
| [
"aalsha2@masonlive.gmu.edu"
] | aalsha2@masonlive.gmu.edu |
2a1169b1bf7a160bfd0add8694c8ab31b7c8a499 | 737078c7e192845ef784aa5c45b9cdee6072b526 | /src/main/java/com/tdex/meulanche/domain/repository/IngredienteRepository.java | 3dab61818d81a01f1b4a91a1980a16ce3f92aade | [] | no_license | tdex/meu-lanche | 25b02eb77ce62dc62dda2f631ff5e39c8972bc09 | 009824d8272e94f0d033b1fc226dcf20925c7757 | refs/heads/master | 2022-11-23T18:50:51.911394 | 2020-08-02T13:34:02 | 2020-08-02T13:34:02 | 284,357,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.tdex.meulanche.domain.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.tdex.meulanche.domain.entity.Ingrediente;
public interface IngredienteRepository extends JpaRepository<Ingrediente, Integer> {
}
| [
"tardchamps94@gmail.com"
] | tardchamps94@gmail.com |
96c64852772044231c48d5f9a3ec2bab82290299 | 5bafd011567cadfcf315bb5904f9047f3d372c7c | /ReuseProcessMining/XPDL2BPMNTransformator/src/br/ufrj/cos/prisma/Task2$Name.java | 33458b58485eeb64801f83433f492e6d49767dce | [] | no_license | talitalopes/ReuseProcessMining | 12ae46defb4fb8d6d1a7ba109c07f618a469057c | 4b3b9f3e43517598009fdf6f2a16968675194fff | refs/heads/master | 2021-01-10T02:20:28.642658 | 2014-05-06T23:53:41 | 2014-05-06T23:53:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package br.ufrj.cos.prisma;
import java.util.*;
import org.eclipse.emf.ecore.*;
import net.sf.jetset.runtime.*;
import net.sf.jetset.runtime.generator.PropertyGenerator;
/**
* GENERATED CLASS: DO NOT EDIT! (unless you really want to)
*/
@SuppressWarnings("unused")public class Task2$Name extends PropertyGenerator
{
protected static String nl;
public static synchronized Task2$Name create(String lineSeparator)
{
nl = lineSeparator;
Task2$Name result = new Task2$Name();
nl = null;
return result;
}
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "MethodExtension";
/**
* The emitter method.
* @return The translation text.
*/
public String generate()
{
final StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(TEXT_1);
return stringBuffer.toString();
}
}
| [
"talitalopes@gmail.com"
] | talitalopes@gmail.com |
7f2a2f4bc1c8833911f70830a69b38898e38ec65 | 1b6329498520da3c7134a732bbbcef45f5664fd0 | /src/Dominio/Hotel.java | 67f7f4bbf732a212061cdb0cfa057247c87593cb | [] | no_license | nachetons/Programacion_Hoteles | 0aa2e3e1e1381d07dc7c34115e3064a044f092bd | 1b1713fd3944e0b1b963050bdbe43fc996e0ee54 | refs/heads/master | 2020-09-14T14:37:39.014698 | 2019-11-21T11:25:52 | 2019-11-21T11:25:52 | 223,158,122 | 3 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,848 | java | package Dominio;
import java.util.ArrayList;
import Persistencia.hotelPers;
// Clase hotel, donde se van a declarar todas las variables, constructores, getters y setters que tenga esta clase.
public class Hotel {
// Declaraciรณn de variables, donde estarรกn todos los factores que tenga un hotel.
private String nombre;
private String foto;
private int telefono;
private String direccion;
private String ciudad;
private String pais;
private int numestrellas;
private int hab_indi;
private int hab_dobles;
private int hab_triples;
private int suites;
private hotelPers HotelPers;
// Constructores que tiene un hotel, con las variables declaradas anteriormente.
public Hotel(String nombres, String fotos, int telefono, String direccion, String ciudad, String pais, int numestrellas, int hab_indi,
int hab_dobles, int hab_triples, int suites) {
this.nombre = nombres;
this.foto = fotos;
this.telefono = telefono;
this.direccion = direccion;
this.ciudad = ciudad;
this.pais = pais;
this.numestrellas = numestrellas;
this.hab_indi = hab_indi;
this.hab_dobles = hab_dobles;
this.hab_triples = hab_triples;
this.suites = suites;
hotelPers HotelPers = new hotelPers();
}
// Getters y Setter que tiene la clase "Hotel".
public Hotel(){
hotelPers HotelPers = new hotelPers();
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getFoto() {
return foto;
}
public void setFoto(String foto) {
this.foto = foto;
}
public int getTelefono() {
return telefono;
}
public void setTelefono(int telefono) {
this.telefono = telefono;
}
public String getDireccion() {
return direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
public String getCiudad() {
return ciudad;
}
public void setCiudad(String ciudad) {
this.ciudad = ciudad;
}
public String getPais() {
return pais;
}
public void setPais(String pais) {
this.pais = pais;
}
public int getNumestrellas() {
return numestrellas;
}
public void setNumestrellas(int numestrellas) {
this.numestrellas = numestrellas;
}
public int getHab_indi() {
return hab_indi;
}
public void setHab_indi(int hab_indi) {
this.hab_indi = hab_indi;
}
public int getHab_dobles() {
return hab_dobles;
}
public void setHab_dobles(int hab_dobles) {
this.hab_dobles = hab_dobles;
}
public int getHab_triples() {
return hab_triples;
}
public void setHab_triples(int hab_triples) {
this.hab_triples = hab_triples;
}
public int getSuites() {
return suites;
}
public void setSuites(int suites) {
this.suites = suites;
}
// Declaraciรณn de la funcionalidad de leer los hoteles de la lista. Para ello se tiene que declarar una variable, y crear una clase para poder
// realizar esta funciรณn. La variable relacionada se llama "HotelPers".
public void escribir(ArrayList<Hotel> lista){
HotelPers.escribir(lista);
}
// Declaraciรณn de la funcionalidad de modificar, aรฑadir y eliminar los hoteles de la lista. Para ello se tiene que declarar una variable, y
// crear una clase para poder realizar esta funciรณn. La variable relacionada se llama "HotelPers".
public ArrayList<Hotel>leer() {
return HotelPers.leer();
}
// Declaraciรณn del toString de la clase "Hotel" (Como se va a visualizar los datos almacenados del programa.).
@Override
public String toString() {
return "Nombre:" + nombre + ", Foto:" + foto + ", Telefono:" + telefono + ", Direcciรณn:"
+ direccion + ", Ciudad:" + ciudad + ", Paรญs:" + pais + ", Nรบmero de Estrellas:" + numestrellas +
", Habitaciones Individuales:"+ hab_indi + ", Habitaciones Dobles:" + hab_dobles +
", Habitaciones Triples:" + hab_triples + ", Suites:" + suites + "";
}
}
| [
"52700609+SoftwareIFP@users.noreply.github.com"
] | 52700609+SoftwareIFP@users.noreply.github.com |
a9ca983dbee1060b56dfa54394adfce3b922bbf4 | 5453a0e1e7397e1db51e1d3c439ef5dedde1af31 | /app/src/main/java/com/example/myapplication/MainActivity.java | 6a88a56b1bffd25f6915af282c5294b1e8658c5a | [] | no_license | thunder-coding/Android-Counter | 9258f6bda96bb5dba202a8b5f654b4fe4e943816 | d32c96d990a2463e185fea420dd85f8a214b8f75 | refs/heads/main | 2023-02-23T10:44:46.120073 | 2021-01-28T08:06:59 | 2021-01-28T08:06:59 | 330,978,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,458 | java | package com.example.myapplication;
import androidx.annotation.ColorInt;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private int countInt = 0;
private TextView count;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
countInt = 0;
count = findViewById(R.id.count);
}
public void OnClickPlusOne(View view){
Log.e("Hello", "+1 Clicked");
++countInt;
count.setText(String.valueOf(countInt));
}
public void onClickMinusOne(View view){
Log.e("Hello", "-1 Clicked");
--countInt;
count.setText(String.valueOf(countInt));
}
public void onClickReset(View view){
countInt = 0;
count.setText(String.valueOf(countInt));
}
public void onClickRandomColor(View view){
ScrollView scrollView = findViewById(R.id.ScrollView);
Random random = new Random();
scrollView.setBackgroundColor(Color.argb(255,random.nextInt(256),random.nextInt(256), random.nextInt(256)));
}
} | [
"yakshbari4@gmail.com"
] | yakshbari4@gmail.com |
336aa6095dc858bdbb32a605eae4f74ce0913e51 | cca87c4ade972a682c9bf0663ffdf21232c9b857 | /com/tencent/mm/boot/svg/a/a/sf.java | bc560ff115695052c460611f444f2d2693eb9f90 | [] | no_license | ZoranLi/wechat_reversing | b246d43f7c2d7beb00a339e2f825fcb127e0d1a1 | 36b10ef49d2c75d69e3c8fdd5b1ea3baa2bba49a | refs/heads/master | 2021-07-05T01:17:20.533427 | 2017-09-25T09:07:33 | 2017-09-25T09:07:33 | 104,726,592 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,530 | java | package com.tencent.mm.boot.svg.a.a;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Join;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.os.Looper;
import com.tencent.mm.svg.WeChatSVGRenderC2Java;
import com.tencent.mm.svg.c;
import com.tencent.smtt.sdk.WebView;
public final class sf extends c {
private final int height = 96;
private final int width = 96;
protected final int b(int i, Object... objArr) {
switch (i) {
case 0:
return 96;
case 1:
return 96;
case 2:
Canvas canvas = (Canvas) objArr[0];
Looper looper = (Looper) objArr[1];
c.d(looper);
c.c(looper);
Paint g = c.g(looper);
g.setFlags(385);
g.setStyle(Style.FILL);
Paint g2 = c.g(looper);
g2.setFlags(385);
g2.setStyle(Style.STROKE);
g.setColor(WebView.NIGHT_MODE_COLOR);
g2.setStrokeWidth(1.0f);
g2.setStrokeCap(Cap.BUTT);
g2.setStrokeJoin(Join.MITER);
g2.setStrokeMiter(4.0f);
g2.setPathEffect(null);
Paint a = c.a(g2, looper);
a.setStrokeWidth(1.0f);
Paint a2 = c.a(g, looper);
a2.setColor(-8617594);
canvas.save();
Paint a3 = c.a(a2, looper);
Path h = c.h(looper);
h.moveTo(96.0f, 48.0f);
h.cubicTo(96.0f, 74.50967f, 74.50967f, 96.0f, 48.0f, 96.0f);
h.cubicTo(21.490332f, 96.0f, 0.0f, 74.50967f, 0.0f, 48.0f);
h.cubicTo(0.0f, 21.490332f, 21.490332f, 0.0f, 48.0f, 0.0f);
h.cubicTo(74.50967f, 0.0f, 96.0f, 21.490332f, 96.0f, 48.0f);
h.close();
h.moveTo(2.2325583f, 48.0f);
h.cubicTo(2.2325583f, 73.27666f, 22.72334f, 93.76744f, 48.0f, 93.76744f);
h.cubicTo(73.27666f, 93.76744f, 93.76744f, 73.27666f, 93.76744f, 48.0f);
h.cubicTo(93.76744f, 22.72334f, 73.27666f, 2.2325583f, 48.0f, 2.2325583f);
h.cubicTo(22.72334f, 2.2325583f, 2.2325583f, 22.72334f, 2.2325583f, 48.0f);
h.close();
WeChatSVGRenderC2Java.setFillType(h, 1);
canvas.drawPath(h, a3);
canvas.restore();
canvas.save();
a2 = c.a(a2, looper);
a = c.a(a, looper);
a.setColor(-8617594);
a.setStrokeWidth(2.0f);
h = c.h(looper);
h.moveTo(61.0f, 51.0f);
h.cubicTo(59.552845f, 51.154545f, 58.8374f, 50.327274f, 60.0f, 49.0f);
h.cubicTo(59.672085f, 48.436363f, 60.506775f, 47.727272f, 62.0f, 48.0f);
h.cubicTo(65.03794f, 46.663635f, 67.54201f, 43.945454f, 68.0f, 41.0f);
h.cubicTo(67.54201f, 36.736362f, 63.845528f, 33.545456f, 60.0f, 33.0f);
h.cubicTo(54.544716f, 33.545456f, 50.84824f, 36.736362f, 51.0f, 41.0f);
h.lineTo(51.0f, 58.0f);
h.cubicTo(50.84824f, 64.27273f, 45.482384f, 69.0f, 39.0f, 69.0f);
h.cubicTo(32.365852f, 69.0f, 27.0f, 64.27273f, 27.0f, 58.0f);
h.cubicTo(27.0f, 53.163635f, 31.17344f, 48.79091f, 37.0f, 48.0f);
h.cubicTo(38.20867f, 47.96364f, 38.80488f, 49.618183f, 38.0f, 50.0f);
h.cubicTo(37.759224f, 50.496105f, 37.373985f, 51.390907f, 36.0f, 51.0f);
h.cubicTo(32.96206f, 52.454544f, 30.457994f, 55.172726f, 30.0f, 58.0f);
h.cubicTo(30.457994f, 62.263638f, 34.154472f, 65.454544f, 38.0f, 66.0f);
h.cubicTo(43.455284f, 65.454544f, 47.15176f, 62.263638f, 47.0f, 58.0f);
h.lineTo(47.0f, 41.0f);
h.cubicTo(47.15176f, 34.727272f, 52.517616f, 30.0f, 59.0f, 30.0f);
h.cubicTo(65.63415f, 30.0f, 71.0f, 34.727272f, 71.0f, 41.0f);
h.cubicTo(71.0f, 45.954544f, 66.82656f, 50.20909f, 61.0f, 51.0f);
h.close();
WeChatSVGRenderC2Java.setFillType(h, 2);
canvas.drawPath(h, a2);
canvas.drawPath(h, a);
canvas.restore();
c.f(looper);
break;
}
return 0;
}
}
| [
"lizhangliao@xiaohongchun.com"
] | lizhangliao@xiaohongchun.com |
13cdc331475b0c4de95b46c05718795157e4bc84 | 5ea4c4371ba52e4b27f64d0b689e1f801226d82e | /wear/src/main/java/com/bytemesoftware/wear/faces/binary/WatchFaceActivity.java | 2562d26bd918e234d0d79fe24a97f283fd1bb0ea | [
"Apache-2.0"
] | permissive | tristan202/WearBinaryWatchFace | 0364a9cccab93fe2113063ffdf4a1b8ffe12f1c0 | aa99d6f125ebcad834a942278b73bf381739c4d6 | refs/heads/master | 2020-12-02T16:35:58.186029 | 2015-01-08T19:25:11 | 2015-01-08T19:25:11 | 28,981,778 | 0 | 0 | null | 2015-01-08T19:18:45 | 2015-01-08T19:18:44 | Java | UTF-8 | Java | false | false | 8,327 | java | package com.bytemesoftware.wear.faces.binary;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.wearable.view.WatchViewStub;
import android.util.Log;
import android.view.View;
import com.bytemesoftware.wear.faces.binary.time.Minutes;
import com.bytemesoftware.wear.faces.binary.time.Hours;
import com.bytemesoftware.wear.faces.binary.time.Seconds;
import java.util.Calendar;
public class WatchFaceActivity extends Activity {
private int TICK_INTERVAL = 950;
private Handler mHandler;
private View rootView;
private IntentFilter timeTickFilter;
private IntentFilter timeChangedFilter;
private IntentFilter timeZoneChnagedFilter;
private IntentFilter dotColorChangedIntentFilter;
private BroadcastReceiver timeUpdateReceiver;
private BroadcastReceiver dotColorChangedReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_watch_face);
// get the watch face stud. This is loaded asynchronously.
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
rootView = stub.getRootView(); // set the root view of the face
setBright(); // set the mode to bright
startRepeatingTask(); // start the seconds animation
}
});
// create te handler for the seconds animation
mHandler = new Handler(Looper.getMainLooper());
// create the needed receivers
initReceivers();
}
private void initReceivers() {
// create the intent filter for the time tick action
timeTickFilter = new IntentFilter(Intent.ACTION_TIME_TICK);
timeChangedFilter = new IntentFilter(Intent.ACTION_TIME_CHANGED);
timeZoneChnagedFilter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
// create the reciever
timeUpdateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) {
updateCompleteTime();
// if we are not dimmed, then restart the seconds animation
if (!isDimmed()) {
restartRepeatingTask();
}
}
}
};
// create the intent filter for the time tick action
dotColorChangedIntentFilter = new IntentFilter(Constants.DOT_COLOR_RECIEVED_ACTION);
// create the receiver
dotColorChangedReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (Constants.DOT_COLOR_RECIEVED_ACTION.equals(intent.getAction())) {
updateCompleteTime();
startRepeatingTask();
}
}
};
}
@Override
protected void onStart() {
super.onStart();
// attach the time receiver to listen for time ticks.
this.registerReceiver(timeUpdateReceiver, timeTickFilter);
this.registerReceiver(timeUpdateReceiver, timeChangedFilter);
this.registerReceiver(timeUpdateReceiver, timeZoneChnagedFilter);
this.registerReceiver(dotColorChangedReceiver, dotColorChangedIntentFilter);
}
@Override
protected void onResume() {
super.onResume();
// wWen we resume, we are going to a bright state.
// There is state where there is not a watch face does not have a view yet.
// The guard prevents trying to update views that do not exist.
if (rootView != null) {
setBright();
}
}
@Override
protected void onPause() {
super.onPause();
// When the face is paused, we are going to go into the dimmed state
if (rootView != null) setDimmed();
}
@Override
protected void onDestroy() {
super.onDestroy();
// Traditionally this is done in the onPause.
// But since we are going to still get time updates
// when paused, we can unregister the receiver
this.unregisterReceiver(timeUpdateReceiver);
this.unregisterReceiver(dotColorChangedReceiver);
}
//========================================================================
// HELPERS FOR UPDATING THE VIEW WITH THE CURRENT TIME
//========================================================================
private void updateCompleteTime() {
View view = this.findViewById(android.R.id.content).getRootView();
Calendar calendar = Calendar.getInstance();
Minutes.updateViewWithTime(view, calendar);
Hours.updateViewWithTime(view, calendar);
// if we are not dimmed, then update the seconds dots
if (!isDimmed()) {
Seconds.updateViewWithTime(view, calendar);
}
}
private void updateSeconds() {
View view = this.findViewById(android.R.id.content).getRootView();
Calendar calendar = Calendar.getInstance();
Seconds.updateViewWithTime(view, calendar);
}
private void clearSeconds() {
View view = this.findViewById(android.R.id.content).getRootView();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.SECOND, 0);
Seconds.updateViewWithTime(view, calendar);
}
//========================================================================
// HELPERS FOR CHANGING THE COLOR STATES BASED ON BEING DIMMED OR NOT
//========================================================================
private void setDimmed() {
// set the dimmed flag
this.getSharedPreferences(Constants.PREFS, MODE_PRIVATE).edit().putBoolean(Constants.PREFS_DIMMED_KEY, true).commit();
// stop the second updates
stopRepeatingTask();
// update the time
updateCompleteTime();
//clear the seconds value
clearSeconds();
}
private void setBright() {
this.getSharedPreferences(Constants.PREFS, MODE_PRIVATE).edit().putBoolean(Constants.PREFS_DIMMED_KEY, false).commit();
updateCompleteTime();
// start the seconds animation again
startRepeatingTask();
}
private boolean isDimmed() {
return this.getSharedPreferences(Constants.PREFS, MODE_PRIVATE).getBoolean(Constants.PREFS_DIMMED_KEY, false);
}
//========================================================================
// CODE FOR THE SECONDS ANIMATION
//========================================================================
private void startRepeatingTask() {
// make sure that there is not a task running
// before starting a new task
mHandler.post(secondsAnimation);
}
private void stopRepeatingTask() {
mHandler.removeCallbacksAndMessages(null);
}
private void restartRepeatingTask() {
// make sure that there is not a task running
// before starting a new task
stopRepeatingTask();
startRepeatingTask();
}
private void updateSecondsUI() {
runOnUiThread(new Runnable() {
public void run() {
try {
updateSeconds();
} catch (Exception e) {
// left blank
}
}
});
}
private Runnable secondsAnimation = new Runnable() {
// @Override
public void run() {
if (!Thread.currentThread().isInterrupted()) {
try {
updateSecondsUI();
mHandler.postDelayed(secondsAnimation, TICK_INTERVAL);
} catch (Exception e) {
Log.e("log_tag", "Error is " + e.toString());
}
}
}
};
}
| [
"dwa012@gmail.com"
] | dwa012@gmail.com |
3a0793692cc75cc55076e173763b909ee9801dfa | f30cb28578d51bfa03ce132567a0e96c028eab94 | /src/main/java/com/asset/Login.java | ec0b5929302576ee4f0ee15cff97be0c933c144b | [] | no_license | wangjiabc/asset | 589b862f85f9fb453e30fd75057e2eca010ea0ce | 481c038be6f4ab64cab1e0261563fd20bd290288 | refs/heads/master | 2021-01-20T03:06:53.142268 | 2018-06-03T12:34:00 | 2018-06-03T12:34:00 | 101,287,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,609 | java | package com.asset;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Date;
import java.util.Map;
import java.util.Random;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import org.eclipse.jetty.util.security.Credential.MD5;
import com.asset.database.Connect;
import com.asset.tool.Md5;
import com.asset.tool.TestDB;
import com.rmi.server.Assets;
import com.voucher.manage.daoModel.Assets.Hidden_User;
public class Login extends JFrame implements ActionListener {
String userName;
String password;
String captcha;
public static String randomcaptcha;
JLabel logoLabel, userNameLabel, passwordLabel, captchaLabel;
JTextField userNameInput;
// JTextField captchaInput;
JPasswordField passwordInput;
JButton login, logout;
// jButton change;
Panel panel;
Connection connection;
PreparedStatement pstmt = null;
ResultSet rs = null;
ResultSetMetaData rsmd;
public Login() {
setTitle("ๅฎๅ
จ้ๆฃ็็ฎก็ณป็ป็ปๅฝ");
setSize(500, 300);
setLocationRelativeTo(null);
init();
/*
try {
connection=TestDB.getConnection();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);
}
public void init() {
setLayout(null);
logoLabel= new JLabel();
URL url = getClass().getResource("welcome.gif");
logoLabel.setIcon(new ImageIcon(url));
logoLabel.setBounds(80, 10, 300, 70);
// add(logoLabel);
Font font=new java.awt.Font("Dialog",1,16);
userNameLabel = new JLabel("ๅธๅท:");
userNameLabel.setBounds(130, 60, 60, 40);
userNameLabel.setFont(font);
add(userNameLabel);
userNameInput = new JTextField();
userNameInput.setBounds(180, 70, 150, 20);
userNameInput.setSize(200,30);
userNameInput.setFont(font);
add(userNameInput);
passwordLabel = new JLabel("ๅฏ็ :");
passwordLabel.setBounds(130, 120, 60, 40);
passwordLabel.setFont(font);
add(passwordLabel);
passwordInput = new JPasswordField();
passwordInput.setBounds(180, 130, 150, 20);
passwordInput.setSize(200,30);
passwordInput.setFont(font);
add(passwordInput);
/*
captchaLabel = new JLabel("้ช่ฏ็ :");
captchaLabel.setBounds(120, 180, 60, 40);
captchaLabel.setFont(font);
add(captchaLabel);
captchaInput = new JTextField();
captchaInput.setBounds(180, 190, 70, 20);
captchaInput.setSize(80,30);
captchaInput.setFont(font);
add(captchaInput);
panel = new PanelDemo();
panel.setBounds(270, 196, 80, 20);
panel.setSize(80,30);
add(panel);
change = new JButton("ๆดๆข");
change.setBounds(330, 196, 80, 20);
change.setContentAreaFilled(false);
change.setBorderPainted(false);
add(change);
*/
login = new JButton("็กฎๅฎ");
login.setBounds(120, 200, 120, 30);
login.setFont(new java.awt.Font("",1,14));
// login.setMnemonic(KeyEvent.VK_L);
add(login);
logout = new JButton("้ๅบ");
logout.setBounds(270, 200, 120, 30);
// logout.setMnemonic(KeyEvent.VK_X);
logout.setFont(new java.awt.Font("",1,14));
add(logout);
userNameInput.addActionListener(this);
passwordInput.addActionListener(this);
// captchaInput.addActionListener(this);
login.addActionListener(this);
logout.addActionListener(this);
// change.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
Assets assets = null;
try{
assets= new Connect().get();
}catch (java.lang.ExceptionInInitializerError ex) {
// TODO: handle exception
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>็ฝ็ป่ฟๆฅๅผๅธธ</html></h2>"));
dispose();
}
userName = userNameInput.getText();
password = new String(passwordInput.getPassword());
// captcha = captchaInput.getText();
/*
if (e.getSource() == change) {
panel.repaint();
}
*/
if (e.getSource() == login) {
if(userName.equals("")){
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>ๅธๅทไธ่ฝ็ฉบ</html></h2>"));
return;
}
if(password.equals("")){
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>ๅฏ็ ไธ่ฝ็ฉบ</html></h2>"));
return;
}
/*
if(captcha.equals("")){
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>่ฏท่พๅ
ฅ้ช่ฏ็ </html></h2>"));
return;
}
*/
Map map=assets.selectHiddenUser(userName);
int state=(int) map.get("state");
Hidden_User hidden_User=(Hidden_User) map.get("row");
// if (captcha.equals(randomcaptcha.toLowerCase())) {
if(state==0){
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>็จๆทไธๅญๅจ</html></h2>"));
return;
}
String campusAdmin=hidden_User.getCampusAdmin();
String pw=hidden_User.getPassword();
if ((userName.equals(campusAdmin)) && (Md5.GetMD5Code(password).equals(pw))) {
System.out.println(randomcaptcha);
System.out.println(captcha);
Singleton.getInstance().setHidden_User(hidden_User);
Hidden_User hidden_User2=new Hidden_User();
Date date=new Date();
hidden_User2.setEnter_time(date);
String[] where={"[Hidden_User].campusAdmin = ",campusAdmin};
hidden_User2.setWhere(where);
assets.updateHiddenUser(hidden_User2);
dispose();
if(Md5.GetMD5Code(password).equals(Md5.GetMD5Code("xl123"))){
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>็ปๅฝๅ่ฏทไฟฎๆน้ป่ฎคๅฏ็ </html></h2>"));
}
new MainApp().launch(Main.class, "");
} else if (userName.equals(campusAdmin)){
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>ๅฏ็ ้่ฏฏ!</html></h2>"));
} else {
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>็จๆทไธๅญๅจ!</html></h2>"));
}
/* } else {
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>้ช่ฏ็ ้่ฏฏ</html></h2>"));
panel.repaint();
} */
}
if (e.getSource() == logout) {
JOptionPane.showMessageDialog(this, new JLabel("<html><h2>้ๅบ็ณป็ป</html></h2>"));
System.exit(0);
//dispose();
}
}
public static void main(String[] args) {
new Login();
}
}
class PanelDemo extends Panel {
public void paint(Graphics g) {
int width = 80;
int height = 20;
g.setColor(Color.LIGHT_GRAY);
g.fillRect(0, 0, width, height);
g.setColor(Color.BLACK);
g.drawRect(0, 0, width, height);
Random rd = new Random();
for (int i = 0; i < 100; i++) {
int x = rd.nextInt(width) - 2;
int y = rd.nextInt(height) - 2;
g.setColor(Color.RED);
g.drawOval(x, y, 2, 2);
}
g.setFont(new Font("", Font.BOLD, 20));
g.setColor(Color.BLUE);
char[] c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 4; i++) {
int index = rd.nextInt(c.length);
sb.append(c[index] + " ");
}
g.drawString(sb.toString(), 0, 18);
String str = sb.toString().replaceAll(" ", "");
Login.randomcaptcha = str;
}
} | [
"2768911783@qq.com"
] | 2768911783@qq.com |
1a6b0687a040d8e3127a19e1cb7469208b3801dd | a36d625e36fd73c9938eead7ffff6fe73c660a74 | /src/java/com/medihub/patient/SubmitOrder.java | 8160249114e4cfe50f9f9efc5ea3b329d2980e68 | [] | no_license | AyshaIfra/Medihub | 4dd186d556f8b487fec8b95353c5f67df04a32b3 | 3b3e72cc4328448fa9b6a82ee1008205464f1cbd | refs/heads/main | 2023-06-22T02:08:42.075713 | 2021-07-15T15:33:05 | 2021-07-15T15:33:05 | 386,334,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,498 | 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.medihub.patient;
import java.io.*;
import java.util.*;
import com.medihub.db.DbConfig;
import com.medihub.user.Notifications;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Random;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.output.*;
/**
*
* @author Yash
*/
@WebServlet(name = "SubmitOrder", urlPatterns = {"/submitorder"})
@MultipartConfig
public class SubmitOrder extends HttpServlet {
private boolean isMultipart;
private int maxFileSize = 15 * 1024*1024; //max upload size in bytes
private File file ;
protected String getSaltString() {
String SALTCHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
StringBuilder salt = new StringBuilder();
Random rnd = new Random();
while (salt.length() < 30) { // length of the random string.
int index = (int) (rnd.nextFloat() * SALTCHARS.length());
salt.append(SALTCHARS.charAt(index));
}
String saltStr = salt.toString();
return saltStr;
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
String pharmacyid="1";
try
{
//getting from DbConfig class
DbConfig db = DbConfig.getInstance();
Connection con = db.getConnecton();
String description="";//=request.getParameter("description");
String filepath="";//=request.getParameter("file_path");
String date="" ;//= request.getParameter("date");
String doctorPrescriptions="";
HttpSession session = request.getSession();
int patientId =Integer.parseInt(session.getAttribute("userid").toString());
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setSizeMax( maxFileSize );
String status="Pending";
String randomString = getSaltString();
String extension = ".pdf";//filepath.substring(filepath.length()-4, filepath.length()-1);
String absolutePath = randomString+extension;
try{
List fileItems = upload.parseRequest(request);
Iterator iter = fileItems.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
String name = item.getFieldName();//text1
String value = item.getString();
if(name.compareTo("description")==0){
description=value;
}
else if(name.compareTo("date")==0){
date = value;
}
else if(name.compareTo("pharmacy")==0){
pharmacyid=value;
}
else if(name.compareTo("doctorPrescriptions")==0){
doctorPrescriptions=value;
}
} else {
String fieldName = item.getFieldName();
String fileName = item.getName();
String contentType = item.getContentType();
boolean isInMemory = item.isInMemory();
long sizeInBytes = item.getSize();
filepath=fileName;
file = new File(getServletContext().getRealPath("public/storage/pres/").replace('\\', '/')+"/"+absolutePath) ;
item.write( file ) ;
}
}
String query="INSERT INTO pharmacy_orders (id,pharmacy_id,status,created_at,updated_at,created_by,order_status,expected_delivery_date) VALUES(NULL,"+pharmacyid+",1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'"+patientId+"','"+status+"','"+date+"')";
PreparedStatement stmt=con.prepareStatement(query);
int rs=stmt.executeUpdate();
if(filepath.isEmpty()){
filepath="Doctor Prescription";
absolutePath="prescriptionview?presId="+doctorPrescriptions;
}
String query2="INSERT INTO order_items (id,order_id,file_path,absolute_path,description,status,created_at,updated_at,created_by) VALUES(NULL,LAST_INSERT_ID(),'"+filepath+"','"+absolutePath+"','"+description+"',1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'"+patientId+"')";
PreparedStatement stmt2=con.prepareStatement(query2);
int rs2=stmt2.executeUpdate();
}
catch(Exception e){
e.printStackTrace();
}
Notifications n = new Notifications();
n.createNotification(patientId,Integer.parseInt(pharmacyid),"New Pharmacy Order has been placed", 3);
//out.print(getServletContext().getRealPath("public/storage/pres/").replace('\\', '/')+"/"+absolutePath);
response.sendRedirect("patient");
con.close();
}
catch(Exception e)
{
out.println(e.toString());
}
}
}
| [
"ayshaifra15@gmail.com"
] | ayshaifra15@gmail.com |
4429a5c6a48e83053cedf97b141cfd25c614fa8c | 5c56d7f97ec5d34994b1357c09d952b3859c7ff7 | /app/src/main/java/com/crossfire/instagramclone/Profile/SignOutFragment.java | fb3e7c65ef79c0b0efa60ec4df43558453410e9a | [] | no_license | akshatcr7/InstagramClone | f09c426489f555240b365ca55a125644de946619 | baafb227009677d9323802b92306b6d2ed7c01d2 | refs/heads/master | 2021-01-23T23:53:03.998173 | 2018-02-24T13:49:49 | 2018-02-24T13:49:49 | 106,103,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,597 | java | package com.crossfire.instagramclone.Profile;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.crossfire.instagramclone.Login.LoginActivity;
import com.crossfire.instagramclone.R;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
/**
* @author Akshat Pandey
* @version 1.0
* @date 03-10-2017
*/
public class SignOutFragment extends Fragment {
private static final String TAG = "SignOutFragment";
//firebase
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;
private ProgressBar mProgressBar;
private TextView tvSignout;
private Button btnConfirmSignout;
private TextView tvSigningout;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_signout, container, false);
tvSignout = (TextView) view.findViewById(R.id.tvConfirmSignout);
mProgressBar = (ProgressBar) view.findViewById(R.id.progressBar);
btnConfirmSignout = (Button) view.findViewById(R.id.btnConfirmSignout);
tvSigningout = (TextView) view.findViewById(R.id.tvSingingOut);
mProgressBar.setVisibility(View.GONE);
tvSigningout.setVisibility(View.GONE);
setupFirebaseAuth();
btnConfirmSignout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "onClick: Attempting to signout.");
mProgressBar.setVisibility(View.VISIBLE);
tvSigningout.setVisibility(View.VISIBLE);
mAuth.signOut();
getActivity().finish();
}
});
return view;
}
/**
********************************* Firebase Stuff ***************************
*/
/**
* Setup the firebase auth object
*/
private void setupFirebaseAuth() {
Log.d(TAG, "setupFirebaseAuth: setting up Firebase Auth");
mAuth = FirebaseAuth.getInstance();
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
// User is signed in
Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
} else {
// User is signed out
Log.d(TAG, "onAuthStateChanged:signed_out");
Intent intent = new Intent(getActivity(), LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
// ...
}
};
}
@Override
public void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListener);
}
@Override
public void onStop() {
super.onStop();
if (mAuthListener != null) {
mAuth.removeAuthStateListener(mAuthListener);
}
}
}
| [
"imakshat147@gmail.com"
] | imakshat147@gmail.com |
03956d27695aeb06d48dd36f6357d9d1f8c3bda2 | 2cab72cff44f1ebe52080fe68f4a743da086e58b | /HomeWorkEE511/src/main/java/ua/goit/homework511/OpLongMultiply.java | e3a4a9f4890c7294be5b71065f6b212ecd4cde40 | [] | no_license | BessonovOleg/GoITHomework | a399c12d16e19b4020a6b95a737bb52ab9a007bd | d9d2d2ac9174b2e14fac81a93b745cf4ad57e144 | refs/heads/master | 2021-01-17T07:11:11.222446 | 2016-07-16T18:28:56 | 2016-07-16T18:28:56 | 50,577,650 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package ua.goit.homework511;
import ua.goit.homework51.AbstractOperation;
import ua.goit.homework51.Calculator;
public class OpLongMultiply extends AbstractOperation {
public String calc(Object var1, Object var2) {
return String.valueOf(Long.valueOf(var1.toString()) * Long.valueOf(var2.toString()));
}
public OpLongMultiply(){
super(Calculator.ADD_LONG,"*");
}
}
| [
"oleg_en@ukr.net"
] | oleg_en@ukr.net |
ec0e7bab363a1641ec683e199de2934d442ad884 | 285807ee8907cea0eae5cb2ac8bbf99178f4a7bd | /gateway/Example1.java | 36b947348ccc40507225c69f2765f396eb586b4c | [] | no_license | zhangxin8105/c8 | 9c8b678c418836b25501a1f1fe77aca27245bb2e | 55c33bdb02078cff4d8a7c1fb92d9dd960df9968 | refs/heads/master | 2021-05-26T13:02:39.650671 | 2010-10-24T11:05:13 | 2010-10-24T11:05:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,501 | java | package c8.gateway;
import java.util.Vector;
import com.oanda.fxtrade.api.Account;
import com.oanda.fxtrade.api.FXGame;
import com.oanda.fxtrade.api.FXClient;
import com.oanda.fxtrade.api.FXPair;
import com.oanda.fxtrade.api.MarketOrder;
import com.oanda.fxtrade.api.OAException;
import com.oanda.fxtrade.api.StopLossOrder;
import com.oanda.fxtrade.api.User;
public final class Example1 extends Thread {
private Example1() {
super();
}
public static void main(String[] args) throws Exception {
FXClient fxclient = new FXGame();
String username = args[0];
String password = args[1];
while (true) {
try {
fxclient.setTimeout(10);
fxclient.setWithRateThread(true);
fxclient.login(username, password);
break;
}
catch (OAException oe) {
System.out.println("Example: caught: " + oe);
}
sleep(5000);
}
User me = fxclient.getUser();
System.out.println("name=" + me.getName());
System.out.println("email=" + me.getEmail());
Vector accounts = me.getAccounts();
for (int i = 0; i < accounts.size(); i++) {
System.out.println("accountid=" + accounts.elementAt(i));
}
Account myaccount = (Account)accounts.firstElement();
System.out.println("Account ID: " + myaccount.getAccountId());
System.out.println("MarginRate: " + myaccount.getMarginRate());
//PLACE A MARKET ORDER
MarketOrder neworder = new MarketOrder();
neworder.setUnits(100000);
neworder.setPair(new FXPair("GBP/CHF"));
neworder.setStopLoss(new StopLossOrder(0.1029));
try {
myaccount.execute(neworder);
}
catch (OAException oae) {
System.out.println("Example: caught: " + oae);
}
//MONITOR MY ACCOUNT AND DISPLAY ACCOUNT INFO EVERY 5 SECONDS
while (true) {
Vector trades = new Vector();
try {
trades = myaccount.getTrades();
}
catch (OAException oe) {
System.out.println("Example: caught: " + oe);
sleep(1000);
continue;
}
System.out.println("CURRENT TRADES:");
for (int i = 0; i < trades.size(); i++) {
System.out.println(trades.elementAt(i));
}
System.out.println("CURRENT ACCOUNT INFO:");
System.out.println("Balance: " + myaccount.getBalance());
System.out.println("Realized PL: " + myaccount.getRealizedPL());
System.out.println("Unrealized PL: " + myaccount.getUnrealizedPL());
System.out.println("MarginUsed: " + myaccount.getMarginUsed());
System.out.println("MarginAvailable: " + myaccount.getMarginAvailable());
sleep(5000);
}
}
}
| [
"mblackwell8@gmail.com"
] | mblackwell8@gmail.com |
3d6c8731a862543a0540d43949c6bb71d11fdecd | 708722edd1e13e63200e619f00f1cd5e8791a0bb | /sales/src/main/java/sales/app/server/businessservice/CoreContactsBusinessService.java | 111c6f7b9c54c2ce912edc82448f3f8b1df70ca9 | [] | no_license | applifireAlgo/deploytest | 85495085ae7da736976843ec787dd626468ea0d7 | 253cca7b5bd07a9607a8111b6b331eb69e609bf2 | refs/heads/master | 2021-01-10T13:52:03.711214 | 2015-12-21T07:03:56 | 2015-12-21T07:03:56 | 48,237,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,365 | java | package sales.app.server.businessservice;
import com.athena.framework.server.exception.repository.SpartanPersistenceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import sales.app.server.repository.CoreContactsRepository;
import sales.app.shared.contacts.CoreContacts;
import java.util.List;
@Component
public class CoreContactsBusinessService {
@Autowired
private CoreContactsRepository coreContactsRepository;
public void update(CoreContacts entity) throws SpartanPersistenceException {
try {
if (entity.isHardDelete()) {
coreContactsRepository.delete(entity.getContactId());
} else {
coreContactsRepository.deleteCommunicationData(entity.getDeletedCommunicationDataList());
coreContactsRepository.deleteAddress(entity.getDeletedAddressList());
coreContactsRepository.update(entity);
}
} catch (javax.persistence.PersistenceException e) {
throw new com.athena.framework.server.exception.repository.SpartanPersistenceException("Error in entity creation", e);
} catch (Exception e) {
throw new com.athena.framework.server.exception.repository.SpartanPersistenceException("Error while updating entity", e);
}
}
public void update(List<CoreContacts> entity) throws SpartanPersistenceException {
try {
for (CoreContacts _corecontacts : entity) {
if (_corecontacts.isHardDelete()) {
coreContactsRepository.delete(_corecontacts.getContactId());
} else {
coreContactsRepository.deleteCommunicationData(_corecontacts.getDeletedCommunicationDataList());
coreContactsRepository.deleteAddress(_corecontacts.getDeletedAddressList());
coreContactsRepository.update(_corecontacts);
}
}
} catch (javax.persistence.PersistenceException e) {
throw new com.athena.framework.server.exception.repository.SpartanPersistenceException("Error in updating Entity", e);
} catch (Exception e) {
throw new com.athena.framework.server.exception.repository.SpartanPersistenceException("Error while updating entity", e);
}
}
}
| [
"applifire@ae4e8c8ef1a4"
] | applifire@ae4e8c8ef1a4 |
ea8ee84788db0a648f3e3fbe2f8eb036c751a9dd | ad5b11ce6186ca76bf4098852d34b4a806906b1f | /zhao_sheng/src/main/java/com/yfy/app/net/event/EventDelRes.java | 4ff76db7d0afddc9c53b365be401d6d1c603f85f | [] | no_license | Zhaoxianxv/zhao_sheng1 | 700666c2589529aee9a25597f63cc6a07dcfe78c | 9fdd9512bf38fcfe4ccbe197034a006a3d053c66 | refs/heads/master | 2022-12-14T03:07:48.096666 | 2020-09-06T03:36:17 | 2020-09-06T03:36:17 | 291,885,920 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package com.yfy.app.net.event;
import com.yfy.final_tag.Base;
import com.yfy.final_tag.TagFinal;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
/**
* Created by yfyandr on 2018/4/26.
*/
@Root(name = TagFinal.EVENT_DEL+Base.RESPONSE)
public class EventDelRes {
@Attribute(name = "xmlns", empty = TagFinal.NAMESPACE, required = false)
public String nameSpace;
@Element(name = TagFinal.EVENT_DEL+Base.RESULT, required = false)
public String result;
}
| [
"1006584058@qq.com"
] | 1006584058@qq.com |
af8160b44a9abd42eac565b624a7e2bdd222e3fb | 24f0e295ee1a85d30966e8e98d33fc21bd2d6d63 | /src/main/java/com/example/helloworld/api/Question.java | 536e8b97c5dfb6a821c7088eccce46cff0be50ab | [] | no_license | emilgth/PersonalityTest | ac6b1fb20486e307b932ff42587841475a198570 | ac0d095578c7fa2366f37e16d3176a07cde50f76 | refs/heads/master | 2022-12-01T16:50:02.228961 | 2020-08-17T11:45:09 | 2020-08-17T11:45:09 | 288,164,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.example.helloworld.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class Question {
private String question;
private List<Answer> answers;
public Question() {
}
public Question(String question, List<Answer> answers) {
this.question = question;
this.answers = answers;
}
@JsonProperty
public String getQuestion() {
return question;
}
@JsonProperty
public void setQuestion(String question) {
this.question = question;
}
@JsonProperty
public List<Answer> getAnswers() {
return answers;
}
@JsonProperty
public void setAnswers(List<Answer> answers) {
this.answers = answers;
}
}
| [
"emilgth@gmail.com"
] | emilgth@gmail.com |
dc5b44a4af9ba86d8cbcef08174e11452050c934 | 5fc604a5711eacf9b3ab587b7242e1383eb2dcc4 | /app/src/main/java/br/ufc/es/retry/HistoricoReciclagem.java | 4cb8b00a564b75fbbce43fd6061e16dfc655dbf4 | [] | no_license | anderson-uchoa/ReTry | f27d729f179404ae8b0fba2c30c7047391d3b954 | 78d02c4453db2cb4a11f90ec731b811cc487cac4 | refs/heads/master | 2021-01-15T18:15:07.472386 | 2016-01-26T01:27:47 | 2016-01-26T01:27:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,005 | java | package br.ufc.es.retry;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ExpandableListView;
public class HistoricoReciclagem extends AppCompatActivity {
SparseArray<Group> groups = new SparseArray<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_historico_reciclagem);
createData();
ExpandableListView list = (ExpandableListView) findViewById(R.id.listView);
ListaHistoricoReciclagem adapter = new ListaHistoricoReciclagem(this, groups);
list.setAdapter(adapter);
}
private void createData() {
int k = 1;
for (int j = 0; j < 5; j++) {
k = j * j + k;
Group group = new Group("Item de reciclagem " + j);
group.children.add("Tipo do item reciclado");
group.children.add("Quantidade de itens: " +j);
group.children.add("Pontuaรงรฃo obtida: " +k);
groups.append(j, group);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_historico_reciclagem, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch (item.getItemId()) {
case R.id.home:
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
return true;
case R.id.editar_perfil:
Intent intent1 = new Intent(getApplicationContext(), EditarPerfil.class);
startActivity(intent1);
return true;
case R.id.rankings:
Intent intent2 = new Intent(getApplicationContext(), Ranking.class);
startActivity(intent2);
return true;
case R.id.locais:
Intent intent3 = new Intent(getApplicationContext(), PontosDeReciclagem.class);
startActivity(intent3);
return true;
case R.id.historico:
Intent intent4 = new Intent(getApplicationContext(), HistoricoReciclagem.class);
startActivity(intent4);
return true;
case R.id.sair:
Intent intent5 = new Intent(getApplicationContext(), Login.class);
startActivity(intent5);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| [
"cayk-lima@hotmail.com"
] | cayk-lima@hotmail.com |
008cbcd89d54162973e6a96fda4a3fd0ef8274de | 4652102ea0f77e0caff90b2de076a0023638c950 | /subjects/Socket/mutants/traditional_mutants/void_internal_connect(com.example.socket.MockSocketAddress,int)/ROR_10/Socket.java | 38125100be91816f35648cc5fa06640f7f2fc557 | [] | no_license | j-godoy/epa-benchmark | 678716b8f4a7ba31569500a9474ced47ad6e8a8d | e5cc4958cf927366afffe0d8741c86caf14cfceb | refs/heads/master | 2021-07-05T16:14:02.902363 | 2020-06-18T00:51:35 | 2020-06-18T00:51:35 | 154,675,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,628 | java | // This is a mutant program.
// Author : ysma
package com.example.socket;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
public class Socket
{
private boolean created = false;
private boolean bound = false;
private boolean connected = false;
private boolean closed = false;
private java.lang.Object closeLock = new java.lang.Object();
private boolean shutIn = false;
private boolean shutOut = false;
private com.example.socket.MockSocketImpl impl;
private boolean oldImpl = false;
private com.example.socket.MockEnvironment env;
public Socket( com.example.socket.MockEnvironment env )
throws java.lang.Exception
{
try {
this.env = env;
setImpl();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
public Socket()
throws java.lang.Exception
{
this( new com.example.socket.MockEnvironment() );
}
private void createImpl( boolean stream )
throws java.net.SocketException
{
if (impl == null) {
setImpl();
}
try {
impl.create( stream );
created = true;
} catch ( java.io.IOException e ) {
throw new java.net.SocketException( e.getMessage() );
}
}
private void setImpl()
{
if (factory != null) {
impl = factory.createSocketImpl( env );
} else {
impl = new com.example.socket.MockSocketImpl( env );
}
if (impl != null) {
impl.setSocket( this );
}
}
private com.example.socket.MockSocketImpl getImpl()
throws java.net.SocketException
{
if (!created) {
createImpl( true );
}
return impl;
}
public int connect( com.example.socket.MockSocketAddress endpoint )
throws java.io.IOException, java.lang.Exception
{
try {
return connect0( endpoint );
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private int connect0( com.example.socket.MockSocketAddress endpoint )
throws java.io.IOException
{
try {
internal_connect( endpoint, 0 );
return RET_OK;
} catch ( com.example.socket.MockIOException ex ) {
return IO_EXCEPTION;
}
}
private static final int RET_OK = 0;
private static final int IO_EXCEPTION = 1;
public int connect( com.example.socket.MockSocketAddress endpoint, int timeout )
throws java.io.IOException, java.lang.Exception
{
try {
return connect0( endpoint, timeout );
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private int connect0( com.example.socket.MockSocketAddress endpoint, int timeout )
throws java.io.IOException
{
try {
internal_connect( endpoint, timeout );
return RET_OK;
} catch ( com.example.socket.MockIOException ex ) {
return IO_EXCEPTION;
}
}
private void internal_connect( com.example.socket.MockSocketAddress endpoint, int timeout )
throws java.io.IOException, java.lang.IllegalArgumentException, com.example.socket.MockIOException
{
try {
if (endpoint == null) {
throw new java.lang.IllegalArgumentException( "connect: The address can't be null" );
}
if (true) {
throw new java.lang.IllegalArgumentException( "connect: timeout can't be negative" );
}
if (isClosed()) {
throw new java.net.SocketException( "Socket is closed" );
}
if (!oldImpl && isConnected()) {
throw new java.net.SocketException( "already connected" );
}
if (!(endpoint instanceof com.example.socket.MockInetSocketAddress)) {
throw new java.lang.IllegalArgumentException( "Unsupported address type" );
}
com.example.socket.MockInetSocketAddress epoint = (com.example.socket.MockInetSocketAddress) endpoint;
com.example.socket.MockInetAddress addr = epoint.getAddress();
int port = epoint.getPort();
checkAddress( addr, "connect" );
if (!created) {
createImpl( true );
}
if (!oldImpl) {
impl.connect( epoint, timeout );
} else {
if (timeout == 0) {
if (epoint.isUnresolved()) {
impl.connect( addr.getHostName(), port );
} else {
impl.connect( addr, port );
}
} else {
throw new java.lang.UnsupportedOperationException( "SocketImpl.connect(addr, timeout)" );
}
}
connected = true;
bound = true;
} finally
{
if (!connected) {
this.internal_close();
}
}
}
public int bind( com.example.socket.MockSocketAddress bindpoint )
throws java.io.IOException, java.lang.Exception
{
try {
return bind0( bindpoint );
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private int bind0( com.example.socket.MockSocketAddress bindpoint )
throws java.net.SocketException, java.io.IOException
{
try {
internal_bind( bindpoint );
return RET_OK;
} catch ( com.example.socket.MockIOException ex ) {
return IO_EXCEPTION;
}
}
private void internal_bind( com.example.socket.MockSocketAddress bindpoint )
throws java.net.SocketException, java.io.IOException, com.example.socket.MockIOException
{
if (isClosed()) {
throw new java.net.SocketException( "Socket is closed" );
}
if (!oldImpl && isBound()) {
throw new java.net.SocketException( "Already bound" );
}
if (bindpoint != null && !(bindpoint instanceof com.example.socket.MockInetSocketAddress)) {
throw new java.lang.IllegalArgumentException( "Unsupported address type" );
}
com.example.socket.MockInetSocketAddress epoint = (com.example.socket.MockInetSocketAddress) bindpoint;
if (epoint != null && epoint.isUnresolved()) {
throw new java.net.SocketException( "Unresolved address" );
}
if (epoint == null) {
epoint = new com.example.socket.MockInetSocketAddress( 0 );
}
com.example.socket.MockInetAddress addr = epoint.getAddress();
int port = epoint.getPort();
checkAddress( addr, "bind" );
getImpl().bind( addr, port );
bound = true;
}
private void checkAddress( com.example.socket.MockInetAddress addr, java.lang.String op )
{
if (addr == null) {
return;
}
if (!(addr instanceof com.example.socket.MockInet4Address || addr instanceof com.example.socket.MockInet6Address)) {
throw new java.lang.IllegalArgumentException( op + ": invalid address type" );
}
}
public com.example.socket.Pair<Integer,InputStream> getInputStream()
throws java.io.IOException, java.lang.Exception
{
try {
return getInputStream0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private com.example.socket.Pair<Integer,InputStream> getInputStream0()
throws java.net.SocketException, java.io.IOException
{
try {
java.io.InputStream is = internal_getInputStream();
return new com.example.socket.Pair<Integer,InputStream>( RET_OK, is );
} catch ( com.example.socket.MockIOException ex ) {
return new com.example.socket.Pair<Integer,InputStream>( IO_EXCEPTION, null );
}
}
private java.io.InputStream internal_getInputStream()
throws java.net.SocketException, java.io.IOException, com.example.socket.MockIOException
{
if (isClosed()) {
throw new java.net.SocketException( "Socket is closed" );
}
if (!isConnected()) {
throw new java.net.SocketException( "Socket is not connected" );
}
if (isInputShutdown()) {
throw new java.net.SocketException( "Socket input is shutdown" );
}
java.io.InputStream is = null;
try {
is = AccessController.doPrivileged( new java.security.PrivilegedExceptionAction<InputStream>(){
public java.io.InputStream run()
throws java.io.IOException, com.example.socket.MockIOException
{
return impl.getInputStream();
}
} );
} catch ( java.security.PrivilegedActionException e ) {
throw (java.io.IOException) e.getException();
}
return is;
}
public com.example.socket.Pair<Integer,OutputStream> getOutputStream()
throws java.io.IOException, java.lang.Exception
{
try {
return getOutputStream0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private com.example.socket.Pair<Integer,OutputStream> getOutputStream0()
throws java.net.SocketException, java.io.IOException
{
try {
java.io.OutputStream os = internal_getOutputStream();
return new com.example.socket.Pair<Integer,OutputStream>( RET_OK, os );
} catch ( com.example.socket.MockIOException ex ) {
return new com.example.socket.Pair<Integer,OutputStream>( IO_EXCEPTION, null );
}
}
private java.io.OutputStream internal_getOutputStream()
throws java.net.SocketException, java.io.IOException, com.example.socket.MockIOException
{
if (isClosed()) {
throw new java.net.SocketException( "Socket is closed" );
}
if (!isConnected()) {
throw new java.net.SocketException( "Socket is not connected" );
}
if (isOutputShutdown()) {
throw new java.net.SocketException( "Socket output is shutdown" );
}
java.io.OutputStream os = null;
try {
os = AccessController.doPrivileged( new java.security.PrivilegedExceptionAction<OutputStream>(){
public java.io.OutputStream run()
throws java.io.IOException, com.example.socket.MockIOException
{
return impl.getOutputStream();
}
} );
} catch ( java.security.PrivilegedActionException e ) {
throw (java.io.IOException) e.getException();
}
return os;
}
private synchronized void internal_close()
throws java.io.IOException, com.example.socket.MockIOException
{
synchronized (closeLock)
{
if (isClosed()) {
return;
}
if (created) {
impl.close();
}
closed = true;
}
}
public int close()
throws java.io.IOException, java.lang.Exception
{
try {
return close0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private int close0()
throws java.io.IOException
{
try {
this.internal_close();
return RET_OK;
} catch ( com.example.socket.MockIOException ex ) {
return IO_EXCEPTION;
}
}
public int shutdownInput()
throws java.io.IOException, java.lang.Exception
{
try {
return shutdownInput0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private int shutdownInput0()
throws java.net.SocketException, java.io.IOException
{
try {
internal_shutdownInput();
return RET_OK;
} catch ( com.example.socket.MockIOException ex ) {
return IO_EXCEPTION;
}
}
private void internal_shutdownInput()
throws java.net.SocketException, java.io.IOException, com.example.socket.MockIOException
{
if (isClosed()) {
throw new java.net.SocketException( "Socket is closed" );
}
if (!isConnected()) {
throw new java.net.SocketException( "Socket is not connected" );
}
if (isInputShutdown()) {
throw new java.net.SocketException( "Socket input is already shutdown" );
}
getImpl().shutdownInput();
shutIn = true;
}
public int shutdownOutput()
throws java.io.IOException, java.lang.Exception
{
try {
return shutdownOutput0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private int shutdownOutput0()
throws java.net.SocketException, java.io.IOException
{
try {
internal_shutdownOutput();
return RET_OK;
} catch ( com.example.socket.MockIOException ex ) {
return IO_EXCEPTION;
}
}
private void internal_shutdownOutput()
throws java.net.SocketException, java.io.IOException, com.example.socket.MockIOException
{
if (isClosed()) {
throw new java.net.SocketException( "Socket is closed" );
}
if (!isConnected()) {
throw new java.net.SocketException( "Socket is not connected" );
}
if (isOutputShutdown()) {
throw new java.net.SocketException( "Socket output is already shutdown" );
}
getImpl().shutdownOutput();
shutOut = true;
}
private boolean isConnected()
{
return connected || oldImpl;
}
private boolean isBound()
{
return bound || oldImpl;
}
private boolean isClosed()
{
synchronized (closeLock)
{
return closed;
}
}
private boolean isInputShutdown()
{
return shutIn;
}
private boolean isOutputShutdown()
{
return shutOut;
}
private static com.example.socket.MockSocketImplFactory factory = null;
}
| [
"j.godoy277@gmail.com"
] | j.godoy277@gmail.com |
e001ccc39a4c8e294e05e4d3c0f3ec59f787bdf7 | deabf85ebe6669fd037711ccfb1f5d3c54d5666d | /src/edu/bxml/swt/Combo.java | a2ac8852bc75f5a613af639bf4daf3a4bd821a97 | [] | no_license | satyasumans/XML-batch-project | 1fc8251c183266c004817e67f48169bc9d9eb1cf | ea0946ae7d948e9037b8e9c4984a6086e747c6f1 | refs/heads/master | 2020-12-25T05:30:24.831468 | 2013-07-10T20:39:16 | 2013-07-10T20:39:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,388 | java | package edu.bxml.swt;
import java.util.HashMap;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.swt.SWT;
import com.browsexml.core.XMLBuildException;
import com.browsexml.core.XmlParser;
import com.javalobby.tnt.annotation.attribute;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
/**
* A combo box gui item
*/
@attribute(value = "", required = false)
public class Combo extends ControlObject {
private static Log log = LogFactory.getLog(Combo.class);
org.eclipse.swt.widgets.Combo combo = null;
org.eclipse.swt.widgets.Composite GUIParent = null;
HashMap<String, String> values = new HashMap<String, String>();
public org.eclipse.swt.widgets.Combo getGUIObject() {
return combo;
}
public boolean processRawAttributes(org.xml.sax.Attributes attrs) {
String style = attrs.getValue("style");
this.style = XmlParser.getFieldValues(SWT.class, style);
combo = new org.eclipse.swt.widgets.Combo(getGUIParent(), this.style);
return true;
}
/**
* DROP_DOWN, READ_ONLY, SIMPLE
* Events: DefaultSelection, Modify, Selection
*/
@attribute(value = "", required = false, defaultValue="NONE")
public void setStyle(String style) {
// dummy function for comment
}
@Override
public void execute() throws XMLBuildException {
}
@Override
public void check() throws XMLBuildException {
}
/**
* Clear the dropdown list
*/
@attribute(value = "", required = false, defaultValue="false")
public void removeAll() {
combo.removeAll();
}
/**
* Set the text
*/
@attribute(value = "", required = false, defaultValue="blank")
public void setText(String text) {
combo.setText(text);
}
/**
* Set the number of items appearing without the need to scroll.
* If more items this this are in the drop down list, a scrollbar
* will be drawn at the right.
*/
@attribute(value = "", required = false, defaultValue="SWT default")
public void setVisibleItemCount(Integer count) {
combo.setVisibleItemCount(count);
}
public void setVisibleItemCount(String count) throws XMLParseException {
setVisibleItemCount(Integer.parseInt(count));
}
public void setItems(String items) {
log.debug("COMBO SET ITEMS");
edu.bxml.swt.Linkedhashmap lhm = (edu.bxml.swt.Linkedhashmap) getSymbolTable().get(items);
HashMap values = lhm.values;
log.debug("values size = " + values.size());
Iterator myVeryOwnIterator = values.keySet().iterator();
while(myVeryOwnIterator.hasNext()) {
String item = (String) myVeryOwnIterator.next();
log.debug(item);
combo.add(item);
}
}
/**
* Add an item to the dropdown list
*/
@attribute(value = "", required = false)
public void addItem(Item i) {
}
public void addItemEnd(Item i) {
combo.add(i.getValue());
values.put( i.getValue(), i.getKey());
}
public String getText() {
return values.get(combo.getText());
}
public org.eclipse.swt.widgets.Composite getGUIParent() {
return GUIParent;
}
public void setGUIParent(org.eclipse.swt.widgets.Widget parent) {
GUIParent = (org.eclipse.swt.widgets.Composite)parent;
}
public String toString() {
if (combo != null)
return values.get(combo.getText());
return "";
}
}
| [
"geoff.ritchey@lcu.edu"
] | geoff.ritchey@lcu.edu |
2235bda549fed35a51adde75212da418de8330dc | e2f2326ef807eef64c7a8b85c999fe902b80c072 | /src/main/java/com/howtodoinjava/core/string/ReverseString.java | 4b3f6731e72e5a52693621ac2d8b03bad180bab8 | [
"Apache-2.0"
] | permissive | lokeshgupta1981/Core-Java | e867a9929d654bf9ddbe95708bca80ecfe757232 | a1e249f6bf43898b6e293d41900f68fbc3afbaa2 | refs/heads/master | 2023-08-09T19:05:12.740014 | 2023-08-04T16:49:32 | 2023-08-04T16:49:32 | 213,713,246 | 54 | 89 | Apache-2.0 | 2023-09-05T08:16:19 | 2019-10-08T17:53:32 | Java | UTF-8 | Java | false | false | 639 | java | package com.howtodoinjava.core.string;
import org.junit.jupiter.api.Assertions;
public class ReverseString {
public static void main(String[] args) {
String blogName = "How To Do In Java";
String reverseString = reverseString(blogName);
Assertions.assertEquals("avaJ nI oD oT woH", reverseString);
reverseString = new StringBuilder(blogName).reverse().toString();
Assertions.assertEquals("avaJ nI oD oT woH", reverseString);
}
public static String reverseString(String string) {
if (string.isEmpty()) {
return string;
}
return reverseString(string.substring(1)) + string.charAt(0);
}
}
| [
"howtodoinjava@gmail.com"
] | howtodoinjava@gmail.com |
24a713561079ca4629835d30a178f2ea28b7b31b | a40c680a0c353c64c2f265af81ded9157e7ac478 | /com.onpositive.text.analisys/src/com/onpositive/text/analysis/filtering/IPartOfSpeechSelector.java | fe3fa062d7dcd4219b62f8db7d3c60e97e4fb797 | [
"Apache-2.0"
] | permissive | 32kda/com.onpositive.textresearch | c9d97547b98b3159341813401ec788b59b4d569f | a183c9f62e0fae528e2cdbeffb95ad8d271424e5 | refs/heads/master | 2023-01-06T16:26:46.182686 | 2020-11-24T03:32:02 | 2020-11-24T03:32:02 | 55,604,374 | 1 | 0 | Apache-2.0 | 2023-01-02T22:09:11 | 2016-04-06T12:36:08 | Java | UTF-8 | Java | false | false | 281 | java | package com.onpositive.text.analysis.filtering;
import java.util.Collection;
import com.onpositive.semantic.wordnet.Grammem.PartOfSpeech;
public interface IPartOfSpeechSelector {
public Collection<PartOfSpeech> select(String token, Collection<PartOfSpeech> originalParts);
}
| [
"dmitry@onpositive.com"
] | dmitry@onpositive.com |
5d011f02589a1974f753391e69d278d1f03fb1bf | 2d5e9c2d12dbd5262933370776b72dcd8504dbfd | /app/src/main/java/com/example/myapplication02/EditUserActivity.java | 5f9a18236a359c54ac28a4a566f83319da70ba5b | [] | no_license | Blueguy51/MADWeek01-Task02-0706012010040 | 7a2f5ee7a685367580c92d3e48bf49bfc91e70ce | 2a2c99f73fe0c1872022f1da92b00d93f93c6d72 | refs/heads/master | 2023-08-18T15:08:35.764512 | 2021-09-15T17:06:45 | 2021-09-15T17:06:45 | 406,221,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,184 | java | package com.example.myapplication02;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import java.util.ArrayList;
import model.Data;
import model.User;
public class EditUserActivity extends AppCompatActivity {
public User user;
public int position;
public ArrayList<User> listUser = Data.saveList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edituser);
user = getIntent().getParcelableExtra("data");
position = getIntent().getIntExtra("position", 0);
TextView user_cardview = findViewById(R.id.user_cardview);
TextView card_age = findViewById(R.id.subtoolbar_int_age);
TextView card_address = findViewById(R.id.subtoolbar_string_address);
Button button_edit = findViewById(R.id.button_edit);
Button button_delete = findViewById(R.id.button_delete);
user_cardview.setText(user.getNama());
card_age.setText(String.valueOf(user.getAge()));
card_address.setText(user.getAddress());
button_edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navigateToEditPage();
}
});
button_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
alertMessage();
}
});
}
public void navigateToEditPage() {
Intent intent = new Intent(this, com.example.myapplication02.AddUserActivity.class);
intent.putExtra("data", user);
intent.putExtra("position", position);
startActivity(intent);
finish();
}
public void alertMessage() {
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
listUser.remove(position);
Log.d("test", String.valueOf(position));
Toast.makeText(EditUserActivity.this, "Delete Success",
Toast.LENGTH_LONG).show();
Intent intent = new Intent(EditUserActivity.this, MainActivity.class);
startActivity(intent);
case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss();
}
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Hapus Data");
builder.setMessage("Yakin ingin hapus data?")
.setPositiveButton("Hapus", dialogClickListener)
.setNegativeButton("Batal", dialogClickListener).show();
}
} | [
"tdewanto@student.ciputra.ac.id"
] | tdewanto@student.ciputra.ac.id |
1934afb02ebe12f1f1075444bba42fef81d5adfc | 22e1c8eee9666f60a905f5a4da3e6c3a1d3f0b47 | /src/main/java/com/cygnus/bookface/BookFaceApplication.java | 24b6fae6c406bcc8c5dc6793fc8d75f886700e9c | [] | no_license | melybowden/BookFace | c54782eaac994691f6f3c7fb8b1218c2fec474bc | 125a50709ed73501236cabac761b21b3727021a8 | refs/heads/master | 2023-06-30T22:21:13.180122 | 2021-08-03T20:29:16 | 2021-08-03T20:29:16 | 390,395,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package com.cygnus.bookface;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BookFaceApplication {
public static void main(String[] args) {
SpringApplication.run(BookFaceApplication.class, args);
}
}
| [
"melybowden@gmail.com"
] | melybowden@gmail.com |
55f3bc0fc5b6262a2cdbd2bb1b246025daf74920 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /java/java-tests/testData/refactoring/introduceParameter/beforeMethodUsageInThisMethodInheritor.java | f3708af9585f4be33a58a4f50e747079cc9b7c10 | [
"Apache-2.0"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 145 | java | class C {
int foo(int x) {
return <selection>x+1</selection>;
}
}
class D extends C {
int foo(int x) {
return super.foo(x);
}
} | [
"no_reply@jetbrains.com"
] | no_reply@jetbrains.com |
9f00fa306cc609c53e12f5dee3d7d40b3ba877e5 | 0123b693e59a27b1259c5d51c5f194e13a93e3c5 | /demo-rabbitmq/src/main/java/io/lzz/demo/rabbitmq/api/fanout/ProducerFanout.java | b4226e1a940621fd6f14725bec14fad026ef4617 | [
"Apache-2.0"
] | permissive | lzz-io/demo | 351b6ee39b4320b8947d862ade8fe2f71adda15a | c667dde8138d86ab1674cb312c203cc52a222ecc | refs/heads/master | 2023-06-10T16:32:07.857829 | 2023-05-24T14:15:49 | 2023-05-24T14:15:49 | 153,786,501 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,156 | java | /*
* Copyright qq:1219331697
*
* 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 io.lzz.demo.rabbitmq.api.fanout;
import java.util.Date;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
/**
* fanout: ๅนฟๆญ
*
* 1.่ฟ็งๆจกๅผไธ้่ฆๆๅฎRouting key่ทฏ็ฑ้ฎ๏ผ
* ไธไธชไบคๆขๆบๅฏไปฅ็ปๅฎๅคไธช้ๅqueue,ไธไธชqueueๅฏๅๆถไธๅคไธชexchangeไบคๆขๆบ่ฟ่ก็ปๅฎ๏ผ
*
* 2.ๅฆๆๆถๆฏๅ้ๅฐไบคๆขๆบไธ๏ผไฝๆฏ่ฟไธชไบคๆขๆบไธ้ขๆฒกๆ็ปๅฎ็้ๅ๏ผ้ฃไน่ฟไบๆถๆฏๅฐไผ่ขซไธขๅผ๏ผ
*
* @author q1219331697
*
*/
public class ProducerFanout {
private static final String exchange = "demo.fanout";
// fanout: ๅนฟๆญ
private static final String type = "fanout";
public void send() throws Exception {
ConnectionFactory connectionFactory = new ConnectionFactory();
String host = "localhost";
String username = "guest";
String password = "guest";
int port = 5672;
connectionFactory.setHost(host);
connectionFactory.setUsername(username);
connectionFactory.setPassword(password);
connectionFactory.setPort(port);
Connection connection = connectionFactory.newConnection();
Channel channel = connection.createChannel();
channel.exchangeDeclare(exchange, type, true, false, null);
// ๅ้ๆถๆฏ
String msg = "fanout msg! " + new Date();
channel.basicPublish(exchange, "", null, msg.getBytes());
// ้ๅฟ
้กป
channel.close();
connection.close();
}
public static void main(String[] args) throws Exception {
ProducerFanout producer = new ProducerFanout();
producer.send();
}
}
| [
"1219331697@qq.com"
] | 1219331697@qq.com |
bc633925757f9202780cae2b6d3cbe2b9368da9d | 48631c3851b15fbc20e61e29b82480b64eec2885 | /utils/src/main/java/com/prosayj/springboot/utils/freemarker/FreemarkerUtil.java | c536da80b912fa7b0137107f23bc4a25086c9bef | [
"Apache-2.0"
] | permissive | ProSayJ/springbootstudy | 56cb7f80502888d2c564d7a4bda23dd0650750f7 | 04b5ce563b9e6163ab6d6217292d7dd266e105c3 | refs/heads/master | 2022-12-25T10:42:49.047945 | 2021-04-09T15:20:12 | 2021-04-09T15:20:12 | 147,488,466 | 0 | 0 | Apache-2.0 | 2022-12-16T03:22:22 | 2018-09-05T08:52:00 | Java | UTF-8 | Java | false | false | 1,366 | java | package com.prosayj.springboot.utils.freemarker;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
public class FreemarkerUtil {
private static FreemarkerUtil fu = null;
private Configuration cfg = null;
private FreemarkerUtil() {
cfg = new Configuration(Configuration.VERSION_2_3_23);
try {
//ๆณจๅtmlplate็load่ทฏๅพ
cfg.setClassForTemplateLoading(this.getClass(), "com/prosayj/springboot/utils/template/");
} catch (Exception e) {
}
}
private static Template getTemplate(String name) throws IOException {
if(fu == null) {
fu = new FreemarkerUtil();
}
return fu.cfg.getTemplate(name);
}
/**
*
* @param templatefile ๆจกๆฟๆไปถ
* @param param ้่ฆๅกซๅ
็ๅ
ๅฎน
* @param out ๅกซๅ
ๅฎๆ่พๅบ็ๆไปถ
* @throws IOException
* @throws TemplateException
*/
public static void process(String templatefile, Map param ,Writer out) throws IOException, TemplateException{
//่ทๅๆจกๆฟ
Template template = FreemarkerUtil.getTemplate(templatefile);
template.setOutputEncoding("UTF-8");
//ๅๅนถๆฐๆฎ
template.process(param, out);
if(out!=null){
out.close();
}
}
}
| [
"prosayj@gmail.com"
] | prosayj@gmail.com |
66bf3da7bed110a7ea97d8742b37195f0d800a8c | 5cb7b7f3d3b25ef344268bf75897a716217570c2 | /app/src/main/java/com/example/chongjiale/navr/WayFindingActivity.java | d676939c54005245f12215c6a5a9dbe903e19857 | [] | no_license | lighthouse-dkit/Navr | ade48cf766c8b0b731929c4efe3fcb7371a4eebd | 9084683aa2f85ee25dec4d94e2f8eba2322cd70c | refs/heads/master | 2021-04-26T13:24:48.605354 | 2018-05-03T03:24:45 | 2018-05-03T03:24:45 | 121,310,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.example.chongjiale.navr;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.FrameLayout;
public class WayFindingActivity extends AppCompatActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_way_finding);
FrameLayout arViewPane = (FrameLayout) findViewById(R.id.ar_view_pane);
ArNavigateView arDisplay = new ArNavigateView(this,this);
arViewPane.addView(arDisplay);
OverlayView arContent = new OverlayView(getApplicationContext());
arViewPane.addView(arContent);
}
}
| [
"D00169978@student.dkit.ie"
] | D00169978@student.dkit.ie |
97f2bab9f00c7d81675b144816c4f32d35640a00 | 0c06413eb3ea47de1764577bfeed195175a96c33 | /src/main/java/dailycodingproblems/DailyCodingProblem4.java | 20b2020656102be7347d93779d24fa489dd42bd1 | [] | no_license | urmilkarani/Practice | 92f06ef8b22804ff29e62e24bfc63caeb3dd5877 | 8d6c2f08bef5806ff25030cbcb2370657b7bb771 | refs/heads/master | 2020-05-16T15:06:10.927994 | 2019-08-13T23:40:30 | 2019-08-13T23:40:30 | 183,120,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | /**
* Given an array of integers, find the first missing positive integer in linear time and constant space.
* In other words, find the lowest positive integer that does not exist in the array.
* The array can contain duplicates and negative numbers as well.
*
* For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.
*
* You can modify the input array in-place.
*/
package dailycodingproblems;
import java.util.Arrays;
public class DailyCodingProblem4 {
public static void main(String[] args) {
int[] arr = {0,0,0,-1,1,1,1,5,4,1,2};
System.out.println(findMissingPositive(arr));
}
private static int findMissingPositive(int[] arr) {
int missingElement = 0;
Arrays.sort(arr);
for(int i = 1, j = 0 ; i <= arr.length; i++) {
if(arr[j] == arr[i-1] || arr[i-1] < 0) {
continue;
} else if (arr[i-1] == missingElement) {
j = i-1;
missingElement++;
} else {
return missingElement;
}
}
return missingElement;
}
}
| [
"urmilkarani@gmail.com"
] | urmilkarani@gmail.com |
8e71428ae26ce7ebef34a574dd1c77fa3f5d257a | 0be704cafcde3a7d18895a402311add671dd275c | /firstMvc/src/com/org/mvc/EmployeeManger.java | b67ffc8d6a282daddcefbbc879aacb60607dc94d | [] | no_license | MahendraDecha/javaLogin-GetData-Using-MVC | 401ab06edb4c802926f5098fc3f367c19dfdb945 | 786ae72af77481d15f9921a83ca89573f26af1dd | refs/heads/master | 2020-06-19T12:00:31.764999 | 2016-11-27T13:31:41 | 2016-11-27T13:31:41 | 74,905,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.org.mvc;
import java.util.ArrayList;
public class EmployeeManger {
EmployeeDAO employee=new EmployeeDAO();
public ArrayList getEmployee()
{
return generateEmployees();
}
private ArrayList generateEmployees(){
ArrayList empList = new ArrayList();
empList =employee.getCustmInfo();
return empList;
}
}
| [
"patidarmahendra@yahoo.in"
] | patidarmahendra@yahoo.in |
9f3f8f0273617dad1b1893f49b70067ce28ecf7c | c819a666a00bc18b9b6557578ee4563c810e8fab | /plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/MutexJobSchedulingRule.java | c32dc339bef36d3f4ecef660aee64a280c324352 | [] | no_license | grdryn/jbosstools-webservices | cb5d09e2aa0ba31142ee67d602451c2670270da6 | cdef80b19c4815ebae9f39a49dba6919f8b4111f | refs/heads/master | 2020-12-25T02:39:40.902857 | 2012-12-12T18:08:34 | 2012-12-12T18:08:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,202 | java | /*******************************************************************************
* Copyright (c) 2012 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
/**
* @author Xavier Coulon
*
*/
public class MutexJobSchedulingRule implements ISchedulingRule {
private final static MutexJobSchedulingRule instance = new MutexJobSchedulingRule();
/**
* Private singleton constructor
*/
private MutexJobSchedulingRule() {
super();
}
public static MutexJobSchedulingRule getInstance() {
return instance;
}
@Override
public boolean contains(ISchedulingRule rule) {
return rule == this;
}
@Override
public boolean isConflicting(ISchedulingRule rule) {
return rule == this;
}
}
| [
"xcoulon@gmail.com"
] | xcoulon@gmail.com |
e1d41580ebaefeef529e1951a7c30b25b2464f7c | 88ec509c2a63c2dac7aead8009917677d6c38b5f | /src/Calc3D.java | dd2c417968c8e583d04832696d773a5cf9f04383 | [] | no_license | agaszab/zad8_2 | 91bd2f52ea11625491f046f303182b5e1702fa5c | db7a27d59e394b2d64b2183a1b9207e5bcedc4ad | refs/heads/master | 2021-05-04T14:42:23.776357 | 2018-02-04T17:51:55 | 2018-02-04T17:51:55 | 120,208,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | public interface Calc3D {
int ballVolume(Ball ball); // oblicza pojemnoลฤ przekazanej jako argument kuli
int cubeVolume(Cube cube); // oblicza pojemnoลฤ przekazanego jako argument szeลcianu
}
| [
"agatito@yopmail.com"
] | agatito@yopmail.com |
27beca221cb0b55f892032992b9967c2f0d8fc93 | f88d99070998325bf33ee25db4cafbe9b25757d6 | /pagerslidingtabstriplibrary/src/com/astuetz/PagerSlidingTabStrip.java | dde32cf43706d7f818b68a0c3dab8363f9a05a4c | [] | no_license | jannonx/GooglePlay | c5f9ba6740832daa125187dfa883030a3b9eb4db | 0b447197c7338ed97b16766a5b755caf87db5f96 | refs/heads/master | 2020-06-15T12:24:46.407662 | 2016-12-13T08:29:10 | 2016-12-13T08:29:10 | 75,262,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,153 | java | /*
* Copyright (C) 2013 Andreas Stuetz <andreas.stuetz@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.astuetz;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.HorizontalScrollView;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.Locale;
import com.astuetz.pagerslidingtabstrip.R;
public class PagerSlidingTabStrip extends HorizontalScrollView {
// @formatter:off
private static final int[] ATTRS = new int[]{
android.R.attr.textSize,
android.R.attr.textColor
};
private final PageListener pageListener = new PageListener();
// @formatter:on
public OnPageChangeListener delegatePageListener;
private LinearLayout.LayoutParams defaultTabLayoutParams;
private LinearLayout.LayoutParams expandedTabLayoutParams;
private LinearLayout tabsContainer;
private ViewPager pager;
private int tabCount;
private int currentPosition = 0;
private float currentPositionOffset = 0f;
private Paint rectPaint;
private Paint dividerPaint;
private int indicatorColor = 0xFF666666;
private int underlineColor = 0x1A000000;
private int dividerColor = 0x1A000000;
private boolean shouldExpand = false;
private boolean textAllCaps = true;
private int scrollOffset = 52;
private int indicatorHeight = 8;
private int underlineHeight = 2;
private int dividerPadding = 12;
private int tabPadding = 24;
private int dividerWidth = 1;
private int tabTextSize = 12;
private int tabTextColor = 0xFF666666;
private Typeface tabTypeface = null;
private int tabTypefaceStyle = Typeface.BOLD;
private int lastScrollX = 0;
private int tabBackgroundResId = R.drawable.background_tab;
private Locale locale;
public PagerSlidingTabStrip(Context context) {
this(context, null);
}
public PagerSlidingTabStrip(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setFillViewport(true);
setWillNotDraw(false);
tabsContainer = new LinearLayout(context);
tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
addView(tabsContainer);
DisplayMetrics dm = getResources().getDisplayMetrics();
scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm);
indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm);
underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm);
tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm);
tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);
// get system attrs (android:textSize and android:textColor)
TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
tabTextSize = a.getDimensionPixelSize(0, tabTextSize);
tabTextColor = a.getColor(1, tabTextColor);
a.recycle();
// get custom attrs
a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip);
indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor);
underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor);
dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor);
indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight);
underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight);
dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding);
tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding);
tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId);
shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand);
scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset);
textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps);
a.recycle();
rectPaint = new Paint();
rectPaint.setAntiAlias(true);
rectPaint.setStyle(Style.FILL);
dividerPaint = new Paint();
dividerPaint.setAntiAlias(true);
dividerPaint.setStrokeWidth(dividerWidth);
defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f);
if (locale == null) {
locale = getResources().getConfiguration().locale;
}
}
public void setViewPager(ViewPager pager) {
this.pager = pager;
if (pager.getAdapter() == null) {
throw new IllegalStateException("ViewPager does not have adapter instance.");
}
pager.setOnPageChangeListener(pageListener);
notifyDataSetChanged();
}
public void setOnPageChangeListener(OnPageChangeListener listener) {
this.delegatePageListener = listener;
}
public void notifyDataSetChanged() {
tabsContainer.removeAllViews();
tabCount = pager.getAdapter().getCount();
for (int i = 0; i < tabCount; i++) {
if (pager.getAdapter() instanceof IconTabProvider) {
addIconTab(i, ((IconTabProvider) pager.getAdapter()).getPageIconResId(i));
} else {
addTextTab(i, pager.getAdapter().getPageTitle(i).toString());
}
}
updateTabStyles();
getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
currentPosition = pager.getCurrentItem();
scrollToChild(currentPosition, 0);
}
});
}
private void addTextTab(final int position, String title) {
TextView tab = new TextView(getContext());
tab.setText(title);
tab.setGravity(Gravity.CENTER);
tab.setSingleLine();
addTab(position, tab);
}
private void addIconTab(final int position, int resId) {
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
addTab(position, tab);
}
private void addTab(final int position, View tab) {
tab.setFocusable(true);
tab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
pager.setCurrentItem(position);
}
});
tab.setPadding(tabPadding, 0, tabPadding, 0);
tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams);
}
private void updateTabStyles() {
for (int i = 0; i < tabCount; i++) {
View v = tabsContainer.getChildAt(i);
v.setBackgroundResource(tabBackgroundResId);
if (v instanceof TextView) {
TextView tab = (TextView) v;
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
tab.setTextColor(tabTextColor);
// setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
// pre-ICS-build
if (textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tab.setAllCaps(true);
} else {
tab.setText(tab.getText().toString().toUpperCase(locale));
}
}
}
}
}
private void scrollToChild(int position, int offset) {
if (tabCount == 0) {
return;
}
int newScrollX = tabsContainer.getChildAt(position).getLeft() + offset;
if (position > 0 || offset > 0) {
newScrollX -= scrollOffset;
}
if (newScrollX != lastScrollX) {
lastScrollX = newScrollX;
scrollTo(newScrollX, 0);
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (isInEditMode() || tabCount == 0) {
return;
}
final int height = getHeight();
// draw indicator line
rectPaint.setColor(indicatorColor);
// default: line below current tab
View currentTab = tabsContainer.getChildAt(currentPosition);
float lineLeft = currentTab.getLeft();
float lineRight = currentTab.getRight();
// if there is an offset, start interpolating left and right coordinates between current and next tab
if (currentPositionOffset > 0f && currentPosition < tabCount - 1) {
View nextTab = tabsContainer.getChildAt(currentPosition + 1);
final float nextTabLeft = nextTab.getLeft();
final float nextTabRight = nextTab.getRight();
lineLeft = (currentPositionOffset * nextTabLeft + (1f - currentPositionOffset) * lineLeft);
lineRight = (currentPositionOffset * nextTabRight + (1f - currentPositionOffset) * lineRight);
}
canvas.drawRect(lineLeft, height - indicatorHeight, lineRight, height, rectPaint);
// draw underline
rectPaint.setColor(underlineColor);
canvas.drawRect(0, height - underlineHeight, tabsContainer.getWidth(), height, rectPaint);
// draw divider
dividerPaint.setColor(dividerColor);
for (int i = 0; i < tabCount - 1; i++) {
View tab = tabsContainer.getChildAt(i);
canvas.drawLine(tab.getRight(), dividerPadding, tab.getRight(), height - dividerPadding, dividerPaint);
}
}
public void setIndicatorColorResource(int resId) {
this.indicatorColor = getResources().getColor(resId);
invalidate();
}
public int getIndicatorColor() {
return this.indicatorColor;
}
public void setIndicatorColor(int indicatorColor) {
this.indicatorColor = indicatorColor;
invalidate();
}
public int getIndicatorHeight() {
return indicatorHeight;
}
public void setIndicatorHeight(int indicatorLineHeightPx) {
this.indicatorHeight = indicatorLineHeightPx;
invalidate();
}
public void setUnderlineColorResource(int resId) {
this.underlineColor = getResources().getColor(resId);
invalidate();
}
public int getUnderlineColor() {
return underlineColor;
}
public void setUnderlineColor(int underlineColor) {
this.underlineColor = underlineColor;
invalidate();
}
public void setDividerColorResource(int resId) {
this.dividerColor = getResources().getColor(resId);
invalidate();
}
public int getDividerColor() {
return dividerColor;
}
public void setDividerColor(int dividerColor) {
this.dividerColor = dividerColor;
invalidate();
}
public int getUnderlineHeight() {
return underlineHeight;
}
public void setUnderlineHeight(int underlineHeightPx) {
this.underlineHeight = underlineHeightPx;
invalidate();
}
public int getDividerPadding() {
return dividerPadding;
}
public void setDividerPadding(int dividerPaddingPx) {
this.dividerPadding = dividerPaddingPx;
invalidate();
}
public int getScrollOffset() {
return scrollOffset;
}
public void setScrollOffset(int scrollOffsetPx) {
this.scrollOffset = scrollOffsetPx;
invalidate();
}
public boolean getShouldExpand() {
return shouldExpand;
}
public void setShouldExpand(boolean shouldExpand) {
this.shouldExpand = shouldExpand;
requestLayout();
}
public boolean isTextAllCaps() {
return textAllCaps;
}
public void setAllCaps(boolean textAllCaps) {
this.textAllCaps = textAllCaps;
}
public int getTextSize() {
return tabTextSize;
}
public void setTextSize(int textSizePx) {
this.tabTextSize = textSizePx;
updateTabStyles();
}
public void setTextColorResource(int resId) {
this.tabTextColor = getResources().getColor(resId);
updateTabStyles();
}
public int getTextColor() {
return tabTextColor;
}
public void setTextColor(int textColor) {
this.tabTextColor = textColor;
updateTabStyles();
}
public void setTypeface(Typeface typeface, int style) {
this.tabTypeface = typeface;
this.tabTypefaceStyle = style;
updateTabStyles();
}
public int getTabBackground() {
return tabBackgroundResId;
}
public void setTabBackground(int resId) {
this.tabBackgroundResId = resId;
}
public int getTabPaddingLeftRight() {
return tabPadding;
}
public void setTabPaddingLeftRight(int paddingPx) {
this.tabPadding = paddingPx;
updateTabStyles();
}
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState savedState = (SavedState) state;
super.onRestoreInstanceState(savedState.getSuperState());
currentPosition = savedState.currentPosition;
requestLayout();
}
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState savedState = new SavedState(superState);
savedState.currentPosition = currentPosition;
return savedState;
}
public interface IconTabProvider {
public int getPageIconResId(int position);
}
static class SavedState extends BaseSavedState {
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
int currentPosition;
public SavedState(Parcelable superState) {
super(superState);
}
private SavedState(Parcel in) {
super(in);
currentPosition = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(currentPosition);
}
}
private class PageListener implements OnPageChangeListener {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
currentPosition = position;
currentPositionOffset = positionOffset;
scrollToChild(position, (int) (positionOffset * tabsContainer.getChildAt(position).getWidth()));
invalidate();
if (delegatePageListener != null) {
delegatePageListener.onPageScrolled(position, positionOffset, positionOffsetPixels);
}
}
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
scrollToChild(pager.getCurrentItem(), 0);
}
if (delegatePageListener != null) {
delegatePageListener.onPageScrollStateChanged(state);
}
}
@Override
public void onPageSelected(int position) {
if (delegatePageListener != null) {
delegatePageListener.onPageSelected(position);
}
}
}
}
| [
"jannonx@foxmail.com"
] | jannonx@foxmail.com |
b09b906b2781050e11e546bad6e2ec151ce439f4 | 69005ab4c8cc5d88d7996d47ac8def0b28730b95 | /android-medium/app/src/main/java/test/perf/MyPerfClass_2356.java | 8b48ccc6452f50134f8995826d65cff4d8df89e2 | [] | no_license | sakerbuild/performance-comparisons | ed603c9ffa0d34983a7da74f7b2b731dc3350d7e | 78cd8d7896c4b0255ec77304762471e6cab95411 | refs/heads/master | 2020-12-02T19:14:57.865537 | 2020-05-11T14:09:40 | 2020-05-11T14:09:40 | 231,092,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package test.perf;
public class MyPerfClass_2356{
private final String property;
public MyPerfClass_2356(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((property == null) ? 0 : property.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MyPerfClass_2356 other = (MyPerfClass_2356) obj;
if (property == null) {
if (other.property != null)
return false;
} else if (!property.equals(other.property))
return false;
return true;
}
}
| [
"10866741+Sipkab@users.noreply.github.com"
] | 10866741+Sipkab@users.noreply.github.com |
17aa5ece66ee36bcb2fc9c3e00e898381a69c45c | 66b21cb7ac61adb3dcf30fa031433dfaba1fcb51 | /LearningAssetsAndSharePreference/app/src/test/java/io/github/ledinhtri97/learningassetsandsharepreference/ExampleUnitTest.java | 7c264136080ad2f68f56b69fb331f6e8998cf450 | [] | no_license | odejinmi/android-projects | a242d9bec4167a31abf34354848f5e21cf0d493d | 29a8d18b9dcd20d11950ad9bfae6e37514e02854 | refs/heads/master | 2021-02-26T09:01:27.683408 | 2018-11-28T03:15:52 | 2018-11-28T03:15:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package io.github.ledinhtri97.learningassetsandsharepreference;
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);
}
} | [
"ledinhtri.cse.hcmut@gmail.com"
] | ledinhtri.cse.hcmut@gmail.com |
046e9261af75cde88223b76562b99054850df939 | 29196e2d4adfb14ddd7c2ca8c1e60f8c10c26dad | /src/main/java/it/csi/siac/siacbilser/frontend/webservice/msg/quadroeconomico/AggiornaQuadroEconomico.java | 6d8d85bf547de639f6c535744bac7b164eb737d4 | [] | no_license | unica-open/siacbilitf | bbeef5ceca40e9fb83d5b1176e7f54e8d84592bf | 85f3254c05c719a0016fe55cea1a105bcb6b89b2 | refs/heads/master | 2021-01-06T14:51:17.786934 | 2020-03-03T13:27:47 | 2020-03-03T13:27:47 | 241,366,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | /*
*SPDX-FileCopyrightText: Copyright 2020 | CSI Piemonte
*SPDX-License-Identifier: EUPL-1.2
*/
package it.csi.siac.siacbilser.frontend.webservice.msg.quadroeconomico;
import javax.xml.bind.annotation.XmlType;
import it.csi.siac.siaccorser.model.Bilancio;
import it.csi.siac.siaccorser.model.ServiceRequest;
import it.csi.siac.siacbilser.frontend.webservice.BILSvcDictionary;
import it.csi.siac.siacbilser.model.QuadroEconomico;
/**
* @author Marchino Alessandro
* @version 1.0.0 - 26/10/2015
*/
@XmlType(namespace = BILSvcDictionary.NAMESPACE)
public class AggiornaQuadroEconomico extends ServiceRequest {
private QuadroEconomico quadroEconomico;
private Bilancio bilancio;
/**
* @return the quadroEconomico
*/
public QuadroEconomico getQuadroEconomico() {
return quadroEconomico;
}
/**
* @param quadroEconomico the quadroEconomico to set
*/
public void setQuadroEconomico(QuadroEconomico quadroEconomico) {
this.quadroEconomico = quadroEconomico;
}
/**
* Gets the bilancio.
*
* @return the bilancio
*/
public Bilancio getBilancio() {
return bilancio;
}
/**
* Sets the bilancio.
*
* @param bilancio the bilancio to set
*/
public void setBilancio(Bilancio bilancio) {
this.bilancio = bilancio;
}
}
| [
"barbara.malano@csi.it"
] | barbara.malano@csi.it |
b7c4a1d32e58912f414179e3497a7226ba20d8c5 | 347eebd8173786738e6e01f3cdc9b16b88925e9c | /webserver/tyrus/src/main/java/io/helidon/webserver/tyrus/TyrusWriterPublisher.java | 0d5c6fa350182d5a5cb0f3571bed6e601034bca6 | [
"Apache-2.0"
] | permissive | graemerocher/helidon | 8e53b3b159de276f95c773a6f8a9800259406ffb | d5d1f6133abc7cb7e5932836406073d571061c41 | refs/heads/master | 2022-06-20T02:14:30.093545 | 2020-05-11T19:36:53 | 2020-05-11T19:36:53 | 263,279,309 | 0 | 1 | Apache-2.0 | 2020-05-12T08:34:40 | 2020-05-12T08:34:39 | null | UTF-8 | Java | false | false | 5,147 | java | /*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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 io.helidon.webserver.tyrus;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Queue;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Flow;
import java.util.concurrent.atomic.AtomicLong;
import io.helidon.common.http.DataChunk;
import org.glassfish.tyrus.spi.CompletionHandler;
import org.glassfish.tyrus.spi.Writer;
/**
* Class TyrusWriterProducer.
*/
public class TyrusWriterPublisher extends Writer implements Flow.Publisher<DataChunk> {
private Flow.Subscriber<? super DataChunk> subscriber;
private final Queue<QueuedBuffer> queue = new ConcurrentLinkedQueue<>();
private final AtomicLong requested = new AtomicLong(0L);
private static class QueuedBuffer {
private final CompletionHandler<ByteBuffer> completionHandler;
private final ByteBuffer byteBuffer;
QueuedBuffer(ByteBuffer byteBuffer, CompletionHandler<ByteBuffer> completionHandler) {
this.byteBuffer = byteBuffer;
this.completionHandler = completionHandler;
}
CompletionHandler<ByteBuffer> completionHandler() {
return completionHandler;
}
ByteBuffer byteBuffer() {
return byteBuffer;
}
}
// -- Writer --------------------------------------------------------------
@Override
public void write(ByteBuffer byteBuffer, CompletionHandler<ByteBuffer> handler) {
// No queueing if there is no subscriber
if (subscriber == null) {
return;
}
// Nothing requested yet, just queue buffer
if (requested.get() <= 0) {
queue.add(new QueuedBuffer(byteBuffer, handler));
return;
}
// Write queued buffers first
while (!queue.isEmpty() && requested.get() > 0) {
QueuedBuffer queuedBuffer = queue.remove();
writeNext(queuedBuffer.byteBuffer(), queuedBuffer.completionHandler());
decrement(requested);
}
// Process current buffer
if (requested.get() > 0) {
writeNext(byteBuffer, handler);
decrement(requested);
} else {
queue.add(new QueuedBuffer(byteBuffer, handler));
}
}
@Override
public void close() throws IOException {
if (subscriber != null) {
subscriber.onComplete();
}
}
// -- Publisher -----------------------------------------------------------
@Override
public void subscribe(Flow.Subscriber<? super DataChunk> newSubscriber) {
if (subscriber != null) {
throw new IllegalStateException("Only one subscriber is allowed");
}
subscriber = newSubscriber;
subscriber.onSubscribe(new Flow.Subscription() {
@Override
public void request(long n) {
if (n == Long.MAX_VALUE) {
requested.set(Long.MAX_VALUE);
} else {
requested.getAndAdd(n);
}
}
@Override
public void cancel() {
requested.set(0L);
}
});
}
// -- Utility methods -----------------------------------------------------
private static synchronized long decrement(AtomicLong requested) {
long value = requested.get();
return value == Long.MAX_VALUE ? requested.get() : requested.decrementAndGet();
}
private void writeNext(ByteBuffer byteBuffer, CompletionHandler<ByteBuffer> handler) {
DataChunk dataChunk = DataChunk.create(true, byteBuffer, true);
if (handler != null) {
dataChunk.writeFuture(fromCompletionHandler(handler));
}
subscriber.onNext(dataChunk);
}
/**
* Wraps {@code CompletionHandler} into a {@code CompletableFuture} so that
* when the latter succeeds or fails so does the former.
*
* @param handler Handler to wrap.
* @return Wrapped handler.
*/
private static CompletableFuture<DataChunk> fromCompletionHandler(CompletionHandler<ByteBuffer> handler) {
CompletableFuture<DataChunk> future = new CompletableFuture<>();
future.whenComplete((chunk, throwable) -> {
if (throwable == null) {
handler.completed(chunk.data());
} else {
handler.failed(throwable);
}
});
return future;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ffb33849f0c0fe27a157c5ba89c4f90a176456e0 | 52285bf0f05809e3663d9e456f36ce3dcaa9ca83 | /hlq-commer-shopWeb/src/main/java/com/commer/app/shopUsercontroller/BaseController.java | 948de4211c6d08b23c55fd54eb578dd7d86741f1 | [
"Apache-2.0"
] | permissive | mlkspringboot/hlq-commer | 6b07e91351e786ee544d21ebc230d75fae41de2d | c4e02144041c5ac16cd06eedbd56890f46480a12 | refs/heads/master | 2020-05-04T06:32:33.221143 | 2019-04-02T05:54:22 | 2019-04-02T05:54:22 | 179,008,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 834 | java | package com.commer.app.shopUsercontroller;
import javax.servlet.http.HttpServletRequest;
/**
* Created by 13 on 2017/2/21.
*/
public abstract class BaseController {
public static String THEME = "themes/default";
/**
* ไธป้กต็้กต้ขไธป้ข
* @param viewName
* @return
*/
public String render(String viewName) {
System.out.println(THEME + "/" + viewName);
return THEME + "/" + viewName;
}
public BaseController title(HttpServletRequest request, String title) {
request.setAttribute("title", title);
return this;
}
public BaseController keywords(HttpServletRequest request, String keywords) {
request.setAttribute("keywords", keywords);
return this;
}
public String render_404() {
return "comm/error_404";
}
}
| [
"guofeng@asiasea.cn"
] | guofeng@asiasea.cn |
3681dfaa9ed8bb6c4dc67acffc5193b700f3642c | c8d34b12eb538826b390d92e5120480c18803f0e | /Test/src/Main.java | 13bb5761995669b095a4ab4fcbedfb8ecea66d36 | [] | no_license | tynangardner/Test | bc121d8022b79b97b1f59e60777cdd6d3d08aba6 | 03829448879aa8b1f5e2523682c96fcfcdb2877b | refs/heads/master | 2021-01-01T03:52:25.222229 | 2016-05-16T13:00:22 | 2016-05-16T13:00:22 | 58,931,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | import java.util.ArrayList;
public class Main {
Main(){
Dog fido = new Underdog();
fido.act();
}
public static void main(String args[])
{
ArrayList list1 = new ArrayList();
list1.add("Tom");
list1.add("Sue");
list1.add("Bob");
list1.add("Ann");
ArrayList list2 = list1;
list1.set(1,"Joe");
list2.set(2, "Meg");
System.out.println(list1);
System.out.println(list2);
String s1 = "CAR";
String s2 = "car";
int x = s1.compareTo(s2);
System.out.println(x);
Main main = new Main();
}
}
| [
"tynangardner2@gmail.com"
] | tynangardner2@gmail.com |
81f59f9316b3eb0f984c005b787f9501c6953437 | 2f11eae61d2a6d090988c9f22324507fc1a542f4 | /src/main/java/com/squareup/square/models/PaymentBalanceActivityFeeDetail.java | 59210bc22a62d88cef2136b655d3aa30bf347b58 | [
"Apache-2.0"
] | permissive | square/square-java-sdk | afe08f35b4c8887240e9c7149366b83609bb65bd | 769e694c3894dcaef713cba4af3d4ad0c0b45a47 | refs/heads/master | 2023-08-16T15:45:47.076201 | 2023-08-15T21:45:53 | 2023-08-15T21:45:53 | 221,058,243 | 59 | 33 | NOASSERTION | 2023-08-15T21:45:54 | 2019-11-11T19:51:18 | Java | UTF-8 | Java | false | false | 3,983 | java |
package com.squareup.square.models;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.apimatic.core.types.OptionalNullable;
import java.util.Objects;
/**
* This is a model class for PaymentBalanceActivityFeeDetail type.
*/
public class PaymentBalanceActivityFeeDetail {
private final OptionalNullable<String> paymentId;
/**
* Initialization constructor.
* @param paymentId String value for paymentId.
*/
@JsonCreator
public PaymentBalanceActivityFeeDetail(
@JsonProperty("payment_id") String paymentId) {
this.paymentId = OptionalNullable.of(paymentId);
}
/**
* Internal initialization constructor.
*/
protected PaymentBalanceActivityFeeDetail(OptionalNullable<String> paymentId) {
this.paymentId = paymentId;
}
/**
* Internal Getter for PaymentId.
* The ID of the payment associated with this activity.
* @return Returns the Internal String
*/
@JsonGetter("payment_id")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonSerialize(using = OptionalNullable.Serializer.class)
protected OptionalNullable<String> internalGetPaymentId() {
return this.paymentId;
}
/**
* Getter for PaymentId.
* The ID of the payment associated with this activity.
* @return Returns the String
*/
@JsonIgnore
public String getPaymentId() {
return OptionalNullable.getFrom(paymentId);
}
@Override
public int hashCode() {
return Objects.hash(paymentId);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PaymentBalanceActivityFeeDetail)) {
return false;
}
PaymentBalanceActivityFeeDetail other = (PaymentBalanceActivityFeeDetail) obj;
return Objects.equals(paymentId, other.paymentId);
}
/**
* Converts this PaymentBalanceActivityFeeDetail into string format.
* @return String representation of this class
*/
@Override
public String toString() {
return "PaymentBalanceActivityFeeDetail [" + "paymentId=" + paymentId + "]";
}
/**
* Builds a new {@link PaymentBalanceActivityFeeDetail.Builder} object.
* Creates the instance with the state of the current model.
* @return a new {@link PaymentBalanceActivityFeeDetail.Builder} object
*/
public Builder toBuilder() {
Builder builder = new Builder();
builder.paymentId = internalGetPaymentId();
return builder;
}
/**
* Class to build instances of {@link PaymentBalanceActivityFeeDetail}.
*/
public static class Builder {
private OptionalNullable<String> paymentId;
/**
* Setter for paymentId.
* @param paymentId String value for paymentId.
* @return Builder
*/
public Builder paymentId(String paymentId) {
this.paymentId = OptionalNullable.of(paymentId);
return this;
}
/**
* UnSetter for paymentId.
* @return Builder
*/
public Builder unsetPaymentId() {
paymentId = null;
return this;
}
/**
* Builds a new {@link PaymentBalanceActivityFeeDetail} object using the set fields.
* @return {@link PaymentBalanceActivityFeeDetail}
*/
public PaymentBalanceActivityFeeDetail build() {
return new PaymentBalanceActivityFeeDetail(paymentId);
}
}
}
| [
"devs-apex+github-pusher@squareup.com"
] | devs-apex+github-pusher@squareup.com |
5bb381d2e0b4931f49129c6b4025f508a26c5a39 | b8411ebb061dd56427b5aa0bb99e2e01a0e69023 | /pinju-biz/src/main/java/com/yuwang/pinju/core/order/dao/impl/OrderLogisticsDaoImpl.java | 9f68c53e0bddd39491f43336dd9772f02514f1d1 | [] | no_license | sgrass/double11_bugfix_asst_acct | afce8261bb275474f792e1cb41d9ff4fabad06b0 | 8eea9a16b43600c0c7574db5353c3d3b86cf4694 | refs/heads/master | 2021-01-19T04:48:03.445861 | 2017-04-06T06:34:17 | 2017-04-06T06:34:17 | 87,394,668 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,093 | java | package com.yuwang.pinju.core.order.dao.impl;
import com.yuwang.pinju.core.common.BaseDAO;
import com.yuwang.pinju.core.common.DaoException;
import com.yuwang.pinju.core.order.dao.OrderLogisticsDao;
import com.yuwang.pinju.domain.order.OrderLogisticsDO;
public class OrderLogisticsDaoImpl extends BaseDAO implements OrderLogisticsDao {
private final static String NAMESPACE = "TRADE_ORDER_LOGISTICS.";
/**
* ๆฅ่ฏข่ฎขๅ็ฉๆตไฟกๆฏ
*
* @return OrderLogisticsDO
*/
public OrderLogisticsDO queryOrderLogisticsById(Long orderLogisticsId)
throws DaoException {
return (OrderLogisticsDO) super.executeQueryForObject(
NAMESPACE+"selectOrderLogisticsDOById", orderLogisticsId);
}
@Override
public Long insertOrderLogistics(OrderLogisticsDO orderLogisticsDO)
throws DaoException {
return (Long) super.executeInsert(NAMESPACE+"insertOrderLogistics",
orderLogisticsDO);
}
@Override
public int upOrderLogistics(OrderLogisticsDO orderLogisticsDO)
throws DaoException {
return super.executeUpdate(NAMESPACE+"updateOrderLogistics",orderLogisticsDO);
}
}
| [
"xgrass@foxmail.com"
] | xgrass@foxmail.com |
7d9571bcfa0f10ae20c78014f30458a6dd7770e3 | 077415036a3876608f5b060adeec882f85f19682 | /src/main/java/com/oblivm/compiler/ast/stmt/ASTStatement.java | 748b128712a2e539a09c4bb93dbf7142eb35b703 | [] | no_license | brucechin/Yoda | aef97cd27098fe0dc82f99d7942194129a362cd6 | 9ef4727611623d099ded3e96e9eb36dd5360d81c | refs/heads/master | 2020-12-03T10:03:33.300407 | 2020-01-31T05:14:38 | 2020-01-31T05:14:38 | 231,276,970 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | /***
* Copyright (C) 2015 by Chang Liu <liuchang@cs.umd.edu>
*/
package com.oblivm.compiler.ast.stmt;
import com.oblivm.compiler.ast.AST;
/**
* Top level class for statements.
* Type hierarchy of ASTStatement.java:<p>
* <BLOCKQUOTE>
* - ASTArrayAssignStatement.java<br>
* - ASTAssignStatement.java <br>
* - ASTIfStatement.java <br>
* - ASTReturnStatement.java <br>
* - ASTWhileStatement.java
* </BLOCKQUOTE>
*
* @see ASTArrayAssignStatement
* @see ASTAssignStatement
* @see ASTIfStatement
* @see ASTReturnStatement
* @see ASTWhileStatement
*/
public abstract class ASTStatement extends AST {
}
| [
"lianke.qin@gmail.com"
] | lianke.qin@gmail.com |
a140bcd6f46884d6166d68250e4890d2bad086ee | 508044a8c89f02684e789384608a6fa009458f0c | /src/main/java/com/epam/anuar/editor/text/Letter.java | 0c1311c016dcafa489c928e60c77f80f8f0041fb | [] | no_license | omarovanuar/book-editor | 332dd02882a8e04a5cf1a37af5bc5df6eb023186 | 194b3aaebd8322dced30d7389d1b0e42833cc45a | refs/heads/master | 2021-01-10T05:55:29.384063 | 2016-03-11T09:07:51 | 2016-03-11T09:07:51 | 52,507,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.epam.anuar.editor.text;
public class Letter extends Word{
private char value;
public Letter(char value) {
this.value = value;
}
public static Letter of(char value) {
if (Cache.isSet(value)) return Cache.letterArray[value];
return new Letter(value);
}
public String getLetterString() {
return String.valueOf(value);
}
private static class Cache {
static Letter[] letterArray = new Letter[65536];
static {
for (int i = 0; i < 127; i++) {
letterArray[i] = new Letter((char) i);
}
}
public static boolean isSet(char value) {
return value == letterArray[value].value;
}
}
}
| [
"omarovanuar91@gmail.com"
] | omarovanuar91@gmail.com |
1aaad28c7d041e26fc478d325cb29f7de8fcda3f | 7989cb3d1630d21981cce2d60afbbf27bddcc858 | /app/src/main/java/com/dittieszzz/ditties/ditties_zzz/base/BaseAdapter.java | 09df6131b5b13356465da37b99ae502cf06d970f | [] | no_license | XiaoHuisir/dittieszzz | 29c05a8045908cc776899da5980f6dcd8613d113 | 422eb037cfec7d486d97acc4fd4efc46ee6f539d | refs/heads/master | 2023-02-17T13:20:29.866992 | 2021-01-17T04:05:14 | 2021-01-17T04:05:14 | 324,577,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,445 | java | package com.dittieszzz.ditties.ditties_zzz.base;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
public abstract class BaseAdapter<T> extends RecyclerView.Adapter<BaseAdapter.BaseViewHolder> {
private OnItemClickListener onItemClickListener;
protected List<T> mDatas; //ๅ่กจๆฐๆฎ
protected Context mContext;
public BaseAdapter(List<T> mDatas){
this.mDatas = mDatas;
//่ฎพ็ฝฎๅฑ้จๅทๆฐ
setHasStableIds(true);
}
@NonNull
@Override
public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
mContext = viewGroup.getContext();
View view = LayoutInflater.from(mContext).inflate(getLayoutId(),viewGroup,false);
final BaseViewHolder baseViewHolder = new BaseViewHolder(view);
view.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
if(onItemClickListener != null){
onItemClickListener.onItemClick(v,baseViewHolder.getLayoutPosition());
}
}
});
return baseViewHolder;
}
@Override
public void onBindViewHolder(BaseAdapter.BaseViewHolder viewHolder, int i) {
T t = mDatas.get(i);
bindData(viewHolder,i,t);
}
@Override
public int getItemCount() {
return mDatas == null ? 0 : mDatas.size();
}
/**
* ๅทๆฐๆฐๆฎ
* @param list
*/
public void refresh(List<T> list){
this.mDatas.clear();
this.mDatas.addAll(list);
notifyDataSetChanged();
}
/**
* ๆทปๅ ๆฐๆฎ
* @param list
*/
public void addData(List<T> list){
this.mDatas.addAll(list);
notifyDataSetChanged();
}
/**
* ๆทปๅ ๆฐๆฎ๏ผๅฑ้จๅทๆฐ๏ผ้ๅgetItemIdๆนๆณ๏ผๅๆถsetHasStableIds(true)๏ผ
* @param datas
*/
public void addDataWithoutAnim(List<T> datas){
if(datas == null) return;
int size = datas.size();
this.mDatas.addAll(datas);
notifyItemChanged(size,datas.size());
}
/**
* ๅฑ้จๅทๆฐ้่ฆๅฎ็ฐ็ๆนๆณ
* @param position
* @return
*/
@Override
public long getItemId(int position) {
return position;
}
protected abstract int getLayoutId();
protected abstract void bindData(BaseViewHolder holder,int positon,T t);
public void setOnItemClickListener(OnItemClickListener onItemClickListener){
this.onItemClickListener = onItemClickListener;
}
/**
* ๆก็ฎ็นๅปๆฅๅฃ
*/
public interface OnItemClickListener{
void onItemClick(View v, int position);
}
public class BaseViewHolder extends RecyclerView.ViewHolder{
private SparseArray<View> myViewSparseArray;
public BaseViewHolder(@NonNull View itemView) {
super(itemView);
myViewSparseArray = new SparseArray<>();
}
public View getView(int id){
View view = myViewSparseArray.get(id);
if(view == null){
view = itemView.findViewById(id);
myViewSparseArray.put(id,view);
}
return view;
}
}
}
| [
"860663594@qq.com"
] | 860663594@qq.com |
261e19b371618ae132ce25d707edf3186c8942d1 | 6bb92ce979a2065833759cc58c1cfbc93d115070 | /domain/src/test/java/org/m4m/domain/dsl/FrameFather.java | ef738a9e481b855c342a83ebf06d882646350a1a | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | daniloercoli/media-for-mobile | ace8fbd29edeb3dd2f0dd96e06e9229ccb06e885 | d1fb2538f5af5992159857ac5744759923ef1e6a | refs/heads/master | 2021-06-24T21:36:31.148400 | 2021-02-16T12:45:47 | 2021-02-16T12:45:47 | 94,329,893 | 0 | 0 | Apache-2.0 | 2020-06-15T10:28:47 | 2017-06-14T12:44:01 | Java | UTF-8 | Java | false | false | 1,960 | java | /*
* Copyright 2014-2016 Media for Mobile
*
* 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.m4m.domain.dsl;
import org.m4m.domain.Frame;
import java.nio.ByteBuffer;
public class FrameFather {
private final Father create;
private ByteBuffer bytes = null;
private long pts = 0;
private int length = 0;
private int inputBufferIndex;
private int flags = 0;
private int trackid;
public FrameFather(Father create) {
this.create = create;
bytes = create.byteBuffer();
length = 0;
}
public FrameFather withBuffer(int... bytes) {
this.bytes = create.byteBuffer(bytes);
length = bytes.length;
return this;
}
public FrameFather withTimeStamp(long pts) {
this.pts = pts;
return this;
}
public FrameFather withInputBufferIndex(int inputBufferIndex) {
this.inputBufferIndex = inputBufferIndex;
return this;
}
public FrameFather withTrackId(int trackid) {
this.trackid = trackid;
return this;
}
public FrameFather withFlag(int flags) {
this.flags = flags;
return this;
}
public FrameFather withLength(int length) {
this.bytes = create.byteBuffer(new int[length]);
this.length = length;
return this;
}
public Frame construct() {
return new Frame(bytes, length, pts, inputBufferIndex, flags, trackid);
}
}
| [
"alexey.suhov@intel.com"
] | alexey.suhov@intel.com |
85068c7318e998a42a4d602b103e3a2677844989 | f40b60444835e9b39260adbaeeb2354943d269ef | /qcm-context/src/main/java/com/emu/apps/qcm/domain/model/questionnaire/QuestionnaireAggregate.java | 74e23b3acbde9d5eb41dce7bde654929e39e45e8 | [
"MIT"
] | permissive | EricMuller/qcm-rest-api | e996d053010d5f6b624c0cec8a1978186ac08820 | 45c7daae9d0bb8c08ec906a8acecd991d03168f0 | refs/heads/master | 2023-04-01T02:31:02.018123 | 2022-07-01T15:02:36 | 2022-07-01T15:02:36 | 132,563,491 | 0 | 0 | MIT | 2023-03-23T20:43:24 | 2018-05-08T06:21:01 | Java | UTF-8 | Java | false | false | 579 | java | package com.emu.apps.qcm.domain.model.questionnaire;
import com.emu.apps.qcm.domain.model.base.Aggregate;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
//@NoArgsConstructor
//@AllArgsConstructor
public class QuestionnaireAggregate extends Aggregate <Questionnaire> {
private final List <QuestionnaireQuestion> questionnaireQuestions;
public QuestionnaireAggregate(Questionnaire root, List <QuestionnaireQuestion> questionnaireQuestions) {
super(root);
this.questionnaireQuestions = questionnaireQuestions;
}
}
| [
"eric.pierre.muller@gmail.com"
] | eric.pierre.muller@gmail.com |
c422833aabca5ed60b9db8ce7c1c43a7487878cc | c66ddef2f3fe24a43dcaa30fc534435ded1e3fa0 | /Lumileds/Lumiledsstorefront/web/src/Lumileds/storefront/controllers/pages/MyQuotesController.java | aae91fedf1f79401629e74af8b6b588e5c94bb7b | [] | no_license | debadey1/Ztest | 6c93f05866923ce2f09ce5a901a4e71d7e6d936b | 7aeb82f98bd6b33ebc5a8aab69c4ecd8edb1a831 | refs/heads/master | 2021-01-24T07:55:54.447593 | 2017-06-05T08:12:54 | 2017-06-05T08:12:54 | 93,364,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,352 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package Lumileds.storefront.controllers.pages;
import de.hybris.platform.acceleratorfacades.ordergridform.OrderGridFormFacade;
import de.hybris.platform.acceleratorfacades.product.data.ReadOnlyOrderGridData;
import de.hybris.platform.acceleratorstorefrontcommons.annotations.RequireHardLogIn;
import de.hybris.platform.acceleratorstorefrontcommons.breadcrumb.Breadcrumb;
import de.hybris.platform.acceleratorstorefrontcommons.breadcrumb.ResourceBreadcrumbBuilder;
import de.hybris.platform.acceleratorstorefrontcommons.constants.WebConstants;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.ThirdPartyConstants;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractSearchPageController;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages;
import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException;
import de.hybris.platform.commercefacades.comment.data.CommentData;
import de.hybris.platform.commercefacades.order.CartFacade;
import de.hybris.platform.commercefacades.order.QuoteFacade;
import de.hybris.platform.commercefacades.order.data.AbstractOrderData;
import de.hybris.platform.commercefacades.order.data.OrderEntryData;
import de.hybris.platform.commercefacades.product.ProductOption;
import de.hybris.platform.commercefacades.quote.data.QuoteData;
import de.hybris.platform.commercefacades.voucher.VoucherFacade;
import de.hybris.platform.commerceservices.enums.QuoteAction;
import de.hybris.platform.commerceservices.search.pagedata.PageableData;
import de.hybris.platform.commerceservices.search.pagedata.SearchPageData;
import de.hybris.platform.core.enums.QuoteState;
import de.hybris.platform.servicelayer.exceptions.ModelNotFoundException;
import de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException;
import Lumileds.storefront.controllers.ControllerConstants;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@Controller
@RequestMapping(value = "/my-account/my-quotes")
public class MyQuotesController extends AbstractSearchPageController
{
private static final Logger LOG = Logger.getLogger(MyQuotesController.class);
private static final String MY_QUOTES_CMS_PAGE = "my-quotes";
private static final String QUOTE_DETAILS_CMS_PAGE = "quote-detail";
private static final String REDIRECT_QUOTE_LIST_URL = REDIRECT_PREFIX + "/my-account/my-quotes/";
private static final String REDIRECT_QUOTE_EDIT_URL = REDIRECT_PREFIX + "/quote/%s/edit/";
private static final String PAGINATION_NUMBER_OF_COMMENTS = "quote.pagination.numberofcomments";
private static final String ALLOWED_ACTIONS = "allowedActions";
private static final String SYSTEM_ERROR_PAGE_NOT_FOUND = "system.error.page.not.found";
private static final String QUOTE_CART_INSUFFICIENT_ACCESS_RIGHTS = "quote.cart.insufficient.access.rights.error";
private static final List<QuoteState> DRAFT_STATES = Arrays.asList(QuoteState.BUYER_DRAFT, QuoteState.SELLER_DRAFT);
@Resource(name = "accountBreadcrumbBuilder")
private ResourceBreadcrumbBuilder accountBreadcrumbBuilder;
@Resource(name = "quoteFacade")
private QuoteFacade quoteFacade;
@Resource(name = "voucherFacade")
private VoucherFacade voucherFacade;
@Resource(name = "orderGridFormFacade")
private OrderGridFormFacade orderGridFormFacade;
@Resource(name = "cartFacade")
private CartFacade cartFacade;
@RequestMapping(method = RequestMethod.GET)
@RequireHardLogIn
public String quotes(@RequestParam(value = "page", defaultValue = "0") final int page,
@RequestParam(value = "show", defaultValue = "Page") final ShowMode showMode,
@RequestParam(value = "sort", defaultValue = "byDate") final String sortCode, final Model model)
throws CMSItemNotFoundException
{
// Handle paged search results
final PageableData pageableData = createPageableData(page, 5, sortCode, showMode);
final SearchPageData searchPageData = getQuoteFacade().getPagedQuotes(pageableData);
populateModel(model, searchPageData, showMode);
final List<Breadcrumb> breadcrumbs = accountBreadcrumbBuilder.getBreadcrumbs(null);
breadcrumbs.add(new Breadcrumb("/my-account/my-quotes", getMessageSource().getMessage(
"text.account.manageQuotes.breadcrumb", null, getI18nService().getCurrentLocale()), null));
model.addAttribute(WebConstants.BREADCRUMBS_KEY, breadcrumbs);
storeCmsPageInModel(model, getContentPageForLabelOrId(MY_QUOTES_CMS_PAGE));
setUpMetaDataForContentPage(model, getContentPageForLabelOrId(MY_QUOTES_CMS_PAGE));
model.addAttribute(ThirdPartyConstants.SeoRobots.META_ROBOTS, ThirdPartyConstants.SeoRobots.NOINDEX_NOFOLLOW);
return getViewForPage(model);
}
@RequestMapping(value = "/{quoteCode}", method = RequestMethod.GET)
@RequireHardLogIn
public String quote(final Model model, final RedirectAttributes redirectModel,
@PathVariable("quoteCode") final String quoteCode) throws CMSItemNotFoundException
{
try
{
final QuoteData quoteData = getQuoteFacade().getQuoteForCode(quoteCode);
if (Boolean.TRUE.equals(quoteData.getHasCart()) && DRAFT_STATES.contains(quoteData.getState()))
{
return String.format(REDIRECT_QUOTE_EDIT_URL, urlEncode(quoteData.getCode()));
}
model.addAttribute("quoteData", quoteData);
loadCommentsShown(model);
sortComments(quoteData);
storeCmsPageInModel(model, getContentPageForLabelOrId(QUOTE_DETAILS_CMS_PAGE));
setUpMetaDataForContentPage(model, getContentPageForLabelOrId(QUOTE_DETAILS_CMS_PAGE));
setAllowedActions(model, quoteCode);
final List<Breadcrumb> breadcrumbs = accountBreadcrumbBuilder.getBreadcrumbs(null);
breadcrumbs.add(new Breadcrumb("/my-account/my-quotes", getMessageSource().getMessage(
"text.account.manageQuotes.breadcrumb", null, getI18nService().getCurrentLocale()), null));
breadcrumbs.add(new Breadcrumb("/" + urlEncode(quoteCode) + "/", getMessageSource().getMessage("breadcrumb.quote.view",
new Object[]
{ quoteCode }, "Quote {0}", getI18nService().getCurrentLocale()), null));
model.addAttribute(WebConstants.BREADCRUMBS_KEY, breadcrumbs);
model.addAttribute(ThirdPartyConstants.SeoRobots.META_ROBOTS, ThirdPartyConstants.SeoRobots.NOINDEX_NOFOLLOW);
return getViewForPage(model);
}
catch (final UnknownIdentifierException e)
{
LOG.warn("Unable to load cart for quote " + quoteCode, e);
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.ERROR_MESSAGES_HOLDER, SYSTEM_ERROR_PAGE_NOT_FOUND, null);
return REDIRECT_QUOTE_LIST_URL;
}
catch (final ModelNotFoundException e)
{
LOG.warn("Attempted to load a quote that does not exist or is not accessible by current user:" + quoteCode, e);
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.ERROR_MESSAGES_HOLDER,
QUOTE_CART_INSUFFICIENT_ACCESS_RIGHTS, new Object[]
{ getCartFacade().getSessionCart().getCode() });
return REDIRECT_PREFIX + ROOT;
}
}
@RequestMapping(value = "/{quoteCode}/getReadOnlyProductVariantMatrix", method = RequestMethod.GET)
@RequireHardLogIn
public String getProductVariantMatrixForResponsive(@PathVariable("quoteCode") final String quoteCode,
@RequestParam("productCode") final String productCode, final Model model)
{
final QuoteData quoteData = getQuoteFacade().getQuoteForCode(quoteCode);
final Map<String, ReadOnlyOrderGridData> readOnlyMultiDMap = orderGridFormFacade.getReadOnlyOrderGridForProductInOrder(
productCode, Arrays.asList(ProductOption.BASIC, ProductOption.CATEGORIES), quoteData);
model.addAttribute("readOnlyMultiDMap", readOnlyMultiDMap);
return ControllerConstants.Views.Fragments.Checkout.ReadOnlyExpandedOrderForm;
}
protected void sortComments(final AbstractOrderData orderData)
{
if (orderData != null)
{
if (CollectionUtils.isNotEmpty(orderData.getComments()))
{
final List<CommentData> sortedComments = orderData.getComments().stream()
.sorted((comment1, comment2) -> comment2.getCreationDate().compareTo(comment1.getCreationDate()))
.collect(Collectors.toList());
orderData.setComments(sortedComments);
}
if (CollectionUtils.isNotEmpty(orderData.getEntries()))
{
for (final OrderEntryData orderEntry : orderData.getEntries())
{
if (CollectionUtils.isNotEmpty(orderEntry.getComments()))
{
final List<CommentData> sortedEntryComments = orderEntry.getComments().stream()
.sorted((comment1, comment2) -> comment2.getCreationDate().compareTo(comment1.getCreationDate()))
.collect(Collectors.toList());
orderEntry.setComments(sortedEntryComments);
}
else if (orderEntry.getProduct() != null && orderEntry.getProduct().getMultidimensional() != null
&& orderEntry.getProduct().getMultidimensional())
{
if (CollectionUtils.isNotEmpty(orderEntry.getEntries()))
{
for (final OrderEntryData multiDOrderEntry : orderEntry.getEntries())
{
if (CollectionUtils.isNotEmpty(multiDOrderEntry.getComments()))
{
final List<CommentData> sortedMultiDOrderEntryComments = multiDOrderEntry
.getComments()
.stream()
.sorted((comment1, comment2) -> comment2.getCreationDate().compareTo(comment1.getCreationDate()))
.collect(Collectors.toList());
multiDOrderEntry.setComments(sortedMultiDOrderEntryComments);
}
}
}
}
}
}
}
}
protected void loadCommentsShown(final Model model)
{
final int commentsShown = getSiteConfigService().getInt(PAGINATION_NUMBER_OF_COMMENTS, 5);
model.addAttribute("commentsShown", Integer.valueOf(commentsShown));
}
/**
* Set allowed actions for a given quote on model.
*
* @param model
* the MVC model
* @param quoteCode
* the quote to be checked.
*/
protected void setAllowedActions(final Model model, final String quoteCode)
{
final Set<QuoteAction> actionSet = getQuoteFacade().getAllowedActions(quoteCode);
if (actionSet != null)
{
final Map<String, Boolean> actionsMap = actionSet.stream().collect(
Collectors.toMap((v) -> v.getCode(), (v) -> Boolean.TRUE));
model.addAttribute(ALLOWED_ACTIONS, actionsMap);
}
}
protected QuoteFacade getQuoteFacade()
{
return quoteFacade;
}
public VoucherFacade getVoucherFacade()
{
return voucherFacade;
}
protected CartFacade getCartFacade()
{
return cartFacade;
}
}
| [
"ddey@intrigo.in"
] | ddey@intrigo.in |
b1865ff03f9425c64e15b48aa1838a9852709bb3 | 866a9d96d7fc714597d7b5398fea92c127103940 | /week8-week8_11.BoxesAndThings/src/Main.java | cd182524d333435700b26190a3047f03d5b0825d | [] | no_license | jrozbicki/2013-OOProgrammingWithJava-PART2 | cbf03167e2e1423ca219522bf7931298a100a197 | 2ee1a0bb4de906b756773a30ec8ff49a1623f31e | refs/heads/master | 2021-05-14T07:51:49.521284 | 2018-01-04T15:57:11 | 2018-01-04T15:57:11 | 116,279,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | public class Main {
public static void main(String[] args) {
Box box = new Box(10);
box.add( new Book("Fedor Dostojevski", "Crime and Punishment", 2) ) ;
box.add( new Book("Robert Martin", "Clean Code", 1) );
box.add( new Book("Kent Beck", "Test Driven Development", 0.7) );
box.add( new CD("Pink Floyd", "Dark Side of the Moon", 1973) );
box.add( new CD("Wigwam", "Nuclear Nightclub", 1975) );
box.add( new CD("Rendezvous Park", "Closer to Being Here", 2012) );
System.out.println( box );
}
}
| [
"j.rozbicki9@gmail.com"
] | j.rozbicki9@gmail.com |
43ac508197a8dec89a10c4893296e7b889f71b4d | 7187006d09b66e27b48f39dfb9465bc1038e5250 | /services-geojson/src/test/java/com/mapbox/geojson/shifter/ShifterTest.java | b2430b15b166799aabc38cdc07634a421d5afa60 | [
"MIT"
] | permissive | mapbox/mapbox-java | 287635e32a0f6c7a2f4d230db9e6d70e53ab6c77 | 5ab857cdd00f1d8baa4d2478add5348e7b3899bb | refs/heads/main | 2023-09-02T11:24:23.728538 | 2023-07-31T13:38:36 | 2023-07-31T13:38:36 | 55,638,412 | 447 | 163 | MIT | 2023-08-21T07:55:57 | 2016-04-06T20:30:35 | Java | UTF-8 | Java | false | false | 5,965 | java | package com.mapbox.geojson.shifter;
import com.google.gson.JsonParser;
import com.mapbox.geojson.BoundingBox;
import com.mapbox.geojson.LineString;
import com.mapbox.geojson.Point;
import org.hamcrest.Matchers;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.*;
public class ShifterTest {
static class TestCoordinateShifter implements CoordinateShifter {
@Override
public List<Double> shiftLonLat(double lon, double lat) {
return Arrays.asList(lon + 3, lat + 5);
}
@Override
public List<Double> shiftLonLatAlt(double lon, double lat, double altitude) {
return Arrays.asList(lon + 3, lat + 5, altitude + 8);
}
@Override
public List<Double> unshiftPoint(Point shiftedPoint) {
return Arrays.asList(shiftedPoint.longitude() - 3,
shiftedPoint.latitude() - 5,
shiftedPoint.altitude() - 8);
}
@Override
public List<Double> unshiftPoint(List<Double> coordinates) {
if (coordinates.size() > 2) {
return Arrays.asList(coordinates.get(0) - 3,
coordinates.get(1) - 5,
coordinates.get(2) - 8);
}
return Arrays.asList(coordinates.get(0) - 3,
coordinates.get(1) - 5);
}
}
@Test
public void basic_coordinate_shifter_manager_creation() throws Exception {
CoordinateShifterManager coordinateShifterManager = new CoordinateShifterManager();
assertNotNull(coordinateShifterManager);
}
@Test
public void default_shifter(){
assertTrue(CoordinateShifterManager.isUsingDefaultShifter());
CoordinateShifter shifter = new TestCoordinateShifter();
CoordinateShifterManager.setCoordinateShifter(shifter);
assertFalse(CoordinateShifterManager.isUsingDefaultShifter());
CoordinateShifterManager.setCoordinateShifter(null);
assertTrue(CoordinateShifterManager.isUsingDefaultShifter());
}
@Test
public void point_basic_shift() throws Exception {
Point southwest = Point.fromLngLat(2.0, 2.0);
Point northeast = Point.fromLngLat(4.0, 4.0);
CoordinateShifter shifter = new TestCoordinateShifter();
// Manually shifted
List<Double> shifted = shifter.shiftLonLat(southwest.longitude(), southwest.latitude());
Point southwestManualShifted = Point.fromLngLat(shifted.get(0), shifted.get(1));
shifted = shifter.shiftLonLat(northeast.longitude(), northeast.latitude());
Point northeastManualShifted = Point.fromLngLat(shifted.get(0), shifted.get(1));
CoordinateShifterManager.setCoordinateShifter(shifter);
// Autoshifted
Point southwestShifted = Point.fromLngLat(southwest.longitude(), southwest.latitude());
Point northeastShifted = Point.fromLngLat(northeast.longitude(), northeast.latitude());
assertEquals(southwestManualShifted, southwestShifted);
assertEquals(northeastManualShifted, northeastShifted);
CoordinateShifterManager.setCoordinateShifter(null);
}
@Test
public void bbox_basic_shift() throws Exception {
Point southwest = Point.fromLngLat(2.0, 2.0);
Point northeast = Point.fromLngLat(4.0, 4.0);
CoordinateShifter shifter = new TestCoordinateShifter();
// Manually shifted
List<Double> shifted = shifter.shiftLonLat(southwest.longitude(), southwest.latitude());
Point southwestManualShifted = Point.fromLngLat(shifted.get(0), shifted.get(1));
shifted = shifter.shiftLonLat(northeast.longitude(), northeast.latitude());
Point northeastManualShifted = Point.fromLngLat(shifted.get(0), shifted.get(1));
CoordinateShifterManager.setCoordinateShifter(shifter);
BoundingBox boundingBoxFromDouble = BoundingBox.fromLngLats(2.0, 2.0, 4.0, 4.0);
BoundingBox boundingBoxFromPoints =
BoundingBox.fromPoints(Point.fromLngLat(2.0, 2.0),
Point.fromLngLat(4.0, 4.0));
assertEquals(boundingBoxFromDouble, boundingBoxFromPoints);
assertEquals(southwestManualShifted, boundingBoxFromPoints.southwest());
assertEquals(northeastManualShifted, boundingBoxFromPoints.northeast());
CoordinateShifterManager.setCoordinateShifter(null);
}
@Test
public void point_toJson() throws Exception {
// set shifter
CoordinateShifterManager.setCoordinateShifter(new TestCoordinateShifter());
Point point1 = Point.fromLngLat(2.0, 3.0);
String point1JsonString = point1.toJson();
Point point2 = Point.fromJson(point1JsonString);
assertEquals(point1, point2);
CoordinateShifterManager.setCoordinateShifter(null);
}
@Test
public void point_fromJson() throws Exception {
// set shifter
CoordinateShifterManager.setCoordinateShifter(new TestCoordinateShifter());
Point point1 = Point.fromLngLat(1.0, 2.0);
String jsonString = "{\"type\":\"Point\",\"coordinates\":[1.0, 2.0]}";
Point point2 = Point.fromJson(jsonString);
assertEquals(point1, point2);
CoordinateShifterManager.setCoordinateShifter(null);
}
@Test
public void linestring_basic_shift_with_bbox() {
// set shifter
CoordinateShifterManager.setCoordinateShifter(new TestCoordinateShifter());
List<Point> points = new ArrayList<>();
points.add(Point.fromLngLat(1.0, 1.0));
points.add(Point.fromLngLat(2.0, 2.0));
points.add(Point.fromLngLat(3.0, 3.0));
BoundingBox bbox = BoundingBox.fromLngLats(1.0, 2.0, 3.0, 4.0);
LineString lineString = LineString.fromLngLats(points, bbox);
String jsonString = lineString.toJson();
compareJson("{\"coordinates\":[[1,1],[2,2],[3,3]],"
+ "\"type\":\"LineString\",\"bbox\":[1.0,2.0,3.0,4.0]}",
jsonString);
CoordinateShifterManager.setCoordinateShifter(null);
}
public void compareJson(String expectedJson, String actualJson) {
JsonParser parser = new JsonParser();
assertThat(parser.parse(actualJson), Matchers.equalTo(parser.parse(expectedJson)));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
3efa190ab642446d0ab9e6c8bbf944fc5016adf2 | 8335e423343698beca47b6c16e7eac8cb431cce9 | /javaBaseNote/java20151223/IntToHexToOctDemo1.java | cb8f6b9a4b3ddb01057962f0017b47bad2ca11ea | [] | no_license | luoleiself/summary | d10e310d72665c3d316b1e3bfaf54e732d87da22 | bd9f949ef450194a614740283981a79ee115e657 | refs/heads/master | 2023-06-10T02:51:35.858368 | 2023-06-02T09:17:14 | 2023-06-02T09:17:14 | 75,247,872 | 1 | 0 | null | 2016-12-26T07:59:18 | 2016-12-01T02:37:57 | JavaScript | GB18030 | Java | false | false | 2,273 | java | /*
ๅบๆฌๆฐๆฎ็ฑปๅๅฏน่ฑกๅ
่ฃ
็ฑปใ
ๆฐๆฎ็ฑปๅ ็ฑปๅ
byte Byte
short Short
int Integer
boolean Boolean
float Float
double Double
char Character
ๅบๆฌๆฐๆฎ็ฑปๅๅฏน่ฑกๅ
่ฃ
็ฑป็ๆๅธธ่งไฝ็จ๏ผๅฐฑๆฏ็จไบๅบๆฌๆฐๆฎ็ฑปๅๅๅญ็ฌฆไธฒ็ฑปๅไน้ดๅ่ฝฌๆขใ
1๏ผๅบๆฌๆฐๆฎ็ฑปๅ่ฝฌๆขๆๅญ็ฌฆไธฒ๏ผ
1,ๅบๆฌๆฐๆฎ็ฑปๅ+"";
2,ๅบๆฌๆฐๆฎ็ฑปๅ.toString(ๅบๆฌๆฐๆฎ็ฑปๅๅผ);
็คบไพ๏ผInteger.toString(34);ๅฐ34ๆดๅๆฐๆฎ่ฝฌๆขๆๅญ็ฌฆไธฒ"34";
2๏ผๅญ็ฌฆไธฒ่ฝฌๆขๆๅบๆฌๆฐๆฎ็ฑปๅ๏ผ
1๏ผ้ๆๆนๆณ่ฐ็จๆนๅผ๏ผ
xxx a = Xxx.parseXxx(String str);
int a = Integer.parseInt("123");
long a = Long.parseLong("123");
double a = Double.parseDouble("12.23");
boolean a = Boolean.parseBoolean("true");
2๏ผๅฏน่ฑก่ฐ็จๆนๅผ๏ผ
Integer i = new Integer("123");
int num = i.intValue();
3๏ผๅ่ฟๅถ่ฝฌๆขๆๅ
ถไป่ฟๅถ๏ผ
toBinaryString();
toHexString();
toOctalString();
4๏ผๅ
ถไป่ฟๅถ่ฝฌๆขๆๅ่ฟๅถ๏ผ
parseInt(String str,int radix);
็คบไพ๏ผint x = Integer.parseInt("3c",16);ๅฐ3c่ฝฌๆขๆๅๅ
ญ่ฟๅถๆฐๆฎ็ฑปๅใ
*/
class IntToHexToOctDemo1
{
public static void stringPrint(String str)
{
System.out.println(str);
}
public static void main(String[] args)
{
//ๆดๆฐ็ฑปๅ็ๆๅผ๏ผ
stringPrint("int max:"+Integer.MAX_VALUE);//ๆดๅฝข็ฑปๅ็ๆๅคงๅผ;MAX_VALUEไธบๅญๆฎตๅฑๆง;
stringPrint("int max:"+Integer.MIN_VALUE);//ๆดๅฝข็ฑปๅ็ๆๅฐๅผ;MIN_VALUEไธบๅญๆฎตๅฑๆง;
//ๅฐไธไธชๅญ็ฌฆไธฒ่ฝฌๆขๆๆดๆฐ๏ผ
int in = Integer.parseInt("123");
long lon = Long.parseLong("123");
float floa = Float.parseFloat("123.123");
double doubl = Double.parseDouble("123123.123123");
stringPrint("in="+in);
stringPrint("lon="+lon);
stringPrint("floa="+lon);
stringPrint("doubl="+doubl);
//ๅ่ฟๅถ่ฝฌๆขๆๅ
ถไป่ฟๅถ๏ผ
stringPrint(Integer.toBinaryString(100));
stringPrint(Integer.toHexString(100));
stringPrint(Integer.toOctalString(100));
//ๅ
ถไป่ฟๅถ่ฝฌๆขๆๅ่ฟๅถ๏ผ
int in1 = Integer.parseInt("110",2);
int in2 = Integer.parseInt("F6c",16);
int in3 = Integer.parseInt("107",8);
stringPrint("in1="+in1);
stringPrint("in2="+in2);
stringPrint("in3="+in3);
}
}
| [
"18530076746@163.com"
] | 18530076746@163.com |
a77046d2343d743152f43b37513a80e9dfaa963f | 84185a48b50426a05d1f2fd780df67b6b7936580 | /Main.java | fef748dfc4e81c678cc308d10e126da7b1887dcc | [] | no_license | Anamesis/testCalculate | 5b6eda75b316e661057069bfdf52cca9410675f1 | ba55a82c94c8a6a289c61a6d4eb532bec4b3daf4 | refs/heads/master | 2022-11-28T12:02:11.440987 | 2020-08-13T11:06:54 | 2020-08-13T11:06:54 | 287,228,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,303 | java | import java.util.Scanner;
public class Main {
private static Scanner scanner;
public static void main(String[] args) {
scanner = new Scanner(System.in);
String temp = scanner.nextLine();
String x = temp.split(" ")[0];
String op = temp.split(" ")[1];
String y = temp.split(" ")[2];
if (TranslateNum.checkNum(x) && TranslateNum.checkNum(y)) {
double finalNum = ะกalculator.calculator(Integer.parseInt(x), op, Integer.parseInt(y));
if(finalNum == -300) {
throw new NullPointerException("Invalid input");
}
System.out.println(finalNum);
} else if (!TranslateNum.checkNum(x) && !TranslateNum.checkNum(y)) {
int xInt = TranslateNum.romanToArabic(x);
int yInt = TranslateNum.romanToArabic(y);
double finalNum = ะกalculator.calculator(xInt, op, yInt);
if(finalNum == -300) {
throw new NullPointerException("Invalid input");
}
String num = TranslateNum.arabicToRoman((int) finalNum);
System.out.println(num);
} else {
//error
throw new NullPointerException("Invalid input");
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
87c82258be028805113fecd6978490547795f41a | ee4da2945b019bca18c5223e1c60ccaafebe3917 | /MindWaveTestValue/out/production/MindWaveTestValue/gen/com/example/MindWaveTestValue/R.java | 4f24bb19f3a90f6f03b47b111921bc726f741c85 | [] | no_license | ismailraju/mindwave-mobile-project | 1102a1c50fc965a51751c386f0815e3184229b68 | 9c59c783436320d62f3881f9461341c89a4d6e3a | refs/heads/master | 2021-01-23T16:18:23.361168 | 2017-06-04T05:29:59 | 2017-06-04T05:29:59 | 93,291,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | /*___Generated_by_IDEA___*/
package com.example.MindWaveTestValue;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
} | [
"ismailhossainraju74@gmail.com"
] | ismailhossainraju74@gmail.com |
c1ad98457f00afd9b3269a201a7a20419bb39c62 | 490f31c19b8e1aea5655b9e73778cdc63ea857d6 | /src/main/java/com/sedmuc/init/WebSecurityConfig.java | 689a4004b7e341d139b5b32cbcf647cd07546a70 | [] | no_license | abarrientos79/sedmuc | b55c22add6d03e3263ac97c55619692f54571c50 | e7d668b5e1c21ec0149d9f4673409baa57272eec | refs/heads/master | 2023-04-30T20:32:50.658871 | 2021-05-10T01:13:07 | 2021-05-10T01:13:07 | 365,020,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,181 | java | package com.sedmuc.init;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
String[] resources = new String[]{
"/include/**","/css/**","/icons/**","/img/**","/js/**","/layer/**"
};
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers(resources).permitAll()
.antMatchers("/","/index").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.defaultSuccessUrl("/evaluacionForm")
.failureUrl("/login?error=true")
.usernameParameter("username")
.passwordParameter("password")
.and()
.csrf().disable()
.logout()
.permitAll()
.logoutSuccessUrl("/login?logout");
}
BCryptPasswordEncoder bCryptPasswordEncoder;
@Bean
public BCryptPasswordEncoder passwordEncoder() {
bCryptPasswordEncoder = new BCryptPasswordEncoder(4);
return bCryptPasswordEncoder;
}
@Autowired
UserDetailsService userDetailsService;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//Especificar el encargado del login y encriptacion del password
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
}
} | [
"abarr@192.168.0.7"
] | abarr@192.168.0.7 |
28e7ad0cbc95659b9f5bee6347d036896f4a05bd | 8921c3e9c6ebfd19efd489e12b9d713b97f5b2e5 | /app/src/main/java/com/example/oohyugi/livedata/DasboardActivity.java | 79fcdaf56177d056fc777a47df63926d97642500 | [] | no_license | oohyugi/Example-AndroidArchitecture | 555050508072e820411edd283e51e53f2605df81 | 6d5c3a776903753bceec2442aa13bd0c906dc856 | refs/heads/master | 2021-01-01T18:43:33.850392 | 2017-07-26T13:02:39 | 2017-07-26T13:02:39 | 98,413,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package com.example.oohyugi.livedata;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class DasboardActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dasboard);
Button biasa = findViewById(R.id.biasa);
biasa.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(DasboardActivity.this,MainActivity1.class);
startActivity(intent);
}
});
Button livedata = findViewById(R.id.livedata);
livedata.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(DasboardActivity.this,MainLiveDataActivity.class);
startActivity(intent);
}
});
}
}
| [
"yogi@gits.co.id"
] | yogi@gits.co.id |
479e9e1bb79557b15964eee2803184183b477ce9 | f793eaa91f4ad3d2ce48e73cacee1ab51db6ae40 | /iotgp-common-db/src/main/java/cn/inovance/iotgp/common/dao/impl/CdRunStatusDaoImpl.java | 5f90e7d5110cfa92c981e9819fb437c1be119038 | [] | no_license | scorp2010/iot | 03575c0aca335bc8b3d78b85f070f017c3e1dc83 | 218b0a9e173e1637cd0d00abdf727352a2875700 | refs/heads/master | 2021-06-03T05:28:54.117982 | 2016-09-14T07:04:09 | 2016-09-14T07:04:09 | 68,065,562 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,684 | java | /**
r * Project Name:iotgp-common-db
* File Name:Cd.java
* Package Name:cn.inovance.iotgp.common.dao.impl
* Date:2014-5-26ไธๅ2:55:25
* Copyright (c) 2014, Shenzhen Inovance technology Co., Ltd All Rights Reserved.
*
*/
package cn.inovance.iotgp.common.dao.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.test.util.JsonPathExpectationsHelper;
import cn.inovance.iotgp.common.dao.CdRunStatusDao;
import cn.inovance.iotgp.common.dao.SuperBaseDao;
import cn.inovance.iotgp.common.domain.CdRunStatusLog;
/**
* ClassName:CdRunStatusDaoImpl. Date: 2014-5-26 ไธๅ2:55:25 <br/>
*
* @author w1898
* @version
* @since JDK 1.7
* @see
*/
@Repository
public class CdRunStatusDaoImpl extends BaseDaoImpl<CdRunStatusLog> implements
CdRunStatusDao {
@Resource
SuperBaseDao superBaseDao;
@Override
public List <CdRunStatusLog> getCdRunStatusLogByCdRegCode(String cdRegCode) {
String hql = "from CdRunStatusLog t where 1=1 and t.cdRegCode=:cdRegCode ";
Map<String, Object> params = new HashMap<String, Object>(2);
params.put("cdRegCode", cdRegCode);
return find(hql, params);
}
@Override
public List<CdRunStatusLog> getCdRunStatus(List<String> cdRegCodes) {
String hql = "select t " +
" from CdRunStatusLog t"+
" where 1=1 " +
" and t.cdRegCode in (:cdRegCodeList)";
Query q = superBaseDao.getCurrentSession().createQuery(hql);
q.setParameterList("cdRegCodeList", cdRegCodes);
List<CdRunStatusLog> logList = q.list();
return logList;
}
}
| [
"2528360654@qq.com"
] | 2528360654@qq.com |
5cbcc60eb7e3761c626f3cc0a630708c42e2ba50 | 52aa753885647b44c60abf691bfb0116be6fca4e | /src/edu/cmu/cs/stage3/math/Vector4.java | a218d291abd2c0f81ffb034f06a5a0e6efa2182c | [
"MIT"
] | permissive | ai-ku/langvis | 10083029599dac0a0098cdc4cbf77f3e1bdf6d43 | 4ccd37107a3dea4b7b12696270a25df9c17d579d | refs/heads/master | 2020-12-24T15:14:43.644569 | 2014-03-26T13:43:25 | 2014-03-26T14:09:03 | 15,770,922 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,076 | java | /*
* Copyright (c) 1999-2003, Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Products derived from the software may not be called "Alice",
* nor may "Alice" appear in their name, without prior written
* permission of Carnegie Mellon University.
*
* 4. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes software developed by Carnegie Mellon University"
*/
package edu.cmu.cs.stage3.math;
public class Vector4 extends javax.vecmath.Vector4d {
public Vector4() {
}
public Vector4( double x, double y, double z, double w ) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
public Vector4( double[] v ) {
this( v[0], v[1], v[2], v[3] );
}
public Vector4( javax.vecmath.Tuple3d v, double w ) {
this( v.x, v.y, v.z, w );
}
public boolean equals( Object o ) {
if( o==this ) return true;
if( o!=null && o instanceof Vector4 ) {
Vector4 v = (Vector4)o;
return x==v.x && y==v.y && z==v.z && w==v.w;
} else {
return false;
}
}
public double[] getArray() {
double[] a = { x, y, z, w };
return a;
}
public void setArray( double[] a ) {
x = a[0];
y = a[1];
z = a[2];
w = a[3];
}
public void set( Vector4 other ) {
x = other.x;
y = other.y;
z = other.z;
w = other.w;
}
public boolean equals( Vector4 v ) {
return x==v.x && y==v.y && z==v.z && w==v.w;
}
public double getItem( int i ) {
switch( i ) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
case 3:
return w;
}
throw new IllegalArgumentException();
}
public void setItem( int i, double v ) {
switch( i ) {
case 0:
x = v;
return;
case 1:
y = v;
return;
case 2:
z = v;
return;
case 3:
w = v;
return;
}
throw new IllegalArgumentException();
}
public static Vector4 negate( Vector4 v ) {
return new Vector4( -v.x, -v.y, -v.z, -v.w );
}
public static double dotProduct( Vector4 a, Vector4 b ) {
return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
}
public static Vector4 multiply( javax.vecmath.Vector4d a, javax.vecmath.Matrix4d b ) {
Vector4 ab = new Vector4();
ab.x = a.x*b.m00 + a.y*b.m10 + a.z*b.m20 + a.w*b.m30;
ab.y = a.x*b.m01 + a.y*b.m11 + a.z*b.m21 + a.w*b.m31;
ab.z = a.x*b.m02 + a.y*b.m12 + a.z*b.m22 + a.w*b.m32;
ab.w = a.x*b.m03 + a.y*b.m13 + a.z*b.m23 + a.w*b.m33;
return ab;
}
public static Vector4 multiply( javax.vecmath.Matrix4d a, javax.vecmath.Vector4d b ) {
Vector4 ab = new Vector4();
ab.x = b.x*a.m00 + b.y*a.m01 + b.z*a.m02 + b.w*a.m03;
ab.y = b.x*a.m10 + b.y*a.m11 + b.z*a.m12 + b.w*a.m13;
ab.z = b.x*a.m20 + b.y*a.m21 + b.z*a.m22 + b.w*a.m23;
ab.w = b.x*a.m30 + b.y*a.m31 + b.z*a.m32 + b.w*a.m33;
return ab;
}
public void transform( javax.vecmath.Matrix4d m ) {
set( Vector4.multiply( this, m ) );
}
public String toString() {
return "edu.cmu.cs.stage3.math.Vector4[x="+x+",y="+y+",z="+z+",w="+w+"]";
}
public static Vector4 valueOf( String s ) {
String[] markers = { "edu.cmu.cs.stage3.math.Vector4[x=", ",y=", ",z=", ",w=", "]" };
double[] values = new double[markers.length-1];
for( int i=0; i<values.length; i++ ) {
int begin = s.indexOf( markers[i] ) + markers[i].length();
int end = s.indexOf( markers[i+1] );
values[i] = Double.valueOf( s.substring( begin, end ) ).doubleValue();
}
return new Vector4( values );
}
}
| [
"emreunal99@gmail.com"
] | emreunal99@gmail.com |
33ab6d4d6909d3ee65d7b0020779523ffad5b66f | 40f88db3c8f30c0f275c085949367b1c1a148f6e | /UIProject/app/src/main/java/fixinnov/com/uiproject/feed1.java | 2e506891c7f912e4cc9117672ab87a1dc268e3a8 | [] | no_license | govinda123/EdTechUIProject | d57cfa37bd1dadf012216e8f3f5be7a3e560413d | 5580acaf40247e96ee8ea243664c93a666b85d6b | refs/heads/master | 2021-01-20T18:45:06.865642 | 2016-06-12T12:58:42 | 2016-06-12T12:58:42 | 60,967,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,895 | java | package fixinnov.com.uiproject;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
public class feed1 extends AppCompatActivity {
private RecyclerView recyclerView;
private List<Feed> movieList = new ArrayList<>();
private FeedAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feed1);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view2);
mAdapter = new FeedAdapter(movieList);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(mAdapter);
prepareFeedData();
}
private void prepareFeedData() {
Feed movie = new Feed("Mad Max: Fury Road", "Action & Adventure", "2015");
movieList.add(movie);
movie = new Feed("Inside Out", "Animation, Kids & Family", "2015");
movieList.add(movie);
movie = new Feed("Star Wars: Episode VII - The Force Awakens", "Action", "2015");
movieList.add(movie);
movie = new Feed("Shaun the Sheep", "Animation", "2015");
movieList.add(movie);
movie = new Feed("The Martian", "Science Fiction & Fantasy", "2015");
movieList.add(movie);
movie = new Feed("Mission: Impossible Rogue Nation", "Action", "2015");
movieList.add(movie);
// movie = new Movie("Up", "Animation", "2009");
// movieList.add(movie);
//
// movie = new Movie("Star Trek", "Science Fiction", "2009");
// movieList.add(movie);
//
// movie = new Movie("The LEGO Movie", "Animation", "2014");
// movieList.add(movie);
//
// movie = new Movie("Iron Man", "Action & Adventure", "2008");
// movieList.add(movie);
//
// movie = new Movie("Aliens", "Science Fiction", "1986");
// movieList.add(movie);
//
// movie = new Movie("Chicken Run", "Animation", "2000");
// movieList.add(movie);
//
// movie = new Movie("Back to the Future", "Science Fiction", "1985");
// movieList.add(movie);
//
// movie = new Movie("Raiders of the Lost Ark", "Action & Adventure", "1981");
// movieList.add(movie);
//
// movie = new Movie("Goldfinger", "Action & Adventure", "1965");
// movieList.add(movie);
//
// movie = new Movie("Guardians of the Galaxy", "Science Fiction & Fantasy", "2014");
// movieList.add(movie);
mAdapter.notifyDataSetChanged();
}
}
| [
"nishant.jadon02@gmail.com"
] | nishant.jadon02@gmail.com |
c92015cb00836f1f9cf32a28b1f53b1e04d05e54 | 673e2c9a6d51427845d5775ab879d38cb3468f43 | /src/Day5/Fibonacci.java | d268497fa239d8dff32025242a36fe4dfd3c16f2 | [] | no_license | snehalKhole/JavaApplication | 441a05585339d4e7da5b18f7d92731e1d883dca7 | 78e83694846d884167b7d475a46a2eb5e2a3ab5f | refs/heads/master | 2023-07-17T16:01:28.694724 | 2021-09-07T13:06:12 | 2021-09-07T13:06:12 | 400,490,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package Day5;
public class Fibonacci {
public static void main(String[] args) {
int a=0;
int b=1;
System.out.println(a+""+b);
for(int i=3;i<=10;i++)
{
int term=a+b;
System.out.println(""+term);
a=b;
b=term;
}
}
}
| [
"hp@DESKTOP-RPE8CHA"
] | hp@DESKTOP-RPE8CHA |
09792c57a83cb2baab8654a989898086321c2850 | 8699bce499bc62ed999d9631f645e19951103a34 | /chanukah.java | 8d903b360fce16d2ddd806d72fa8ef9b4d1a98ac | [] | no_license | romerojericho/chanukah | 2c7a9e5a06cd5eee261039f6232ae85b527ca212 | 39e675952c24ee6e938ad051bc4dc198e4965673 | refs/heads/main | 2023-09-05T22:29:10.354549 | 2021-11-11T10:59:54 | 2021-11-11T10:59:54 | 426,962,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 624 | java | import java.io.*;
import java.util.*;
public class chanukah {
public static void main(String[] args) throws Exception {
BufferedReader In = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter Out = new BufferedWriter(new OutputStreamWriter(System.out));
int cases = Integer.parseInt(In.readLine());
while (cases-- > 0) {
String[] tokens = In.readLine().split(" ");
int n = Integer.parseInt(tokens[1]);
Out.write(tokens[0] + " " + (n * (n + 1) / 2 + n) + "\n");
}
Out.close();
In.close();
}
} | [
"noreply@github.com"
] | noreply@github.com |
9277b91407c2db1085b610f1d33c37b8120b8a20 | 89ed1cadbb24fcad3559092a70826f44884dca31 | /src/automail/IServiceFeeAdapter.java | 79144cc4f0aa56dc96cb73583e2b59cadaa1f334 | [] | no_license | Valkyriean/SMD_automail | f5fd867d4fb4cc0c33fe667523def4b272b58060 | 434bae8c5d7aca92f1c134127dd4f3ea11618eae | refs/heads/main | 2023-04-02T23:33:54.087786 | 2021-04-20T10:10:10 | 2021-04-20T10:10:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package automail;
/**
* Interface to set standard for ServiceFeeAdapter to ensure protected variation
*/
public interface IServiceFeeAdapter{
/**
* get the service fee and the times of look up service fee
* @param destination_floor destination of the mail
* @return an object contains service fee and times of look up service fee
*/
public ServiceData getServiceFee(int destination_floor);
public void finish();
}
// Class to encapsulate two return variables of different type
class ServiceData{
double serviceFee;
int lookupCount;
ServiceData(double serviceFee, int lookupCount){
this.serviceFee = serviceFee;
this.lookupCount = lookupCount;
}
} | [
"alexjiachenli@hotmail.com"
] | alexjiachenli@hotmail.com |
7f11b4a34b60803a815f3894679e83f9736bce8c | 266615054bb48dfcb3e6f601ced9f18d940a94a1 | /utils-project/java-dom/src/main/java/com/asakusafw/utils/java/internal/model/syntax/SwitchCaseLabelImpl.java | f4f90995700f7c7b6fc036ffec2ed1f23aa820a4 | [
"Apache-2.0"
] | permissive | trmmy/asakusafw | ca7130cb21bee7656e23c397712664761b496ae8 | 9d93386e12dae309d457c877adde3bf5ddd26719 | refs/heads/master | 2021-01-18T09:10:44.799214 | 2012-08-30T08:08:46 | 2012-08-30T08:08:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,123 | java | /**
* Copyright 2011-2012 Asakusa Framework Team.
*
* 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.asakusafw.utils.java.internal.model.syntax;
import com.asakusafw.utils.java.model.syntax.Expression;
import com.asakusafw.utils.java.model.syntax.ModelKind;
import com.asakusafw.utils.java.model.syntax.SwitchCaseLabel;
import com.asakusafw.utils.java.model.syntax.Visitor;
/**
* {@link SwitchCaseLabel}ใฎๅฎ่ฃ
ใ
*/
public final class SwitchCaseLabelImpl extends ModelRoot implements SwitchCaseLabel {
/**
* {@code case}ใฉใใซใฎๅคใ
*/
private Expression expression;
@Override
public Expression getExpression() {
return this.expression;
}
/**
* {@code case}ใฉใใซใฎๅคใ่จญๅฎใใใ
* @param expression
* {@code case}ใฉใใซใฎๅค
* @throws IllegalArgumentException
* {@code expression}ใซ{@code null}ใๆๅฎใใใๅ ดๅ
*/
public void setExpression(Expression expression) {
Util.notNull(expression, "expression"); //$NON-NLS-1$
this.expression = expression;
}
/**
* ใใฎ่ฆ็ด ใฎ็จฎ้กใ่กจใ{@link ModelKind#SWITCH_CASE_LABEL}ใ่ฟใใ
* @return {@link ModelKind#SWITCH_CASE_LABEL}
*/
@Override
public ModelKind getModelKind() {
return ModelKind.SWITCH_CASE_LABEL;
}
@Override
public <R, C, E extends Throwable> R accept(
Visitor<R, C, E> visitor, C context) throws E {
Util.notNull(visitor, "visitor"); //$NON-NLS-1$
return visitor.visitSwitchCaseLabel(this, context);
}
}
| [
"akirakw@gmail.com"
] | akirakw@gmail.com |
2d04ed66861185ad63d0a94e6e6421f13b0f2b65 | 51b385d120dad4c326139f61aebc77985c60bf52 | /Gyst/app/src/main/java/com/example/caitrifeddeler/GYST/AlarmReceiver.java | c255606f9985844aad06e9e6638e837621a05475 | [] | no_license | kingjkang/GYST | 6752cf013d17bf65df949e85e45a35298d25b4e1 | ac9761bcd228306ffa15dfa0cde1d1481badd00a | refs/heads/master | 2020-05-20T06:04:22.804627 | 2016-05-01T20:10:50 | 2016-05-01T20:10:50 | 52,171,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,612 | java | package com.example.caitrifeddeler.GYST;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Toast;
/**
* Created by CaitriFeddeler on 4/21/16.
*/
public class AlarmReceiver extends BroadcastReceiver
{
private LocationManager locationManager;
private String provider;
Globals variables = Globals.getInstance();
@Override
public void onReceive(Context context, Intent intent) {
//Currently this should sound an alarm 15 min before an event
//it should just pop up a Toast with the location of the event
Bundle bundle = intent.getExtras();
String title = bundle.getString("event_title");
String location = bundle.getString("event_location");
Double eventLat = bundle.getDouble("event_latitude");
Double eventLon = bundle.getDouble("event_longitude");
GeoPoint eventGeo= new GeoPoint(eventLat, eventLon);
GeoPoint userGeo=new GeoPoint(variables.getUserLat(), variables.getUserLong());
Location locationA = new Location("point A");
locationA.setLatitude(userGeo.getLatitude());
locationA.setLongitude(userGeo.getLongitude());
Location locationB = new Location("point B");
locationB.setLatitude(eventGeo.getLatitude());
locationB.setLongitude(eventGeo.getLongitude());
System.out.println("user location, latitude: " + locationA.getLatitude() + " longitude: " + locationA.getLongitude());
System.out.println("event location, latitude: " + locationB.getLatitude() + " longitude: " + locationB.getLongitude());
float distance = locationA.distanceTo(locationB);
System.out.println("distance between = " + distance);
float maxDist= 5000;
if(distance<= maxDist){
System.out.println("attendedEvent");
Toast.makeText(context, "attended " + title, Toast.LENGTH_LONG).show();
attendedEvent();
}
else{
System.out.println("missedEvent");
Toast.makeText(context, "missed " + title, Toast.LENGTH_LONG).show();
missedEvent();
}
}
public void attendedEvent(){
Globals variables = Globals.getInstance();
int updatedStreak = 0;
updatedStreak = variables.getStreak() + 1;
variables.setStreak(updatedStreak);
int updatedPetals = variables.getPetals() + 1;
//This takes into account that the user has more than 20 petals
variables.setPetals(updatedPetals);
}
public void missedEvent(){
Globals variables = Globals.getInstance();
int updatedStreak = 0;
variables.setStreak(0);
int updatedPetals = variables.getPetals() -1;
//this takes into account the user has less than 0 petals
if(updatedPetals<0){
updatedPetals=0;
}
variables.setPetals(updatedPetals);
}
}
/*
Things I need to know about geofences
1. Can I set a geofence to last for a certain amount of time?
2. How do I remove a geofence when this time is up?
3. How do I convert a string location into the latitude and longitude coordinates
Things our geofence will do:
1. The geofence will be created when the alarm sounds to last for 20 min
2. When the user enters the geofence it will trigger attendedEvent() and will remove the geofence
3. If the geofence is still up after 20 min the geofence will be removed and will trigger missedEvent()
*/ | [
"justin.d.kang@gmail.com"
] | justin.d.kang@gmail.com |
32aa7184438509a69f632348e340339b95548df6 | 95365153bacd0f7d5aef1247302a10548b7612a1 | /JavaFXTest/src/kr/or/ddit/basic/T12_RadioButtonTest.java | 9178017541b99404e453dbd1fefc157685d2207f | [] | no_license | ahffk933/highJava | dae100823675d9006932ec544417faf7440a52bb | ad3e06037c7230856c5b3a611fca57f3e9ef2447 | refs/heads/master | 2021-01-02T17:08:55.325089 | 2020-02-11T08:48:19 | 2020-02-11T08:48:19 | 239,715,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,313 | java | package kr.or.ddit.basic;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.RadioButton;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class T12_RadioButtonTest extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
// ๋ผ๋์ค ๋ฒํผ์ ๋ฌถ์์ผ๋ก ์ฒ๋ฆฌํ ๊ฐ์ฒด ์์ฑ
ToggleGroup group = new ToggleGroup();
ImageView icon = new ImageView();
RadioButton rb1 = new RadioButton("HOME");
rb1.setToggleGroup(group); //๋ผ๋์ค ๋ฒํผ์ ๊ทธ๋ฃน์ ์ถ๊ฐ
rb1.setUserData("Home"); //์ ํ
ํ์ ๋ ๊ฐ์ ๋ํ๋ด๊ธฐ ์ํ ๋ฐ์ดํฐ ์ค์
RadioButton rb2 = new RadioButton("CALENDAR");
rb2.setToggleGroup(group);
rb2.setUserData("Calendar");
RadioButton rb3 = new RadioButton("CONTACTS");
rb3.setToggleGroup(group);
rb3.setUserData("Contacts");
//๊ทธ๋ฃน๋ด์์ RadioButton์ค ํ๋๊ฐ ์ ํ๋์์ ๋ ์ฒ๋ฆฌํ๊ธฐ toggle
group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
@Override
public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) {
//์ ํ๋ ํญ๋ชฉ(๋ผ๋์ค๋ฒํผ)์ด ์๋์ง ๊ฒ์ฌ
if(group.getSelectedToggle().getUserData() !=null) {
String url = group.getSelectedToggle().getUserData().toString();
Image img = new Image(getClass().getResourceAsStream("images/"+url+".jpg"));
icon.setImage(img);
}
}
});
rb1.setSelected(true); //์ ํ๋ ์ํ๋ก ์ค์ ํ๊ธฐ
HBox hbox = new HBox();
VBox vbox = new VBox();
vbox.getChildren().addAll(rb1, rb2, rb3);
vbox.setSpacing(10);
hbox.getChildren().addAll(vbox, icon);
hbox.setSpacing(50);
hbox.setPadding(new Insets(10));
Scene scene = new Scene(hbox, 250, 150);
primaryStage.setTitle("๋ผ์ด๋๋ฒํผ ์์ ");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"ahffk933@gmail.com"
] | ahffk933@gmail.com |
dba296d0be0340ed9aa96a1ac30c64f4f1c8a7d0 | f56fc41a9ba51f7f4b056595589105259b9f6d36 | /libenc/JOpusHeader.java | 6bc7e2085fead532e53489cf01a17c4b0c38a8ba | [] | no_license | ggrandes-clones/jopus | adbcfaf18948f53714211cd819f3bceaac0a0f00 | c179bf2012cb2542386c91a309720527a559ec4c | refs/heads/master | 2020-11-27T23:19:22.695754 | 2019-12-22T23:33:27 | 2019-12-22T23:33:27 | 229,644,009 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,784 | java | package libenc;
import java.nio.charset.Charset;
import opus.Jopus_defines;
import opus.Jopus_projection;
/* Copyright (C)2012 Xiph.Org Foundation
File: opus_header.c
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.
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 FOUNDATION 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.
*/
/* Header contents:
- "OpusHead" (64 bits)
- version number (8 bits)
- Channels C (8 bits)
- Pre-skip (16 bits)
- Sampling rate (32 bits)
- Gain in dB (16 bits, S7.8)
- Mapping (8 bits, 0=single stream (mono/stereo) 1=Vorbis mapping,
2=ambisonics, 3=projection ambisonics, 4..239: reserved,
240..254: experiments, 255: multistream with no mapping)
- if (mapping != 0)
- N = total number of streams (8 bits)
- M = number of paired streams (8 bits)
- if (mapping != a projection family)
- C times channel origin
- if (C<2*M)
- stream = byte/2
- if (byte&0x1 == 0)
- left
else
- right
- else
- stream = byte-M
- else
- D demixing matrix (C*(N+M)*16 bits)
*/
final class JOpusHeader {
/** java: data is an offset to base. Use base[ data ]. */
private static final class JPacket {
private final byte[] base;// java added
private final int data;// java changed to offset
private final int maxlen;
private int pos;
private JPacket(final byte[] b, final int d, final int len, final int p) {
base = b;
data = d;
maxlen = len;
pos = p;
}
private final boolean write_uint32(final int val)
{
if( this.pos > this.maxlen - 4 ) {
return false;
}
int off = this.data + this.pos;// java
this.base[ off++ ] = (byte)(val );
this.base[ off++ ] = (byte)(val >> 8 );
this.base[ off++ ] = (byte)(val >> 16);
this.base[ off ] = (byte)(val >> 24);
this.pos += 4;
return true;
}
private final boolean write_uint16(final short val)// TODO java: use int to increase speed
{
if( this.pos > this.maxlen - 2 ) {
return false;
}
int off = this.data + this.pos;// java
this.base[ off++ ] = (byte)(val );
this.base[ off ] = (byte)(val >> 8);
this.pos += 2;
return true;
}
private final boolean write_chars(final byte[] str, final int nb_chars)
{
if( this.pos > this.maxlen - nb_chars ) {
return false;
}
for( int i = 0, pi = this.data + this.pos; i < nb_chars; i++, pi++ ) {
this.base[ pi ] = str[ i ];
}
this.pos += nb_chars;
return true;
}
// java: added a version for 1 byte
private final boolean write_chars(final byte str)
{
if( this.pos > this.maxlen - 1 ) {
return false;
}
this.base[ this.data + this.pos++ ] = str;
return true;
}
private final boolean write_matrix_chars(final JOpusGenericEncoder st)
{
// #ifdef OPUS_HAVE_OPUS_PROJECTION_H
final Object request[] = new Object[1];// java helper
int ret = st.opeint_encoder_ctl( Jopus_projection.OPUS_PROJECTION_GET_DEMIXING_MATRIX_SIZE, request );
final int size = ((Integer)request[0]).intValue();
if( ret != Jopus_defines.OPUS_OK ) {
return false;
}
if( size > this.maxlen - this.pos ) {
return false;
}
ret = st.opeint_encoder_ctl( Jopus_projection.OPUS_PROJECTION_GET_DEMIXING_MATRIX, this.base, this.data + this.pos, size );
if( ret != Jopus_defines.OPUS_OK ) {
return false;
}
this.pos += size;
return true;
/* #else
(void)p;
(void)st;
return 0;
#endif */
}
}// JPacket
// private int version;// FIXME isn't used
int channels; /* Number of channels: 1..255 */
int preskip;
int input_sample_rate;
int gain; /* in dB S7.8 should be zero whenever possible */
int channel_mapping;
/* The rest is only used if channel_mapping != 0 */
int nb_streams;
int nb_coupled;
final char stream_map[] = new char[255];// java: uint16 instead of unsigned byte
final int opeint_opus_header_get_size()
{
// int len;
if( JOpusGenericEncoder.opeint_use_projection( this.channel_mapping ) )
{
/* 19 bytes from fixed header,
* 2 bytes for nb_streams & nb_coupled,
* 2 bytes per cell of demixing matrix, where:
* rows=channels, cols=nb_streams+nb_coupled
*/
return 21 + ((this.channels * (this.nb_streams + this.nb_coupled)) << 1);
}
//else
//{
/* 19 bytes from fixed header,
* 2 bytes for nb_streams & nb_coupled,
* 1 byte per channel
*/
return 21 + this.channels;
//}
//return len;
}
final int opeint_opus_header_to_packet(final byte[] packet, final int poffset, final int len, final JOpusGenericEncoder st)
{
final JPacket p = new JPacket( packet, poffset, len, 0 );
// p.base = packet;// java
// p.data = poffset;// java packet;
// p.maxlen = len;
// p.pos = 0;
if( len < 19 ) {
return 0;
}
if( ! p.write_chars( "OpusHead".getBytes( Charset.forName( "UTF-8" ) ), 8 ) ) {
return 0;
}
/* Version is 1 */
if( ! p.write_chars( (byte)1 ) ) {
return 0;
}
if( ! p.write_chars( (byte)this.channels ) ) {
return 0;
}
if( ! p.write_uint16( (short)this.preskip ) ) {
return 0;
}
if( ! p.write_uint32( this.input_sample_rate ) ) {
return 0;
}
if( JOpusGenericEncoder.opeint_use_projection( this.channel_mapping ) )
{
// #ifdef OPUS_HAVE_OPUS_PROJECTION_H
final Object request[] = new Object[1];// java helper
final int ret = st.opeint_encoder_ctl( Jopus_projection.OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN, request );
final int matrix_gain = ((Integer)request[0]).intValue();
if( ret != Jopus_defines.OPUS_OK ) {
return 0;
}
if( ! p.write_uint16( (short)(this.gain + matrix_gain) ) ) {
return 0;
}
// #else
// return 0;
// #endif
}
else
{
if( ! p.write_uint16( (short)this.gain ) ) {
return 0;
}
}
if( ! p.write_chars( (byte)this.channel_mapping ) ) {
return 0;
}
if( this.channel_mapping != 0 )
{
if( ! p.write_chars( (byte)this.nb_streams ) ) {
return 0;
}
if( ! p.write_chars( (byte)this.nb_coupled ) ) {
return 0;
}
/* Multi-stream support */
if( JOpusGenericEncoder.opeint_use_projection( this.channel_mapping ) )
{
if( ! p.write_matrix_chars( st ) ) {
return 0;
}
}
else
{
final char[] map = this.stream_map;
for( int i = 0, ie = this.channels; i < ie; i++ )
{
if( ! p.write_chars( (byte)map[i] ) ) {
return 0;
}
}
}
}
return p.pos;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.