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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c25063b5bd4ec96181a11c3da8d69e2b1033ed4 | 7ec043d7866d61cae3ae96d5a5a7aae7e9192e9e | /Sanity's Eclipse/src/controllers/SeekNShoot.java | e7bb012f05bcaeca1ca0cd7ad957cf5729b5c89e | [] | no_license | vs-slavchev/Small_projects | bd847fe82e5086b616bc3bf0e4c24666331e636e | 98a0df0820c3814ab4b580161b34762a5723d77d | refs/heads/master | 2022-08-11T14:44:43.545656 | 2022-07-24T13:10:43 | 2022-07-24T13:10:43 | 43,750,905 | 1 | 1 | null | 2020-04-30T06:33:27 | 2015-10-06T13:02:15 | C++ | UTF-8 | Java | false | false | 1,578 | java | package controllers;
import utilities.Vector2D;
import entities.AlienShip;
import game.Action;
import game.Game;
/* defines the basic alien ship logic: seek the player, aim and shoot,
* while keeping some safe distance */
public class SeekNShoot implements Controller {
Action action = new Action();
private int timer;
@Override
public Action action() {
return this.action;
}
public void update(AlienShip alien) {
double playerShipRelativeX = Game.getShip().getX() - alien.getX();
double playerShipRelativeY = Game.getShip().getY() - alien.getY();
double distance = Game.calculateDistance(playerShipRelativeX,
playerShipRelativeY);
double angleAlienDirection = alien.getD().theta();
Vector2D toShip = new Vector2D(playerShipRelativeX, playerShipRelativeY);
toShip.rotate(-angleAlienDirection);
double angleToTarget = toShip.theta();
tickTimer(angleToTarget);
if (3.1 <= Math.abs(angleToTarget) && distance > 500) {
this.action.thrust = -1;
}
if (distance > 200 && distance < 500) {
this.action.thrust = 0;
}
if (distance < 200) {
this.action.thrust = 1;
}
if (2.5 <= Math.abs(angleToTarget) && distance < 500) {
if (this.timer > 0) {
this.action.shoot = false;
this.timer--;
} else {
this.action.shoot = true;
this.timer = 20;
}
}
}
private void tickTimer(double angleToTarget) {
this.action.turn = 0;
if (angleToTarget > 0)
this.action.turn = -1;
else if (angleToTarget < 0) {
this.action.turn = 1;
}
}
} | [
"vs_slavchev2@abv.bg"
] | vs_slavchev2@abv.bg |
6606a523d7ad9868a5a1eca9d23fb7039b41e2b7 | d84119d07cbed0f93701d32b811039d2afc25889 | /Spring/SpringTraingJava2/src/com/chethana/training/salesmanager/config/ApplicationConfiguration.java | 88ef6b8da11bd22f0aa17e1e6a5d7be63aac0c1f | [] | no_license | chethanaj/Java-Training- | 05ddaec1aaf3e3cb73e35151e41932dd862c6b85 | 6b0b5731443e9ed36877a9f6fd273579214086c8 | refs/heads/master | 2020-12-04T03:59:27.215198 | 2020-02-27T18:07:27 | 2020-02-27T18:07:27 | 231,601,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package com.chethana.training.salesmanager.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.chethana.training.salesmanager.repository.EmployeeRepository;
import com.chethana.training.salesmanager.repository.HibernateEmployeeRepositoryImpl;
import com.chethana.training.salesmanager.service.EmployeeService;
import com.chethana.training.salesmanager.service.EmployeeServiceImpl;
@Configuration
public class ApplicationConfiguration {
@Bean(name="employeeService")
public EmployeeService getEmployeeService() {
EmployeeServiceImpl employeeService=new EmployeeServiceImpl(getEmployeeRepository());
//employeeService.setEmployeeRepository(getEmployeeRepository());
return employeeService;
}
@Bean(name="employeeRepository")
public EmployeeRepository getEmployeeRepository() {
return new HibernateEmployeeRepositoryImpl(); }
}
| [
"chethanad.jayarathne@gmail.com"
] | chethanad.jayarathne@gmail.com |
223e347f74503e6f2cd6c501a0ecd35378779850 | 0da7a397d3cfe2beb1fa5fc871a4d6865525d8c6 | /ChickenInvaders/src/com/example/chickeninvaders/Menu.java | 86eab44c9eeccb8e0f06ceb262c3df4639f8d092 | [] | no_license | azmy92/chicken-invaders | c9c2d6785224cac6d972ee53fd123a8c4475b433 | 57d548970346a277f56e44d77123d0c9e55fa771 | refs/heads/master | 2021-01-10T21:24:17.747019 | 2014-01-12T15:51:59 | 2014-01-12T15:51:59 | 15,637,543 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,832 | java | package com.example.chickeninvaders;
import com.example.finalchicken.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
public class Menu extends Activity implements OnClickListener {
public static Activity view;
public static final String networkName = "chicken@osa";
public static final String networkPass = "a1b2c3d45";
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
view = this;
// to set it full screen and turn of title
requestWindowFeature(Window.FEATURE_NO_TITLE);
// for full screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
findViewById(R.id.start).setOnClickListener(this);
findViewById(R.id.create).setOnClickListener(this);
findViewById(R.id.join).setOnClickListener(this);
findViewById(R.id.exit).setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.start:
finish();
Intent t = new Intent(view, MainActivity.class);
t.putExtra("case", "start");
startActivity(t);
break;
case R.id.create:
finish();
Intent rt = new Intent(view, MainActivity.class);
rt.putExtra("case", "server");
startActivity(rt);
break;
case R.id.join:
finish();
Intent tt = new Intent(view, MainActivity.class);
tt.putExtra("case", "join");
startActivity(tt);
break;
case R.id.exit:
finish();
onDestroy();
break;
}
}
}
| [
"eng.osama12@gmail.com"
] | eng.osama12@gmail.com |
a9658962a294dcb8126330eb9d125a7aa2e729b2 | c38ccaa6c6b3810e55380943d31e72a444a33553 | /src/test/java/com/creditcard/creditcards/service/TransactionServiceTest.java | 5c0c9118269b3b95289128ad359978cdeba1894f | [] | no_license | nivetha-r/micro-credit-cards | 55afb75b36801c50fef6ac8a3fe7ec7520a17ff6 | e57d840d88f49ad495d79bcc094bfe9f7a96ef4c | refs/heads/master | 2020-11-28T03:27:54.043172 | 2019-12-24T07:10:37 | 2019-12-24T07:10:37 | 229,693,180 | 0 | 0 | null | 2019-12-23T06:45:02 | 2019-12-23T06:45:01 | null | UTF-8 | Java | false | false | 1,634 | java | package com.creditcard.creditcards.service;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import com.creditcard.creditcards.dto.TransactionRequestDto;
import com.creditcard.creditcards.entity.CreditCard;
import com.creditcard.creditcards.entity.Transaction;
import com.creditcard.creditcards.exception.TransactionNotFoundException;
import com.creditcard.creditcards.repository.TransactionRepository;
@RunWith(MockitoJUnitRunner.Silent.class)
public class TransactionServiceTest {
@InjectMocks
TransactionServiceImpl transactionService;
@Mock
TransactionRepository transactionRepository;
@Test
public void testMonthlyTransactions() throws TransactionNotFoundException {
TransactionRequestDto transactionRequestDto = new TransactionRequestDto();
transactionRequestDto.setUserId(1L);
transactionRequestDto.setMonth("01");
transactionRequestDto.setYear(2019);
CreditCard creditCard=new CreditCard();
creditCard.setCardId(2L);
List<Transaction> transactions = new ArrayList<>();
Mockito.when(transactionRepository.findAllByCreditCardCardIdAndDateBetween
(Mockito.any() , Mockito.any(),Mockito.any())).thenReturn(transactions);
Transaction transaction = new Transaction();
transaction.setAmount(20000.00);
transaction.setCreditCard(creditCard);
transaction.setDescription("purchase");
transaction.setStatus("success");
transaction.setTransactionId(1L);
transactions.add(transaction);
}
}
| [
"rnivetha197@gmail.com"
] | rnivetha197@gmail.com |
5da362aaab9d6490e2428bc73cfbb7c461fffab1 | dc6f01e799283188b02e85bed3385b51f92b7231 | /src/main/java/com/xianghuan/auth/base/service/IBparameterConfService.java | f638004e5effb2c3e9532b4c8eb74dc43f7f4fc6 | [] | no_license | pengzg/xianghuan | 17d28eba097f2a8ccde58cdddc1cc9170ed87c06 | a16c114ff0bc6b76e13ace7cd436bc29625da7b6 | refs/heads/master | 2022-12-20T20:12:56.679668 | 2019-06-29T11:49:43 | 2019-06-29T11:49:43 | 141,511,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,714 | java | /*
* Powered By [rapid-framework]
* Web Site: http://www.rapid-framework.org.cn
* Google Code: http://code.google.com/p/rapid-framework/
* Since 2008 - 2014
*/
package com.xianghuan.auth.base.service;
import java.util.List;
import java.util.Map;
import org.xianghuan.web.model.DataGrid;
import org.xianghuan.web.model.Query;
import com.xianghuan.auth.base.model.BparameterConf;
public interface IBparameterConfService {
/**
* 查询列表信息
*
* @param queryParams
* @return list
*/
public List<BparameterConf> select(Map queryParams);
/**
* 分页查询
*
* @param query
* @return
*/
public DataGrid dataGrid(Query query);
/**
* 插入单条记录,用id作主键,把null全替换为""
*
* @param vo
* 用于添加的VO对象
* @return 若添加成功,返回新生成的id
*/
public String insert(BparameterConf vo);
/**
* 批更新插入多条记录,用id作主键,把null全替换为""
*
* @param vos
* 添加的VO对象数组
* @return 若添加成功,返回新生成的id数组
*/
public String[] insertBatch(BparameterConf[] vos);
/**
* 物理删除单条记录
*
* @param id
* 用于删除的记录的id
* @return 成功删除的记录数
*/
public int delete(String id);
/**
* 物理删除多条记录
*
* @param id
* 用于删除的记录的id
* @return 成功删除的记录数
*/
public int deleteBatch(String[] ids);
/**
* 逻辑删除单条记录
*
* @param id
* 用于删除的记录的id
* @return 成功删除的记录数
*/
public int remove(Map params);
/**
* 逻辑删除多条记录
*
* @param id
* 用于删除的记录的id
* @return 成功删除的记录数
*/
public int removeBatch(Map params);
/**
* 根据Id进行查询
*
* @param id
* 用于查找的id
* @return 查询到的VO对象
*/
public BparameterConf find(String id);
/**
* 根据key_code进行查询
*
* @param id
* 用于查找的id
* @return 查询到的VO对象
*/
public BparameterConf findByKeyCode(String key_code);
/**
* 更新单条记录
*
* @param vo
* 用于更新的VO对象
* @return 成功更新的记录数
*/
public int update(BparameterConf vo);
/**
* 更新单条记录
*
* @param vo
* 用于更新的VO对象
* @return 成功更新的记录数
*/
public int updateSelect(BparameterConf vo);
/**
* 批量更新修改多条记录
*
* @param vos
* 添加的VO对象数组
* @return 成功更新的记录数组
*/
public int updateBatch(BparameterConf[] vos);
}
| [
"pengzongge@PengZonggedeMacBook-Pro-2.local"
] | pengzongge@PengZonggedeMacBook-Pro-2.local |
ce4c9b9a8130f8bbfebb85b507b467e0e76cbcfa | af79e532a5f23d19c9e8ee889c8c3b2c6fa1fc46 | /src/main/java/org/lunatics/Main.java | daf79e1793e7a4f6e7210c90f091c7c75bf9cc3c | [] | no_license | CryptoSingh1337/todolist-maven | b401931f221d13b407fb9c46d0e69cb9b2f07d87 | 6dcf2d9fb62b9536bd40f2b6c3a44fa1b387d478 | refs/heads/master | 2023-04-18T13:34:51.404096 | 2021-04-29T10:48:12 | 2021-04-29T10:48:12 | 351,736,438 | 1 | 1 | null | 2021-03-26T15:22:48 | 2021-03-26T09:59:53 | Java | UTF-8 | Java | false | false | 174 | java | package org.lunatics;
/**
* Created by CryptoSingh1337 on 26-03-2021
*/
public class Main {
public static void main(String[] args) {
App.main(args);
}
}
| [
"cryptosingh@gmail.com"
] | cryptosingh@gmail.com |
9ca0e6970026e56f9e241518325ee23baf006d33 | 519be6e55eafde0cc5e3ff83d36e1e34300707fe | /app/src/main/java/com/saner/ui/photo/SelectedAdapter.java | 891731d382d6bb8af87ba71099af1ff0817faedd | [] | no_license | Sanerly/Saner | 61e38bf6f7057354ea6b341c75c212085b840ae1 | 39f7dcfcd6b55a13edcbccf88a6d31cc11ce578c | refs/heads/master | 2021-09-15T21:29:00.692775 | 2018-06-11T07:04:52 | 2018-06-11T07:04:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,021 | java | package com.saner.ui.photo;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.saner.R;
import com.saner.util.SelPhotoUtil;
import java.util.List;
/**
* Created by sunset on 2018/3/21.
*/
public class SelectedAdapter extends RecyclerView.Adapter<SelectedAdapter.ViewHolder> {
private List<PhotoModel> mDatas;
private int mColumns;
private OnItemClickListener listener;
public SelectedAdapter(List<PhotoModel> mDatas, int columns) {
this.mDatas = mDatas;
this.mColumns = columns;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_photo_selected, null);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final PhotoModel data = mDatas.get(position);
SelPhotoUtil.showImageLayoutMeasure(holder.mImage, mColumns);
SelPhotoUtil.load(holder.mImage, data.getUrl());
setImageRes(data.isSelected(), holder.mCheckBox);
setDisplay(data.isMulti(),holder.mCheckBox);
if (data.isSelected()) {
holder.mImage.setAlpha(0.5f);
} else {
holder.mImage.setAlpha(1.0f);
}
holder.mCheckBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onSelected(data, position);
}
});
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onShowPhoto(data, position);
}
});
}
/**
*设置选中和未选中使用的图片
*/
private void setImageRes(boolean isShow, ImageView view) {
int resId = isShow ? R.mipmap.ic_checked : R.mipmap.ic_uncheck;
view.setImageResource(resId);
}
/**
*设置多选时显示选择框,单选时隐藏
*/
private void setDisplay(boolean isMulti, ImageView view) {
int vis = isMulti ? View.VISIBLE : View.GONE ;
view.setVisibility(vis);
}
@Override
public int getItemCount() {
return mDatas.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
ImageView mImage;
ImageView mCheckBox;
ViewHolder(View itemView) {
super(itemView);
mImage = itemView.findViewById(R.id.item_image);
mCheckBox = itemView.findViewById(R.id.item_check);
}
}
void setOnItemClickListener(OnItemClickListener onItemLongClickListener) {
this.listener = onItemLongClickListener;
}
interface OnItemClickListener {
void onSelected(PhotoModel data, int pos);
void onShowPhoto(PhotoModel data, int pos);
}
}
| [
"sunset3296@163.com"
] | sunset3296@163.com |
c138c97f1e137a3b309bff7063009671a83539b5 | 346bf7d817f60048580e6842112c2faa7e3616e7 | /app/src/main/java/com/example/vinay/sms/Adapter/SentTabAdapter.java | e76dbe26227bf084548e97389d3f301136be001a | [] | no_license | chandakvishal/SmartSMS | 09239a74cd3bbaf437c5a6a69a5647924e917488 | 32d9bc0619e59fe50843417567626cee3ac09b8c | refs/heads/master | 2021-01-20T22:29:11.762369 | 2016-10-21T11:20:04 | 2016-10-21T11:20:04 | 64,705,390 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,955 | java | package com.example.vinay.sms.Adapter;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.net.Uri;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.vinay.sms.MainActivity;
import com.example.vinay.sms.Messaging.SMS;
import com.example.vinay.sms.R;
import com.example.vinay.sms.Utilities.DatabaseHandler;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class SentTabAdapter extends RecyclerView.Adapter<SentTabAdapter.MyViewHolder> implements MessagingAdapter {
private String TAG = SmsAdapter.class.getSimpleName();
private List<SMS> smsList;
private Context ctx;
DatabaseHandler db;
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
private List<SMS> smsListToDelete = new ArrayList<>();
public SentTabAdapter(Activity activity, List<SMS> smsList) {
this.smsList = smsList;
ctx = activity.getApplicationContext();
db = new DatabaseHandler(ctx);
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.sms_display_row, parent, false);
return new MyViewHolder(itemView);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
String email = String.valueOf(smsList.get(position).senderAddress);
holder.email.setText(email);
final TypedArray imgs = ctx.getResources().obtainTypedArray(R.array.userArray);
final Random rand = new Random();
final int rndInt = rand.nextInt(imgs.length());
final int resID = imgs.getResourceId(rndInt, 0);
holder.image.setImageResource(resID);
}
@Override
public int getItemCount() {
return smsList.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
public TextView email;
public ImageView image;
public MyViewHolder(View view) {
super(view);
image = (ImageView) view.findViewById(R.id.userImageAnswer);
email = (TextView) view.findViewById(R.id.emailAnswer);
}
}
@Override
public void onItemRemove(final RecyclerView.ViewHolder viewHolder, final RecyclerView recyclerView) {
final int adapterPosition = viewHolder.getAdapterPosition();
Log.d(TAG, "onItemRemove: " + adapterPosition);
final SMS sms = smsList.get(adapterPosition);
CoordinatorLayout coordinatorLayout = MainActivity.getCoordinateLayout();
Snackbar snackbar = Snackbar
.make(coordinatorLayout, "Message Deleted", Snackbar.LENGTH_LONG)
.setAction("UNDO", new View.OnClickListener() {
@Override
public void onClick(View view) {
smsList.add(adapterPosition, sms);
notifyItemInserted(adapterPosition);
recyclerView.scrollToPosition(adapterPosition);
smsListToDelete.remove(sms);
}
});
snackbar.show();
List<SMS> list = new ArrayList<>();
list.add(sms);
db.deleteSingleMessage(list, "_SENT");
smsList.remove(adapterPosition);
notifyItemRemoved(adapterPosition);
smsListToDelete.add(sms);
}
public void deleteSMS(Context context, String message, String number) {
try {
Log.d(TAG, "deleteSMS: Deleting SMS from sent");
Uri uriSms = Uri.parse("content://sms/sent");
Cursor c = context.getContentResolver().query(uriSms,
new String[]{"_id", "thread_id", "address",
"person", "date", "body"}, null, null, null);
if (c != null && c.moveToFirst()) {
do {
long id = c.getLong(0);
long threadId = c.getLong(1);
String address = c.getString(2);
String body = c.getString(5);
if (message.equals(body) && address.equals(number)) {
Log.d(TAG, "deleteSMS: Deleting SMS with id: " + threadId);
context.getContentResolver().delete(
Uri.parse("content://sms/" + id), null, null);
}
} while (c.moveToNext());
}
} catch (Exception e) {
Log.d(TAG, "deleteSMS: Could not delete SMS from sent: " + e.getMessage());
}
}
} | [
"vishalchandak0212@gmail.com"
] | vishalchandak0212@gmail.com |
3752889568c2db537ec6b3cdfa655b3316dea93b | 463e7796fe3474607a572d7bf6a600c4181589e8 | /bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java | 742d3fb0f1ffa3da839577baf2a7d08b5a1a3044 | [
"Apache-2.0"
] | permissive | balazs-zsoldos/felix | ac85ba0469ff921314f3d53dd2346f2ea6e8c885 | a422addfd3d53db78ed064001aa45ff25c63d8fa | refs/heads/trunk | 2021-01-17T14:17:02.039893 | 2015-04-22T22:40:53 | 2015-04-22T22:40:53 | 34,159,539 | 0 | 0 | null | 2015-04-18T09:07:12 | 2015-04-18T09:07:12 | null | UTF-8 | Java | false | false | 11,542 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.felix.bundleplugin.baseline;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.util.IOUtil;
import aQute.bnd.version.Version;
/**
* BND Baseline report.
*
* @since 2.4.1
*/
@Mojo( name = "baseline-report", threadSafe = true )
@Execute( phase = LifecyclePhase.SITE )
public final class BaselineReport
extends AbstractBaselinePlugin
implements MavenReport
{
/**
* Specifies the directory where the report will be generated.
*/
@Parameter(defaultValue = "${project.reporting.outputDirectory}")
private File outputDirectory;
private static final class Context {
public Sink sink;
public Locale locale;
public int currentDepth = 0;
}
// AbstractBaselinePlugin events
@Override
protected Object init(final Object context)
{
failOnError = false;
failOnWarning = false;
final File baselineImagesDirectory = new File( outputDirectory, "images/baseline" );
baselineImagesDirectory.mkdirs();
for ( String resourceName : new String[]{ "access.gif",
"annotated.gif",
"annotation.gif",
"bundle.gif",
"class.gif",
"constant.gif",
"enum.gif",
"error.gif",
"extends.gif",
"field.gif",
"implements.gif",
"info.gif",
"interface.gif",
"method.gif",
"package.gif",
"resource.gif",
"return.gif",
"version.gif",
"warning.gif" } )
{
InputStream source = getClass().getResourceAsStream( resourceName );
OutputStream target = null;
File targetFile = new File( baselineImagesDirectory, resourceName );
try
{
target = new FileOutputStream( targetFile );
IOUtil.copy( source, target );
}
catch ( IOException e )
{
getLog().warn( "Impossible to copy " + resourceName + " image, maybe the site won't be properly rendered." );
}
finally
{
IOUtil.close( source );
IOUtil.close( target );
}
}
return context;
}
@Override
protected void close(final Object context)
{
// nothing to do
}
@Override
protected void startBaseline( final Object context, String generationDate, String bundleName,
String currentVersion, String previousVersion )
{
final Context ctx = (Context)context;
final Sink sink = ctx.sink;
sink.head();
sink.title();
String title = getBundle( ctx.locale ).getString( "report.baseline.title" );
sink.text( title );
sink.title_();
sink.head_();
sink.body();
sink.section1();
sink.sectionTitle1();
sink.text( title );
sink.sectionTitle1_();
sink.paragraph();
sink.text( getBundle( ctx.locale ).getString( "report.baseline.bndlink" ) + " " );
sink.link( "http://www.aqute.biz/Bnd/Bnd" );
sink.text( "Bnd" );
sink.link_();
sink.text( "." );
sink.paragraph_();
sink.paragraph();
sink.text( getBundle( ctx.locale ).getString( "report.baseline.bundle" ) + " " );
sink.figure();
sink.figureGraphics( "images/baseline/bundle.gif" );
sink.figure_();
sink.text( " " );
sink.bold();
sink.text( bundleName );
sink.bold_();
sink.listItem_();
sink.paragraph();
sink.text( getBundle( ctx.locale ).getString( "report.baseline.version.current" ) + " " );
sink.bold();
sink.text( currentVersion );
sink.bold_();
sink.paragraph_();
sink.paragraph();
sink.text( getBundle( ctx.locale ).getString( "report.baseline.version.comparison" ) + " " );
sink.bold();
sink.text( comparisonVersion );
sink.bold_();
sink.paragraph_();
sink.paragraph();
sink.text( getBundle( ctx.locale ).getString( "report.baseline.generationdate" ) + " " );
sink.bold();
sink.text( generationDate );
sink.bold_();
sink.paragraph_();
sink.section1_();
}
@Override
protected void startPackage( final Object context,
boolean mismatch,
String packageName,
String shortDelta,
String delta,
Version newerVersion,
Version olderVersion,
Version suggestedVersion,
DiffMessage diffMessage,
Map<String,String> attributes )
{
final Context ctx = (Context)context;
final Sink sink = ctx.sink;
sink.list();
sink.listItem();
sink.figure();
sink.figureGraphics( "./images/baseline/package.gif" );
sink.figure_();
sink.text( " " );
sink.monospaced();
sink.text( packageName );
sink.monospaced_();
if ( diffMessage != null )
{
sink.text( " " );
sink.figure();
sink.figureGraphics( "./images/baseline/" + diffMessage.getType().name() + ".gif" );
sink.figure_();
sink.text( " " );
sink.italic();
sink.text( diffMessage.getMessage() );
sink.italic_();
sink.text( " (newer version: " );
sink.monospaced();
sink.text( newerVersion.toString() );
sink.monospaced_();
sink.text( ", older version: " );
sink.monospaced();
sink.text( olderVersion.toString() );
if ( suggestedVersion != null )
{
sink.monospaced_();
sink.text( ", suggested version: " );
sink.monospaced();
sink.text( suggestedVersion.toString() );
}
sink.monospaced_();
sink.text( ")" );
}
}
@Override
protected void startDiff( final Object context,
int depth,
String type,
String name,
String delta,
String shortDelta )
{
final Context ctx = (Context)context;
final Sink sink = ctx.sink;
if ( ctx.currentDepth < depth )
{
sink.list();
}
ctx.currentDepth = depth;
sink.listItem();
sink.figure();
sink.figureGraphics( "images/baseline/" + type + ".gif" );
sink.figure_();
sink.text( " " );
sink.monospaced();
sink.text( name );
sink.monospaced_();
sink.text( " " );
sink.italic();
sink.text( delta );
sink.italic_();
}
@Override
protected void endDiff( final Object context, int depth )
{
final Context ctx = (Context)context;
final Sink sink = ctx.sink;
sink.listItem_();
if ( ctx.currentDepth > depth )
{
sink.list_();
}
ctx.currentDepth = depth;
}
@Override
protected void endPackage(final Object context)
{
final Context ctx = (Context)context;
final Sink sink = ctx.sink;
if ( ctx.currentDepth > 0 )
{
sink.list_();
ctx.currentDepth = 0;
}
sink.listItem_();
sink.list_();
}
@Override
protected void endBaseline(final Object context)
{
final Context ctx = (Context)context;
ctx.sink.body_();
ctx.sink.flush();
ctx.sink.close();
}
// MavenReport methods
public boolean canGenerateReport()
{
return !skip && outputDirectory != null;
}
public void generate( @SuppressWarnings( "deprecation" ) org.codehaus.doxia.sink.Sink sink, Locale locale )
throws MavenReportException
{
final Context ctx = new Context();
ctx.sink = sink;
ctx.locale = locale;
try
{
execute(ctx);
}
catch ( Exception e )
{
getLog().warn( "An error occurred while producing the report page, see nested exceptions", e );
}
}
public String getCategoryName()
{
return MavenReport.CATEGORY_PROJECT_REPORTS;
}
public String getDescription( Locale locale )
{
return getBundle( locale ).getString( "report.baseline.description" );
}
public String getName( Locale locale )
{
return getBundle( locale ).getString( "report.baseline.name" );
}
private ResourceBundle getBundle( Locale locale )
{
return ResourceBundle.getBundle( "baseline-report", locale, getClass().getClassLoader() );
}
public String getOutputName()
{
return "baseline-report";
}
public File getReportOutputDirectory()
{
return outputDirectory;
}
public boolean isExternalReport()
{
return false;
}
public void setReportOutputDirectory( File outputDirectory )
{
this.outputDirectory = outputDirectory;
}
}
| [
"cziegeler@apache.org"
] | cziegeler@apache.org |
e7fcaacde9e61e02230b4ebe23cbfe19cfcb0e3b | 13b62c91adc679f368aeeac191fd9303f30b2878 | /recyclerviewtest/src/main/java/com/atsgg/recyclerviewtest/adapterholder/RandomStaggeredRecyclerAdapter.java | 65679dafe21af63a3a40e1fc81eae973366a34bf | [] | no_license | MrbigW/MaterialDesign | f8de84680d21e850ad54eb5ebdb4e7145357f836 | cdaaeb3d1a9f08e247323bd9ae091565323e35e9 | refs/heads/master | 2021-01-18T19:14:30.281441 | 2016-10-26T15:35:39 | 2016-10-26T15:35:39 | 72,017,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,845 | java | package com.atsgg.recyclerviewtest.adapterholder;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.atsgg.recyclerviewtest.R;
import com.atsgg.recyclerviewtest.data.DemoApp;
import com.atsgg.recyclerviewtest.data.SampleModel;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by HP on 2016/8/25.
*/
public class RandomStaggeredRecyclerAdapter extends RecyclerView.Adapter<RecyclerViewHolder> {
private List<Integer> mHeights;
public interface OnItemClickListener {
void onItemClick(View view, int position);
void onItemLongClick(View view, int position);
}
private OnItemClickListener mOnItemClickListener;
public void setOnItemClickListener(OnItemClickListener mOnItemClickListener) {
this.mOnItemClickListener = mOnItemClickListener;
}
private final ArrayList<SampleModel> sampleData = DemoApp.getSampleDate(50);
public RandomStaggeredRecyclerAdapter()
{
mHeights = new ArrayList<Integer>();
for (int i = 0; i < sampleData.size(); i++)
{
mHeights.add( (int) (100 + Math.random() * 300));
}
}
// 用于创建控件
@Override
public RecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//获得列表项控件(LinearLayout)
//item_layout.xml布局文件中只包含一个<LinearLayout>标签,在该标签中包含了一个<TextView>标签
View item = LayoutInflater.from(parent.getContext()).inflate(R.layout.random_item_layout, parent, false);
return new RecyclerViewHolder(item);
}
// 把数据绑定到控件中
@Override
public void onBindViewHolder(final RecyclerViewHolder holder, int position) {
// 获取当前item中显示的数据
final SampleModel rowData = sampleData.get(position);
//设置view的高度(只要在)
ViewGroup.LayoutParams lp = holder.getTextViewSample().getLayoutParams();
lp.height = mHeights.get(position);
holder.getTextViewSample().setLayoutParams(lp);
// 设置要显示的数据
holder.getTextViewSample().setText(rowData.getSampleText());
// 如果设置了回调,则设置点击事件
if (mOnItemClickListener != null) {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = holder.getLayoutPosition();
mOnItemClickListener.onItemClick(holder.itemView, pos);
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int pos = holder.getLayoutPosition();
mOnItemClickListener.onItemLongClick(holder.itemView, pos);
removeData(pos);
return true;
}
});
}
}
@Override
public int getItemCount() {
return sampleData.size();
}
// 删除指定的Item
public void removeData(int position) {
sampleData.remove(position);
// 通知RecycleView控件某个Item被删除了
notifyItemRemoved(position);
}
// 在指定位置添加一个新的Item
public void addItem(int positionToadd) {
sampleData.add(positionToadd, new SampleModel("new" + new Random().nextInt(1000)));
mHeights.add( (int) (100 + Math.random() * 300));
// 通知RecycleView控件增加了某个Item
notifyItemInserted(positionToadd);
}
}
| [
"1024057635@qq.com"
] | 1024057635@qq.com |
fbeb039e48e7c774fca8617979bfe005f61030ad | a6b2958917acf8038de24b06dd26dadda4ff716a | /src/gui/SellerFormController.java | c37bdee7865a1549ff2d54e2951717a61528bfbc | [] | no_license | Mclares/workshop-javafx-jdbc | 0fcda3fe92faab6fc9f748a20f50b82715376f7b | 2156a6afd4d51c9388159e9d275aba2ded981e35 | refs/heads/master | 2022-10-23T18:59:43.534835 | 2020-06-18T03:24:19 | 2020-06-18T03:24:19 | 272,264,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,426 | java | package gui;
import java.net.URL;
import java.time.Instant;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import db.DbException;
import gui.listeners.DataChangeListener;
import gui.util.Alerts;
import gui.util.Constraints;
import gui.util.Utils;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.util.Callback;
import model.entities.Department;
import model.entities.Seller;
import model.exceptions.ValidationException;
import model.services.DepartmentService;
import model.services.SellerService;
public class SellerFormController implements Initializable {
private Seller entity;
private SellerService service;
private DepartmentService departmentService;
private List<DataChangeListener> dataChangeListeners = new ArrayList<>();
@FXML
private TextField txtId;
@FXML
private TextField txtName;
@FXML
private TextField txtEmail;
@FXML
private DatePicker dpBirthDate;
@FXML
private TextField txtBaseSalary;
@FXML
private ComboBox<Department> comboBoxDepartment;
@FXML
private Label labelErrorName;
@FXML
private Label labelErrorEmail;
@FXML
private Label labelErrorBirthDate;
@FXML
private Label labelErrorBaseSalary;
@FXML
private Button btSave;
@FXML
private Button btCancel;
private ObservableList<Department> obsList;
public void setSeller(Seller entity) {
this.entity = entity;
}
public void setServices(SellerService service, DepartmentService departmentService) {
this.service = service;
this.departmentService = departmentService;
}
public void subscribeDataChangeListener(DataChangeListener listener) {
dataChangeListeners.add(listener);
}
@FXML
public void onBtSaveAction(ActionEvent event) {
if (entity == null) {
throw new IllegalStateException("Entity was null!");
}
if (service == null) {
throw new IllegalStateException("Service was null!");
}
try {
entity = getFormData();
service.saveOrUpdate(entity);
notifyDataChangeListeners();
Utils.currentStage(event).close();
} catch (ValidationException e) {
setErrorMessages(e.getErrors());
} catch (DbException e) {
Alerts.showAlert("Error saving object", null, e.getMessage(), AlertType.ERROR);
}
}
private void notifyDataChangeListeners() {
for (DataChangeListener listener : dataChangeListeners) {
listener.onDataChanged();
}
}
private Seller getFormData() {
Seller obj = new Seller();
ValidationException exception = new ValidationException("Validation error");
obj.setId(Utils.tryParseToInt(txtId.getText()));
if (txtName.getText() == null || txtName.getText().trim().equals("")) {
exception.addError("name", "Field can't be empty!");
}
obj.setName(txtName.getText());
if (txtEmail.getText() == null || txtEmail.getText().trim().equals("")) {
exception.addError("email", "Field can't be empty!");
}
obj.setEmail(txtEmail.getText());
if (dpBirthDate.getValue() == null) {
exception.addError("birthDate", "Field can't be empty!");
}
else {
Instant instant = Instant.from(dpBirthDate.getValue().atStartOfDay(ZoneId.systemDefault()));
obj.setBirthDate(Date.from(instant));
}
if (txtBaseSalary.getText() == null || txtBaseSalary.getText().trim().equals("")) {
exception.addError("baseSalary", "Field can't be empty!");
}
obj.setBaseSalary(Utils.tryParseToDouble(txtBaseSalary.getText()));
obj.setDepartment(comboBoxDepartment.getValue());
if (exception.getErrors().size() > 0) {
throw exception;
}
return obj;
}
@FXML
public void onBtCancelAction(ActionEvent event) {
Utils.currentStage(event).close();
}
@Override
public void initialize(URL url, ResourceBundle rb) {
initializeNodes();
}
private void initializeNodes() {
Constraints.setTextFieldInteger(txtId);
Constraints.setTextFieldMaxLength(txtName, 70);
Constraints.setTextFieldDouble(txtBaseSalary);
Constraints.setTextFieldMaxLength(txtEmail, 60);
Utils.formatDatePicker(dpBirthDate, "dd/MM/yyyy");
initializeComboBoxDepartment();
}
public void updateFormData() {
if (entity == null) {
throw new IllegalStateException("Entity was null");
}
txtId.setText(String.valueOf(entity.getId()));
txtName.setText(entity.getName());
txtEmail.setText(entity.getEmail());
Locale.setDefault(Locale.US);
txtBaseSalary.setText(String.format("%.2f", entity.getBaseSalary()));
if (entity.getBirthDate() != null) {
dpBirthDate.setValue(entity.getBirthDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
}
if (entity.getDepartment() == null) {
comboBoxDepartment.getSelectionModel().selectFirst();
}
else {
comboBoxDepartment.setValue(entity.getDepartment());
}
}
public void loadAssociatedObjects() {
if (departmentService == null) {
throw new IllegalStateException("DepartmentService was null");
}
List<Department> list = departmentService.findAll();
obsList = FXCollections.observableArrayList(list);
comboBoxDepartment.setItems(obsList);
}
private void setErrorMessages(Map<String, String> errors) {
Set<String> fields = errors.keySet();
labelErrorName.setText(fields.contains("name") ? errors.get("name") : (""));
labelErrorEmail.setText(fields.contains("email") ? errors.get("email") : (""));
labelErrorBaseSalary.setText(fields.contains("baseSalary") ? errors.get("baseSalary") : (""));
labelErrorBirthDate.setText(fields.contains("birthDate") ? errors.get("birthDate") : (""));
}
private void initializeComboBoxDepartment() {
Callback<ListView<Department>, ListCell<Department>> factory = lv -> new ListCell<Department>() {
@Override
protected void updateItem(Department item, boolean empty) {
super.updateItem(item, empty);
setText(empty ? "" : item.getName());
}
};
comboBoxDepartment.setCellFactory(factory);
comboBoxDepartment.setButtonCell(factory.call(null));
}
}
| [
"msc.09.wylde@gmail.com"
] | msc.09.wylde@gmail.com |
18487d92fa9af1c1966ea251537a449acf9fcd39 | 3a676f1ce8c8cb33ff30008126b97fe9adb1cb49 | /src/main/java/com/common/MyResource.java | 759d18083a385413f457479bfd484403760eee1f | [] | no_license | HuangZhiAn/common-service | 9d4f312fd1919ae16d186f6d45f2f633ecb459fc | d8cf21009ccf60079de6f9d69f43decee147e29a | refs/heads/master | 2021-01-01T15:42:24.974921 | 2017-07-19T09:05:10 | 2017-07-19T09:05:10 | 97,678,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package com.common;
import com.service.InitData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Root resource (exposed at "myresource" path)
*/
@Path("myresource")
public class MyResource {
/**
* Method handling HTTP GET requests. The returned object will be sent
* to the client as "text/plain" media type.
*
* @return String that will be returned as a text/plain response.
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public String getIt() {
Date date = new Date();
return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date);
}
}
| [
"zhianhuang@outlook.com"
] | zhianhuang@outlook.com |
3ce3d6107145df062c7d862e085f1741b4f05d63 | f89cbd114efa5dd380075e8424cfd8feac625ebb | /src/java/controller/SearchServlet.java | 635bb51157a43fe0a0500c9def7952a291516fd2 | [] | no_license | ocfranco/HW5redo | ad65847a2292b608fe834a24256c8999233903fd | 5d6e4c8f19a421ca1a9a4a20fd529e4b471c2770 | refs/heads/master | 2021-07-14T16:18:49.939634 | 2017-10-20T17:56:17 | 2017-10-20T17:56:17 | 107,198,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,752 | 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 controller;
import dbhelpers.SearchQuery;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author btfra
*/
@WebServlet(name = "SearchServlet", urlPatterns = {"/search"})
public class SearchServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SearchServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet SearchServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//Get the text to search
String carModel = request.getParameter("searchVal");
//Create a SearchQuery helper object
SearchQuery sq = new SearchQuery();
//Get the HTML table from the SearchQuery object
sq.doSearch(carModel);
String table = sq.getHTMLTable();
//Pass execution control to read.jsp along with the table.
request.setAttribute("table", table);
String url = "/read.jsp";
RequestDispatcher dispatcher = request.getRequestDispatcher(url);
dispatcher.forward(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"orestes-franco@uiowa.edu"
] | orestes-franco@uiowa.edu |
45981f395f0b0b07630d875f3fda3663468100d0 | 30c4047025cdbb4e11adaa983605c1580d1a1221 | /src/main/java/com/yuhang/novel/pirate/model/BooksModel.java | 59e18c1f086211f4d2f89b6dec80cfda40f1c9a5 | [] | no_license | yuhanghate/pirate_web | 4642c240efc17e3f90abb99ab38bd0ff0a0f7b71 | 8519c626ce831b898e97a289e1076bfb194db41e | refs/heads/master | 2022-09-10T06:20:49.987630 | 2021-08-13T02:58:45 | 2021-08-13T02:58:45 | 200,390,031 | 1 | 0 | null | 2022-09-01T23:14:01 | 2019-08-03T15:16:59 | Java | UTF-8 | Java | false | false | 3,993 | java | package com.yuhang.novel.pirate.model;
import java.util.List;
public class BooksModel {
/**
* Id : 462437
* Name : 氪命得分王
* Img : kemingdefenwang.jpg
* Author : 暖舒柳岸
* Desc : 赵乐说他的偶像是“魔术师”,他喜欢传球。可是没有人相信,所有人都说赵乐比科比更毒瘤。
赵乐无奈的很,他不是不喜欢传球,关键是他得分越多活的越久。用50年寿命买来的系统,不翻倍赚回来,那就是血亏。
* CId : 95
* CName : 玄幻奇幻
* LastTime : 10/11/2019 11:53:22 PM
* FirstChapterId : 2347322
* LastChapter : 第二百八十一章 他们响应赵乐了
* LastChapterId : 2546345
* BookStatus : 连载
* SameUserBooks : []
* SameCategoryBooks : [{"Id":457573,"Name":"快穿之总有男神想黑化","Img":"kuaichuanzhizongyounanshenxiangheihua.jpg","Score":0},{"Id":369539,"Name":"风水女术士","Img":"fengshuinvshushi.jpg","Score":0},{"Id":454028,"Name":"婚姻是道算术题","Img":"hunyinshidaosuanshuti.jpg","Score":0},{"Id":459043,"Name":"重生直播系统","Img":"zhongshengzhiboxitong.jpg","Score":0},{"Id":465602,"Name":"一人之力","Img":"yirenzhili.jpg","Score":0},{"Id":469635,"Name":"凤凰乌鸦","Img":"fenghuangwuya.jpg","Score":0},{"Id":446714,"Name":"凶尸实录","Img":"xiongshishilu.jpg","Score":0},{"Id":475972,"Name":"修真轩辕","Img":"xiuzhenxuanyuan.jpg","Score":0},{"Id":451668,"Name":"不一样的一代人","Img":"buyiyangdeyidairen.jpg","Score":0},{"Id":433799,"Name":"快穿系统:矫宠无罪","Img":"kuaichuanxitong:jiaochongwuzui.jpg","Score":0},{"Id":451200,"Name":"斗罗之重生昊天锤","Img":"douluozhizhongshenghaotianchui.jpg","Score":0},{"Id":422941,"Name":"星魂帝主","Img":"xinghundizhu.jpg","Score":0}]
* BookVote : {"BookId":462437,"TotalScore":6,"VoterCount":1,"Score":6}
*/
private int Id;
private String Name;
private String Img;
private String Author;
private String Desc;
private int CId;
private String CName;
private String LastTime;
private int FirstChapterId;
private String LastChapter;
private int LastChapterId;
private String BookStatus;
public int getId() {
return Id;
}
public void setId(int Id) {
this.Id = Id;
}
public String getName() {
return Name;
}
public void setName(String Name) {
this.Name = Name;
}
public String getImg() {
return Img;
}
public void setImg(String Img) {
this.Img = Img;
}
public String getAuthor() {
return Author;
}
public void setAuthor(String Author) {
this.Author = Author;
}
public String getDesc() {
return Desc;
}
public void setDesc(String Desc) {
this.Desc = Desc;
}
public int getCId() {
return CId;
}
public void setCId(int CId) {
this.CId = CId;
}
public String getCName() {
return CName;
}
public void setCName(String CName) {
this.CName = CName;
}
public String getLastTime() {
return LastTime;
}
public void setLastTime(String LastTime) {
this.LastTime = LastTime;
}
public int getFirstChapterId() {
return FirstChapterId;
}
public void setFirstChapterId(int FirstChapterId) {
this.FirstChapterId = FirstChapterId;
}
public String getLastChapter() {
return LastChapter;
}
public void setLastChapter(String LastChapter) {
this.LastChapter = LastChapter;
}
public int getLastChapterId() {
return LastChapterId;
}
public void setLastChapterId(int LastChapterId) {
this.LastChapterId = LastChapterId;
}
public String getBookStatus() {
return BookStatus;
}
public void setBookStatus(String BookStatus) {
this.BookStatus = BookStatus;
}
}
| [
"714610354@qq.com"
] | 714610354@qq.com |
39bd23d182b467fa0e4785ea58d609fac7e0b26f | 0269b3ef12658f1b4cc11e8eed034e6b771a7e47 | /src/main/java/com/example/timetable/GMailSender.java | f71cc4a15dafd988dc20f76c9db0fb9f2b1f1b1b | [] | no_license | YoonHyeJu/Graduation_Project | d6a90194c22f1c7c745a5b7420c1781659d60f20 | 21215fa4d25a7dfc7ac0e23bce13d800aebda694 | refs/heads/master | 2023-06-03T10:25:43.525208 | 2021-06-13T10:08:30 | 2021-06-13T10:08:30 | 289,183,770 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,314 | java | package com.example.timetable;
import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class GMailSender extends javax.mail.Authenticator {
private String mailhost = "smtp.gmail.com";
private String user;
private String password;
private Session session;
private String emailCode;
public GMailSender(String user, String password) {
this.user = user;
this.password = password;
emailCode = createEmailCode();
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");
//구글에서 지원하는 smtp 정보를 받아와 MimeMessage 객체에 전달해준다.
session = Session.getDefaultInstance(props, this);
}
public String getEmailCode() {
return emailCode;
} //생성된 이메일 인증코드 반환
private String createEmailCode() { //이메일 인증코드 생성
String[] str = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
String newCode = new String();
for (int x = 0; x < 8; x++) {
int random = (int) (Math.random() * str.length);
newCode += str[random];
}
return newCode;
}
protected PasswordAuthentication getPasswordAuthentication() {
//해당 메서드에서 사용자의 계정(id & password)을 받아 인증받으며 인증 실패시 기본값으로 반환됨.
return new PasswordAuthentication(user, password);
}
public synchronized void sendMail(String subject, String body, String recipients) throws Exception {
MimeMessage message = new MimeMessage(session);
DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain")); //본문 내용을 byte단위로 쪼개어 전달
message.setSender(new InternetAddress(user)); //본인 이메일 설정
message.setSubject(subject); //해당 이메일의 본문 설정
Log.d("Tag11","=>"+subject+user+password);
message.setDataHandler(handler);
if (recipients.indexOf(',') > 0)
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));
else
message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));
Transport.send(message); //메시지 전달
}
public class ByteArrayDataSource implements DataSource {
private byte[] data;
private String type;
public ByteArrayDataSource(byte[] data, String type) {
super();
this.data = data;
this.type = type;
}
public ByteArrayDataSource(byte[] data) {
super();
this.data = data;
}
public void setType(String type) {
this.type = type;
}
public String getContentType() {
if (type == null)
return "application/octet-stream";
else
return type;
}
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(data);
}
public String getName() {
return "ByteArrayDataSource";
}
public OutputStream getOutputStream() throws IOException {
throw new IOException("Not Supported");
}
}
}
| [
"ydg8732@naver.com"
] | ydg8732@naver.com |
457b87ec5a941feb90efb52a5819854e37676018 | 7b76e760e959d32c5c14cc2c82d5af3b131e2227 | /Classes and objects revisited/exercise/src/Q1 revisted/DistanceDemo.java | 995faf3e1cc20218671ba426956905c019934bae | [] | no_license | Shweta0105/java | b170578ec5901199e9909775f175fddb7376babb | 20be2ff32d88a72ffdbecaf79da3689d315e4766 | refs/heads/master | 2020-04-16T18:09:07.435718 | 2019-02-12T14:48:19 | 2019-02-12T14:48:19 | 164,794,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | import java.util.Scanner;
public class DistanceDemo {
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
Distance d1 = new Distance();
Distance d2 = new Distance();
d1.setfeet(5,6,7,8);
d2.setfeet(9,10,11,12);
d1.sum(d2);
}
} | [
"saini.shweta028@gmail.com"
] | saini.shweta028@gmail.com |
91297c1373c6019857e726ec573a1a08ae7b3a8e | 296d2f500952c0b575cd08926f1c3a5da236fc4a | /OA_for/src/main/java/com/wang/lms/common/page/Operas.java | 9be946f226ea86a9b0d4dabc5a676dcbe9472156 | [] | no_license | Mrwangtudou/wang_OA | 61e599b840419f4905be5f93676e3d229d27b666 | a1056bc9b63f6458a64541ac0bbe511b7fa396fc | refs/heads/master | 2020-05-01T15:12:53.967011 | 2019-03-25T08:29:02 | 2019-03-25T08:29:02 | 177,541,113 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package com.wang.lms.common.page;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
/**
* @author CHUNLONG.LUO
* @email 584614151@qq.com
* @date 2018年1月20日
* @version 1.0
* 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a>
*
* PageTag:标签处理类
* 标签处理类的作用:通过该类画分页标签
*/
public class Operas extends TagSupport{
private String name;
//页面解析 <fk:pager>开始标签时 会触发 doStartTag方法
@Override
public int doStartTag() throws JspException {
// TODO Auto-generated method stub
try{
System.out.println("name:"+this.name);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return super.doStartTag();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"“15883394994@163.com"
] | “15883394994@163.com |
e0fe159dae97add3c7d2ab11414bbf5ce71385eb | aeb5877e12dbdd49ff891bf1074b6f019fca929c | /src/main/java/com/example/shop/api/v1/PaymentController.java | e8a27a56b25279e343b5022cec25980c98364236 | [] | no_license | KokoTa/seven-shop-backend | 2832f894a133e10c8f6215b236d64375a45a1f24 | f747226d4c2b8270d813939db575de1c00c126fd | refs/heads/master | 2022-12-31T10:52:13.798209 | 2020-10-22T06:40:52 | 2020-10-22T06:40:52 | 246,535,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,056 | java | package com.example.shop.api.v1;
import com.example.shop.core.annotation.ScopeLevel;
import com.example.shop.service.WxPaymentService;
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Positive;
@RequestMapping("payment")
@RestController
@Validated
public class PaymentController {
@Autowired
private WxPaymentService wxPaymentService;
@Autowired
private WxPayService wxPayService;
/**
* 获取微信的预订单,获取 PrepayId
* @param oid 订单号
* @return
*/
@ScopeLevel
@PostMapping("/pay/order/{id}")
public WxPayMpOrderResult preWxOrder(@PathVariable(name = "id") @Positive Long oid) {
// 返回的数据格式
// app_id: "wxdcb0da10fa48b2d0"
// nonce_str: "1589356667849"
// package_value: "prepay_id=wx13155747046342ee3dd8d6231667978000"
// pay_sign: "344D08B3D2CA877A17A3D7DF0838D953"
// sign_type: "MD5"
// time_stamp: "1589356667"
return wxPaymentService.preOrder(oid);
}
/**
* 支付成功后微信会调用该接口,更新订单状态
*/
@PostMapping("/pay/order/notify")
public String wxNotify(@RequestBody String xmlData) throws WxPayException {
WxPayOrderNotifyResult result = wxPayService.parseOrderNotifyResult(xmlData);
try {
this.wxPaymentService.dealOrder(result.getOutTradeNo());
} catch (Exception e) {
return WxPayNotifyResponse.fail("失败");
}
System.out.println(result);
return WxPayNotifyResponse.success("成功");
}
}
| [
"584847514@qq.com"
] | 584847514@qq.com |
ddcbab81d11cc2c04c05be6e14edf11a1ff954dd | a9959dc178c136c077a4acd7b2807f0749f1729c | /addons/uimafit-s4-sdk/src/main/java/com/ontotext/s4/api/types/sbt/Manufactured_Object.java | 2364fc2a997e9c38dbb3432d96223a605492fdf3 | [
"Apache-2.0"
] | permissive | AndreiD/S4 | 5985fca87b8e3de8427e2e8a6db7b2fd0c3a4d91 | cb33a1157666ff07cf27e8b0f60945bb412bce69 | refs/heads/master | 2020-12-24T11:53:34.060483 | 2015-03-20T12:52:32 | 2015-03-20T12:52:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,367 | java |
/* First created by JCasGen Tue Mar 10 17:57:38 EET 2015 */
package com.ontotext.s4.api.types.sbt;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
import org.apache.uima.jcas.tcas.Annotation;
/** Automatically generated type for Manufactured_Object
* Updated by JCasGen Tue Mar 10 17:57:38 EET 2015
* XML source: desc/sbt_typesystem.xml
* @generated */
public class Manufactured_Object extends Annotation {
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int typeIndexID = JCasRegistry.register(Manufactured_Object.class);
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int type = typeIndexID;
/** @generated
* @return index of the type
*/
@Override
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected Manufactured_Object() {/* intentionally empty block */}
/** Internal - constructor used by generator
* @generated
* @param addr low level Feature Structure reference
* @param type the type of this Feature Structure
*/
public Manufactured_Object(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
*/
public Manufactured_Object(JCas jcas) {
super(jcas);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
* @param begin offset to the begin spot in the SofA
* @param end offset to the end spot in the SofA
*/
public Manufactured_Object(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/**
* <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
*
* @generated modifiable
*/
private void readObject() {/*default - does nothing empty block */}
//*--------------*
//* Feature: string
/** getter for string - gets Feature <string> for type <Manufactured_Object>
* @generated
* @return value of the feature
*/
public String getString() {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_string == null)
jcasType.jcas.throwFeatMissing("string", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
return jcasType.ll_cas.ll_getStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_string);}
/** setter for string - sets Feature <string> for type <Manufactured_Object>
* @generated
* @param v value to set into the feature
*/
public void setString(String v) {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_string == null)
jcasType.jcas.throwFeatMissing("string", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
jcasType.ll_cas.ll_setStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_string, v);}
//*--------------*
//* Feature: class_feature
/** getter for class_feature - gets Feature <class_feature> for type <Manufactured_Object>
* @generated
* @return value of the feature
*/
public String getClass_feature() {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_class_feature == null)
jcasType.jcas.throwFeatMissing("class_feature", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
return jcasType.ll_cas.ll_getStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_class_feature);}
/** setter for class_feature - sets Feature <class_feature> for type <Manufactured_Object>
* @generated
* @param v value to set into the feature
*/
public void setClass_feature(String v) {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_class_feature == null)
jcasType.jcas.throwFeatMissing("class_feature", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
jcasType.ll_cas.ll_setStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_class_feature, v);}
//*--------------*
//* Feature: inst
/** getter for inst - gets Feature <inst> for type <Manufactured_Object>
* @generated
* @return value of the feature
*/
public String getInst() {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_inst == null)
jcasType.jcas.throwFeatMissing("inst", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
return jcasType.ll_cas.ll_getStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_inst);}
/** setter for inst - sets Feature <inst> for type <Manufactured_Object>
* @generated
* @param v value to set into the feature
*/
public void setInst(String v) {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_inst == null)
jcasType.jcas.throwFeatMissing("inst", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
jcasType.ll_cas.ll_setStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_inst, v);}
//*--------------*
//* Feature: type_feature
/** getter for type_feature - gets Feature <type_feature> for type <Manufactured_Object>
* @generated
* @return value of the feature
*/
public String getType_feature() {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_type_feature == null)
jcasType.jcas.throwFeatMissing("type_feature", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
return jcasType.ll_cas.ll_getStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_type_feature);}
/** setter for type_feature - sets Feature <type_feature> for type <Manufactured_Object>
* @generated
* @param v value to set into the feature
*/
public void setType_feature(String v) {
if (Manufactured_Object_Type.featOkTst && ((Manufactured_Object_Type)jcasType).casFeat_type_feature == null)
jcasType.jcas.throwFeatMissing("type_feature", "com.ontotext.s4.api.types.sbt.Manufactured_Object");
jcasType.ll_cas.ll_setStringValue(addr, ((Manufactured_Object_Type)jcasType).casFeatCode_type_feature, v);}
}
| [
"tsvetan.dimitrov23@gmail.com"
] | tsvetan.dimitrov23@gmail.com |
297671148ca67fea1926592cd9039f16d75929ff | 2d276c4aa222d76144bc8f766b1011d3da87d97c | /gshell-core/src/main/java/org/sonatype/gshell/variables/VariableSetEvent.java | 6e635f2942fcbc3792d0dab5a9052a0fb5a15bd3 | [
"Apache-2.0"
] | permissive | runepeter/gshell | 2af5706f1cef256358c7535fbbf4fff1990cbbaa | 5f77b45c99f8a68642a3fa90d1d5680b90c881b6 | refs/heads/master | 2021-01-18T00:04:32.862380 | 2012-08-28T16:23:12 | 2012-08-28T16:23:12 | 1,693,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | /**
* Copyright (c) 2009-2011 the original author or authors.
*
* 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.sonatype.gshell.variables;
import java.util.EventObject;
/**
* Event fired once a variable has been set.
*
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @since 2.0
*/
public class VariableSetEvent
extends EventObject
{
///CLOVER:OFF
private final String name;
private final Object previous;
public VariableSetEvent(final String name, final Object previous) {
super(name);
assert name != null;
// previous could be null
this.name = name;
this.previous = previous;
}
public String getName() {
return name;
}
public Object getPrevious() {
return previous;
}
} | [
"jason@planet57.com"
] | jason@planet57.com |
01216ece463b4addf06e966cd9caad6e8360efda | 9a8bda9015e6c2f91a8fec91eded663140bca73f | /src/com/hazirlik/interviewQ/LongestWord.java | 13867bffa5652feee534ddef529ec947701b8f45 | [] | no_license | emineakbulut/JavaProject | d649b1dd3048cce67c481ecaff840d4ec8559e1e | 05dfc78e459a7a82ddd4010f030bf28b0f2a4cc7 | refs/heads/main | 2023-03-11T22:15:47.022170 | 2021-02-16T21:45:54 | 2021-02-16T21:45:54 | 304,908,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,771 | java | package com.hazirlik.interviewQ;
public class LongestWord {
/*
Have the function LongestWord(sen) take the sen parameter being passed and return the largest word in the string.
If there are two or more words that are the same length, return the first word from the string with that length.
Ignore punctuation and assume sen will not be empty.
Input: "fun&!! time"
Output: time
Input: "I love dogs"
Output: love
*/
public String returnLongestWord(String str){
String [] eachWord=str.split(" ");
String largestWord="";
for(int i=0;i<eachWord.length;i++){
if(eachWord[i].length()>largestWord.length()){
largestWord=eachWord[i];
}
}
return largestWord;
}
public static void main(String[] args) {
LongestWord l=new LongestWord();
System.out.println(l.returnLongestWord("Hello Happiest People")); ;
}
}
/*
// keep this function call here
Scanner s = new Scanner(System.in);
System.out.print(LongestWord(s.nextLine()));
// String s="I love%!& dogs";
}
public static String LongestWord(String sen) {
// code goes here
int count=0;
String longest="";
//divide the sentence
String[] splitSen= sen.split("\\s+");
//trim -get rid of the extra charachters using regex
// find the longest word
for (int i = 0; i < splitSen.length; i++) {
splitSen [i] = splitSen [i].replaceAll("[^\\w]", "");
if(splitSen[i].length()>count){
count= splitSen[i].length();
longest= splitSen[i];
}
}
return longest;
}
//input.split("[\\s@&.?$+-]+");
*/
| [
"ezz.akbulut@gmail.com"
] | ezz.akbulut@gmail.com |
8f2daac275b14c1ed84eade48d852e5c4de87688 | 9854f7ee1ae654460d7172e94ec2c4bd9596e387 | /Desktop/ble_lock_demo/ding/h_ble/src/main/java/com/hansion/h_ble/callback/ScanCallback.java | b0e6997f945ae58e541f654df5d057dcf84d8363 | [] | no_license | YuanLingCH/testBleDemo | fcf3b2d2d707a9951231bf04dc2b7c63ee84b4d4 | 28f6c384b804fd432f5f2c4e003f91619c8961bf | refs/heads/master | 2020-03-26T00:00:50.812850 | 2018-10-10T02:31:05 | 2018-10-10T02:31:05 | 144,303,223 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package com.hansion.h_ble.callback;
import android.bluetooth.BluetoothDevice;
/**
* Description:
* Author: Hansion
* Time: 2016/10/11 12:11
*/
public interface ScanCallback {
/**
* 扫描完成,成功回调
*/
void onSuccess();
/**
* 扫描过程中,每扫描到一个设备回调一次
*
* @param device 扫描到的设备
* @param rssi 设备的信息强度
* @param scanRecord
*/
void onScanning(final BluetoothDevice device, int rssi, byte[] scanRecord);
}
| [
"lingYuan@gmail.comgit config --global user.name git config --global user.email git config --global user.email lingYuan@gmail.com"
] | lingYuan@gmail.comgit config --global user.name git config --global user.email git config --global user.email lingYuan@gmail.com |
573ca98e037f87401592ab7dbf1ff04990e71414 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/alibaba--druid/969e878ca9b41de28c1eb75b7117e78a8a715d45/before/PGCommitTest.java | c6eb476760e5524b57ad6923c1a5cc8de3d5adae | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | /*
* Copyright 1999-2017 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.bvt.sql.postgresql;
import com.alibaba.druid.sql.PGTest;
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGCommitStatement;
public class PGCommitTest extends PGTest {
public void testCommit() throws Exception {
String sql = "commit;";
String expected = "COMMIT";
testParseSql(sql, expected, expected, PGCommitStatement.class);
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
24d6feaba2358bd68eeeec36fd2b0c1234afb766 | b165d1e0529288bffb8a0ffe30a5494d48df35b4 | /mx2150_code/bird/alps/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java | d0378fa51af94502993e5a58e70f589a1895ec25 | [] | no_license | Born2013/Alcor_Android_SmartCardApp | 2a1fb06e545c9a3b2291788f78bc23d497feb6de | c0370afffa86ea5c19f50a6cf8a0a03989524497 | refs/heads/master | 2022-11-21T14:00:31.863119 | 2020-07-28T10:01:24 | 2020-07-28T10:01:24 | 275,978,251 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 10,718 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.qs.customize;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.content.res.Configuration;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toolbar;
import android.widget.Toolbar.OnMenuItemClickListener;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto;
import com.android.systemui.R;
import com.android.systemui.qs.QSContainer;
import com.android.systemui.qs.QSDetailClipper;
import com.android.systemui.qs.QSTile;
import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.phone.QSTileHost;
import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback;
/// M: add plugin in quicksetting @{
import com.mediatek.systemui.ext.IQuickSettingsPlugin;
import com.mediatek.systemui.PluginManager;
/// @}
import java.util.ArrayList;
import java.util.List;
/*[BIRD][BIRD_ENCRYPT_SPACE][加密空间][yangbo][20170817]BEGIN */
import android.os.UserHandle;
import com.bird.security.ContainerManager;
import com.android.systemui.FeatureOption;
/*[BIRD][BIRD_ENCRYPT_SPACE][加密空间][yangbo][20170817]END */
/**
* Allows full-screen customization of QS, through show() and hide().
*
* This adds itself to the status bar window, so it can appear on top of quick settings and
* *someday* do fancy animations to get into/out of it.
*/
public class QSCustomizer extends LinearLayout implements OnMenuItemClickListener {
private static final int MENU_RESET = Menu.FIRST;
private final QSDetailClipper mClipper;
private PhoneStatusBar mPhoneStatusBar;
private boolean isShown;
private QSTileHost mHost;
private RecyclerView mRecyclerView;
private TileAdapter mTileAdapter;
private Toolbar mToolbar;
private boolean mCustomizing;
private NotificationsQuickSettingsContainer mNotifQsContainer;
private QSContainer mQsContainer;
public QSCustomizer(Context context, AttributeSet attrs) {
super(new ContextThemeWrapper(context, R.style.edit_theme), attrs);
mClipper = new QSDetailClipper(this);
LayoutInflater.from(getContext()).inflate(R.layout.qs_customize_panel_content, this);
mToolbar = (Toolbar) findViewById(com.android.internal.R.id.action_bar);
TypedValue value = new TypedValue();
mContext.getTheme().resolveAttribute(android.R.attr.homeAsUpIndicator, value, true);
mToolbar.setNavigationIcon(
getResources().getDrawable(value.resourceId, mContext.getTheme()));
mToolbar.setNavigationOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hide((int) v.getX() + v.getWidth() / 2, (int) v.getY() + v.getHeight() / 2);
}
});
mToolbar.setOnMenuItemClickListener(this);
mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0,
mContext.getString(com.android.internal.R.string.reset));
mToolbar.setTitle(R.string.qs_edit);
mRecyclerView = (RecyclerView) findViewById(android.R.id.list);
mTileAdapter = new TileAdapter(getContext());
mRecyclerView.setAdapter(mTileAdapter);
mTileAdapter.getItemTouchHelper().attachToRecyclerView(mRecyclerView);
GridLayoutManager layout = new GridLayoutManager(getContext(), 3);
layout.setSpanSizeLookup(mTileAdapter.getSizeLookup());
mRecyclerView.setLayoutManager(layout);
mRecyclerView.addItemDecoration(mTileAdapter.getItemDecoration());
DefaultItemAnimator animator = new DefaultItemAnimator();
animator.setMoveDuration(TileAdapter.MOVE_DURATION);
mRecyclerView.setItemAnimator(animator);
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
View navBackdrop = findViewById(R.id.nav_bar_background);
if (navBackdrop != null) {
boolean shouldShow = newConfig.smallestScreenWidthDp >= 600
|| newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE;
navBackdrop.setVisibility(shouldShow ? View.VISIBLE : View.GONE);
}
}
public void setHost(QSTileHost host) {
mHost = host;
mPhoneStatusBar = host.getPhoneStatusBar();
mTileAdapter.setHost(host);
}
public void setContainer(NotificationsQuickSettingsContainer notificationsQsContainer) {
mNotifQsContainer = notificationsQsContainer;
}
public void setQsContainer(QSContainer qsContainer) {
mQsContainer = qsContainer;
}
public void show(int x, int y) {
if (!isShown) {
MetricsLogger.visible(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
isShown = true;
setTileSpecs();
setVisibility(View.VISIBLE);
mClipper.animateCircularClip(x, y, true, mExpandAnimationListener);
new TileQueryHelper(mContext, mHost).setListener(mTileAdapter);
mNotifQsContainer.setCustomizerAnimating(true);
mNotifQsContainer.setCustomizerShowing(true);
announceForAccessibility(mContext.getString(
R.string.accessibility_desc_quick_settings_edit));
mHost.getKeyguardMonitor().addCallback(mKeyguardCallback);
}
}
public void hide(int x, int y) {
if (isShown) {
MetricsLogger.hidden(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
isShown = false;
mToolbar.dismissPopupMenus();
setCustomizing(false);
save();
mClipper.animateCircularClip(x, y, false, mCollapseAnimationListener);
mNotifQsContainer.setCustomizerAnimating(true);
mNotifQsContainer.setCustomizerShowing(false);
announceForAccessibility(mContext.getString(
R.string.accessibility_desc_quick_settings));
mHost.getKeyguardMonitor().removeCallback(mKeyguardCallback);
}
}
private void setCustomizing(boolean customizing) {
mCustomizing = customizing;
mQsContainer.notifyCustomizeChanged();
}
public boolean isCustomizing() {
return mCustomizing;
}
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case MENU_RESET:
MetricsLogger.action(getContext(), MetricsProto.MetricsEvent.ACTION_QS_EDIT_RESET);
reset();
break;
}
return false;
}
private void reset() {
ArrayList<String> tiles = new ArrayList<>();
/*[BIRD][BIRD_ENCRYPT_SPACE][加密空间][yangbo][20170817]BEGIN */
String defTiles;
if (FeatureOption.BIRD_ENCRYPT_SPACE) {
ContainerManager containerManager = (ContainerManager) mContext.getSystemService(Context.BIRD_CONTAINER_SERVICE);
if (containerManager.isCurrentContainerUser()) {
defTiles = mContext.getString(R.string.bird_encrypt_space_quick_settings_tiles_default);
} else {
defTiles = mContext.getString(R.string.quick_settings_tiles_default);
}
} else {
defTiles = mContext.getString(R.string.quick_settings_tiles_default);
}
/*[BIRD][BIRD_ENCRYPT_SPACE][加密空间][yangbo][20170817]END */
/// M: Customize the quick settings tile order for operator. @{
IQuickSettingsPlugin quickSettingsPlugin = PluginManager.getQuickSettingsPlugin(mContext);
defTiles = quickSettingsPlugin.customizeQuickSettingsTileOrder(defTiles);
/// M: Customize the quick settings tile order for operator. @}
for (String tile : defTiles.split(",")) {
tiles.add(tile);
}
mTileAdapter.setTileSpecs(tiles);
}
private void setTileSpecs() {
List<String> specs = new ArrayList<>();
for (QSTile tile : mHost.getTiles()) {
specs.add(tile.getTileSpec());
}
mTileAdapter.setTileSpecs(specs);
mRecyclerView.setAdapter(mTileAdapter);
}
private void save() {
mTileAdapter.saveSpecs(mHost);
}
private final Callback mKeyguardCallback = new Callback() {
@Override
public void onKeyguardChanged() {
if (mHost.getKeyguardMonitor().isShowing()) {
hide(0, 0);
}
}
};
private final AnimatorListener mExpandAnimationListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
setCustomizing(true);
mNotifQsContainer.setCustomizerAnimating(false);
}
@Override
public void onAnimationCancel(Animator animation) {
mNotifQsContainer.setCustomizerAnimating(false);
}
};
private final AnimatorListener mCollapseAnimationListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!isShown) {
setVisibility(View.GONE);
}
mNotifQsContainer.setCustomizerAnimating(false);
mRecyclerView.setAdapter(mTileAdapter);
}
@Override
public void onAnimationCancel(Animator animation) {
if (!isShown) {
setVisibility(View.GONE);
}
mNotifQsContainer.setCustomizerAnimating(false);
}
};
}
| [
"pgyi2011@163.com"
] | pgyi2011@163.com |
3437a17be7a9f9449056d12671b3c6c81613c8cc | 7ca5fd68e66a870bc5f35e3f3a9db2917a2f81d7 | /src/main/java/io/github/biezhi/lattice/example/service/LogService.java | d08a309de492a43ac63e0027a189487369b3dbd0 | [
"MIT"
] | permissive | lets-blade/lattice-example | f759a5d9ebb387727e639fb3e28ea14dcc793765 | 83f4f40d0f294c859a1408b584bc2bd6aa5c4ab6 | refs/heads/master | 2021-07-09T12:18:59.640453 | 2018-12-14T09:51:28 | 2018-12-14T09:51:28 | 136,125,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,134 | java | package io.github.biezhi.lattice.example.service;
import com.blade.ioc.annotation.Bean;
import com.blade.kit.StringKit;
import io.github.biezhi.anima.core.AnimaQuery;
import io.github.biezhi.anima.enums.OrderBy;
import io.github.biezhi.anima.page.Page;
import io.github.biezhi.lattice.example.model.SysLog;
import io.github.biezhi.lattice.example.params.LogParam;
import static io.github.biezhi.anima.Anima.select;
/**
* @author biezhi
* @date 2018/6/5
*/
@Bean
public class LogService {
public Page<SysLog> findLogs(LogParam logParam) {
AnimaQuery<SysLog> query = select().from(SysLog.class);
if (StringKit.isNotEmpty(logParam.getUsername())) {
query.and(SysLog::getUsername, logParam.getUsername());
}
if (null != logParam.getStartDate()) {
query.and(SysLog::getCreatedTime).gte(logParam.getStartDate());
}
if (null != logParam.getEndDate()) {
query.and(SysLog::getCreatedTime).lte(logParam.getEndDate());
}
return query.order(SysLog::getId, OrderBy.DESC).page(logParam.getPageNumber(), logParam.getPageSize());
}
}
| [
"biezhi.me@gmail.com"
] | biezhi.me@gmail.com |
c18271ab87305f0337f70148f17b3af93fdf7d51 | 3d2fe31ee5ab7bfda2f0160b5819178a227edfa8 | /Chapter 1/Stack LIFO/src/main/java/io/jmpalazzolo/App.java | 23d67ace6e2d7a13ad516db2e629c43b6ba96b3d | [
"MIT"
] | permissive | jmpala/DataStructuresAndAlgorithms | 9df2986b6bf8bc9bd63b274b96c2db41e8ee6720 | 0a6da7c87b6526d7b0b9e160d0b87f8bb264e60e | refs/heads/main | 2023-08-27T13:18:14.453577 | 2021-11-03T21:20:35 | 2021-11-03T21:20:35 | 421,918,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package io.jmpalazzolo;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"contact@jmpalazzolo.io"
] | contact@jmpalazzolo.io |
ec62c8ae158d2c814800b73ae05c218edeb0f53d | aedf44cae53e4ed0e3173fe03120d557ba445ba7 | /src/main/java/fr/locapov/app/config/LoggingAspectConfiguration.java | e67058359d852429d71f6dca75ae8b83e8ce6308 | [] | no_license | Locapov/locapov-front | 6596166dfec4c4b022e213d948a828b17acb3a10 | 2948cbe1696cc41b39662d83999a5ed29819027c | refs/heads/master | 2021-08-30T11:29:24.061672 | 2017-12-17T18:55:14 | 2017-12-17T18:55:14 | 114,560,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package fr.locapov.app.config;
import fr.locapov.app.aop.logging.LoggingAspect;
import io.github.jhipster.config.JHipsterConstants;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
@Configuration
@EnableAspectJAutoProxy
public class LoggingAspectConfiguration {
@Bean
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public LoggingAspect loggingAspect(Environment env) {
return new LoggingAspect(env);
}
}
| [
"aymerictibere@gmail.com"
] | aymerictibere@gmail.com |
cc753c37746db9442eaf1bc1153a3788f86ca647 | 1b5987a7e72a58e12ac36a36a60aa6add2661095 | /code/org/processmining/framework/util/GuiPropertyObjectSetSimple.java | c36876af68b52b33ac3ef48d84443400b9db6b79 | [] | no_license | qianc62/BePT | f4b1da467ee52e714c9a9cc2fb33cd2c75bdb5db | 38fb5cc5521223ba07402c7bb5909b17967cfad8 | refs/heads/master | 2021-07-11T16:25:25.879525 | 2020-09-22T10:50:51 | 2020-09-22T10:50:51 | 201,562,390 | 36 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,111 | java | package org.processmining.framework.util;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.deckfour.slickerbox.components.SlickerButton;
import org.deckfour.slickerbox.util.SlickerSwingUtils;
/**
* An object set property that can be readily displayed as it maintains its own
* GUI panel. The property will be graphically represented as a list including
* buttons to add or remove values available in the initially provided object
* set. <br>
* Changes performed via the GUI will be immedeately propagated to the
* internally held property values. Furthermore, a {@link GuiNotificationTarget
* notification target} may be specified in order to be informed as soon as the
* list of values has been changed. <br>
* <br>
* A typical usage scenario looks as follows: <br>
* <br>
* <code>
* JPanel testPanel = new Panel(); // create parent panel <br>
* testPanel.setLayout(new BoxLayout(testPanel, BoxLayout.PAGE_AXIS)); <br>
* HashSet<String> values = new HashSet<String>();
* values.add("Anne");
* values.add("Maria");
* GuiPropertyObjectSet names = new GuiPropertyObjectSet("Names", values); <br>
* testPanel.add(names.getPropertyPanel()); // add property <br>
* return testPanel; <br>
* </code>
*
* @see getAllValues
* @see getPropertyPanel
*/
public class GuiPropertyObjectSetSimple implements ListSelectionListener,
GuiNotificationTarget {
// property attributes
private String myName;
private String myDescription;
private Set myAvailableValues;
private GUIPropertySetEnumeration myAvailableList;
private GuiNotificationTarget myTarget;
private int myPreferredHeight;
// GUI attributes
private JPanel myPanel;
private JList myJList;
private DefaultListModel myListModel;
private JButton myAddButton;
private JButton myRemoveButton;
/**
* Creates a string list property without a discription and notification.
*
* @param name
* the name of this property
* @param initialValues
* the initial values of this property. The objects in this list
* should either be simple strings or override the toString()
* method, which is then displayed as the name of this value in
* the ComboBox
* @param availableValues
* the available values of this property. The objects in this
* list should be of the same type as the initial values.
* Furthermore they should contain the initial values
*/
public GuiPropertyObjectSetSimple(String name, List initialValues,
List availableValues) {
this(name, null, initialValues, availableValues);
}
/**
* Creates a string list property without notification.
*
* @param name
* the name of this property
* @param description
* of this property (to be displayed as a tool tip)
* @param initialValues
* the initial values of this property. The objects in this list
* should either be simple strings or override the toString()
* method, which is then displayed as the name of this value in
* the ComboBox
* @param availableValues
* the available values of this property. The objects in this
* list should be of the same type as the initial values.
* Furthermore they should contain the initial values
*/
public GuiPropertyObjectSetSimple(String name, String description,
List initialValues, List availableValues) {
this(name, description, initialValues, availableValues, null, 70);
}
/**
* Creates a string list without a discription.
*
* @param name
* the name of this property
* @param initialValues
* the initial values of this property. The objects in this list
* should either be simple strings or override the toString()
* method, which is then displayed as the name of this value in
* the ComboBox
* @param availableValues
* the available values of this property. The objects in this
* list should be of the same type as the initial values.
* Furthermore they should contain the initial values
* @param target
* the object to be notified as soon the state of this property
* changes
*/
public GuiPropertyObjectSetSimple(String name, List initialValues,
List availableValues, GuiNotificationTarget target) {
this(name, null, initialValues, availableValues, target, 70);
}
/**
* Creates a string list property.
*
* @param name
* the name of this property
* @param description
* of this property (to be displayed as a tool tip)
* @param initialValues
* the initial values of this property. The objects in this list
* should either be simple strings or override the toString()
* method, which is then displayed as the name of this value in
* the ComboBox
* @param availableValues
* the available values of this property. The objects in this
* list should be of the same type as the initial values.
* Furthermore they should contain the initial values
* @param target
* the object to be notified as soon the state of this property
* changes
*/
public GuiPropertyObjectSetSimple(String name, String description,
List initialValues, List availableValues,
GuiNotificationTarget target) {
this(name, description, initialValues, availableValues, target, 70);
}
/**
* Creates a string list property.
*
* @param name
* the name of this property
* @param description
* of this property (to be displayed as a tool tip)
* @param initialValues
* the initial values of this property. The objects in this list
* should either be simple strings or override the toString()
* method, which is then displayed as the name of this value in
* the ComboBox
* @param availableValues
* the available values of this property. The objects in this
* list should be of the same type as the initial values.
* Furthermore they should contain the initial values
* @param target
* the object to be notified as soon the state of this property
* changes
* @param height
* the preferred height for the list property (default value is
* 70)
*/
public GuiPropertyObjectSetSimple(String name, String description,
List initialValues, List availableValues,
GuiNotificationTarget target, int height) {
myName = name;
myDescription = description;
myTarget = target;
myPreferredHeight = height;
// GUI attributes
myAvailableValues = new HashSet();
myAvailableValues.addAll(availableValues);
myListModel = new DefaultListModel();
if (initialValues != null) {
Iterator it = initialValues.iterator();
while (it.hasNext()) {
Object current = it.next();
myListModel.addElement(current);
// remove initial values from list of available values
myAvailableValues.remove(current);
}
}
myAvailableList = new GUIPropertySetEnumeration("", "",
myAvailableValues, null, 150);
myJList = new JList(myListModel);
myJList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
myJList.setLayoutOrientation(JList.VERTICAL);
myJList.setVisibleRowCount(-1);
myJList.addListSelectionListener(this);
myAddButton = new SlickerButton("Add");
myAddButton.setToolTipText("Adds current value from list to the right");
myAddButton.addActionListener(new ActionListener() {
// specify the action to be taken when pressing the "Add" button
public void actionPerformed(ActionEvent e) {
int index = myJList.getSelectedIndex(); // get selected index
if (index == -1) { // no selection, so insert at beginning
index = 0;
} else { // add after the selected item
index++;
}
Object toBeAdded = myAvailableList.getValue();
myListModel.insertElementAt(toBeAdded, index);
// Reset the combo box property
myAvailableValues.remove(toBeAdded);
myAvailableList = new GUIPropertySetEnumeration("", "",
myAvailableValues, null, 150);
// if no further attributes available anymore disable "Add"
// button
if (myAvailableValues.size() == 0) {
myAddButton.setEnabled(false);
}
// Select the new item and make it visible
myJList.setSelectedIndex(index);
myJList.ensureIndexIsVisible(index);
// redraw this property panel
updateGUI();
if (myTarget != null) {
// notify owner of this property if specified
myTarget.updateGUI();
}
}
});
myRemoveButton = new SlickerButton("Remove");
myRemoveButton.setToolTipText("Removes selected value from list above");
// is disabled per default since no element is selected per default
myRemoveButton.setEnabled(false);
myRemoveButton.addActionListener(new ActionListener() {
// specify the action to be taken when pressing the "Remove" button
public void actionPerformed(ActionEvent e) {
int index = myJList.getSelectedIndex();
Object toBeRemoved = myListModel.get(index);
// Reset the combo box property
myAvailableValues.add(toBeRemoved);
myAvailableList = new GUIPropertySetEnumeration("", "",
myAvailableValues, null, 150);
// enable "Add" button (could have been enabled before if no
// values were available anymore)
myAddButton.setEnabled(true);
myListModel.remove(index);
int size = myListModel.getSize();
if (size == 0) { // no value left, disable removing
myRemoveButton.setEnabled(false);
} else { // Select an index
if (index == myListModel.getSize()) {
// removed item in last position
index--;
}
myJList.setSelectedIndex(index);
myJList.ensureIndexIsVisible(index);
}
// redraw this property panel
updateGUI();
if (myTarget != null) {
// notify owner of this property if specified
myTarget.updateGUI();
}
}
});
}
/**
* Method to be automatically invoked as soon as the selection of the list
* changes.
*/
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting() == false) {
if (myJList.getSelectedIndex() == -1) {
// No selection, disable "Remove" button
myRemoveButton.setEnabled(false);
// property list should also disappear, if provided
// if (myPropertyInitialValuesPanel != null) {
// myPropertyInitialValuesPanel.removeAll();
// // redraw
// myPanel.validate();
// myPanel.repaint();
// }
} else {
// Selection, enable the "Remove" button
myRemoveButton.setEnabled(true);
// property list should also be adapted, if provided
// if (myPropertyInitialValuesPanel != null) {
// Object value = myJList.getSelectedValue();
// // show the combobox for the selected item
// NotificationTargetPropertyListEnumeration enumProp =
// (NotificationTargetPropertyListEnumeration)
// myInitialValuesAndProperty.get(value);
// myPropertyInitialValuesPanel.removeAll();
// myPropertyInitialValuesPanel.add(enumProp.getPropertyPanel(),
// BorderLayout.EAST);
// // redraw
// myPanel.validate();
// myPanel.repaint();
// }
}
}
}
// /**
// * Retrieves all the possible values specified for this property.
// * @return all possible values
// */
// public List getAllValues() {
// ArrayList result = new ArrayList();
// Object[] currentValues = myListModel.toArray();
// for (int i=0; i < currentValues.length; i++) {
// Object val = currentValues[i];
// result.add(val);
// }
// return result;
// }
/**
* Creates GUI panel containg this property, ready to display in some
* settings dialog.
*
* @return the graphical panel representing this property
*/
public JPanel getPropertyPanel() {
if (myPanel == null) {
myPanel = new JPanel();
myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.PAGE_AXIS));
updateGUI();
}
return myPanel;
}
/*
* Helper method to redraw property panel as soon as list of selected values
* has changed.
*/
public void updateGUI() {
myPanel.removeAll();
JPanel namePanel = new JPanel();
namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.LINE_AXIS));
JLabel myNameLabel = new JLabel(" " + myName);
if (myDescription != null) {
myNameLabel.setToolTipText(myDescription);
}
namePanel.add(myNameLabel);
namePanel.add(Box.createHorizontalGlue());
myPanel.add(namePanel);
myPanel.add(Box.createRigidArea(new Dimension(0, 5)));
JScrollPane listScroller = new JScrollPane(myJList);
listScroller.setPreferredSize(new Dimension(250, myPreferredHeight));
myPanel.add(listScroller);
myPanel.add(Box.createRigidArea(new Dimension(0, 5)));
JPanel buttonsPanel = new JPanel();
buttonsPanel
.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS));
buttonsPanel.add(myAddButton);
buttonsPanel.add(Box.createRigidArea(new Dimension(5, 0)));
buttonsPanel.add(myAvailableList.getPropertyPanel());
buttonsPanel.add(Box.createRigidArea(new Dimension(5, 0)));
buttonsPanel.add(Box.createHorizontalGlue());
buttonsPanel.add(myRemoveButton);
myPanel.add(buttonsPanel);
SlickerSwingUtils.injectTransparency(myPanel);
// redraw
myPanel.validate();
myPanel.repaint();
}
}
| [
"qianc62@gmail.com"
] | qianc62@gmail.com |
cd043adf68c38a92cd476d0d1694581919b09db5 | 3bcdc47f211912a96541c04305a1afc540a90ca0 | /ftcappv2.2OpenCVworking/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/LinearVisionSample.java | cea05eaf6b77d6229d7dda343794265e32a50a18 | [
"MIT",
"BSD-3-Clause"
] | permissive | Alex-Gurung/oldFTCProjects | 2fffde386298822243547537529968f49fc07d48 | 3d4a2cf1e9be25b202efdd6762bf9d19d8222c35 | refs/heads/master | 2021-01-12T13:47:11.963000 | 2016-10-15T15:40:53 | 2016-10-15T15:40:53 | 69,127,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,532 | java | package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import org.lasarobotics.vision.android.Cameras;
import org.lasarobotics.vision.ftc.resq.Beacon;
import org.lasarobotics.vision.opmode.LinearVisionOpMode;
import org.lasarobotics.vision.opmode.extensions.CameraControlExtension;
import org.lasarobotics.vision.util.ScreenOrientation;
import org.opencv.core.Mat;
import org.opencv.core.Size;
/**
* Linear Vision Sample
* <p/>
* Use this in a typical linear op mode. A LinearVisionOpMode allows using
* Vision Extensions, which do a lot of processing for you. Just enable the extension
* and set its options to your preference!
* <p/>
* Please note that the LinearVisionOpMode is specially designed to target a particular
* version of the FTC Robot Controller app. Changes to the app may break the LinearVisionOpMode.
* Should this happen, open up an issue on GitHub. :)
*/
@TeleOp(name="OpenCV: OpenCV Linear Test", group="OpenCV")
public class LinearVisionSample extends LinearVisionOpMode {
//Frame counter
int frameCount = 0;
@Override
public void runOpMode() throws InterruptedException {
//Wait for vision to initialize - this should be the first thing you do
waitForVisionStart();
/**
* Set the camera used for detection
* PRIMARY = Front-facing, larger camera
* SECONDARY = Screen-facing, "selfie" camera :D
**/
this.setCamera(Cameras.PRIMARY);
/**
* Set the frame size
* Larger = sometimes more accurate, but also much slower
* After this method runs, it will set the "width" and "height" of the frame
**/
this.setFrameSize(new Size(900, 900));
/**
* Enable extensions. Use what you need.
* If you turn on the BEACON extension, it's best to turn on ROTATION too.
*/
enableExtension(Extensions.BEACON); //Beacon detection
enableExtension(Extensions.ROTATION); //Automatic screen rotation correction
enableExtension(Extensions.CAMERA_CONTROL); //Manual camera control
/**
* Set the beacon analysis method
* Try them all and see what works!
*/
beacon.setAnalysisMethod(Beacon.AnalysisMethod.FAST);
/**
* Set color tolerances
* 0 is default, -1 is minimum and 1 is maximum tolerance
*/
beacon.setColorToleranceRed(0);
beacon.setColorToleranceBlue(0);
/**
* Set analysis boundary
* You should comment this to use the entire screen and uncomment only if
* you want faster analysis at the cost of not using the entire frame.
* This is also particularly useful if you know approximately where the beacon is
* as this will eliminate parts of the frame which may cause problems
* This will not work on some methods, such as COMPLEX
**/
//beacon.setAnalysisBounds(new Rectangle(new Point(width / 2, height / 2), width - 200, 200));
/**
* Set the rotation parameters of the screen
* If colors are being flipped or output appears consistently incorrect, try changing these.
*
* First, tell the extension whether you are using a secondary camera
* (or in some devices, a front-facing camera that reverses some colors).
*
* It's a good idea to disable global auto rotate in Android settings. You can do this
* by calling disableAutoRotate() or enableAutoRotate().
*
* It's also a good idea to force the phone into a specific orientation (or auto rotate) by
* calling either setActivityOrientationAutoRotate() or setActivityOrientationFixed(). If
* you don't, the camera reader may have problems reading the current orientation.
*/
rotation.setIsUsingSecondaryCamera(false);
rotation.disableAutoRotate();
rotation.setActivityOrientationFixed(ScreenOrientation.PORTRAIT);
/**
* Set camera control extension preferences
*
* Enabling manual settings will improve analysis rate and may lead to better results under
* tested conditions. If the environment changes, expect to change these values.
*/
cameraControl.setColorTemperature(CameraControlExtension.ColorTemperature.AUTO);
cameraControl.setAutoExposureCompensation();
telemetry.addData("BeforeWaitForStart", 0);
updateTelemetry(telemetry);
//Wait for the match to begin
waitForStart();
//Main loop
//Camera frames and OpenCV analysis will be delivered to this method as quickly as possible
//This loop will exit once the opmode is closed
while (opModeIsActive()) {
//Log a few things
telemetry.addData("Beacon Color", beacon.getAnalysis().getColorString());
telemetry.addData("Beacon Center", beacon.getAnalysis().getLocationString());
telemetry.addData("Beacon Confidence", beacon.getAnalysis().getConfidenceString());
telemetry.addData("Beacon Buttons", beacon.getAnalysis().getButtonString());
telemetry.addData("Screen Rotation", rotation.getScreenOrientationActual());
telemetry.addData("Frame Rate", fps.getFPSString() + " FPS");
telemetry.addData("Frame Size", "Width: " + width + " Height: " + height);
telemetry.addData("Frame Counter", frameCount);
updateTelemetry(telemetry);
//You can access the most recent frame data and modify it here using getFrameRgba() or getFrameGray()
//Vision will run asynchronously (parallel) to any user code so your programs won't hang
//You can use hasNewFrame() to test whether vision processed a new frame
//Once you copy the frame, discard it immediately with discardFrame()
if (hasNewFrame()) {
//Get the frame
Mat rgba = getFrameRgba();
Mat gray = getFrameGray();
//Discard the current frame to allow for the next one to render
discardFrame();
//Do all of your custom frame processing here
//For this demo, let's just add to a frame counter
frameCount++;
}
//Wait for a hardware cycle to allow other processes to run
waitOneFullHardwareCycle();
}
}
}
| [
"aag1234@gmail.com"
] | aag1234@gmail.com |
3f038ff86dddb4db8d34eb2c2c244daaa99cc3dd | 7ba00878619005c07da73dea904f0673f509fbe7 | /com/gossip/GossipBatch.java | 68695e49daf1934a32080ebea32ecd753a104e06 | [] | no_license | Blockchain-World/gossip-based-diffusion | 1e05c5bf64d16d31f5b7b18b0e04bf52a545eab7 | 2746584e75cfdd806da23389e145f5bcf5fe4ffe | refs/heads/master | 2021-07-23T21:27:11.029118 | 2020-06-10T14:09:37 | 2020-06-10T14:09:37 | 271,293,653 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,829 | java | package com.gossip;
import java.util.concurrent.ExecutorService;
public class GossipBatch implements Runnable {
ExecutorService executor;
public GossipBatch(ExecutorService executor){
this.executor = executor;
}
@Override
public void run() {
executor.execute(new Runnable() {
@Override
public void run() {
GossipLogger.info("Start batch listening thread...");
try{
while (true){
//Thread.sleep(500);
//GossipLogger.info("Seed queue size: " + Constant.SEED_QUEUE.size());
int seedQueueSize = Constant.SEED_QUEUE.size();
StringBuilder sb = new StringBuilder();
if (seedQueueSize >= Constant.BATCH_SIZE){
synchronized (Constant.SEED_QUEUE){
GossipLogger.info("Start to batch...");
for (int i = 0; i < Constant.BATCH_SIZE; i++){
String temp = Constant.SEED_QUEUE.poll();
if(i == (Constant.BATCH_SIZE - 1)){
sb.append(temp);
}else {
sb.append(temp).append("^_^");
}
}
}
}
// Disseminate the batch to the gossip port 40001
if (!sb.toString().equals("")){
GossipLogger.info("Start to gossip to peers, message: " + sb.toString());
if(Constant.GOSSIP_MODE.equals("gossip")){
GossipLogger.info("Gossip to random peers");
// listen to message from client on port 30001, disseminate to other nodes on port 40001
if(Utils.Gossip(sb.toString())){
// Record the timestamp when start to gossip
Utils.writeToLedger("[seed]: " + Utils.currentTS("micro").toString() + " " + sb.toString());
GossipLogger.info("Gossip successfully.");
}else {
GossipLogger.error("Gossip failed.");
}
}else {
GossipLogger.error("Gossip mode is wrong.");
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
});
}
}
| [
"sh553@njit.edu"
] | sh553@njit.edu |
3b8ed144b4fb3d1018a1d292f97f3fab0da1ed97 | 47380f68e407dc83c95729562da62dac2143a4e2 | /src/main/java/org/etsdb/util/AbstractProperties.java | 068029a6ba705b58bad70ec582edacadde39436e | [] | no_license | iot-dsa-v2/dslink-java-v2-restadapter | 488aa445ca135972a5fe73e888f97efe9d054b7c | 38a556639b86417dd33f401f7f3fdda261424ddb | refs/heads/master | 2021-11-24T16:23:05.405539 | 2021-10-25T14:22:36 | 2021-10-25T14:22:36 | 128,474,249 | 0 | 1 | null | 2019-08-20T23:13:35 | 2018-04-06T21:55:10 | Java | UTF-8 | Java | false | false | 2,689 | java | package org.etsdb.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.iot.dsa.logging.DSLogger;
public abstract class AbstractProperties extends DSLogger {
private static final Pattern PATTERN_ENV = Pattern.compile("(\\$\\{env:(.+?)\\})");
private static final Pattern PATTERN_PROP = Pattern.compile("(\\$\\{prop:(.+?)\\})");
private static final Pattern PATTERN_BS = Pattern.compile("\\\\");
private static final Pattern PATTERN_DOL = Pattern.compile("\\$");
private final String description;
public AbstractProperties() {
this("unnamed");
}
public AbstractProperties(String description) {
this.description = description;
}
public String getString(String key) {
String s = getStringImpl(key);
if (s == null) {
return null;
}
Matcher matcher = PATTERN_ENV.matcher(s);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String pkey = matcher.group(2);
matcher.appendReplacement(sb, escape(System.getenv(pkey)));
}
matcher.appendTail(sb);
matcher = PATTERN_PROP.matcher(sb.toString());
sb = new StringBuffer();
while (matcher.find()) {
String pkey = matcher.group(2);
matcher.appendReplacement(sb, escape(System.getProperty(pkey)));
}
matcher.appendTail(sb);
return sb.toString();
}
private String escape(String s) {
if (s == null) {
return "";
}
s = PATTERN_BS.matcher(s).replaceAll("\\\\\\\\");
s = PATTERN_DOL.matcher(s).replaceAll("\\\\\\$");
return s;
}
protected abstract String getStringImpl(String paramString);
public int getInt(String key, int defaultValue) {
String value = getString(key);
if ("".equals(value)) {
return defaultValue;
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
warn("(" + this.description + ") Can't parse int from properties key: " + key + ", value=" + value);
}
return defaultValue;
}
public boolean getBoolean(String key, boolean defaultValue) {
String value = getString(key);
if ("".equals(value)) {
return defaultValue;
}
if ("true".equalsIgnoreCase(value)) {
return true;
}
if ("false".equalsIgnoreCase(value)) {
return false;
}
warn("(" + this.description + ") Can't parse boolean from properties key: " + key + ", value=" + value);
return defaultValue;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ce9808049bcbeb2a4abb755b05c85bf006bb30cf | 8191bea395f0e97835735d1ab6e859db3a7f8a99 | /f737922a0ddc9335bb0fc2f3ae5ffe93_source_from_JADX/java_files/apl.java | 6fcda0a889dae3edf6563e998c10d8a6fb6e91ff | [] | no_license | msmtmsmt123/jadx-1 | 5e5aea319e094b5d09c66e0fdb31f10a3238346c | b9458bb1a49a8a7fba8b9f9a6fb6f54438ce03a2 | refs/heads/master | 2021-05-08T19:21:27.870459 | 2017-01-28T04:19:54 | 2017-01-28T04:19:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 868 | java | class apl {
private apl$a DW;
private apl$a FH;
private apl$b j6;
apl() {
this.j6 = new apl$b();
}
void j6(aqg aqg) {
apl$a apl_a = this.FH;
if (apl_a == null) {
apl_a = this.j6.j6();
apl_a.j6(aqg);
this.DW = apl_a;
this.FH = apl_a;
return;
}
if (apl_a.j6()) {
apl_a = this.j6.j6();
this.FH.j6 = apl_a;
this.FH = apl_a;
}
apl_a.j6(aqg);
}
aqg j6() {
apl$a apl_a = this.DW;
if (apl_a == null) {
return null;
}
aqg FH = apl_a.FH();
if (apl_a.DW()) {
this.DW = apl_a.j6;
if (this.DW == null) {
this.FH = null;
}
this.j6.j6(apl_a);
}
return FH;
}
}
| [
"eggfly@qq.com"
] | eggfly@qq.com |
c16765459f85174ff56b19ad40c7329250ef4b6b | 35eb154a692d7841785489d4568b8b84db9d4ea9 | /src/main/java/com/job/controller/ACallForVivaController.java | ddc25e9018647df5f47f13acd84cba4c74a56337 | [] | no_license | MHbappy/recruit | 9c13cc52d16dc8b3508f6547b7da9b877dad01e8 | 9e541f221b6cd470ed08ae763eb7b3b3d450d445 | refs/heads/master | 2021-01-19T22:14:10.178775 | 2017-05-28T10:47:33 | 2017-05-28T10:47:33 | 88,774,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,117 | java | package com.job.controller;
import com.job.model.CallForViva;
import com.job.service.CallForVivaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
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.ResponseStatus;
@Controller
public class ACallForVivaController {
private static final Logger logger = (Logger) LoggerFactory.getLogger(AdminController.class);
private CallForVivaService callForVivaService;
@Autowired
public void setCallForVivaService(CallForVivaService callForVivaService) {
this.callForVivaService = callForVivaService;
}
//tested
@RequestMapping(value = "admin/adminCallForVivaList", method = RequestMethod.GET)
public String list(Model model){
logger.info("_____________"+callForVivaService.listAllCallForViva());
model.addAttribute("callForViva", callForVivaService.listAllCallForViva());
return "admin/callForVivaAction/listOfCreatePost";
}
//tested
@RequestMapping("admin/adminCallForVivaList/{id}")
public String showProduct(@PathVariable Integer id, Model model){
logger.info("id+++++++++"+id);
model.addAttribute("callForViva", callForVivaService.getCallForVivaById(id));
return "admin/callForVivaAction/showOfCreatePosts";
}
//tested
@RequestMapping("admin/adminCallForVivaDelete/{id}")
public String delete(@PathVariable Integer id){
logger.info("___________"+id);
callForVivaService.deleteCallForViva(id);
return "redirect:/admin/adminCallForVivaList";
}
@RequestMapping(value = "callForVivaa", method = RequestMethod.POST)
public String saveProduct(CallForViva callForViva){
logger.info("_______________________"+callForViva.toString());
callForVivaService.saveCallForViva(callForViva);
return "redirect:/admin/adminCallForVivaList";
}
@RequestMapping("admin/adminCallForViva/new")
public String newProduct(Model model){
model.addAttribute("callForViva", new CallForViva());
return "admin/adminVivaNotification";
}
@RequestMapping("admin/adminCallForViva/edit/{id}")
public String edit(@PathVariable Integer id, Model model){
model.addAttribute("callForViva", callForVivaService.getCallForVivaById(id));
return "admin/adminVivaNotification";
}
@RequestMapping("admin/adminCallForViva/show/{id}")
public String showPost(@PathVariable Integer id, Model model){
model.addAttribute("callForViva", callForVivaService.getCallForVivaById(id));
return "admin/callForVivaAction/singleCreatePost";
}
}
| [
"mhbappy18@gmail.com"
] | mhbappy18@gmail.com |
8a3e43d7a2d37df84743f0b58e40f339b92374e0 | bb357e828e17423631f0d6cbe0696063a2e87d69 | /jpasample/src/main/java/com/sy/spring5/jpa/DemoApplication.java | e7f4b461c5674cc44abf1ed6dd20e468dfb0d2e6 | [] | no_license | syhwang125/spring5 | 7d106b9b8bda1dcbf26b862c73d0244fe54f6271 | ce289dc51c623cea7dfe0e9c03fce6e9248b32a5 | refs/heads/master | 2022-12-22T22:50:46.607017 | 2021-01-31T02:58:58 | 2021-01-31T02:58:58 | 164,200,441 | 1 | 0 | null | 2022-12-16T04:50:37 | 2019-01-05T09:25:45 | Java | UTF-8 | Java | false | false | 307 | java | package com.sy.spring5.jpa;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"syhwang125@gmail.com"
] | syhwang125@gmail.com |
826c2b47d966358abdd440f9c59cbf1d3a11f186 | b9974b4e65e3e39c3767275f839ce1c8243e1ccb | /springcore/src/main/java/com/springcore/Student.java | c7d2ce77d7be925d36402c1ae91c07f112752635 | [] | no_license | SanjayKumarKhatri/Spring-Learning | 1c519abbe59aa568a1d2391745a2823e91d5e957 | 338c5a1fa5f3c47013d7edacb404426d84e56303 | refs/heads/master | 2023-06-04T13:10:52.762932 | 2021-06-20T19:29:24 | 2021-06-20T19:29:24 | 378,718,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | package com.springcore;
public class Student {
private int studentId;
private String studentName;
private String studentAddress;
public int getStudentId() {
return studentId;
}
public void setStudentId(int studentId) {
System.out.println("Setting student id");
this.studentId = studentId;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
System.out.println("Setting student name");
this.studentName = studentName;
}
public String getStudentAddress() {
return studentAddress;
}
public void setStudentAddress(String studentAddress) {
System.out.println("Setting student Address");
this.studentAddress = studentAddress;
}
public Student(int studentId, String studentName, String studentAddress) {
super();
this.studentId = studentId;
this.studentName = studentName;
this.studentAddress = studentAddress;
}
public Student() {
super();
// TODO Auto-generated constructor stub
}
@Override
public String toString() {
return "Student [studentId=" + studentId + ", studentName=" + studentName + ", studentAddress=" + studentAddress
+ "]";
}
}
| [
"skkhatri948@gmail.com"
] | skkhatri948@gmail.com |
7c19b9bb4b49f9dc06e7d789f74ad5114de022f4 | 22999453db1f02b1b3e4d035d6102e60a57d25a0 | /test/org/ruhlendavis/mc/communitybridge/PermissionHandlerGroupManagerTest.java | aca338a5fd77a38479811e131af3e9f847c1cfe4 | [] | no_license | LoadingChunks/CommunityBridge | e1bed88079bcc25d90e5a3e72e5f546ba595ff06 | 1d9094075e91c96ee5d355cffb3c8e68974e2823 | refs/heads/master | 2021-01-18T08:50:28.028334 | 2013-01-31T19:05:49 | 2013-01-31T19:05:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,298 | java | package org.ruhlendavis.mc.communitybridge;
import java.util.ArrayList;
import java.util.List;
import net.netmanagers.community.Main;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
/**
* Tests for the PermissionHandlerGroupManager Class
*
* @author Feaelin
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest(Bukkit.class)
public class PermissionHandlerGroupManagerTest
{
private final String goodPlayerName = "goodPlayer";
private final String badPlayerName = "badPlayer";
private final String goodGroupName = "goodGroup";
private final String badGroupName = "badGroup";
private final String worldName = "world";
private final String noexistGroupName = "thisgroupdoesnotexist";
private Server server;
private Player goodPlayer;
private World world;
private List<World> worlds;
private GroupManager gmPluginAsGroupManager;
private WorldsHolder worldHolder;
private AnjoPermissionsHandler handler;
private PermissionHandler permissionHandler;
public PermissionHandlerGroupManagerTest()
{
}
@BeforeClass
public static void setUpClass()
{
}
@AfterClass
public static void tearDownClass()
{
}
@Before
public void setUp()
{
PowerMockito.mockStatic(Bukkit.class);
server = mock(Server.class);
goodPlayer = mock(Player.class);
world = mock(World.class);
worlds = new ArrayList<World>();
worlds.add(world);
gmPluginAsGroupManager = mock(GroupManager.class);
worldHolder = mock(WorldsHolder.class);
handler = mock(AnjoPermissionsHandler.class);
when(Bukkit.getServer()).thenReturn(server);
when(server.getPlayerExact(goodPlayerName)).thenReturn(goodPlayer);
when(server.getPlayerExact(badPlayerName)).thenReturn(null);
when(goodPlayer.getWorld()).thenReturn(world);
when(world.getName()).thenReturn(worldName);
when(server.getWorlds()).thenReturn(worlds);
when(gmPluginAsGroupManager.getWorldsHolder()).thenReturn(worldHolder);
when(worldHolder.getWorldPermissions(worldName)).thenReturn(handler);
when(handler.getGroup(goodPlayerName)).thenReturn(goodGroupName);
when(handler.inGroup(goodPlayerName, goodGroupName)).thenReturn(true);
when(handler.inGroup(badPlayerName, goodGroupName)).thenReturn(false);
when(handler.inGroup(goodPlayerName, badGroupName)).thenReturn(false);
when(handler.inGroup(badPlayerName, badGroupName)).thenReturn(false);
permissionHandler = new PermissionHandlerGroupManager(gmPluginAsGroupManager);
}
@After
public void tearDown()
{
}
@Test
public void testGetPrimaryGroup()
{
Assert.assertEquals("getPrimaryGroup() should return null with an invalid player",
null, permissionHandler.getPrimaryGroup(badPlayerName));
Assert.assertEquals("getPrimaryGroup() should return correct group with an valid player",
goodGroupName, permissionHandler.getPrimaryGroup(goodPlayerName));
}
/**
* Test of isMemberOfGroup method, of class PermissionHandlerGroupManager.
*/
@Test
public void testIsMemberOfGroup()
{
Assert.assertTrue("isMemberOfGroup should return true with GroupManager, correct"
+ " player and correct group",
permissionHandler.isMemberOfGroup(goodPlayerName, goodGroupName));
Assert.assertFalse("isMemberOfGroup should return false with GroupManager, incorrect"
+ " player and correct group",
permissionHandler.isMemberOfGroup(badPlayerName, goodGroupName));
Assert.assertFalse("isMemberOfGroup should return false with GroupManager, correct"
+ " player and incorrect group",
permissionHandler.isMemberOfGroup(goodPlayerName, noexistGroupName));
Assert.assertFalse("isMemberOfGroup should return false with GroupManager, incorrect"
+ " player and incorrect group",
permissionHandler.isMemberOfGroup(badPlayerName, noexistGroupName));
}
/**
* Test of isPrimaryGroup method, of class PermissionHandlerGroupManager
*/
@Test
public void testIsPrimaryGroup()
{
Assert.assertTrue("isPrimaryGroup() should return true with valid player/group combo",
permissionHandler.isPrimaryGroup(goodPlayerName, goodGroupName));
Assert.assertFalse("isPrimaryGroup() should return false with valid player, wrong group",
permissionHandler.isPrimaryGroup(goodPlayerName, noexistGroupName));
Assert.assertFalse("isPrimaryGroup() should return false with invalid player",
permissionHandler.isPrimaryGroup(badPlayerName, goodGroupName));
}
}
| [
"iain@ruhlendavis.org"
] | iain@ruhlendavis.org |
ecc78198f17323b70b02d0f9c3c5242ad3b1532e | 542f7a91eba50f634158eaca6840c2dd3cbc921c | /on-line-video-system/on-line-video-oauth/src/main/java/com/video/oauth/OauthApplication.java | cb1754238f21a1c5e168eb48ca73abaf4e6b44fa | [] | no_license | LuisRain/on-line-video | a640bdff0cf3f08eb9871565b0d97560213f01e7 | bb46c85ee21a713fbadffc1699a03e9485967c88 | refs/heads/master | 2020-04-03T06:52:52.900347 | 2018-09-14T11:49:24 | 2018-09-14T11:49:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package com.video.oauth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
@SpringBootApplication
@EnableDiscoveryClient
@EnableEurekaClient
@EnableAuthorizationServer
public class OauthApplication {
public static void main(String[] args) {
SpringApplication.run(OauthApplication.class, args);
}
}
| [
"qinyuchu.huantian@gmail.com"
] | qinyuchu.huantian@gmail.com |
cc109fdbd98bc576574cdfd01be8d6cea24fbbed | 8b750bf14b29c5eb93afde381dcca8acf7bfca48 | /PeopleFinder/src/PersonDetails.java | f23605b10ce3126b0b7afd7fdc9e5063f4ca12fb | [] | no_license | Olukoya/PeopleFinder | 3eca857831a9c0fda407a124be10f9aca8eab53f | acb7c9c3e85c4caa6a12fe291dcbb9efbbe4d70b | refs/heads/master | 2020-04-06T16:54:43.147911 | 2015-08-24T17:47:01 | 2015-08-24T17:47:01 | 41,318,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,449 | java | import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/PersonDetails")
public class PersonDetails extends HttpServlet
{
static String title, fname,lname,address,email,position,person, fullname, coyname, zip,id,cityID,stateID="";
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html");
String singleP = req.getParameter("individual");
if (singleP != null)
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:testuser/password@localhost","testdb","password");
Statement st=con.createStatement();
System.out.println("connection established successfully...!!");
ResultSet rs=st.executeQuery("select * from CUSTOMERS where FULLNAME ='"+singleP+"'");
person+= "<table border=1>";
person+= "<tr><th>Fullname</th>"
+ "<th>Title</th>"
+ "<th>First Name</th>"
+ "<th>Last Name</th>"
+ "<th>Address</th>"
+ "<th>Zip Code</th>"
+ "<th>Email</th>"
+ "<th>Position</th>"
+ "<th>ID</th>"
+ "<th>City ID</th>"
+ "<th>State ID</th>"
+ "</tr>";
while(rs.next())
{
fullname = rs.getString("FULLNAME");
title = rs.getString("TITLE");
fname = rs.getString("FIRSTNAME");
lname = rs.getString("LASTNAME");
address = rs.getString("STREETADDRESS");
zip = rs.getString("ZIPCODE");
email = rs.getString("EMAILADDRESS");
position = rs.getString("POSITION");
id = rs.getString("ID");
cityID = rs.getString("CITYID");
stateID = rs.getString("STATEID");
person+="<tr><td>"+fullname
+"</td><td>"+title
+"</td><td>"+fname
+"</td><td>"+lname
+"</td><td>"+address
+"</td><td>"+zip
+"</td><td>"+email
+"</td><td>"+position
+"</td><td>"+id
+"</td><td>"+cityID
+"</td><td>"+stateID
+"</td></tr>";
}
con.close();
}
catch (Exception e){
e.printStackTrace();
}
req.setAttribute("message",person);
getServletContext().getRequestDispatcher("/SearchOutput.jsp").forward(req, res);
}
}
protected void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
}
} | [
"olu.dehinsilu@gmail.com"
] | olu.dehinsilu@gmail.com |
9468c6326ea4a7e98d28b040347034d712b448f1 | 1b745451ebab5b805a266ec140bc69df29857cd4 | /InterviewPrep/src/org/ip/string/PhoneMnemonicRecursive.java | f4ab0ec56c5a04db1556ed567244606942348c01 | [] | no_license | jdesjean/InterviewPrep | 36f8c2b877f221f60c7630c9943a395e9efe3f13 | 26aa0bc3fbfc05e366dc917f3706246cc3796c4c | refs/heads/master | 2022-05-01T03:04:45.845998 | 2022-04-22T14:52:31 | 2022-04-22T14:52:31 | 79,151,269 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package org.ip.string;
import org.ip.string.Visitors.CharArrayVisitor;
// EPI: 7.7
public class PhoneMnemonicRecursive {
char[][] PHONE_MAP = new char[][] {{' '}, {' '}, {'a', 'b', 'c'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}, {'j', 'k', 'l'}, {'m','n','o'}, {'p', 'q', 'r', 's'}, {'t', 'u', 'v'}, {'w', 'x', 'y', 'z'}};
public static void main(String[] s) {
PhoneMnemonicRecursive mnemonic = new PhoneMnemonicRecursive();
mnemonic.generate(new int[] {2,2,7,6,6,9,6}, (char[] array, int length) -> {org.ip.array.Utils.println(array, length);} );
}
public void generate(int[] number, CharArrayVisitor visitor) {
generate(number, new char[number.length], 0, visitor);
}
private void generate(int[] number, char[] mnemonic, int write, CharArrayVisitor visitor) {
if (write >= number.length) {
visitor.visit(mnemonic, number.length);
return;
}
for (int i = 0; i < PHONE_MAP[number[write]].length; i++) {
mnemonic[write] = PHONE_MAP[number[write]][i];
generate(number, mnemonic, write + 1, visitor);
}
}
}
| [
"jf.desjeans.gauthier@gmail.com"
] | jf.desjeans.gauthier@gmail.com |
16cd35512bc201afe851bd9c1f3a1b994e49f84b | 9e355b305de383abe70a0a84f9ec1e2c45a958a0 | /src/main/java/com/demo/test/controller/UserController.java | 103e324635d9cb463ccf4f702395376e292466c1 | [] | no_license | wyl0903/ssm | c70b302806bf55093e48061e0c61544efe358570 | 3fd3c7c2cd3f6f73c2c0ec462779dabbbbd46832 | refs/heads/master | 2020-09-20T05:20:37.103450 | 2017-06-16T03:22:56 | 2017-06-16T03:22:56 | 94,500,727 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package com.demo.test.controller;
import com.demo.test.model.User;
import com.demo.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
/**
* Created by ylwu on 2017/6/15.
*/
@Controller
public class UserController {
public UserController(){
System.out.println("-----------init-------------");
}
//service类
@Autowired
private UserService userService;
/**
* 查找所用用户控制器方法
* @return
* @throws Exception
*/
@RequestMapping("/findUser")
public ModelAndView findUser()throws Exception{
ModelAndView modelAndView = new ModelAndView();
//调用service方法得到用户列表
List<User> users = userService.findUser();
//将得到的用户列表内容添加到ModelAndView中
modelAndView.addObject("users",users);
//设置响应的jsp视图
modelAndView.setViewName("findUser");
return modelAndView;
}
}
| [
"573242882@qq.com"
] | 573242882@qq.com |
513831d8e5f09c57e347612df8048bcef0b736cb | 8455a897d1b459f2edd14f2b8eeafb2cda6d1916 | /src/main/java/com/ibm/coh/applicantregistry/ws/data/BankAccountDTO.java | 8d5a0243c94a9e8e491edc4a1aee1f64911eb0d8 | [] | no_license | ataxexe/fuse-example | dde9136b1f6efc75c326896f2d0f3c43a73b479c | ece8d609ca763ccdb0b71b9ea9c96c4e73b8b01b | refs/heads/master | 2023-03-11T04:15:34.266600 | 2021-02-25T16:49:43 | 2021-02-25T16:49:43 | 341,557,616 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package com.ibm.coh.applicantregistry.ws.data;
public class BankAccountDTO {
private String iban;
// when opening, need to know whether had come from register -> was readonly
private boolean readOnlyWhenSaved;
public String getIban() {
return iban;
}
public void setIban(String iban) {
this.iban = iban;
}
public boolean isReadOnlyWhenSaved() {
return readOnlyWhenSaved;
}
public void setReadOnlyWhenSaved(boolean readOnly) {
this.readOnlyWhenSaved = readOnly;
}
}
| [
"ataxexe@backpackcloud.com"
] | ataxexe@backpackcloud.com |
268b3506f60cf44e284fd1aa4b2d9941ca862e89 | 1eb7912c41d6c26cc3103b4de9a17e323d13a3fb | /src/第四章习题四/第六题/SIMofChinaUnicom.java | bed80360161fd334782bb5763fe2efb15954d5fd | [] | no_license | msskx/java_homework | 3cb294b549f76b9e776c3a55421109a4f0bb51f6 | 8870f41f2a98a9548177f68a94a65385e6cf1ded | refs/heads/master | 2023-08-25T01:29:33.014185 | 2021-11-08T10:55:19 | 2021-11-08T10:55:19 | 415,956,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package 第四章习题四.第六题;
/**
* @ClassName SIMofChinaUnicom
* @Description
* @Author msskx
* @Date 2021/9/29 14:45
* @Version 1.0
**/
public class SIMofChinaUnicom extends SIM{
public SIMofChinaUnicom() {
this.corpName = "中国联通";
}
}
| [
"2690438874@qq.com"
] | 2690438874@qq.com |
9feb3e8af358d942b53b427e79e0e2433a46488c | fe124f7e947cc61cdb16b9ac8dac04c3b581acd0 | /JavaSource/com/jrapid/demohr/dao/hibernate/HibernateVacationRequestDAO.java | e912c9954a2f4f6063c00cb5318e1ea66cba481f | [] | no_license | jrapid/demo | a612ff939017fadcef0bd3b48e23ff4f92935e58 | 76bd46ab917d7fde779511e7c3ff9b4e4c8fab9b | refs/heads/master | 2021-01-25T08:28:30.760889 | 2011-03-16T18:42:50 | 2011-03-16T18:42:50 | 1,488,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java |
package com.jrapid.demohr.dao.hibernate;
import com.jrapid.demohr.dao.VacationRequestDAO;
public class HibernateVacationRequestDAO extends HibernateVacationRequestDAOAbstract implements VacationRequestDAO {
}
| [
"info@jrapid.com"
] | info@jrapid.com |
5bbba1b122946dff3beef4d3a92336b87a93eceb | 9b23ee83d4f056ac982ab08dd3fd8c11e7d7880a | /com.technophobia.substeps.tests.acceptance/src/main/java/com/technophobia/substeps/test/controller/SWTController.java | 385a85a4ea844db08ffa476e2d94c432b9d9430d | [] | no_license | adrianriley/substeps-eclipse-plugin | 0401464394fe97794fa717ea8c13c52bdf4c4c80 | 554a359adb19d491814e1f3d0d7c4dd5f2d3eba2 | refs/heads/master | 2021-01-21T01:35:01.270585 | 2012-10-11T12:57:08 | 2012-10-11T12:57:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 100 | java | package com.technophobia.substeps.test.controller;
public interface SWTController {
// No-op
}
| [
"mr.stu.forbes@gmail.com"
] | mr.stu.forbes@gmail.com |
4e652add22f6dcc3e3d4b48ab1a23b47b7818331 | 740c547edbb94ea43b43da6d2287ac80b353a83f | /src/common/GetLatestTweets.java | 86cb4354c44422d88d701732dfff47272df9966d | [
"MIT"
] | permissive | jingwei-yang/TrackingEmotion | fe8ace2f712a58aa9e35d3ada0805327bef2e51e | 5a0afad6c7e5b50e0b7d4ed24899d9ba49f58960 | refs/heads/master | 2021-05-30T12:27:18.381527 | 2015-11-07T22:44:56 | 2015-11-07T22:44:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package common;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
/**
* Servlet implementation class GetLatestTweets
*/
@WebServlet("/GetLatestTweets")
public class GetLatestTweets extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public GetLatestTweets() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
if (TweetsCollection.getSize() > 0) {
//response.getWriter().write("Something for you!");
TweetInfo temp_tweet = TweetsCollection.getNewTweet();
JSONObject temp_json = new JSONObject(temp_tweet.dict);
System.out.println("The JSON String sent to front end :" + temp_json.toString());
response.getWriter().write(temp_json.toString());
} else {
response.getWriter().write("null");
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"350609633@qq.com"
] | 350609633@qq.com |
1abe52801d9d002007e76df072ea0277f979f80a | a386a1e186871d9766f8c28b010d2157ecc4ea3e | /Swimming.java | 66430530589774221f3baa02dd46d2ad35f777f3 | [] | no_license | ThanhLam3096/ResortFurama | a8e4f22c558489d729f0f949f83db6a3199816e7 | e111ad89986f7520a00b629a761505872c6a47a2 | refs/heads/master | 2020-06-29T20:13:21.319792 | 2019-08-05T08:30:47 | 2019-08-05T08:30:47 | 200,613,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | java | package ResortFurama;
public class Swimming extends Customer {
private float timeToOpen;
private float timeToClose;
private float timeSwimming;
public Swimming(){
}
public Swimming(float timeToOpen,float timeToClose,float timeSwimming){
this.timeToOpen = timeToOpen;
this.timeToClose = timeToClose;
this.timeSwimming = timeSwimming;
}
public float getTimeToOpen() {
return timeToOpen;
}
public void setTimeToOpen(float timeToOpen) {
this.timeToOpen = timeToOpen;
}
public float getTimeToClose() {
return timeToClose;
}
public void setTimeToClose(float timeToClose) {
this.timeToClose = timeToClose;
}
public float getTimeSwimming() {
return timeSwimming;
}
public void setTimeSwimming(float timeSwimming) {
this.timeSwimming = timeSwimming;
}
public void openSwim(){
System.out.println("Time to Open begin At : " + getTimeToOpen() + "h to " + getTimeToClose() + "h close" );
}
public void CheckOpenTime(){
if(getTimeSwimming() < getTimeToOpen() || getTimeSwimming() > getTimeToClose()){
System.out.println("Sorry Service Stop Come Back " + getTimeToOpen() + "h");
}
else{
System.out.println("Welcome ");
}
}
}
| [
"lethanhlam3096@gmail.com"
] | lethanhlam3096@gmail.com |
a15c58d7a11d6744dd62c514c5449664a23e2a1f | b9b318e807f3bee24a6ae54e5b36a05a36a3e456 | /src/main/java/com/init/MvcConfiguration.java | 38de97d5affe6c05022ee38b3af64924ec346385 | [] | no_license | Mellez/EwaWebshop6.0 | 1eaf1576f725249dea55987351261a5e5e6f687a | 48608d5a5cce9c70c6da13a4f816ab56cccf4dba | refs/heads/master | 2016-09-06T07:56:38.056735 | 2014-11-11T12:06:18 | 2014-11-11T12:06:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,150 | java | package com.init;
import java.util.Properties;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
@ComponentScan(basePackages = "com")
@EnableWebMvc
@EnableTransactionManagement
@PropertySource("classpath:application.properties")
public class MvcConfiguration extends WebMvcConfigurerAdapter {
private static final String PROPERTY_NAME_DATABASE_DRIVER = "db.driver";
private static final String PROPERTY_NAME_DATABASE_PASSWORD = "db.password";
private static final String PROPERTY_NAME_DATABASE_URL = "db.url";
private static final String PROPERTY_NAME_DATABASE_USERNAME = "db.username";
private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "hibernate.dialect";
private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "hibernate.show_sql";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN = "entitymanager.packages.to.scan";
private static final String PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO = "hibernate.hbm2ddl.auto";
@Resource
private Environment env;
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(env.getRequiredProperty(PROPERTY_NAME_DATABASE_DRIVER));
dataSource.setUrl(env.getRequiredProperty(PROPERTY_NAME_DATABASE_URL));
dataSource.setUsername(env.getRequiredProperty(PROPERTY_NAME_DATABASE_USERNAME));
dataSource.setPassword(env.getRequiredProperty(PROPERTY_NAME_DATABASE_PASSWORD));
return dataSource;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource());
sessionFactoryBean.setPackagesToScan(env.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
sessionFactoryBean.setHibernateProperties(hibProperties());
return sessionFactoryBean;
}
private Properties hibProperties() {
Properties properties = new Properties();
properties.put(PROPERTY_NAME_HIBERNATE_DIALECT, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT));
properties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));
properties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO));
return properties;
}
@Bean
public HibernateTransactionManager transactionManager() {
HibernateTransactionManager transactionManager = new HibernateTransactionManager();
transactionManager.setSessionFactory(sessionFactory().getObject());
return transactionManager;
}
@Bean
public ViewResolver getViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/jsp/");
resolver.setSuffix(".jsp");
return resolver;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("resources/**").addResourceLocations("resources/");
}
}
| [
"mbmelle@gmail.com"
] | mbmelle@gmail.com |
3852df49597ea3d14e5b6b27925d281f8903c5f5 | 9c2757da02d8ec1f2954246090a0ba75af7f7a41 | /src/main/java/com/assign/features/BoundedFeatureExtractor.java | b0927368d2a708189694ca07192e8d62eedaeb89 | [] | no_license | Kajanan/Similarity | 8d7ce576d35c784d82d190c99511b7026ed4e759 | 4443e6c920690f49e4403d92e47bb0041d583db3 | refs/heads/master | 2016-09-06T17:41:09.424061 | 2016-01-19T05:47:19 | 2016-01-19T05:47:19 | 30,587,572 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,664 | java | /*
* LingPipe v. 3.9
* Copyright (C) 2003-2010 Alias-i
*
* This program is licensed under the Alias-i Royalty Free License
* Version 1 WITHOUT ANY WARRANTY, without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Alias-i
* Royalty Free License Version 1 for more details.
*
* You should have received a copy of the Alias-i Royalty Free License
* Version 1 along with this program; if not, visit
* http://alias-i.com/lingpipe/licenses/lingpipe-license-1.txt or contact
* Alias-i, Inc. at 181 North 11th Street, Suite 401, Brooklyn, NY 11211,
* +1 (718) 290-9170.
*/
package com.assign.features;
import com.assign.util.AbstractExternalizable;
import com.assign.util.FeatureExtractor;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* A {@code BoundedFeatureExtractor} provides a lower-bound and
* upper-bound on feature values between which all values from a
* contained base extractor are bounded. Values greater than the
* upper bound are replaced with the upper bound, and values less than
* the lower bound are replaced with the lower bound. Values may be
* unbounded below by using {@link Double#NEGATIVE_INFINITY} as the
* lower bound, and may be unbounded above by using {@link
* Double#POSITIVE_INFINITY} the upper bound.
*
* @author Mike Ross
* @author Bob Carpenter
* @version 3.8
* @since Lingpipe3.8
* @param <E> The type of objects whose features are extracted.
*/
public class BoundedFeatureExtractor<E>
extends ModifiedFeatureExtractor<E>
implements Serializable {
static final long serialVersionUID = -5628628360712035433L;
private final double mMinValue;
private final double mMaxValue;
private final Number mMinValueNumber;
private final Number mMaxValueNumber;
/**
* Construct a bounded feature extractor that bounds the feature
* values produced by the specified extractor to be within the
* specified minimum and maximum values.
*
* @param extractor Base feature extractor.
* @param minValue Minimum value of a feature
* @param maxValue Maximum value of a feature
* @throws IllegalArgumentException If {@code minVal > maxVal}
*/
public BoundedFeatureExtractor(FeatureExtractor<? super E> extractor,
double minValue,
double maxValue) {
super(extractor);
if (minValue > maxValue) {
String msg = "Require minValue <= maxValue."
+ " Found minValue=" + minValue
+ " maxValue=" + maxValue;
throw new IllegalArgumentException(msg);
}
mMinValue = minValue;
mMaxValue = maxValue;
mMinValueNumber = Double.valueOf(minValue);
mMaxValueNumber = Double.valueOf(maxValue);
}
/**
* Return the bounded value corresponding to the specified value.
* The feature name is ignored.
*
* @param feature Name of feature, which is ignored.
* @return The bounded value.
*/
@Override
public Number filter(String feature, Number value) {
double v = value.doubleValue();
if (v < mMinValue)
return mMinValueNumber;
if (v > mMaxValue)
return mMaxValueNumber;
return value;
}
Object writeReplace() {
return new Serializer<E>(this);
}
static class Serializer<F> extends AbstractExternalizable {
static final long serialVersionUID = 6365515337527915147L;
private final BoundedFeatureExtractor<F> mBFExtractor;
public Serializer() {
this(null);
}
public Serializer(BoundedFeatureExtractor<F> extractor) {
mBFExtractor = extractor;
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeDouble(mBFExtractor.mMinValue);
out.writeDouble(mBFExtractor.mMaxValue);
out.writeObject(mBFExtractor.baseExtractor());
}
@Override
public Object read(ObjectInput in)
throws IOException, ClassNotFoundException {
double minValue = in.readDouble();
double maxValue = in.readDouble();
@SuppressWarnings("unchecked")
// required for deserialization
FeatureExtractor<? super F> extractor = (FeatureExtractor<? super F>) in
.readObject();
return new BoundedFeatureExtractor<F>(extractor,minValue,maxValue);
}
}
}
| [
"skajanan@singtel.com"
] | skajanan@singtel.com |
cf56b27a79a5a358b9bb14cadb415bb6fa08f644 | b6eb0ecadbb70ed005d687268a0d40e89d4df73e | /feilong-lib/feilong-lib-jsonlib/src/main/java/com/feilong/lib/ezmorph/array/FloatArrayMorpher.java | e55a77c125a7d6b5ed84a7d1f1c136be44cfb6a4 | [
"Apache-2.0"
] | permissive | ifeilong/feilong | b175d02849585c7b12ed0e9864f307ed1a26e89f | a0d4efeabc29503b97caf0c300afe956a5caeb9f | refs/heads/master | 2023-08-18T13:08:46.724616 | 2023-08-14T04:30:34 | 2023-08-14T04:30:34 | 252,767,655 | 97 | 28 | Apache-2.0 | 2023-04-17T17:47:44 | 2020-04-03T15:14:35 | Java | UTF-8 | Java | false | false | 3,191 | java | /*
* Copyright (C) 2008 feilong
*
* 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.feilong.lib.ezmorph.array;
import java.lang.reflect.Array;
import com.feilong.lib.ezmorph.MorphException;
import com.feilong.lib.ezmorph.primitive.FloatMorpher;
/**
* Morphs an array to a float[].
*
* @author <a href="mailto:aalmiray@users.sourceforge.net">Andres Almiray</a>
*/
public final class FloatArrayMorpher extends AbstractArrayMorpher{
private static final Class<?> FLOAT_ARRAY_CLASS = float[].class;
/** The default value. */
private float defaultValue;
//---------------------------------------------------------------
/**
* Instantiates a new float array morpher.
*/
public FloatArrayMorpher(){
super(false);
}
/**
* Instantiates a new float array morpher.
*
* @param defaultValue
* return value if the value to be morphed is null
*/
public FloatArrayMorpher(float defaultValue){
super(true);
this.defaultValue = defaultValue;
}
/**
* Returns the default value for this Morpher.
*
* @return the default value
*/
public float getDefaultValue(){
return defaultValue;
}
/**
* Morph.
*
* @param array
* the array
* @return the object
*/
@Override
public Object morph(Object array){
if (array == null){
return null;
}
if (FLOAT_ARRAY_CLASS.isAssignableFrom(array.getClass())){
// no conversion needed
return array;
}
if (array.getClass().isArray()){
int length = Array.getLength(array);
int dims = getDimensions(array.getClass());
int[] dimensions = createDimensions(dims, length);
Object result = Array.newInstance(float.class, dimensions);
FloatMorpher morpher = isUseDefault() ? new FloatMorpher(defaultValue) : new FloatMorpher();
if (dims == 1){
for (int index = 0; index < length; index++){
Array.set(result, index, morpher.morph(Array.get(array, index)));
}
}else{
for (int index = 0; index < length; index++){
Array.set(result, index, morph(Array.get(array, index)));
}
}
return result;
}
throw new MorphException("argument is not an array: " + array.getClass());
}
/**
* Morphs to.
*
* @return the class
*/
@Override
public Class<?> morphsTo(){
return FLOAT_ARRAY_CLASS;
}
} | [
"venusdrogon@163.com"
] | venusdrogon@163.com |
cc5c0146549e6299bc5a88a68cd0260858e116ff | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /sgw-20180511/src/main/java/com/aliyun/sgw20180511/models/DescribeExpressSyncSharesRequest.java | bb904bbe04d3c3ccb508d3ceff19be8ad145f856 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,327 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sgw20180511.models;
import com.aliyun.tea.*;
public class DescribeExpressSyncSharesRequest extends TeaModel {
@NameInMap("ExpressSyncIds")
public String expressSyncIds;
@NameInMap("IsExternal")
public Boolean isExternal;
@NameInMap("SecurityToken")
public String securityToken;
public static DescribeExpressSyncSharesRequest build(java.util.Map<String, ?> map) throws Exception {
DescribeExpressSyncSharesRequest self = new DescribeExpressSyncSharesRequest();
return TeaModel.build(map, self);
}
public DescribeExpressSyncSharesRequest setExpressSyncIds(String expressSyncIds) {
this.expressSyncIds = expressSyncIds;
return this;
}
public String getExpressSyncIds() {
return this.expressSyncIds;
}
public DescribeExpressSyncSharesRequest setIsExternal(Boolean isExternal) {
this.isExternal = isExternal;
return this;
}
public Boolean getIsExternal() {
return this.isExternal;
}
public DescribeExpressSyncSharesRequest setSecurityToken(String securityToken) {
this.securityToken = securityToken;
return this;
}
public String getSecurityToken() {
return this.securityToken;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
eb304fb519bbf9393e0c90d4a541a6fe0315e48d | af51fbabd3a9598e563aa7caaaa5d8a857ffcab9 | /StackExchangeClient/app/src/main/java/ru/arturvasilov/stackexchangeclient/api/service/UserInfoService.java | 80e9f0474f0ccad127118c644df264eaf4d0a1a2 | [] | no_license | ArturVasilov/UdacityNanodegree | 89ae19f9af674a13e819de9a29cc97ecf569e946 | 8e31f7c3ef25dc1bf6ee2f610e0b809fd3816add | refs/heads/master | 2020-04-06T07:12:14.189469 | 2016-09-04T21:12:44 | 2016-09-04T21:12:44 | 61,553,165 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | package ru.arturvasilov.stackexchangeclient.api.service;
import android.support.annotation.NonNull;
import retrofit2.http.GET;
import retrofit2.http.Path;
import ru.arturvasilov.stackexchangeclient.model.response.BadgeResponse;
import ru.arturvasilov.stackexchangeclient.model.response.UserResponse;
import ru.arturvasilov.stackexchangeclient.model.response.UserTagResponse;
import rx.Observable;
/**
* @author Artur Vasilov
*/
public interface UserInfoService {
@NonNull
@GET("/me")
Observable<UserResponse> getCurrentUser();
@NonNull
@GET("/users/{ids}/badges?pagesize=10&order=desc&sort=rank")
Observable<BadgeResponse> badges(@Path("ids") int userId);
@NonNull
@GET("/users/{id}/top-tags?pagesize=10")
Observable<UserTagResponse> topTags(@Path("id") int userId);
}
| [
"artur.vasilov@dz.ru"
] | artur.vasilov@dz.ru |
857f9686440abb3d60409b7145fe1b0d6f0f4a5d | c54b1345f89c0d9f0878b2bfa13333362d8800b5 | /app/src/main/java/com/pucese/appturistica/Adapter.java | a8038bd787d7114ae91ccb8e6b4b5fc9bb993f9a | [] | no_license | Sojome/AppTuristica | 9256e6f482a394c2cdc6407e70f48de4ac42344d | e93c0edd3c0dcd37beed79b6c698b15d408282db | refs/heads/master | 2022-11-30T06:50:36.480471 | 2020-08-06T05:19:20 | 2020-08-06T05:19:20 | 282,068,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,837 | java | package com.pucese.appturistica;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class Adapter extends RecyclerView.Adapter<Adapter.MyViewHolder> {
String data1[], data2[], data3[];
int images[];
Context context;
public Adapter(Context ct, String s1[], String s2[], String s3[], int img[]){
context = ct;
data1 = s1;
data2 = s2;
data3 = s3;
images = img;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.cardview_picture, parent, false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
holder.myText1.setText(data1[position]);
holder.myText2.setText(data2[position]);
holder.myText3.setText(data3[position]);
holder.myimage.setImageResource(images[position]);
}
@Override
public int getItemCount() {
return images.length;
}
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView myText1, myText2, myText3;
ImageView myimage;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
myText1 = itemView.findViewById(R.id.userNameCard);
myText2 = itemView.findViewById(R.id.timeCard);
myText3 = itemView.findViewById(R.id.likeNumberCard);
myimage = itemView.findViewById(R.id.pictureCard);
}
}
}
| [
"sojome@outlook.com"
] | sojome@outlook.com |
7b7c8b5036b6652be542a375d4d4dde2b6362f56 | 72bf7b3c0ac194703cb91d954dd9e611acf88865 | /PokemonToronto/core/src/com/pokemon/toronto/game/com/pokemon/toronto/Pokemon/kanto/part_2/Machop.java | 0bbb9d4d12b54ff761fdeb9034950d4fc0487e82 | [] | no_license | amitkpandey/pokemon | a41537ac3d05bfd85b73730316eaf82d9ae37776 | 51d62203b28147511d96ed4e2cbfd60c8777e76f | refs/heads/master | 2022-04-27T02:48:50.607800 | 2020-04-26T00:24:26 | 2020-04-26T00:24:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,819 | java | package com.pokemon.toronto.game.com.pokemon.toronto.Pokemon.kanto.part_2;
import com.pokemon.toronto.game.com.pokemon.toronto.Pokemon.attributes.Ability;
import com.pokemon.toronto.game.com.pokemon.toronto.Pokemon.attributes.Nature;
import com.pokemon.toronto.game.com.pokemon.toronto.Pokemon.Pokemon;
import com.pokemon.toronto.game.com.pokemon.toronto.Pokemon.attributes.PokemonId;
import com.pokemon.toronto.game.com.pokemon.toronto.item.TmId;
import com.pokemon.toronto.game.com.pokemon.toronto.skill.Skill;
import com.pokemon.toronto.game.com.pokemon.toronto.skill.SkillFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by Gregory on 9/16/2017.
*/
public class Machop extends Pokemon {
/** Init Variables */
//Basic (id, name, exp, ev yield, capture rate)
public static final int NUMBER = 66;
public static final String NAME = "Machop";
public static final String TYPE_OF_POKEMON = "Superpower";
public static final String DESCRIPTION = "It hefts a Graveler repeatedly to strengthen" +
" its entire body. It uses every type of martial arts.";
public static final int BASE_EXP = 75;
public static final int[] EV_YIELD = {0, 1, 0, 0, 0, 0};
public static final int CAPTURE_RATE = 180;
public static final double HEIGHT = 0.8;
public static final double WEIGHT = 19.5;
public static final Ability FIRST_ABILITY = new Ability.Guts();
public static final Ability SECOND_ABILITY = new Ability.NoGuard();
public static final Ability HIDDEN_ABILITY = new Ability.Steadfast();
//Base Stats
public static final int BASE_HEALTH = 70;
public static final int BASE_ATTACK = 80;
public static final int BASE_DEFENSE = 50;
public static final int BASE_SPECIAL_ATTACK = 35;
public static final int BASE_SPECIAL_DEFENSE = 35;
public static final int BASE_SPEED = 35;
//Typing
public static final Type TYPE_ONE = Type.FIGHTING;
public static final Type TYPE_TWO = Type.NONE;
//Exp
public static final ExpType EXP_TYPE = ExpType.MEDIUM_SLOW;
//Image Paths
public static final String ICON_PATH = "pokemonSprites/machop.png";
public static final String BACK_PATH = "battle/backs/machop.png";
public static final String MINI_PATH = "pokemonMenu/sprites/machop.png";
public static final String CRY_PATH = "sounds/cry/066.wav";
public static final String PROFILE_PATH = "trainercard/pokemon/kanto/066.png";
/**
* Create a Machop
*/
public Machop() {
super(NUMBER, NAME, TYPE_OF_POKEMON, DESCRIPTION, TYPE_ONE, TYPE_TWO, EXP_TYPE,
BASE_EXP, EV_YIELD, new int[]{BASE_HEALTH, BASE_ATTACK, BASE_DEFENSE,
BASE_SPECIAL_ATTACK, BASE_SPECIAL_DEFENSE, BASE_SPEED}, ICON_PATH,
BACK_PATH, MINI_PATH, CRY_PATH, PROFILE_PATH, CAPTURE_RATE, WEIGHT, HEIGHT, FIRST_ABILITY,
SECOND_ABILITY, HIDDEN_ABILITY);
}
@Override
protected void initGender() {
double genderProbability = Math.random();
if (genderProbability <= .75) {
gender = 'M';
} else {
gender = 'F';
}
}
/**
* Init Machop's level up skills.
*/
@Override
protected void initLevelUpSkills() {
List<Integer> beginnerSkills = new ArrayList<Integer>();
beginnerSkills.add(SkillFactory.LOW_KICK);
beginnerSkills.add(SkillFactory.LEER);
levelUpSkills.put(0, beginnerSkills);
levelUpSkills.put(3, new ArrayList<Integer>(Arrays.asList(SkillFactory.FOCUS_ENERGY)));
levelUpSkills.put(7, new ArrayList<Integer>(Arrays.asList(SkillFactory.KARATE_CHOP)));
//TODO: FORESIGHT 9
levelUpSkills.put(13, new ArrayList<Integer>(Arrays.asList(SkillFactory.LOW_SWEEP)));
levelUpSkills.put(15, new ArrayList<Integer>(Arrays.asList(SkillFactory.SEISMIC_TOSS)));
levelUpSkills.put(19, new ArrayList<Integer>(Arrays.asList(SkillFactory.REVENGE)));
levelUpSkills.put(21, new ArrayList<Integer>(Arrays.asList(SkillFactory.KNOCK_OFF)));
levelUpSkills.put(25, new ArrayList<Integer>(Arrays.asList(SkillFactory.VITAL_THROW)));
levelUpSkills.put(27, new ArrayList<Integer>(Arrays.asList(SkillFactory.WAKE_UP_SLAP)));
levelUpSkills.put(31, new ArrayList<Integer>(Arrays.asList(SkillFactory.DUAL_CHOP)));
levelUpSkills.put(33, new ArrayList<Integer>(Arrays.asList(SkillFactory.SUBMISSION)));
levelUpSkills.put(37, new ArrayList<Integer>(Arrays.asList(SkillFactory.BULK_UP)));
levelUpSkills.put(39, new ArrayList<Integer>(Arrays.asList(SkillFactory.CROSS_CHOP)));
levelUpSkills.put(43, new ArrayList<Integer>(Arrays.asList(SkillFactory.SCARY_FACE)));
levelUpSkills.put(45, new ArrayList<Integer>(Arrays.asList(SkillFactory.DYNAMIC_PUNCH)));
}
@Override
protected void initTMSkills() {
tmSkills.add(TmId.WORK_UP.getValue());
tmSkills.add(TmId.TOXIC.getValue());
tmSkills.add(TmId.BULK_UP.getValue());
tmSkills.add(TmId.HIDDEN_POWER.getValue());
tmSkills.add(TmId.SUNNY_DAY.getValue());
tmSkills.add(TmId.LIGHT_SCREEN.getValue());
tmSkills.add(TmId.PROTECT.getValue());
tmSkills.add(TmId.RAIN_DANCE.getValue());
tmSkills.add(TmId.FRUSTRATION.getValue());
tmSkills.add(TmId.SMACK_DOWN.getValue());
tmSkills.add(TmId.EARTHQUAKE.getValue());
tmSkills.add(TmId.RETURN.getValue());
tmSkills.add(TmId.BRICK_BREAK.getValue());
tmSkills.add(TmId.DOUBLE_TEAM.getValue());
tmSkills.add(TmId.FLAMETHROWER.getValue());
tmSkills.add(TmId.FIRE_BLAST.getValue());
tmSkills.add(TmId.ROCK_TOMB.getValue());
tmSkills.add(TmId.FACADE.getValue());
tmSkills.add(TmId.REST.getValue());
tmSkills.add(TmId.ATTRACT.getValue());
tmSkills.add(TmId.THIEF.getValue());
tmSkills.add(TmId.LOW_SWEEP.getValue());
tmSkills.add(TmId.ROUND.getValue());
tmSkills.add(TmId.FOCUS_BLAST.getValue());
tmSkills.add(TmId.FLING.getValue());
tmSkills.add(TmId.PAYBACK.getValue());
tmSkills.add(TmId.BULLDOZE.getValue());
tmSkills.add(TmId.ROCK_SLIDE.getValue());
tmSkills.add(TmId.POISON_JAB.getValue());
tmSkills.add(TmId.SWAGGER.getValue());
tmSkills.add(TmId.SLEEP_TALK.getValue());
tmSkills.add(TmId.SUBSTITUTE.getValue());
tmSkills.add(TmId.CONFIDE.getValue());
}
/**
* Return Machoke if Machop is 28
* @return Machoke if Machop is the right level.
*/
@Override
public int getLevelUpEvolutionId() {
if (level >= 28) {
return PokemonId.MACHOKE.getValue();
}
return -1;
}
}
| [
"gregory.kelsie@gmail.com"
] | gregory.kelsie@gmail.com |
f7976e1dfdd91dc977dbd048ef274b7cefe88787 | 21bcd1da03415fec0a4f3fa7287f250df1d14051 | /sources/org/jcodec/codecs/aac/ADTSParser.java | f878b006429bc84650298826ff413ff2a3ff0e89 | [] | no_license | lestseeandtest/Delivery | 9a5cc96bd6bd2316a535271ec9ca3865080c3ec8 | bc3fae8f30804a2520e6699df92c2e6a4a0a7cfc | refs/heads/master | 2022-04-24T12:14:22.396398 | 2020-04-25T21:50:29 | 2020-04-25T21:50:29 | 258,875,870 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,066 | java | package org.jcodec.codecs.aac;
import java.nio.ByteBuffer;
import org.jcodec.common.p554io.BitReader;
import org.jcodec.common.p554io.BitWriter;
public class ADTSParser {
public static class Header {
private int chanConfig;
private int crcAbsent;
private int numAACFrames;
private int objectType;
private int samples;
private int samplingIndex;
public Header(int i, int i2, int i3, int i4, int i5) {
this.objectType = i;
this.chanConfig = i2;
this.crcAbsent = i3;
this.numAACFrames = i4;
this.samplingIndex = i5;
}
public int getChanConfig() {
return this.chanConfig;
}
public int getCrcAbsent() {
return this.crcAbsent;
}
public int getNumAACFrames() {
return this.numAACFrames;
}
public int getObjectType() {
return this.objectType;
}
public int getSamples() {
return this.samples;
}
public int getSamplingIndex() {
return this.samplingIndex;
}
}
public static Header read(ByteBuffer byteBuffer) {
ByteBuffer duplicate = byteBuffer.duplicate();
BitReader bitReader = new BitReader(duplicate);
if (bitReader.readNBit(12) != 4095) {
return null;
}
bitReader.read1Bit();
bitReader.readNBit(2);
int read1Bit = bitReader.read1Bit();
int readNBit = bitReader.readNBit(2);
int readNBit2 = bitReader.readNBit(4);
bitReader.read1Bit();
int readNBit3 = bitReader.readNBit(3);
bitReader.read1Bit();
bitReader.read1Bit();
bitReader.read1Bit();
bitReader.read1Bit();
if (bitReader.readNBit(13) < 7) {
return null;
}
bitReader.readNBit(11);
int readNBit4 = bitReader.readNBit(2);
bitReader.stop();
byteBuffer.position(duplicate.position());
Header header = new Header(readNBit + 1, readNBit3, read1Bit, readNBit4 + 1, readNBit2);
return header;
}
public static ByteBuffer write(Header header, ByteBuffer byteBuffer, int i) {
ByteBuffer duplicate = byteBuffer.duplicate();
BitWriter bitWriter = new BitWriter(duplicate);
bitWriter.writeNBit(4095, 12);
bitWriter.write1Bit(1);
bitWriter.writeNBit(0, 2);
bitWriter.write1Bit(header.getCrcAbsent());
bitWriter.writeNBit(header.getObjectType(), 2);
bitWriter.writeNBit(header.getSamplingIndex(), 4);
bitWriter.write1Bit(0);
bitWriter.writeNBit(header.getChanConfig(), 3);
bitWriter.write1Bit(0);
bitWriter.write1Bit(0);
bitWriter.write1Bit(0);
bitWriter.write1Bit(0);
bitWriter.writeNBit(i + 7, 13);
bitWriter.writeNBit(0, 11);
bitWriter.writeNBit(header.getNumAACFrames(), 2);
bitWriter.flush();
duplicate.flip();
return duplicate;
}
}
| [
"zsolimana@uaedomain.local"
] | zsolimana@uaedomain.local |
f867310942056e85c22b6b0b93f3dfc4752295ec | 97e5a5c0a813c6dd6af340cbcea87805777b8093 | /drools-examples/src/main/java/co/com/jhilton/drools/descuentos/ejecutor/CalculadorDescuentos.java | d211280b68755b2941bcef4f215edd83ab5c2fc9 | [] | no_license | jhiltonatr/drools | 2ae16d6731fc3bf5516c21345a3bac3861801b9f | c1bcb849d636cce9539ede0249935e6cf7280eda | refs/heads/master | 2021-01-10T09:04:49.723380 | 2016-03-07T14:56:09 | 2016-03-07T14:56:09 | 53,136,553 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package co.com.jhilton.drools.descuentos.ejecutor;
import java.util.Arrays;
import java.util.List;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.StatelessKieSession;
import co.com.jhilton.drools.descuentos.model.Factura;
public class CalculadorDescuentos {
public void calcular(Factura factura) {
calcular(Arrays.asList(factura));
}
public void calcular(List<Factura> facturas) {
KieServices kService = KieServices.Factory.get();
KieContainer kContainer = kService.newKieClasspathContainer();
StatelessKieSession kSession = kContainer.newStatelessKieSession();
kSession.setGlobal("COLA_CORREOS", ColaCorreo.getCola());
kSession.execute(facturas);
}
}
| [
"jhilton.tamayo@techandsolve.com"
] | jhilton.tamayo@techandsolve.com |
841b0b3ee9ac965acaf922d66470660c89b3dbbc | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project9/src/test/java/org/gradle/test/performance9_2/Test9_164.java | 71406fadaa9a9891e577eb09a7970c355b87217a | [] | 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 | 288 | java | package org.gradle.test.performance9_2;
import static org.junit.Assert.*;
public class Test9_164 {
private final Production9_164 production = new Production9_164("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
57c3d454759c401f5bdcfccc976159878936ca0e | 380366cde7f499290a61f8372034744cae137a4e | /common/src/main/java/org/onap/so/moi/MoiAllocateRequest.java | cc4f02051d858ca09b24b274ac4940b010370e30 | [
"Apache-2.0"
] | permissive | onap/so | 82a219ed0e5559a94d630cc9956180dbab0d33b8 | 43224c4dc5ff3bf67979f480d8628f300497da07 | refs/heads/master | 2023-08-21T00:09:36.560504 | 2023-07-03T16:30:22 | 2023-07-03T16:30:55 | 115,077,083 | 18 | 25 | Apache-2.0 | 2022-03-21T09:59:49 | 2017-12-22T04:39:28 | Java | UTF-8 | Java | false | false | 1,897 | java | /*-
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
* Copyright (C) 2023 DTAG Intellectual Property. 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.
* ============LICENSE_END=========================================================
*/
package org.onap.so.moi;
import com.fasterxml.jackson.annotation.*;
import java.util.HashMap;
import java.util.Map;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"attributes"})
public class MoiAllocateRequest {
@JsonProperty("attributes")
private Attributes attributes;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("attributes")
public Attributes getAttributes() {
return attributes;
}
@JsonProperty("attributes")
public void setAttributes(Attributes attributes) {
this.attributes = attributes;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"abhishek.patil@t-systems.com"
] | abhishek.patil@t-systems.com |
ce78c355fdbc9de68ebc114195405e9f6550f9d9 | ff940cc8ecad5543a6ed7ba2e358f4a6dfd4dbb1 | /backend/src/main/java/com/devsuperior/dspesquisa/dto/GameDTO.java | 525fa078ee943f70d343f4f817adb19b7d63a4c1 | [] | no_license | ricardiobraga/dspesquisa | ca78a670c12a9d54bda87216828b8957d5f73b6a | 64be9e85eba6702d19b213a50e80bbc986e3cd91 | refs/heads/master | 2022-12-18T05:16:55.021035 | 2020-09-20T22:45:46 | 2020-09-20T22:45:46 | 295,590,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package com.devsuperior.dspesquisa.dto;
import java.io.Serializable;
import com.devsuperior.dspesquisa.entities.Game;
import com.devsuperior.dspesquisa.entities.enums.Platform;
public class GameDTO implements Serializable{
private static final long serialVersionUID = 1L;
private Long id;
private String title;
private Platform platform;
public GameDTO() {
}
public GameDTO(Game entity) {
id = entity.getId();
title = entity.getTitle();
platform = entity.getPlatform();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Platform getPlatform() {
return platform;
}
public void setPlatform(Platform platform) {
this.platform = platform;
}
}
| [
"rcardiobraga@gmail.com"
] | rcardiobraga@gmail.com |
4d1bf7ecab506a1705d71309ecd795f331c8a7ad | a1b0d7437af7c1543e313231162b92660217872a | /KKY/app/src/main/java/xyz/yikai/kky/base/BaseFragment.java | fbd1c55c5b9fe69557d896fc1dd3128e53262f59 | [] | no_license | KaiKeYi/KKY-Android | 3c05f99b36fdfacd0464bfc58dd50036ea5229da | bec87ef2fd3ae1647874fc23822fdf1d7a295dd9 | refs/heads/master | 2020-03-10T20:42:42.566789 | 2018-06-15T08:41:00 | 2018-06-15T08:41:00 | 129,575,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,910 | java | package xyz.yikai.kky.base;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import com.xlg.library.R;
import com.xlg.library.network.NetBroadCastReciver;
import com.xlg.library.utils.ToastUtil;
/**
* 基类Fragment.
*/
public class BaseFragment extends Fragment implements
BaseListener, NetBroadCastReciver.INetRevicerListener {
/**
* 屏幕宽度.
*/
protected int width;
/**
* 屏幕高度.
*/
protected int height;
/**
* 网络监听器
*/
private NetBroadCastReciver mNetReceiver;
/**
* 网络是否连接.
*/
public boolean isNetConnect=false;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// 检测网络状态
checkNetState();
// 获取屏幕宽高
getDisplay();
}
/**
* 检测网络状态.
*/
private void checkNetState() {
mNetReceiver = new NetBroadCastReciver();
mNetReceiver.setNetRevicerListener(this, null);
IntentFilter mFilter = new IntentFilter();
mFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
getActivity().registerReceiver(mNetReceiver, mFilter);
}
/**
* 获取屏幕宽高.
*/
private void getDisplay() {
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
width = metrics.widthPixels;
height = metrics.heightPixels;
}
/**
* 关闭Activity.
*/
protected void finish() {
getActivity().finish();
}
@Override
public void onToggle() {
}
@Override
public void onSkipSet() {
getActivity().startActivity(new Intent(Settings.ACTION_SETTINGS));
getActivity().overridePendingTransition(R.anim.slide_in_right,
R.anim.slide_out_left);
}
@Override
public void onDestroy() {
super.onDestroy();
releaseNetObserver();
}
private void releaseNetObserver() {
if (null != mNetReceiver && null != getActivity()) {
getActivity().unregisterReceiver(mNetReceiver);
mNetReceiver = null;
}
}
@Override
public void onNetReceiverSucc(Object data) {
isNetConnect=true;
}
@Override
public void onNetReceiverFailure() {}
@Override
public void onTitleBarLeftClick() {
finish();
}
@Override
public void onTitleBarRightClick() {}
@Override
public void onClick(int index, Object... obj) {}
}
| [
"1655661337@qq.com"
] | 1655661337@qq.com |
77f455b1a2985e84db4c517ded15703bd6911faa | 8d271ee2a0891d4ae06bdca642f9f2a301a87b78 | /SharOnProtocal/src/sharon/serialization/Message.java | 890cc141e2e13f9509b7a213e6a48f9eeca2d305 | [] | no_license | csimmons854/CSI_4321 | 08103c96f270943a833338999d6a2e1542729ed1 | 19da7ac9c7b7c752b33ebce0a4a50f24b9ecb7ff | refs/heads/master | 2021-08-22T23:43:11.219446 | 2017-12-01T18:18:19 | 2017-12-01T18:18:19 | 103,315,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,916 | java | /************************************************
*
* Author: Chris Simmons
* Assignment: Program0Test
* Class: CSI 4321 Data Communications
*
************************************************/
package sharon.serialization;
import java.io.IOException;
import java.util.Arrays;
public abstract class Message {
private byte[] id;
private int ttl;
private RoutingService routingService;
private byte[] sourceSharOnAddress;
private byte[] destinationSharOnAddress;
/**
* Constructs a message
*
* @param in deserialization input source
*/
Message(MessageInput in) throws IOException, BadAttributeValueException {
if(in == null)
{
throw new IOException("Null Value");
}
this.setID(in.getByteArray(15));
int tempTtl = in.getByte();
//convert to unsigned long
if(tempTtl < 0)
{
tempTtl = tempTtl & 0x000000FF;
}
this.setTtl(tempTtl);
this.setRoutingService(RoutingService.getRoutingService(in.getByte()));
this.setSourceAddress(in.getByteArray(5));
this.setDestinationAddress(in.getByteArray(5));
}
/**
* Constructs a Message
*
* @param id message id
* @param ttl message ttl
* @param routingService message routing service
* @param sourceSharOnAddress message source address
* @param destinationSharOnAddress message destination address
*/
Message(byte[] id, int ttl, RoutingService routingService,
byte[] sourceSharOnAddress, byte[] destinationSharOnAddress)
throws BadAttributeValueException {
if (id == null)
{
throw new BadAttributeValueException("ID was null","null");
}
if (id.length < 15) {
throw new BadAttributeValueException("Too Short ID", Arrays.toString(id));
}
if (id.length > 15) {
throw new BadAttributeValueException("Too Large ID", Arrays.toString(id));
}
if (routingService == null) {
throw new BadAttributeValueException("RoutingService is null", "null");
}
if (!routingService.equals(RoutingService.BREADTHFIRSTBROADCAST) &&
!routingService.equals(RoutingService.DEPTHFIRSTSEARCH)) {
throw new BadAttributeValueException("invalid RoutingService",
routingService.toString());
}
if (ttl > 255) {
throw new BadAttributeValueException("Too large ttl", "" + ttl);
}
if (ttl < 0) {
throw new BadAttributeValueException("Too small ttl", "" + ttl);
}
if (sourceSharOnAddress == null) {
throw new BadAttributeValueException("Null sourceAddress",
"null");
}
if (sourceSharOnAddress.length > 5)
{
throw new BadAttributeValueException("Too large sourceAddress",
Arrays.toString(sourceSharOnAddress));
}
if (sourceSharOnAddress.length < 5)
{
throw new BadAttributeValueException("Too small sourceAddress",
Arrays.toString(sourceSharOnAddress));
}
if (destinationSharOnAddress == null)
{
throw new BadAttributeValueException("Null destinationAddress", "null");
}
if (destinationSharOnAddress.length > 5)
{
throw new BadAttributeValueException("Too large destinationAddress",
Arrays.toString(sourceSharOnAddress));
}
if (destinationSharOnAddress.length < 5)
{
throw new BadAttributeValueException("Too small destinationAddress",
Arrays.toString(destinationSharOnAddress));
}
this.ttl = ttl;
this.id = id;
this.routingService = routingService;
this.destinationSharOnAddress = destinationSharOnAddress;
this.sourceSharOnAddress = sourceSharOnAddress;
}
/**
* Serialize message
*
* @param out serialization output message
*
* @throws java.io.IOException if serialization fails
*/
public void encode(MessageOutput out)
throws IOException
{
if (out == null)
{
throw new IOException();
}
if(this.getMessageType() == 1) //encode Search Message
{
out.writeByte(1);
out.writeByteArray(this.getID());
out.writeByte(this.ttl);
out.writeByte(this.getRoutingService().getServiceCode());
out.writeByteArray(this.sourceSharOnAddress);
out.writeByteArray(this.destinationSharOnAddress);
out.writeIntTo2Bytes(((Search)this).getSearchString().length() + 1);
out.writeString(((Search)this).getSearchString());
}
else if(this.getMessageType() == 2) //encode Response Message
{
out.writeByte(2);
out.writeByteArray(this.getID());
out.writeByte(this.ttl);
out.writeByte(this.getRoutingService().getServiceCode());
out.writeByteArray(this.sourceSharOnAddress);
out.writeByteArray(this.destinationSharOnAddress);
//calculate the length of the ResultList
int resultListLength = 0;
for(int i = 0; i < ((Response)this).getResultList().size(); i++)
{
resultListLength +=
((Response)this).getResultList().get(i).length() + 1;
}
out.writeIntTo2Bytes(7 + resultListLength);
out.writeByte(((Response)this).getResultList().size());
out.writeIntTo2Bytes(((Response)this).getResponseHost().getPort());
out.writeByteArray(
((Response)this).getResponseHost().getAddress().getAddress());
//encode each individual result of ResultList
for(int i = 0; i < ((Response)this).getResultList().size(); i++)
{
((Response)this).getResultList().get(i).encode(out);
}
}
else
throw new IOException();
}
/**
* Deserializes message from input source
*
* @param in deserialization input source
*
* @return deserialize message
* @throws java.io.IOException if deserialization fails
* @throws BadAttributeValueException if bad attribute value
*/
public static Message decode(MessageInput in)
throws IOException,
BadAttributeValueException
{
//initialize variables to be used to actually decode a messageInput
int type;
if(in == null)
{
throw new IOException("Null Value");
}
//get type of message
type = in.getByte();
if(type == 1) //decode Search Message
{
return new Search(in);
}
else if(type == 2) //response object
{
return new Response(in);
}
else
{
throw new BadAttributeValueException("Invalid Message Type " + type,
"" + type);
}
}
/**
* Get type of message
*
* @return message type
*/
public int getMessageType()
{
int type = 0;
if(this instanceof Search)
{
type = 1;
}
if(this instanceof Response)
{
type = 2;
}
return type;
}
/**
* Get message id
*
* @return message id
*/
public byte[] getID()
{
return id.clone();
}
/**
* Set message id
*
* @param id new ID
*
* @throws BadAttributeValueException if bad or null attribute
*/
public void setID(byte[] id)
throws BadAttributeValueException
{
if(id == null)
{
throw new BadAttributeValueException("ID is Null", "null");
}
if(id.length < 15)
{
throw new BadAttributeValueException("Too Short ID", Arrays.toString(id));
}
if(id.length > 15)
{
throw new BadAttributeValueException("Too Large ID", Arrays.toString(id));
}
this.id = id.clone();
}
/**
* Get message ttl
*
* @return message ttl
*/
public int getTtl()
{
return ttl;
}
/**
* Get message routing service
*
* @param ttl new ttl
*
* @throws BadAttributeValueException if bad ttl value
*/
public void setTtl(int ttl)
throws BadAttributeValueException
{
if(ttl > 255)
{
throw new BadAttributeValueException("Too large ttl", "" + ttl);
}
if(ttl < 0)
{
throw new BadAttributeValueException("Too small ttl", "" + ttl);
}
this.ttl = ttl;
}
/**
* Get message routing service
*
* @return routing service
*/
public RoutingService getRoutingService()
{
return routingService;
}
/**
* Set message routing service
*
* @param routingService new routing service
*
* @throws BadAttributeValueException if null routing service value
*/
public void setRoutingService(RoutingService routingService)
throws BadAttributeValueException
{
if(routingService == null)
{
throw new BadAttributeValueException("RoutingService is null","null");
}
if(routingService != RoutingService.BREADTHFIRSTBROADCAST &&
routingService != RoutingService.DEPTHFIRSTSEARCH)
{
throw new BadAttributeValueException("invalid RoutingService "
+ routingService.toString(),
routingService.toString());
}
this.routingService = routingService;
}
/**
* Get source address
*
* @return source address
*/
public byte[] getSourceAddress()
{
return sourceSharOnAddress.clone();
}
/**
* Set source address
*
* @param sourceAddress source address
*
* @throws BadAttributeValueException if bad or null address value
*/
public void setSourceAddress(byte[] sourceAddress)
throws BadAttributeValueException
{
if(sourceAddress.length > 5)
{
throw new BadAttributeValueException("Too large sourceAddress",
Arrays.toString(sourceAddress));
}
if(sourceAddress.length < 5)
{
throw new BadAttributeValueException("Too small sourceAddress",
Arrays.toString(sourceAddress));
}
this.sourceSharOnAddress = sourceAddress.clone();
}
/**
* Get destination address
*
* @return destination address
*/
public byte[] getDestinationAddress()
{
return destinationSharOnAddress.clone();
}
/**
* Set destination address
*
* @param destinationAddress destination address
*
* @throws BadAttributeValueException if bad or null address value
*/
public void setDestinationAddress(byte[] destinationAddress)
throws BadAttributeValueException
{
if(destinationAddress.length > 5)
{
throw new BadAttributeValueException("Too large destinationAddress",
Arrays.toString(sourceSharOnAddress));
}
if(destinationAddress.length < 5)
{
throw new BadAttributeValueException("Too small destinationAddress",
Arrays.toString(destinationAddress));
}
this.destinationSharOnAddress = destinationAddress.clone();
}
/**
* Test for equivalency of two Message objects
*
* @param o object to be compared
* @return a boolean based on the equivalency
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Message message = (Message) o;
if (ttl != message.ttl) return false;
if (!Arrays.equals(id, message.id)) return false;
if (routingService != message.routingService) return false;
if (!Arrays.equals(sourceSharOnAddress, message.sourceSharOnAddress))
return false;
return Arrays.equals(destinationSharOnAddress, message.destinationSharOnAddress);
}
@Override
public int hashCode() {
int result = Arrays.hashCode(id);
result = 31 * result + ttl;
result = 31 * result + (routingService != null ? routingService.hashCode() : 0);
result = 31 * result + Arrays.hashCode(sourceSharOnAddress);
result = 31 * result + Arrays.hashCode(destinationSharOnAddress);
return result;
}
@Override
public String toString() {
return "Message{" +
"id=" + Arrays.toString(id) +
", ttl=" + ttl +
", routingService=" + routingService +
", sourceSharOnAddress=" + Arrays.toString(sourceSharOnAddress) +
", destinationSharOnAddress=" + Arrays.toString(destinationSharOnAddress) +
'}';
}
}
| [
"chris.simmons854@gmail.com"
] | chris.simmons854@gmail.com |
4e7a404ba6a40772a08647347545efa006aa2c0a | 4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849 | /aliyun-java-sdk-linkedmall/src/main/java/com/aliyuncs/linkedmall/model/v20180116/CreateOrderV2Request.java | 87b314aef87fcc7da30627fe1bff52ba5ece3c82 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-java-sdk | a263fa08e261f12d45586d1b3ad8a6609bba0e91 | e19239808ad2298d32dda77db29a6d809e4f7add | refs/heads/master | 2023-09-03T12:28:09.765286 | 2023-09-01T09:03:00 | 2023-09-01T09:03:00 | 39,555,898 | 1,542 | 1,317 | NOASSERTION | 2023-09-14T07:27:05 | 2015-07-23T08:41:13 | Java | UTF-8 | Java | false | false | 6,695 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.linkedmall.model.v20180116;
import com.aliyuncs.RpcAcsRequest;
import java.util.List;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.linkedmall.Endpoint;
/**
* @author auto create
* @version
*/
public class CreateOrderV2Request extends RpcAcsRequest<CreateOrderV2Response> {
private Long quantity;
private String bizUid;
private String extJson;
private String accountType;
private Boolean useAnonymousTbAccount;
private Long orderExpireTime;
private String lmItemId;
private List<ItemList> itemLists;
private Long itemId;
private Long totalAmount;
private String thirdPartyUserId;
private String bizId;
private String outTradeId;
private String buyerMessageMap;
private String deliveryAddress;
public CreateOrderV2Request() {
super("linkedmall", "2018-01-16", "CreateOrderV2", "linkedmall");
setMethod(MethodType.POST);
try {
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
public Long getQuantity() {
return this.quantity;
}
public void setQuantity(Long quantity) {
this.quantity = quantity;
if(quantity != null){
putQueryParameter("Quantity", quantity.toString());
}
}
public String getBizUid() {
return this.bizUid;
}
public void setBizUid(String bizUid) {
this.bizUid = bizUid;
if(bizUid != null){
putQueryParameter("BizUid", bizUid);
}
}
public String getExtJson() {
return this.extJson;
}
public void setExtJson(String extJson) {
this.extJson = extJson;
if(extJson != null){
putQueryParameter("ExtJson", extJson);
}
}
public String getAccountType() {
return this.accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
if(accountType != null){
putQueryParameter("AccountType", accountType);
}
}
public Boolean getUseAnonymousTbAccount() {
return this.useAnonymousTbAccount;
}
public void setUseAnonymousTbAccount(Boolean useAnonymousTbAccount) {
this.useAnonymousTbAccount = useAnonymousTbAccount;
if(useAnonymousTbAccount != null){
putQueryParameter("UseAnonymousTbAccount", useAnonymousTbAccount.toString());
}
}
public Long getOrderExpireTime() {
return this.orderExpireTime;
}
public void setOrderExpireTime(Long orderExpireTime) {
this.orderExpireTime = orderExpireTime;
if(orderExpireTime != null){
putQueryParameter("OrderExpireTime", orderExpireTime.toString());
}
}
public String getLmItemId() {
return this.lmItemId;
}
public void setLmItemId(String lmItemId) {
this.lmItemId = lmItemId;
if(lmItemId != null){
putQueryParameter("LmItemId", lmItemId);
}
}
public List<ItemList> getItemLists() {
return this.itemLists;
}
public void setItemLists(List<ItemList> itemLists) {
this.itemLists = itemLists;
if (itemLists != null) {
for (int depth1 = 0; depth1 < itemLists.size(); depth1++) {
putQueryParameter("ItemList." + (depth1 + 1) + ".ItemId" , itemLists.get(depth1).getItemId());
putQueryParameter("ItemList." + (depth1 + 1) + ".Quantity" , itemLists.get(depth1).getQuantity());
putQueryParameter("ItemList." + (depth1 + 1) + ".LmItemId" , itemLists.get(depth1).getLmItemId());
putQueryParameter("ItemList." + (depth1 + 1) + ".SkuId" , itemLists.get(depth1).getSkuId());
}
}
}
public Long getItemId() {
return this.itemId;
}
public void setItemId(Long itemId) {
this.itemId = itemId;
if(itemId != null){
putQueryParameter("ItemId", itemId.toString());
}
}
public Long getTotalAmount() {
return this.totalAmount;
}
public void setTotalAmount(Long totalAmount) {
this.totalAmount = totalAmount;
if(totalAmount != null){
putQueryParameter("TotalAmount", totalAmount.toString());
}
}
public String getThirdPartyUserId() {
return this.thirdPartyUserId;
}
public void setThirdPartyUserId(String thirdPartyUserId) {
this.thirdPartyUserId = thirdPartyUserId;
if(thirdPartyUserId != null){
putQueryParameter("ThirdPartyUserId", thirdPartyUserId);
}
}
public String getBizId() {
return this.bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
if(bizId != null){
putQueryParameter("BizId", bizId);
}
}
public String getOutTradeId() {
return this.outTradeId;
}
public void setOutTradeId(String outTradeId) {
this.outTradeId = outTradeId;
if(outTradeId != null){
putQueryParameter("OutTradeId", outTradeId);
}
}
public String getBuyerMessageMap() {
return this.buyerMessageMap;
}
public void setBuyerMessageMap(String buyerMessageMap) {
this.buyerMessageMap = buyerMessageMap;
if(buyerMessageMap != null){
putQueryParameter("BuyerMessageMap", buyerMessageMap);
}
}
public String getDeliveryAddress() {
return this.deliveryAddress;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
if(deliveryAddress != null){
putQueryParameter("DeliveryAddress", deliveryAddress);
}
}
public static class ItemList {
private Long itemId;
private Integer quantity;
private String lmItemId;
private Long skuId;
public Long getItemId() {
return this.itemId;
}
public void setItemId(Long itemId) {
this.itemId = itemId;
}
public Integer getQuantity() {
return this.quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public String getLmItemId() {
return this.lmItemId;
}
public void setLmItemId(String lmItemId) {
this.lmItemId = lmItemId;
}
public Long getSkuId() {
return this.skuId;
}
public void setSkuId(Long skuId) {
this.skuId = skuId;
}
}
@Override
public Class<CreateOrderV2Response> getResponseClass() {
return CreateOrderV2Response.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
e704fd2abaa4120197ffdd2b1731557d0fdd6cbe | 0b4dcb28cd8047d6b778d0ca54fb31edbc0a053a | /src/main/java/MartinMod/cards/AbstractDefaultCard.java | 82408f064b89f73dd99ac2008cf101ca15a23f2a | [] | no_license | subsistencefarmer/MartinMod | d2431fc7400e4479aa8e8f168a896d2a37def6f7 | 359483e10bdd096b4b207e4e97e59237c7691e92 | refs/heads/master | 2022-10-24T20:27:37.401361 | 2020-06-14T20:53:59 | 2020-06-14T20:53:59 | 272,281,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,371 | java | package MartinMod.cards;
import basemod.abstracts.CustomCard;
public abstract class AbstractDefaultCard extends CustomCard {
// Custom Abstract Cards can be a bit confusing. While this is a simple base for simply adding a second magic number,
// if you're new to modding I suggest you skip this file until you know what unique things that aren't provided
// by default, that you need in your own cards.
// In this example, we use a custom Abstract Card in order to define a new magic number. From here on out, we can
// simply use that in our cards, so long as we put "extends AbstractDynamicCard" instead of "extends CustomCard" at the start.
// In simple terms, it's for things that we don't want to define again and again in every single card we make.
public int defaultSecondMagicNumber; // Just like magic number, or any number for that matter, we want our regular, modifiable stat
public int defaultBaseSecondMagicNumber; // And our base stat - the number in it's base state. It will reset to that by default.
public boolean upgradedDefaultSecondMagicNumber; // A boolean to check whether the number has been upgraded or not.
public boolean isDefaultSecondMagicNumberModified; // A boolean to check whether the number has been modified or not, for coloring purposes. (red/green)
public AbstractDefaultCard(final String id,
final String name,
final String img,
final int cost,
final String rawDescription,
final CardType type,
final CardColor color,
final CardRarity rarity,
final CardTarget target) {
super(id, name, img, cost, rawDescription, type, color, rarity, target);
// Set all the things to their default values.
isCostModified = false;
isCostModifiedForTurn = false;
isDamageModified = false;
isBlockModified = false;
isMagicNumberModified = false;
isDefaultSecondMagicNumberModified = false;
}
public void displayUpgrades() { // Display the upgrade - when you click a card to upgrade it
super.displayUpgrades();
if (upgradedDefaultSecondMagicNumber) { // If we set upgradedDefaultSecondMagicNumber = true in our card.
defaultSecondMagicNumber = defaultBaseSecondMagicNumber; // Show how the number changes, as out of combat, the base number of a card is shown.
isDefaultSecondMagicNumberModified = true; // Modified = true, color it green to highlight that the number is being changed.
}
}
public void upgradeDefaultSecondMagicNumber(int amount) { // If we're upgrading (read: changing) the number. Note "upgrade" and NOT "upgraded" - 2 different things. One is a boolean, and then this one is what you will usually use - change the integer by how much you want to upgrade.
defaultBaseSecondMagicNumber += amount; // Upgrade the number by the amount you provide in your card.
defaultSecondMagicNumber = defaultBaseSecondMagicNumber; // Set the number to be equal to the base value.
upgradedDefaultSecondMagicNumber = true; // Upgraded = true - which does what the above method does.
}
} | [
"subsistencefarmer@hotmail.com"
] | subsistencefarmer@hotmail.com |
aba39223f7f3a7c1b8679067453c668e2f570311 | fdfc22b3a0ee611d7dbb3d9c39931511641765b0 | /core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryGenerator.java | 0adf40eef05f2742532799e7daa5f8c2e326d1ee | [
"Apache-2.0",
"MIT"
] | permissive | aatibudhi/kylin | 88b9329fe88d52a2e1e593508296ae1f38a94abd | 2bf5697da031dba21d2fb863018512fd89147402 | refs/heads/master | 2021-01-13T13:24:17.405717 | 2016-11-02T05:39:26 | 2016-11-02T05:41:12 | 72,612,435 | 1 | 0 | null | 2016-11-02T06:53:14 | 2016-11-02T06:53:13 | null | UTF-8 | Java | false | false | 7,425 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kylin.dict;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.kylin.common.util.Bytes;
import org.apache.kylin.common.util.Dictionary;
import org.apache.kylin.metadata.datatype.DataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
/**
* @author yangli9
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class DictionaryGenerator {
private static final Logger logger = LoggerFactory.getLogger(DictionaryGenerator.class);
private static final String[] DATE_PATTERNS = new String[] { "yyyy-MM-dd", "yyyyMMdd" };
public static Dictionary<String> buildDictionary(DataType dataType, IDictionaryValueEnumerator valueEnumerator) throws IOException {
Preconditions.checkNotNull(dataType, "dataType cannot be null");
// build dict, case by data type
IDictionaryBuilder builder;
if (dataType.isDateTimeFamily()) {
if (dataType.isDate())
builder = new DateDictBuilder();
else
builder = new TimeDictBuilder();
} else if (dataType.isNumberFamily()) {
builder = new NumberDictBuilder();
} else {
builder = new StringDictBuilder();
}
return buildDictionary(builder, null, valueEnumerator);
}
public static Dictionary<String> buildDictionary(IDictionaryBuilder builder, DictionaryInfo dictInfo, IDictionaryValueEnumerator valueEnumerator) throws IOException {
int baseId = 0; // always 0 for now
int nSamples = 5;
ArrayList<String> samples = new ArrayList<String>(nSamples);
Dictionary<String> dict = builder.build(dictInfo, valueEnumerator, baseId, nSamples, samples);
// log a few samples
StringBuilder buf = new StringBuilder();
for (String s : samples) {
if (buf.length() > 0) {
buf.append(", ");
}
buf.append(s.toString()).append("=>").append(dict.getIdFromValue(s));
}
logger.debug("Dictionary value samples: " + buf.toString());
logger.debug("Dictionary cardinality: " + dict.getSize());
logger.debug("Dictionary builder class: " + builder.getClass().getName());
logger.debug("Dictionary class: " + dict.getClass().getName());
return dict;
}
public static Dictionary mergeDictionaries(DataType dataType, List<DictionaryInfo> sourceDicts) throws IOException {
return buildDictionary(dataType, new MultipleDictionaryValueEnumerator(sourceDicts));
}
private static class DateDictBuilder implements IDictionaryBuilder {
@Override
public Dictionary<String> build(DictionaryInfo dictInfo, IDictionaryValueEnumerator valueEnumerator, int baseId, int nSamples, ArrayList<String> returnSamples) throws IOException {
final int BAD_THRESHOLD = 0;
String matchPattern = null;
byte[] value;
for (String ptn : DATE_PATTERNS) {
matchPattern = ptn; // be optimistic
int badCount = 0;
SimpleDateFormat sdf = new SimpleDateFormat(ptn);
while (valueEnumerator.moveNext()) {
value = valueEnumerator.current();
if (value == null || value.length == 0)
continue;
String str = Bytes.toString(value);
try {
sdf.parse(str);
if (returnSamples.size() < nSamples && returnSamples.contains(str) == false)
returnSamples.add(str);
} catch (ParseException e) {
logger.info("Unrecognized date value: " + str);
badCount++;
if (badCount > BAD_THRESHOLD) {
matchPattern = null;
break;
}
}
}
if (matchPattern != null) {
return new DateStrDictionary(matchPattern, baseId);
}
}
throw new IllegalStateException("Unrecognized datetime value");
}
}
private static class TimeDictBuilder implements IDictionaryBuilder {
@Override
public Dictionary<String> build(DictionaryInfo dictInfo, IDictionaryValueEnumerator valueEnumerator, int baseId, int nSamples, ArrayList<String> returnSamples) throws IOException {
return new TimeStrDictionary(); // base ID is always 0
}
}
private static class StringDictBuilder implements IDictionaryBuilder {
@Override
public Dictionary<String> build(DictionaryInfo dictInfo, IDictionaryValueEnumerator valueEnumerator, int baseId, int nSamples, ArrayList<String> returnSamples) throws IOException {
TrieDictionaryBuilder builder = new TrieDictionaryBuilder(new StringBytesConverter());
byte[] value;
while (valueEnumerator.moveNext()) {
value = valueEnumerator.current();
if (value == null)
continue;
String v = Bytes.toString(value);
builder.addValue(v);
if (returnSamples.size() < nSamples && returnSamples.contains(v) == false)
returnSamples.add(v);
}
return builder.build(baseId);
}
}
private static class NumberDictBuilder implements IDictionaryBuilder {
@Override
public Dictionary<String> build(DictionaryInfo dictInfo, IDictionaryValueEnumerator valueEnumerator, int baseId, int nSamples, ArrayList<String> returnSamples) throws IOException {
NumberDictionaryBuilder builder = new NumberDictionaryBuilder(new StringBytesConverter());
byte[] value;
while (valueEnumerator.moveNext()) {
value = valueEnumerator.current();
if (value == null)
continue;
String v = Bytes.toString(value);
if (StringUtils.isBlank(v)) // empty string is null for numbers
continue;
builder.addValue(v);
if (returnSamples.size() < nSamples && returnSamples.contains(v) == false)
returnSamples.add(v);
}
return builder.build(baseId);
}
}
}
| [
"liyang@apache.org"
] | liyang@apache.org |
dd8685a1b0b328f5fe81f7c5819862e34228fd29 | 4e5099c367947136b63b9898ff4c6538ca73fba0 | /comp/src/main/java/com/base/util/dbutil/DBUtils.java | 76347e6a08d3612c9331700167dbb25122f439f2 | [] | no_license | tianling456/comp | 1d4bf73e674a9fb73da52cf66a046ee9b0d153e5 | d406e0f60e95b464c1235988a3778a97cdcc3f68 | refs/heads/master | 2022-12-24T16:59:11.814481 | 2021-02-07T12:50:45 | 2021-02-07T12:50:45 | 88,843,516 | 0 | 0 | null | 2022-12-16T06:31:05 | 2017-04-20T09:00:04 | Java | UTF-8 | Java | false | false | 680 | java | package com.base.util.dbutil;
import com.alibaba.druid.pool.DruidDataSource;
import com.base.util.common.Encoder;
/**
*项目名:
*创建时间:2017-6-24
*创建人:Aobo
*类名:DBUtils
*所属包名:com.base.util.dbutil
*项目名称:comp
*类功能描述:
*/
public class DBUtils extends DruidDataSource{
private static final long serialVersionUID = 1L;
@Override
public void setUsername(String username) {
Encoder encoder = new Encoder();
super.setUsername(encoder.decryptToAES(username));
}
@Override
public void setPassword(String password) {
Encoder encoder = new Encoder();
super.setPassword(encoder.decryptToAES(password));
}
}
| [
"tianling456@sina.com"
] | tianling456@sina.com |
fd9cbd414e9cbe3f0e2a4437e0934c7e6f083298 | a1a28958c01b3a0a741b54917dc7a771a9d2e4f2 | /work/userLogin/src/util/ModelTrain.java | 4c415bd4c440bcda568e58b27d8cd2549dcdfd06 | [] | no_license | 1997lishuang/design_model | ce709937b88e12386a90740e00f2e6c7843843da | 6256bb835032d33010c82f36c0bb6552ae6738a0 | refs/heads/main | 2023-04-29T12:14:01.382573 | 2021-05-22T08:37:57 | 2021-05-22T08:37:57 | 369,746,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package util;
public class ModelTrain implements TrainValid {
@Override
public boolean train() {
/*
执行一段逻辑 当模型 的相似度
大于 96% 时 返回 true
反之 为 false.
*/
return false;
}
}
| [
"1320424353@qq.com"
] | 1320424353@qq.com |
41fc8ccc692696ae7b9ed0836db4d6cf4bdae7ba | ea56c4ec992028768fa6d0f85871d246c426cec8 | /json-service/src/test/java/org/stefaniuk/json/service/test/service/ErrorService.java | ae6c9d74f4d4e85b4dad15a6862f8758ed105fc0 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | perelengo/json-service | e08297824a28f7307dccc252dcca2641f2248184 | bbf691a9e2d5eeaeedd1ed1817298f8153b80cbe | refs/heads/master | 2021-01-11T21:07:20.694977 | 2020-01-06T00:44:54 | 2020-01-06T00:44:54 | 79,248,493 | 0 | 0 | null | 2017-01-17T16:39:42 | 2017-01-17T16:39:42 | null | UTF-8 | Java | false | false | 180 | java | package org.stefaniuk.json.service.test.service;
import org.stefaniuk.json.service.JsonService;
public class ErrorService {
@JsonService
public void error() {
}
}
| [
"daniel.stefaniuk@gmail.com"
] | daniel.stefaniuk@gmail.com |
db0ab93250ea81e74db5e59e4a4225272eff3146 | aa58b0b32c457eb8c49add9baa7693068fa12680 | /src/main/java/com/beyongx/echarts/charts/treemap/select/Label.java | 40892d810143ef596267d377a0e646346213c3ed | [
"Apache-2.0"
] | permissive | wen501271303/java-echarts | 045dcd41eee35b572122c9de27a340cf777a74b1 | 9eb611e8f964833e4dbb7360733a6ae7ac6eace1 | refs/heads/master | 2023-07-30T20:56:23.638092 | 2021-09-28T06:12:21 | 2021-09-28T06:12:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,596 | java | /**
* Created by java-echarts library.
* @author: cattong <aronter@gmail.com>
*/
package com.beyongx.echarts.charts.treemap.select;
import java.io.Serializable;
import java.util.Map;
//import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* {_more_}
*/
@lombok.Data
@EqualsAndHashCode(callSuper = false)
public class Label implements Serializable {
private static final long serialVersionUID = 1L;
private String show; // Default: false
private Object position; //string|Array Default: 'inside'
private String distance; // Default: 5
private Integer rotate; //
private Object[] offset; //
private Object formatter; //string|Function
private String color; // Default: '"#fff"'
private String fontStyle; // Default: 'normal'
private Object fontWeight; //string|number Default: 'normal'
private String fontFamily; // Default: 'sans-serif'
private String fontSize; // Default: 12
private String align; //
private String verticalAlign; //
private Integer lineHeight; //
private Object backgroundColor; //string|Object Default: 'transparent'
private String borderColor; //
private String borderWidth; // Default: 0
private Object borderType; //string|number|Array Default: 'solid'
private String borderDashOffset; // Default: 0
private Object borderRadius; //number|Array Default: 0
private Object padding; //number|Array Default: 0
private String shadowColor; // Default: 'transparent'
private String shadowBlur; // Default: 0
private String shadowOffsetX; // Default: 0
private String shadowOffsetY; // Default: 0
private Integer width; //
private Integer height; //
private String textBorderColor; //
private Integer textBorderWidth; //
private Object textBorderType; //string|number|Array Default: 'solid'
private String textBorderDashOffset; // Default: 0
private String textShadowColor; // Default: 'transparent'
private String textShadowBlur; // Default: 0
private String textShadowOffsetX; // Default: 0
private String textShadowOffsetY; // Default: 0
private String overflow; // Default: 'none'
private String ellipsis; // Default: '...'
private String lineOverflow; // Default: 'none'
private Object[] rich; //
public Label()
{
}
public Label(Map<String, Object> property)
{
}
} | [
"cattong@163.com"
] | cattong@163.com |
0d456b3c30945c50bc4751a0af28cbbb1ffef6a1 | 4e8fbbe30f17a92e8101f2c43d77a4dd0c951f8f | /SSM框架整合/2.MyBatis进阶/4.Spring+Mybatis整合案例之电商模块/源码/shopmgr/src/main/java/com/imooc/shop/service/ShopService.java | 1a49700da2fa95081aacd25f2d408cad40f4aad0 | [] | no_license | ARainyNight/TheRoadOfBaldness | d75b9c8934807ebdd26125bf72d7b6d78c6177f6 | 225c70090fbe6281551f9879f3ab13f56eea5138 | refs/heads/master | 2021-07-05T12:55:11.171062 | 2019-04-16T04:18:11 | 2019-04-16T04:18:11 | 148,400,416 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | package com.imooc.shop.service;
import com.imooc.shop.bean.Article;
import com.imooc.shop.bean.ArticleType;
import com.imooc.shop.utils.Pager;
import java.util.List;
import java.util.Map;
public interface ShopService {
List<ArticleType> getArticleTypes();
Map<String, Object> login(String loginName, String password);
List<ArticleType> loadFirstArticleTypes();
List<Article> searchArticles(String typeCode, String secondType, String title, Pager pager);
List<ArticleType> loadSecondTypes(String typeCode);
void deleteById(String id);
Article getArticleById(String id);
void updateArticle(Article article);
void saveArticle(Article article);
} | [
"18234168426@163.com"
] | 18234168426@163.com |
4c422efeec675a1e5e5b8b533f754b751cbd2ef9 | 748e6ad528ac1690d3ef9d985f751e332bddeb2a | /code/Messenger.java | 3f6b436a474186eeaa1d1e883629d6baba99673a | [] | no_license | sachinmp/Paxos-ADC | 58ef976d345f7aaaaad355c9a2345e0be7fbf5d4 | 7c6d9d0f0637951fc29b03fd2d6bd9cb60a65c86 | refs/heads/master | 2021-01-12T09:45:59.632545 | 2016-12-12T09:57:03 | 2016-12-12T09:57:03 | 76,244,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,404 | java | import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Messenger {
private static final int PORT_OF_ACCEPTOR = 9000;
public Map<String, ServerConnection> acceptorConnections = new HashMap<String, ServerConnection>();
private String filePath;
public Messenger(String filePath) {
// TODO Auto-generated constructor stub
this.filePath = filePath;
/*try{
File serverInfo = new File(filePath);
BufferedReader br = new BufferedReader(new FileReader(serverInfo));
String line;
while ((line = br.readLine()) != null) {
Socket socket = new Socket(line.trim(), PORT_OF_ACCEPTOR);
ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
ObjectInputStream input = new ObjectInputStream(socket.getInputStream());
ServerConnection acceptorConnection = new ServerConnection(socket, input, output);
acceptorConnections.put(line, acceptorConnection);
}
}catch(Exception e){
e.printStackTrace();
}*/
}
public void createConnections(){
try{
File serverInfo = new File(filePath);
BufferedReader br = new BufferedReader(new FileReader(serverInfo));
String line;
while ((line = br.readLine()) != null) {
Socket socket = new Socket(line.trim(), PORT_OF_ACCEPTOR);
ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
ObjectInputStream input = new ObjectInputStream(socket.getInputStream());
ServerConnection acceptorConnection = new ServerConnection(socket, input, output);
acceptorConnections.put(line, acceptorConnection);
}
}catch(Exception e){
e.printStackTrace();
}
}
/**
*
* @param commitMessage
*/
public void sendMessage(String server,Packet message){
//localhost, PORT_OF_LEARNER
try{
acceptorConnections.get(server).getOutput().writeObject(message);
}catch(Exception e){
e.printStackTrace();
}
}
/**
* This method is responsible for sending the accept message to the proposer.
* The message could be an accept or accept with a value or a reject.
* @param serverName
* @param packet
*/
public void sendAcceptMessage(String serverName, Packet packet) {
}
/**
* This function is responsible for sending the acknowledgement of a request to the proposer.
* @param serverName
*/
public void sendAcknowledgement(String serverName){
}
/**
* This method is responsible for sending the proposal to all the acceptors.
* @param proposerId
*/
public boolean sendProposal(int proposerId){
return false;
}
public List<ServerConnection> getAcceptorConnections() {
List<ServerConnection> listOfConnections = new ArrayList<ServerConnection>();
for(String server : acceptorConnections.keySet()){
listOfConnections.add(acceptorConnections.get(server));
}
return listOfConnections;
}
public void setAcceptorConnections(Map<String, ServerConnection> acceptorConnections) {
this.acceptorConnections = acceptorConnections;
}
/**
* This function is responsible for sending the promise message to the proposer.
* @param serverName
* @param p
*/
public void sendPromise(String serverName, Packet p){
}
}
| [
"sachinmohanp@gmail.com"
] | sachinmohanp@gmail.com |
b8235064b7c224fda85323b41eb1abb9135b8837 | eae0aa437bb61fb7ffa2d79aa3331b3e2ecb1794 | /src/main/java/com/org/blinkhealth/pageobjects/LoginPage.java | 32fbc26423f88617a95396d4577f4af873f57b4c | [] | no_license | BikuDAA/BlinkHealthTest | 992fbfa45daf67f02b1bb59975346aa76b2dc806 | 4409b90af3aafd5d5dd3d5e0c00b149fa6380edd | refs/heads/master | 2022-12-30T13:04:52.335409 | 2020-04-30T07:55:31 | 2020-04-30T07:55:31 | 260,142,101 | 0 | 0 | null | 2020-10-13T21:37:31 | 2020-04-30T07:25:34 | Java | UTF-8 | Java | false | false | 830 | java | package com.org.blinkhealth.pageobjects;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class LoginPage {
private WebDriver driver;
@FindBy(id = "email")
private WebElement user_email;
@FindBy(id = "password")
private WebElement user_password;
@FindBy(xpath = "//div[@id='app']/div/div/div[2]/div/div/div[2]/div/form/div/div/span/button/span")
private WebElement loginButton;
public LoginPage(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
public void login(String email, String passwd) {
user_email.sendKeys(email);
user_password.sendKeys(passwd);
loginButton.click();
}
}
| [
"bcashb@gmail.com"
] | bcashb@gmail.com |
36e1df7c1f025e4fcaf9f655e15f5781fe1256bc | 59ad1ab891989ed07598db4731da853792ce4929 | /demo-goods/src/test/java/org/demo/goods/AppTest.java | 29e188d8754cc565691b31f15dfb7e170e2733b8 | [
"MIT"
] | permissive | gkl123/spring-boot-demo-with-angular | fa82ad4b7488a206c8ffe63499914150e6ff9186 | d79333efc86b843be04042ecb436ecf99724ac9d | refs/heads/master | 2020-03-19T01:06:50.642898 | 2018-06-11T10:01:53 | 2018-06-11T10:01:53 | 135,523,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package org.demo.goods;
/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName ) {}
}
| [
"734130455"
] | 734130455 |
80df83eba8d92e053ce0db35e8fae6f508a691a4 | c11bf09c8d2bd908587dee049083c6a5eae1e4c6 | /ServerEngine/src/main/java/cyou/mrd/game/DefaultGameServer.java | 6bbaa8e5b8b3122b4b668580462c4bfd8f2c4b65 | [
"MIT"
] | permissive | luoph/threecss-mmorpg | 009f53861bf5836dc9ce46830f4d7700657be64f | 0779c5374a5b4ee0a6bb92461eb394eb7ad9a93b | refs/heads/master | 2020-08-15T12:56:09.049916 | 2019-10-16T12:12:43 | 2019-10-16T12:12:43 | 215,346,444 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package cyou.mrd.game;
import cyou.mrd.Platform;
import cyou.mrd.service.AdminService;
import cyou.mrd.service.PlayerService;
import cyou.mrd.service.VersionService;
/**
* @author
* 默认的游戏服务,提供的基本的玩家、版本和GM服务
*/
public class DefaultGameServer implements GameServer {
@Override
public void startup() throws Exception {
// 创建service
Platform.getAppContext().create(PlayerService.class, PlayerService.class);
Platform.getAppContext().create(VersionService.class, VersionService.class);
Platform.getAppContext().create(AdminService.class, AdminService.class);
}
}
| [
"232365732@qq.com"
] | 232365732@qq.com |
aff502c91721c59a1dd5a3d5d81a1ca13851b82e | 3d048c8b3a1bbe11789cb7d29ee5d306d3a3a05c | /sources/main/actions/notifications/sendGroupNotification.java | e998393d213e2f67b1de28d7f4df96e407c440bc | [] | no_license | Java-CDS-club/ERP-4 | ac4fe2519dc77fab7b10bfcf7da7c71366677a11 | 460d1819daa865e1e46cb4d466c2b8cf56467873 | refs/heads/master | 2023-04-18T01:05:53.911121 | 2016-05-09T06:11:48 | 2016-05-09T06:11:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,335 | java | package actions.notifications;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import postgreSQLDatabase.notifications.Notifications;
/**
* Servlet implementation class sendGroupNotification
*/
public class sendGroupNotification extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public sendGroupNotification() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
PreparedStatement proc;
Notifications notif=new Notifications();
try {
notif.setType(request.getParameter("notif_type"));
notif.setLink(request.getParameter("link"));
notif.setMessage(request.getParameter("message"));
notif.setAuthor(request.getParameter("notif_author"));
SimpleDateFormat date_format = new SimpleDateFormat("mm-dd-yyyy hh:MM:ss.SSSSSS");
notif.setTimestamp(new java.sql.Date(date_format.parse(request.getParameter("notif_timestamp")).getTime()));
notif.setExpiry(new java.sql.Date(date_format.parse(request.getParameter("expiry")).getTime()));
String [] users_id=request.getParameter("users_id").split(",");
ArrayList<Long> users_id_array=new ArrayList<Long>();
for(String user:users_id){
users_id_array.add(Long.parseLong(user));
}
System.out.println(notif.getMessage()+notif.getAuthor());
postgreSQLDatabase.notifications.Query.addGroupNotification(notif,users_id_array);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"meghagupta.mg04@gmail.com"
] | meghagupta.mg04@gmail.com |
740433c06ac036a813c51d0303b6b0eedcd0d187 | b956f9cc194a119dd1422093918dab87b200c7a7 | /src/main/java/com/example/artistas_eventos_marcel/converter/Converter.java | f32b1210e1f7821664f9e538668fac14f789baab | [] | no_license | mperez10/Artistas | 178dec7289179dbec90d5bcf3b0e04ab11fa6255 | b99ba57b170cc3833d8798b6c931039bc6eb7aea | refs/heads/master | 2020-08-29T22:28:02.947834 | 2019-10-29T02:54:11 | 2019-10-29T02:54:11 | 218,190,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package com.example.artistas_eventos_marcel.converter;
import com.example.artistas_eventos_marcel.entity.SessionEntity;
import com.example.artistas_eventos_marcel.entity.UserEntity;
import com.example.artistas_eventos_marcel.entity.UsuarioArtistasEntity;
import com.example.artistas_eventos_marcel.model.SessionModel;
import com.example.artistas_eventos_marcel.model.UserModel;
import com.example.artistas_eventos_marcel.model.UsuarioArtistasModel;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component("convertidor")
public class Converter {
public List<UserModel> UserEntityToUserModel(List<UserEntity> usersEntity){
List<UserModel> usersModel = new ArrayList<UserModel>();
for(UserEntity userEnt: usersEntity){
usersModel.add(new UserModel(userEnt));
}
return usersModel;
}
public List<SessionModel> SessionEntityToSessionModel(List<SessionEntity> sessionsEntity){
List<SessionModel> sessionsModel = new ArrayList<SessionModel>();
for(SessionEntity sessEnt: sessionsEntity){
sessionsModel.add(new SessionModel(sessEnt));
}
return sessionsModel;
}
public List<UsuarioArtistasModel> UsuArtisEntiToUsuArtisModel(List<UsuarioArtistasEntity> usuArtisEntidad){
List<UsuarioArtistasModel> usuArtisModelo = new ArrayList<UsuarioArtistasModel>();
for(UsuarioArtistasEntity usuArtistasKey: usuArtisEntidad){
usuArtisModelo.add(new UsuarioArtistasModel(usuArtistasKey));
}
return usuArtisModelo;
}
}
| [
"marceloperez9210@gmail.com"
] | marceloperez9210@gmail.com |
1cc034a5c3bcad1f2c238006ce044c41a6588a31 | 9947f65f64c4f7fdcfdc2011b1b063ce38af64ec | /communicationprotocol/src/main/java/com/epocal/reader/legacy/message/request/command/LegacyReqInvalidCard.java | 6ff622dfbfa2b36d547adf91291a116b2fa20d75 | [] | no_license | zhuanglm/HostBridge | 792e3243dfb4f28aa17d2a17df2f66b1717eb3ff | a9413aefa0ec99d16d6b1ff15171d06a058d449d | refs/heads/master | 2020-04-12T04:59:34.821814 | 2019-01-23T18:55:57 | 2019-01-23T18:55:57 | 150,601,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,621 | java | package com.epocal.reader.legacy.message.request.command;
import android.util.Log;
import com.epocal.reader.MsgPayload;
import com.epocal.reader.enumtype.InterfaceType;
import com.epocal.reader.enumtype.MessageClass;
import com.epocal.reader.enumtype.MessageGroup;
import com.epocal.reader.enumtype.ParseResult;
import com.epocal.reader.enumtype.legacy.LegacyMessageType;
import com.epocal.reader.type.MessageDescriptor;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/**
* Created by rzhuang on Aug 10 2018.
*/
public class LegacyReqInvalidCard extends MsgPayload {
public static final MessageDescriptor MESSAGE_DESCRIPTOR = new MessageDescriptor(
InterfaceType.Legacy, MessageClass.Generic, MessageGroup.Debug,
LegacyMessageType.InvalidCard.value);
@Override
public MessageDescriptor getDescriptor() {
return MESSAGE_DESCRIPTOR;
}
public LegacyReqInvalidCard() {
}
@Override
public int fillBuffer() {
try {
ByteArrayOutputStream output = new ByteArrayOutputStream();
output.write(0);
output.flush();
setRawBuffer(output.toByteArray());
output.close();
return getRawBuffer().length;
} catch (IOException e) {
Log.e(LegacyMessageType.convert(getDescriptor().getType()).name(), e.getLocalizedMessage());
}
return 0;
}
@Override
public ParseResult parseBuffer(byte[] buffer) {
return ParseResult.InvalidCall;
}
@Override
public String toString() {
return null;
}
} | [
"raymond.zhuang@siemens-healthineers.com"
] | raymond.zhuang@siemens-healthineers.com |
59b4266336e18019795309d888e295ba4b887842 | da345f79c52d001aa29f4218f5c27f03dc99a9a3 | /src/com/ipcamer/demo/CameralistFragment.java | f595657554794898c60cb9fe1356de0a1cb33849 | [] | no_license | jshanwei/PetCare | 0ab80f990da5e719478a3a8607c37cc3df54c2d3 | 5fd43d009e137f029e8f0dc5caeae0e08bc3c1b5 | refs/heads/master | 2016-09-05T21:47:36.188260 | 2015-03-03T02:19:13 | 2015-03-03T02:19:13 | 31,574,552 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 7,143 | java | package com.ipcamer.demo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import vstc2.nativecaller.NativeCaller;
import com.ipcamer.demo.R;
import com.ipcamer.demo.AddCameraActivity.StartPPPPThread;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import com.ipcamer.demo.BridgeService.AddCameraInterface;
import com.ipcamer.demo.BridgeService.IpcamClientInterface;
import com.ipcamer.demo.PlayActivity.feed;
public class CameralistFragment extends Fragment {
private String uid;
private ListView listview;
private SimpleAdapter adapter;
private ImageButton addCamera;
//public List<Map<String,Object>> cameraList=new ArrayList<Map<String,Object>>();
//private AddCameraActivity newAddCameraActivity;
private ConnectCameraListener connectcamera;
public interface ConnectCameraListener{
public void ConnectCamera(String id,int num);
public void linksecond(String id);
}
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,
Bundle savedInstanceState){
View cameralistLayout=inflater.inflate(R.layout.main_camera_gridview,container,false);
uid=((MainActivity)getActivity()).getUid();
System.out.println("uid is "+uid);
createAdapterData();
listview=(ListView)cameralistLayout.findViewById(R.id.listviewCamera);
addCamera=(ImageButton)cameralistLayout.findViewById(R.id.imgAddDevice);
adapter=new SimpleAdapter(getActivity(), SystemValue.cameraList, R.layout.mian_camera_listview,
new String[]{"uid","img","cameraName","status"},
new int[]{R.id.camera_info_uid,R.id.imagecamer,R.id.camera_info_name,
R.id.camera_info_status});
listview.setAdapter(adapter);
listview.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
ListView listView=(ListView)parent;
HashMap<String,String> map=(HashMap<String,String>) listView.getItemAtPosition(position);
String id1=new String();
id1=map.get("uid");
Log.d("CameralistFragment 连接",id1);
String status=new String();
status=map.get("status");
if(status.equals("在线")){
Intent intent = new Intent(getActivity(),
PlayActivity.class);
Bundle mBundle=new Bundle();
mBundle.putSerializable("cameraInfo", id1);
intent.putExtras(mBundle);
getActivity().startActivity(intent);
}else{
/*Intent i=new Intent();
i.setClass(getActivity(), AddCameraActivity.class);
Bundle mBundle=new Bundle();
mBundle.putSerializable("cameraInfo", id1);
i.putExtras(mBundle);
getActivity().startActivity(i); */
//执行点击连接功能,和点击播放功能。
connectcamera.ConnectCamera(id1,position);
}
}
});
addCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
return cameralistLayout;
}
/*private List<Map<String,Object>> getData(){
final List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();
Map<String,Object> map=new HashMap<String,Object>();
map.put("uid", "VSTC439989PTRKJ");
map.put("cameraName","实验室喂食机1");
//map.put("img",R.drawable.cameralist_settting_button);
map.put("status", "点击进入");
list.add(map);
Map<String,Object> map4=new HashMap<String,Object>();
map4.put("uid", "VSTC440015EPMHF");
map4.put("cameraName","实验室喂食机1独立摄像机");
//map.put("img",R.drawable.cameralist_settting_button);
map4.put("status", "点击进入");
list.add(map4);
Map<String,Object> map5=new HashMap<String,Object>();
map5.put("uid", "VSTC306312TVNJJ");
map5.put("cameraName","实验室喂食机2");
//map.put("img",R.drawable.cameralist_settting_button);
map5.put("status", "点击进入");
list.add(map5);
return list;
}*/
public void createAdapterData(){
SystemValue.cameraList.clear();
Map<String,Object> map=new HashMap<String,Object>();
map.put("uid","VSTC542187NXFGW");
map.put("cameraName","实验室喂食机1");
map.put("status", "点击连接");
Map<String,Object> map2=new HashMap<String,Object>();
SystemValue.cameraList.add(map);
map2.put("uid","VSTC440015EPMHF");
map2.put("cameraName","实验室独立IPCam");
map2.put("status", "点击连接");
SystemValue.cameraList.add(map2);
Map<String,Object> map3=new HashMap<String,Object>();
map3.put("uid","VSTC306312TVNJJ");
map3.put("cameraName","实验室喂食机2");
map3.put("status", "点击连接");
SystemValue.cameraList.add(map3);
Map<String,Object> map9=new HashMap<String,Object>();
map9.put("uid","VSTC538656TEBBM");
map9.put("cameraName","许师傅办公室01");
map9.put("status", "点击连接");
SystemValue.cameraList.add(map9);
Map<String,Object> map10=new HashMap<String,Object>();
map10.put("uid","VSTC509938VKBTR");
map10.put("cameraName","许师傅办公室02");
map10.put("status", "点击连接");
SystemValue.cameraList.add(map10);
Map<String,Object> map4=new HashMap<String,Object>();
map4.put("uid","VSTC306907PSSPY");
map4.put("cameraName","喂食机测试01_user");
map4.put("status", "点击连接");
SystemValue.cameraList.add(map4);
Map<String,Object> map13=new HashMap<String,Object>();
map13.put("uid","VSTC510422EBVHF");
map13.put("cameraName","喂食机测试02_user");
map13.put("status", "点击连接");
SystemValue.cameraList.add(map13);
Map<String,Object> map6=new HashMap<String,Object>();
map6.put("uid","VSTC234402PGLDV");
map6.put("cameraName","喂食机测试04");
map6.put("status", "点击连接");
SystemValue.cameraList.add(map6);
Map<String,Object> map11=new HashMap<String,Object>();
map11.put("uid","VSTC538662YGVHJ");
map11.put("cameraName","喂食机测试07");
map11.put("status", "点击连接");
SystemValue.cameraList.add(map11);
Map<String,Object> map12=new HashMap<String,Object>();
map12.put("uid","VSTC575774PPXUN");
map12.put("cameraName","喂食机测试08");
map12.put("status", "点击连接");
SystemValue.cameraList.add(map12);
}
public void refresh(){
adapter.notifyDataSetChanged();
Log.d("CameralistFragment refresh()", "excute refresh()");
}
private void changeStatus(String s){
}
@Override
public void onAttach(Activity activity){
super.onAttach(activity);
try{
connectcamera=(ConnectCameraListener)activity;
}catch(ClassCastException e){
throw new ClassCastException(activity.toString()+"must implement ConnectCammeraListener");
}
}
}
| [
"jshanwei@126.com"
] | jshanwei@126.com |
a10953bf5f55a00b4508ad99f14c5be9d96552c8 | 88525224597479833ed444d40402ccbaea4f45c0 | /src/main/java/survey/model/manageVO.java | 9d1997eae8886e2ef7aeec780819af636714a3d1 | [] | no_license | ll0513ll/KoscomSurveyNew | 40833c9d20519bf7fb3f99e0b652de35545221d7 | 2e666cfc912a5036bb6669b772d6f15dee95130a | refs/heads/master | 2020-06-26T01:30:43.890374 | 2019-11-13T05:34:03 | 2019-11-13T05:34:03 | 199,482,744 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,656 | java | package survey.model;
public class manageVO {
private int cate_no;
private int company_no;
private String company_name;
private String manager;
private int satis_val;
private String dissatis_reason;
public manageVO() {
}
public manageVO(int cate_no, int company_no, String company_name, String manager, int satis_val,
String dissatis_reason) {
this.cate_no = cate_no;
this.company_no = company_no;
this.company_name = company_name;
this.manager = manager;
this.satis_val = satis_val;
this.dissatis_reason = dissatis_reason;
}
public int getCate_no() {
return cate_no;
}
public void setCate_no(int cate_no) {
this.cate_no = cate_no;
}
public int getCompany_no() {
return company_no;
}
public void setCompany_no(int company_no) {
this.company_no = company_no;
}
public String getCompany_name() {
return company_name;
}
public void setCompany_name(String company_name) {
this.company_name = company_name;
}
public String getManager() {
return manager;
}
public void setManager(String manager) {
this.manager = manager;
}
public int getSatis_val() {
return satis_val;
}
public void setSatis_val(int satis_val) {
this.satis_val = satis_val;
}
public String getDissatis_reason() {
return dissatis_reason;
}
public void setDissatis_reason(String dissatis_reason) {
this.dissatis_reason = dissatis_reason;
}
@Override
public String toString() {
return "manageVO [cate_no=" + cate_no + ", company_no=" + company_no + ", company_name=" + company_name
+ ", manager=" + manager + ", satis_val=" + satis_val + ", dissatis_reason=" + dissatis_reason + "]";
}
}
| [
"sungmo58486@gmail.com"
] | sungmo58486@gmail.com |
10966d4a1fd672ec5157ec1c609d87e377d54cb9 | 0ffe5765b6a5ed454707fb5875ef174dbe576944 | /src/array/Range_Module/Range_Module.java | a7aa84ea8be0c118c7289364fd55480feeb2433c | [] | no_license | liupenny/algorithms | 92b68c6de9abf95747dacda90d15f03791aa5ac5 | f42801c4a5881686905214eddbb8e8ac204fa90d | refs/heads/master | 2021-07-13T08:26:59.691297 | 2018-12-31T13:56:37 | 2018-12-31T13:56:37 | 116,551,822 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,664 | java | package array.Range_Module;
import java.util.*;
/**
* Created by PennyLiu on 2018/6/8.
*/
public class Range_Module {
class RangeModule {
TreeMap<Integer, Integer> map;
public RangeModule() {
map = new TreeMap<>();
}
public void addRange(int left, int right) {
if(left >= right) {
return;
}
// start,end是比left,right小的key
Integer start = map.floorKey(left);
Integer end = map.floorKey(right);
if(start == null && end == null) //没有比left,start小的起点
{
map.put(left, right);
} else if(start != null && map.get(start) >= left) //有比left小的开头,且这一段的结尾大于left,所以合并为start到(right, start对应结尾,end对应结尾)的最大值
{
map.put(start, Math.max(map.get(end), Math.max(right, map.get(start))));
} else //start=null,end!=null.合并为left,到(right,end对应结尾)的最大值
{
map.put(left, Math.max(right, map.get(end)));
}
// 删除left和right之间的interval,因为上面考虑了比left,right小的全部,所以这就把上面考虑过的删除,因为left是加上去的,所以不考虑
Map<Integer, Integer> subMap = map.subMap(left,false,right,true);
Set<Integer> set = new HashSet(subMap.keySet());
map.keySet().removeAll(set);
}
public boolean queryRange(int left, int right) {
Integer start = map.floorKey(left);
if(start == null) {
return false;
}
return map.get(start) >= right;
}
public void removeRange(int left, int right) {
if(right <= left) {
return;
}
Integer start = map.floorKey(left);
Integer end = map.floorKey(right);
// 这里注意顺序,先考虑end,再是start
if(end != null && map.get(end) > right) {
map.put(right, map.get(end));
}
if(start != null && map.get(start) > left) {
map.put(start, left);
}
//清理中间的部分,right是这一轮加上去的,所以不考虑
Map<Integer, Integer> subMap = map.subMap(left,true,right,false);
Set<Integer> set = new HashSet<>(subMap.keySet());
map.keySet().removeAll(set);
}
}
public static void main(String[] args) {
Range_Module t = new Range_Module();
}
}
| [
"651023146@qq.com"
] | 651023146@qq.com |
e51bbd642ec5affbbc28f8d52ba6ad5b58492f61 | b76ea5a254aa54cd355db31ffe2737cf9bd7fec8 | /src/main/java/ru/javazen/telegram/bot/entity/payment/SuccessfulPayment.java | 9595e144489990c3c14ef3ad6eb0f57fb0d18c69 | [
"Apache-2.0"
] | permissive | asmal95/telegram-bot-meta | 79fbc4532da438ca8d2eea5e2fcc74218e5e4600 | 1bc06a73777f37c458916cb3201212f83b33b423 | refs/heads/master | 2021-01-23T22:31:04.627584 | 2018-01-14T18:55:09 | 2018-01-14T18:55:09 | 102,939,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,304 | java | package ru.javazen.telegram.bot.entity.payment;
/**
* Created by Andrew on 07.07.2017.
*/
public class SuccessfulPayment {
private String currency;
private Integer totalAmount;
private String invoicePayload;
private String shippingOptionId;
private OrderInfo orderInfo;
private String telegramPaymentChargeId;
private String providerPaymentChargeId;
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public Integer getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(Integer totalAmount) {
this.totalAmount = totalAmount;
}
public String getInvoicePayload() {
return invoicePayload;
}
public void setInvoicePayload(String invoicePayload) {
this.invoicePayload = invoicePayload;
}
public String getShippingOptionId() {
return shippingOptionId;
}
public void setShippingOptionId(String shippingOptionId) {
this.shippingOptionId = shippingOptionId;
}
public OrderInfo getOrderInfo() {
return orderInfo;
}
public void setOrderInfo(OrderInfo orderInfo) {
this.orderInfo = orderInfo;
}
public String getTelegramPaymentChargeId() {
return telegramPaymentChargeId;
}
public void setTelegramPaymentChargeId(String telegramPaymentChargeId) {
this.telegramPaymentChargeId = telegramPaymentChargeId;
}
public String getProviderPaymentChargeId() {
return providerPaymentChargeId;
}
public void setProviderPaymentChargeId(String providerPaymentChargeId) {
this.providerPaymentChargeId = providerPaymentChargeId;
}
@Override
public String toString() {
return "SuccessfulPayment{" +
"currency='" + currency + '\'' +
", totalAmount=" + totalAmount +
", invoicePayload='" + invoicePayload + '\'' +
", shippingOptionId='" + shippingOptionId + '\'' +
", orderInfo=" + orderInfo +
", telegramPaymentChargeId='" + telegramPaymentChargeId + '\'' +
", providerPaymentChargeId='" + providerPaymentChargeId + '\'' +
'}';
}
}
| [
"asmal95@mail.ru"
] | asmal95@mail.ru |
8f3b7f6842d13b7814b69cbb9df5e8fdb866a2fc | bec4df8f6e0b9e5dc042f206272c93660b69bf5b | /.svn/pristine/37/37957c8b5d615844c3ff55caa88a678af83c6006.svn-base | e45523fc1630eb9120caf49c0cd1494741fc3d29 | [] | no_license | chocoai/cores | 8d1fdce61753f2c5fa6a3ff4d62d5734e9be9b1d | 6a863b4043893d1ac8f29899f772e6d26d55ea7d | refs/heads/master | 2021-05-31T22:05:56.796757 | 2016-07-05T15:13:42 | 2016-07-05T15:13:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,731 | package com.lanen.view.action.studyplan;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.lanen.base.BaseAction;
import com.lanen.jsonAndModel.Json;
import com.lanen.jsonAndModel.JsonPluginsUtil;
import com.lanen.model.studyplan.DictBloodCoag;
import com.opensymphony.xwork2.ActionContext;
@Controller
@Scope("prototype")
public class DictBloodCoagAction extends BaseAction<DictBloodCoag>{
private static final long serialVersionUID = 1L;
private String oldAbbr;
/**
* 顺序设置参数
*/
private int orderNoPara;
/**
* 顺序设置参数
*/
private int orderNoNext;
/** 列表*/
public String list() throws Exception {
return "list";
}
/**list加载数据(json)*/
public void loadList(){
List<DictBloodCoag> objList=dictBloodCoagService.getAll();
String[] _nory_changes ={"orderNo","name","abbr","precision","unit"};
String jsonStr = JsonPluginsUtil.beanListToJson(objList, _nory_changes , true);
writeJson(jsonStr);
}
/** 增加页面*/
public String addUI() throws Exception {
return "addUI";
}
/**异步检查名称是否存在*/
public void checkName(){
if(null!=model.getName() && !"".equals(model.getName())){
boolean isExist = dictBloodCoagService.isExistByName(model.getName());
if(!isExist){
writeJson("true");
}else{
writeJson("false");
}
}else{
writeJson("false");
}
}
/**异步检查缩写是否存在*/
public void checkAbbr(){
if(null!=model.getAbbr() && !"".equals(model.getAbbr())){
boolean isExist = dictBloodCoagService.isExistByAbbr(model.getAbbr());
if(!isExist){
writeJson("true");
}else{
writeJson("false");
}
}else{
writeJson("false");
}
}
/** 增加 (保存) */
public String add() throws Exception {
if(!checkValue()){
//ActionContext.getContext().getValueStack().push(model);
addFieldError("error","信息填写有误!");
return "addUI";
}
model.setOrderNo(dictBloodCoagService.getNextOrderNo());
dictBloodCoagService.save(model);
return "toList";
}
/**查询指标是否已经设置了通道号(异步 json)*/
public void checkIsExist()throws Exception{
Json json = new Json();
String abbr = model.getAbbr();
if(null != abbr && !"".equals(abbr) ){
boolean isExist = passagewayService.isExist(abbr,3);
if(isExist){
json.setSuccess(false);
json.setMsg(abbr+"已设通道号,无法删除或编辑");
}else{
json.setSuccess(true);
json.setMsg("");
}
}else{
json.setMsg("与服务器交互错误");
}
String jsonStr = JsonPluginsUtil.beanToJson(json);
writeJson(jsonStr);
}
/** 删除(异步 json)*/
public void delete() {
Json json = new Json();
if(null!=model.getName() && !"".equals(model.getName())){
DictBloodCoag dictBloodCoag = dictBloodCoagService.getById(model.getName());
String abbr = dictBloodCoag.getAbbr();
boolean isExist = passagewayService.isExist(abbr,3);
if(isExist){
json.setSuccess(false);
json.setMsg("‘"+abbr+"’已设置通道号,无法删除");
}else{
dictBloodCoagService.delete(model.getName());
json.setSuccess(true);
json.setMsg("删除成功");
}
}else{
json.setMsg("删除失败");
}
String jsonStr = JsonPluginsUtil.beanToJson(json);
writeJson(jsonStr);
}
/** 修改页面*/
public String editUI() throws Exception {
if(null!=model.getName() && !"".equals(model.getName())){
DictBloodCoag obj =dictBloodCoagService.getById(model.getName());
ActionContext.getContext().getValueStack().push(obj);
return "editUI";
}else{
return "toList";
}
}
/**检查缩写是否存在(自己除外)*/
public void checkOtherAbbr(){
if(null!=model.getAbbr() && !"".equals(model.getAbbr())&&null!=oldAbbr && !"".equals(oldAbbr)){
if(oldAbbr.trim().equals(model.getAbbr().trim())){
writeJson("true");
}else{
boolean isExist = dictBloodCoagService.isExistByAbbr(model.getAbbr());
if(!isExist){
writeJson("true");
}else{
writeJson("false");
}
}
}else{
writeJson("false");
}
}
/** 修改*/
public String edit() throws Exception {
if(!checkValue_edit()){
// ActionContext.getContext().getValueStack().push(model);
addFieldError("error","信息填写有误!");
return "editUI";
}
DictBloodCoag DictBloodCoag =dictBloodCoagService.getById(model.getName());
DictBloodCoag.setAbbr(model.getAbbr());
DictBloodCoag.setPrecision(model.getPrecision());
DictBloodCoag.setUnit(model.getUnit());
dictBloodCoagService.update(DictBloodCoag);
return "toList";
}
/**验证 输入的值(添加)*/
public boolean checkValue(){
if(null==model.getName()||"".equals(model.getName())){
return false;
}else if(null==model.getAbbr()||"".equals(model.getAbbr())){
return false;
}
boolean isExistName = dictBloodCoagService.isExistByName(model.getName());
if(isExistName){
return false;
}
boolean isExistAbbr = dictBloodCoagService.isExistByAbbr(model.getAbbr());
if(isExistAbbr){
return false;
}
return true;
}
/**验证 输入的值(添加)*/
public boolean checkValue_edit(){
if(null==model.getName()||"".equals(model.getName())){
return false;
}else if(null==model.getAbbr()||"".equals(model.getAbbr())){
return false;
}
boolean isExistName = dictBloodCoagService.isExistByName(model.getName());
if(!isExistName){
return false;
}
boolean isExistAbbr = dictBloodCoagService.isExistByNameAbbr(model.getName(),model.getAbbr());
if(isExistAbbr){
return false;
}
return true;
}
/** 顺序设置*/
public void moveOrder() {
Map<String,Object> map = new HashMap<String,Object>();
if(orderNoPara!=0&&orderNoNext!=0){
dictBloodCoagService.moveOeder(orderNoPara, orderNoNext);
map.put("success", true);
map.put("msg","移动设置成功");
DictBloodCoag currentRow = dictBloodCoagService.getByOrderNo(orderNoPara);
DictBloodCoag nextRow = dictBloodCoagService.getByOrderNo(orderNoNext);
map.put("nextRow", nextRow);
map.put("currentRow", currentRow);
}else{
map.put("success", false);
map.put("msg","移动设置失败");
}
String jsonStr = JsonPluginsUtil.beanToJson(map);
writeJson(jsonStr);
}
public int getOrderNoPara() {
return orderNoPara;
}
public void setOrderNoPara(int orderNoPara) {
this.orderNoPara = orderNoPara;
}
public int getOrderNoNext() {
return orderNoNext;
}
public void setOrderNoNext(int orderNoNext) {
this.orderNoNext = orderNoNext;
}
public String getOldAbbr() {
return oldAbbr;
}
public void setOldAbbr(String oldAbbr) {
this.oldAbbr = oldAbbr;
}
}
| [
"691529382@qq.com"
] | 691529382@qq.com | |
da9e431cfda7f45d06ff85066707d9858c13c608 | 4bdeba9d424485f8fd60b43164d1f7aa07242844 | /src/main/java/com/aileci/speechcenter/serviceimpl/TextToSpeechServiceImpl.java | 9b9eb8725423626096a36f8a68422364464c71b7 | [] | no_license | ljl86400/TextToSpeech | fbe3eaafa391292ba9e33c0ba558ac0893a959bd | 64c531314c2b6a45da21d707b70b06a231f4c5b0 | refs/heads/master | 2021-04-26T22:11:54.077696 | 2016-03-21T16:04:31 | 2016-03-21T16:04:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,179 | java | package com.aileci.speechcenter.serviceimpl;
import com.aileci.speechcenter.service.TextToSpeechService;
import com.aileci.speechcenter.service.model.ResultParameterModel;
import com.aileci.speechcenter.service.model.SpeechResultModel;
import com.aileci.speechcenter.utils.CheckFileIsExistByText;
import com.aileci.speechcenter.utils.SapiFunctionUtil;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* Created by gaoqi on 2015/5/28.
*/
@Service
public class TextToSpeechServiceImpl implements TextToSpeechService {
/**
* 将输入的文本串转换成语音
* @param text
* @param volume
* @param rate
*/
public void textToSpeech(String text,Integer volume,Integer rate){
SapiFunctionUtil.textToSpeechUtil(text, volume, rate);
}
/**
* 根据输入的文本以及相应参数生成语音文件
* @param text
* @param volume
* @param rate
* @param date
* @param fileType
* @param path
* @return
*/
public SpeechResultModel getSpeechFileByText(String text,Integer volume,Integer rate,Date date,String fileType,String path){
SpeechResultModel speechResultModel=new SpeechResultModel();
if(!CheckFileIsExistByText.fileIsExist(path,text,fileType))
{
return SapiFunctionUtil.saveSpeechToFile(text,volume,rate,date,fileType,path);
}
speechResultModel.setRate(rate);
speechResultModel.setVolume(volume);
speechResultModel.setText(text);
speechResultModel.setStatus(0);
speechResultModel.setFilePath(path);
return speechResultModel;
}
/**
* 根据输入的文件夹路径将路径下包含的文本文件转换成语音文件
* @param text
* @param volume
* @param rate
* @param date
* @param fileType
* @param path
* @return
*/
public SpeechResultModel getSpeechFileByDir(String text,Integer volume,Integer rate,Date date,String fileType,String path){
return null;
}
public ResultParameterModel getSpeechFile(String text,Integer volume,Integer rate,String fileType){
return null;
}
}
| [
"18954182574@163.com"
] | 18954182574@163.com |
669157153fe5dac4a7e3b02975ea011d6ec7b470 | 112af4a1c9b633900cb91ee415f1b5a884419e71 | /src/test/java/org/joda/time/TestInterval_Constructors.java | 905b2637bbb5029cf45e01bd837b9561bb3b7a6c | [
"Apache-2.0"
] | permissive | Frenkymd/experiment-sample | e2fd263aba07849944ee0e51930dbc277597d972 | 155860dcda6e66cf9a9dffd686cc1eb3a80eb11f | refs/heads/master | 2022-12-26T23:52:04.170504 | 2020-04-14T10:32:26 | 2020-04-14T10:32:26 | 255,546,614 | 0 | 0 | Apache-2.0 | 2020-10-13T21:10:37 | 2020-04-14T07:59:49 | Java | UTF-8 | Java | false | false | 30,371 | java | /*
* Copyright 2001-2006 Stephen Colebourne
*
* 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.joda.time;
import java.util.Locale;
import java.util.TimeZone;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.joda.time.chrono.BuddhistChronology;
import org.joda.time.chrono.CopticChronology;
import org.joda.time.chrono.GJChronology;
import org.joda.time.chrono.ISOChronology;
import org.joda.time.convert.ConverterManager;
import org.joda.time.convert.IntervalConverter;
/**
* This class is a JUnit test for Interval.
*
* @author Stephen Colebourne
*/
public class TestInterval_Constructors extends TestCase {
// Test in 2002/03 as time zones are more well known
// (before the late 90's they were all over the place)
private static final DateTimeZone PARIS = DateTimeZone.forID("Europe/Paris");
private static final DateTimeZone LONDON = DateTimeZone.forID("Europe/London");
long y2002days = 365 + 365 + 366 + 365 + 365 + 365 + 366 + 365 + 365 + 365 +
366 + 365 + 365 + 365 + 366 + 365 + 365 + 365 + 366 + 365 +
365 + 365 + 366 + 365 + 365 + 365 + 366 + 365 + 365 + 365 +
366 + 365;
long y2003days = 365 + 365 + 366 + 365 + 365 + 365 + 366 + 365 + 365 + 365 +
366 + 365 + 365 + 365 + 366 + 365 + 365 + 365 + 366 + 365 +
365 + 365 + 366 + 365 + 365 + 365 + 366 + 365 + 365 + 365 +
366 + 365 + 365;
// 2002-06-09
private long TEST_TIME_NOW =
(y2002days + 31L + 28L + 31L + 30L + 31L + 9L -1L) * DateTimeConstants.MILLIS_PER_DAY;
// // 2002-04-05
// private long TEST_TIME1 =
// (y2002days + 31L + 28L + 31L + 5L -1L) * DateTimeConstants.MILLIS_PER_DAY
// + 12L * DateTimeConstants.MILLIS_PER_HOUR
// + 24L * DateTimeConstants.MILLIS_PER_MINUTE;
//
// // 2003-05-06
// private long TEST_TIME2 =
// (y2003days + 31L + 28L + 31L + 30L + 6L -1L) * DateTimeConstants.MILLIS_PER_DAY
// + 14L * DateTimeConstants.MILLIS_PER_HOUR
// + 28L * DateTimeConstants.MILLIS_PER_MINUTE;
private DateTimeZone originalDateTimeZone = null;
private TimeZone originalTimeZone = null;
private Locale originalLocale = null;
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
public static TestSuite suite() {
return new TestSuite(TestInterval_Constructors.class);
}
public TestInterval_Constructors(String name) {
super(name);
}
protected void setUp() throws Exception {
DateTimeUtils.setCurrentMillisFixed(TEST_TIME_NOW);
originalDateTimeZone = DateTimeZone.getDefault();
originalTimeZone = TimeZone.getDefault();
originalLocale = Locale.getDefault();
DateTimeZone.setDefault(PARIS);
TimeZone.setDefault(PARIS.toTimeZone());
Locale.setDefault(Locale.FRANCE);
}
protected void tearDown() throws Exception {
DateTimeUtils.setCurrentMillisSystem();
DateTimeZone.setDefault(originalDateTimeZone);
TimeZone.setDefault(originalTimeZone);
Locale.setDefault(originalLocale);
originalDateTimeZone = null;
originalTimeZone = null;
originalLocale = null;
}
//-----------------------------------------------------------------------
public void testParse_noFormatter() throws Throwable {
DateTime start = new DateTime(2010, 6, 30, 12, 30, ISOChronology.getInstance(PARIS));
DateTime end = new DateTime(2010, 7, 1, 14, 30, ISOChronology.getInstance(PARIS));
assertEquals(new Interval(start, end), Interval.parse("2010-06-30T12:30/2010-07-01T14:30"));
assertEquals(new Interval(start, end), Interval.parse("2010-06-30T12:30/P1DT2H"));
assertEquals(new Interval(start, end), Interval.parse("P1DT2H/2010-07-01T14:30"));
}
//-----------------------------------------------------------------------
public void testConstructor_long_long1() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1.getMillis(), dt2.getMillis());
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(), test.getChronology());
}
public void testConstructor_long_long2() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
Interval test = new Interval(dt1.getMillis(), dt1.getMillis());
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt1.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(), test.getChronology());
}
public void testConstructor_long_long3() throws Throwable {
DateTime dt1 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
DateTime dt2 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
new Interval(dt1.getMillis(), dt2.getMillis());
fail();
} catch (IllegalArgumentException ex) {}
}
//-----------------------------------------------------------------------
public void testConstructor_long_long_Zone() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1.getMillis(), dt2.getMillis(), LONDON);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(LONDON), test.getChronology());
}
public void testConstructor_long_long_nullZone() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1.getMillis(), dt2.getMillis(), (DateTimeZone) null);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(), test.getChronology());
}
//-----------------------------------------------------------------------
public void testConstructor_long_long_Chronology() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1.getMillis(), dt2.getMillis(), GJChronology.getInstance());
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(GJChronology.getInstance(), test.getChronology());
}
public void testConstructor_long_long_nullChronology() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1.getMillis(), dt2.getMillis(), (Chronology) null);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(), test.getChronology());
}
//-----------------------------------------------------------------------
public void testConstructor_RI_RI1() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1, dt2);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
}
public void testConstructor_RI_RI2() throws Throwable {
Instant dt1 = new Instant(new DateTime(2004, 6, 9, 0, 0, 0, 0));
Instant dt2 = new Instant(new DateTime(2005, 7, 10, 1, 1, 1, 1));
Interval test = new Interval(dt1, dt2);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
}
public void testConstructor_RI_RI3() throws Throwable {
Interval test = new Interval((ReadableInstant) null, (ReadableInstant) null);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RI_RI4() throws Throwable {
DateTime dt1 = new DateTime(2000, 6, 9, 0, 0, 0, 0);
Interval test = new Interval(dt1, (ReadableInstant) null);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RI_RI5() throws Throwable {
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval((ReadableInstant) null, dt2);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
}
public void testConstructor_RI_RI6() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
Interval test = new Interval(dt1, dt1);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt1.getMillis(), test.getEndMillis());
}
public void testConstructor_RI_RI7() throws Throwable {
DateTime dt1 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
DateTime dt2 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
new Interval(dt1, dt2);
fail();
} catch (IllegalArgumentException ex) {}
}
public void testConstructor_RI_RI_chronoStart() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0, GJChronology.getInstance());
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1, dt2);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(GJChronology.getInstance(), test.getChronology());
}
public void testConstructor_RI_RI_chronoEnd() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1, GJChronology.getInstance());
Interval test = new Interval(dt1, dt2);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(), test.getChronology());
}
public void testConstructor_RI_RI_zones() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0, LONDON);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1, PARIS);
Interval test = new Interval(dt1, dt2);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(LONDON), test.getChronology());
}
public void testConstructor_RI_RI_instant() throws Throwable {
Instant dt1 = new Instant(12345678L);
Instant dt2 = new Instant(22345678L);
Interval test = new Interval(dt1, dt2);
assertEquals(12345678L, test.getStartMillis());
assertEquals(22345678L, test.getEndMillis());
assertEquals(ISOChronology.getInstanceUTC(), test.getChronology());
}
//-----------------------------------------------------------------------
public void testConstructor_RI_RP1() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(0, 6, 0, 0, 1, 0, 0, 0);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().months().add(result, 6);
result = ISOChronology.getInstance().hours().add(result, 1);
Interval test = new Interval(dt, dur);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(result, test.getEndMillis());
}
public void testConstructor_RI_RP2() throws Throwable {
Instant dt = new Instant(new DateTime(TEST_TIME_NOW));
Period dur = new Period(0, 6, 0, 3, 1, 0, 0, 0);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstanceUTC().months().add(result, 6);
result = ISOChronology.getInstanceUTC().days().add(result, 3);
result = ISOChronology.getInstanceUTC().hours().add(result, 1);
Interval test = new Interval(dt, dur);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(result, test.getEndMillis());
}
public void testConstructor_RI_RP3() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW, CopticChronology.getInstanceUTC());
Period dur = new Period(0, 6, 0, 3, 1, 0, 0, 0, PeriodType.standard());
long result = TEST_TIME_NOW;
result = CopticChronology.getInstanceUTC().months().add(result, 6);
result = CopticChronology.getInstanceUTC().days().add(result, 3);
result = CopticChronology.getInstanceUTC().hours().add(result, 1);
Interval test = new Interval(dt, dur);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(result, test.getEndMillis());
}
public void testConstructor_RI_RP4() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(1 * DateTimeConstants.MILLIS_PER_HOUR + 23L);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().hours().add(result, 1);
result = ISOChronology.getInstance().millis().add(result, 23);
Interval test = new Interval(dt, dur);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(result, test.getEndMillis());
}
public void testConstructor_RI_RP5() throws Throwable {
Interval test = new Interval((ReadableInstant) null, (ReadablePeriod) null);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RI_RP6() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Interval test = new Interval(dt, (ReadablePeriod) null);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RI_RP7() throws Throwable {
Period dur = new Period(0, 6, 0, 0, 1, 0, 0, 0);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().monthOfYear().add(result, 6);
result = ISOChronology.getInstance().hourOfDay().add(result, 1);
Interval test = new Interval((ReadableInstant) null, dur);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(result, test.getEndMillis());
}
public void testConstructor_RI_RP8() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(0, 0, 0, 0, 0, 0, 0, -1);
try {
new Interval(dt, dur);
fail();
} catch (IllegalArgumentException ex) {}
}
//-----------------------------------------------------------------------
public void testConstructor_RP_RI1() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(0, 6, 0, 0, 1, 0, 0, 0);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().months().add(result, -6);
result = ISOChronology.getInstance().hours().add(result, -1);
Interval test = new Interval(dur, dt);
assertEquals(result, test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RP_RI2() throws Throwable {
Instant dt = new Instant(new DateTime(TEST_TIME_NOW));
Period dur = new Period(0, 6, 0, 3, 1, 0, 0, 0);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstanceUTC().months().add(result, -6);
result = ISOChronology.getInstanceUTC().days().add(result, -3);
result = ISOChronology.getInstanceUTC().hours().add(result, -1);
Interval test = new Interval(dur, dt);
assertEquals(result, test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RP_RI3() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW, CopticChronology.getInstanceUTC());
Period dur = new Period(0, 6, 0, 3, 1, 0, 0, 0, PeriodType.standard());
long result = TEST_TIME_NOW;
result = CopticChronology.getInstanceUTC().months().add(result, -6);
result = CopticChronology.getInstanceUTC().days().add(result, -3);
result = CopticChronology.getInstanceUTC().hours().add(result, -1);
Interval test = new Interval(dur, dt);
assertEquals(result, test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RP_RI4() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(1 * DateTimeConstants.MILLIS_PER_HOUR + 23L);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().hours().add(result, -1);
result = ISOChronology.getInstance().millis().add(result, -23);
Interval test = new Interval(dur, dt);
assertEquals(result, test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RP_RI5() throws Throwable {
Interval test = new Interval((ReadablePeriod) null, (ReadableInstant) null);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RP_RI6() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Interval test = new Interval((ReadablePeriod) null, dt);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RP_RI7() throws Throwable {
Period dur = new Period(0, 6, 0, 0, 1, 0, 0, 0);
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().monthOfYear().add(result, -6);
result = ISOChronology.getInstance().hourOfDay().add(result, -1);
Interval test = new Interval(dur, (ReadableInstant) null);
assertEquals(result, test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RP_RI8() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(0, 0, 0, 0, 0, 0, 0, -1);
try {
new Interval(dur, dt);
fail();
} catch (IllegalArgumentException ex) {}
}
//-----------------------------------------------------------------------
public void testConstructor_RI_RD1() throws Throwable {
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().months().add(result, 6);
result = ISOChronology.getInstance().hours().add(result, 1);
DateTime dt = new DateTime(TEST_TIME_NOW);
Duration dur = new Duration(result - TEST_TIME_NOW);
Interval test = new Interval(dt, dur);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(result, test.getEndMillis());
}
public void testConstructor_RI_RD2() throws Throwable {
Interval test = new Interval((ReadableInstant) null, (ReadableDuration) null);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RI_RD3() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Interval test = new Interval(dt, (ReadableDuration) null);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RI_RD4() throws Throwable {
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().monthOfYear().add(result, 6);
result = ISOChronology.getInstance().hourOfDay().add(result, 1);
Duration dur = new Duration(result - TEST_TIME_NOW);
Interval test = new Interval((ReadableInstant) null, dur);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(result, test.getEndMillis());
}
public void testConstructor_RI_RD5() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Duration dur = new Duration(-1);
try {
new Interval(dt, dur);
fail();
} catch (IllegalArgumentException ex) {}
}
//-----------------------------------------------------------------------
public void testConstructor_RD_RI1() throws Throwable {
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().months().add(result, -6);
result = ISOChronology.getInstance().hours().add(result, -1);
DateTime dt = new DateTime(TEST_TIME_NOW);
Duration dur = new Duration(TEST_TIME_NOW - result);
Interval test = new Interval(dur, dt);
assertEquals(result, test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RD_RI2() throws Throwable {
Interval test = new Interval((ReadableDuration) null, (ReadableInstant) null);
assertEquals(TEST_TIME_NOW, test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RD_RI3() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Interval test = new Interval((ReadableDuration) null, dt);
assertEquals(dt.getMillis(), test.getStartMillis());
assertEquals(dt.getMillis(), test.getEndMillis());
}
public void testConstructor_RD_RI4() throws Throwable {
long result = TEST_TIME_NOW;
result = ISOChronology.getInstance().monthOfYear().add(result, -6);
result = ISOChronology.getInstance().hourOfDay().add(result, -1);
Duration dur = new Duration(TEST_TIME_NOW - result);
Interval test = new Interval(dur, (ReadableInstant) null);
assertEquals(result, test.getStartMillis());
assertEquals(TEST_TIME_NOW, test.getEndMillis());
}
public void testConstructor_RD_RI5() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Duration dur = new Duration(-1);
try {
new Interval(dur, dt);
fail();
} catch (IllegalArgumentException ex) {}
}
//-----------------------------------------------------------------------
public void testConstructor_Object1() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1.toString() + '/' + dt2.toString());
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
}
public void testConstructor_Object2() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval base = new Interval(dt1, dt2);
Interval test = new Interval(base);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
}
public void testConstructor_Object3() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
MutableInterval base = new MutableInterval(dt1, dt2);
Interval test = new Interval(base);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
}
public void testConstructor_Object4() throws Throwable {
MockInterval base = new MockInterval();
Interval test = new Interval(base);
assertEquals(base.getStartMillis(), test.getStartMillis());
assertEquals(base.getEndMillis(), test.getEndMillis());
}
public void testConstructor_Object5() throws Throwable {
IntervalConverter oldConv = ConverterManager.getInstance().getIntervalConverter("");
IntervalConverter conv = new IntervalConverter() {
public boolean isReadableInterval(Object object, Chronology chrono) {
return false;
}
public void setInto(ReadWritableInterval interval, Object object, Chronology chrono) {
interval.setChronology(chrono);
interval.setInterval(1234L, 5678L);
}
public Class<?> getSupportedType() {
return String.class;
}
};
try {
ConverterManager.getInstance().addIntervalConverter(conv);
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval test = new Interval(dt1.toString() + '/' + dt2.toString());
assertEquals(1234L, test.getStartMillis());
assertEquals(5678L, test.getEndMillis());
} finally {
ConverterManager.getInstance().addIntervalConverter(oldConv);
}
}
public void testConstructor_Object6() throws Throwable {
IntervalConverter oldConv = ConverterManager.getInstance().getIntervalConverter(new Interval(0L, 0L));
IntervalConverter conv = new IntervalConverter() {
public boolean isReadableInterval(Object object, Chronology chrono) {
return false;
}
public void setInto(ReadWritableInterval interval, Object object, Chronology chrono) {
interval.setChronology(chrono);
interval.setInterval(1234L, 5678L);
}
public Class<?> getSupportedType() {
return ReadableInterval.class;
}
};
try {
ConverterManager.getInstance().addIntervalConverter(conv);
Interval base = new Interval(-1000L, 1000L);
Interval test = new Interval(base);
assertEquals(1234L, test.getStartMillis());
assertEquals(5678L, test.getEndMillis());
} finally {
ConverterManager.getInstance().addIntervalConverter(oldConv);
}
}
class MockInterval implements ReadableInterval {
public Chronology getChronology() {
return ISOChronology.getInstance();
}
public long getStartMillis() {
return 1234L;
}
public DateTime getStart() {
return new DateTime(1234L);
}
public long getEndMillis() {
return 5678L;
}
public DateTime getEnd() {
return new DateTime(5678L);
}
public long toDurationMillis() {
return (5678L - 1234L);
}
public Duration toDuration() {
return new Duration(5678L - 1234L);
}
public boolean contains(long millisInstant) {
return false;
}
public boolean containsNow() {
return false;
}
public boolean contains(ReadableInstant instant) {
return false;
}
public boolean contains(ReadableInterval interval) {
return false;
}
public boolean overlaps(ReadableInterval interval) {
return false;
}
public boolean isBefore(ReadableInstant instant) {
return false;
}
public boolean isBefore(ReadableInterval interval) {
return false;
}
public boolean isAfter(ReadableInstant instant) {
return false;
}
public boolean isAfter(ReadableInterval interval) {
return false;
}
public Interval toInterval() {
return null;
}
public MutableInterval toMutableInterval() {
return null;
}
public Period toPeriod() {
return null;
}
public Period toPeriod(PeriodType type) {
return null;
}
}
//-----------------------------------------------------------------------
public void testConstructor_Object_Chronology1() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval base = new Interval(dt1, dt2);
Interval test = new Interval(base, BuddhistChronology.getInstance());
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(BuddhistChronology.getInstance(), test.getChronology());
}
public void testConstructor_Object_Chronology2() throws Throwable {
DateTime dt1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime dt2 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
Interval base = new Interval(dt1, dt2);
Interval test = new Interval(base, null);
assertEquals(dt1.getMillis(), test.getStartMillis());
assertEquals(dt2.getMillis(), test.getEndMillis());
assertEquals(ISOChronology.getInstance(), test.getChronology());
}
}
| [
"hferenc@inf.u-szeged.hu"
] | hferenc@inf.u-szeged.hu |
ea0113d81c615322a70419fbd133d4e55ac8c28f | 565a4aff5f2b2cde52df997fa83d829a8395c600 | /src/com/nick/ls/enity/Goods.java | 5690ee1831dac4d5615c67c0c0c219bd888dd4c7 | [] | no_license | lj199117/ls_server | 95ff9563c39cd09dd604da81b85f691710130532 | 90fe5ad19867624a277ce0c9f5330efa6785fa5a | refs/heads/master | 2021-01-09T20:17:45.271125 | 2016-07-09T07:50:26 | 2016-07-09T07:50:26 | 62,938,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,384 | java | package com.nick.ls.enity;
public class Goods {
private String id;//商品ID
private String categoryId;//分类ID
private String shopId;//商家ID
private String CityId;//城市ID
private String title;//商品的名称
private String sortTitle;//商品描述
private String imgUrl;//图片路径
private String startTime;//开始时间
private String value;//商品原价
private String price;//商品销售价
private String ribat;//商品折扣
private String bought;
private String maxQuota;
private String post;
private String soldOut;
private String tip;
private String endTime;//结束的时间
private String detail;//描述
private boolean isRefund;
private boolean isOverTime;
private String minquota;
private Shop shop;//所属商家
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
public String getCityId() {
return CityId;
}
public void setCityId(String cityId) {
CityId = cityId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSortTitle() {
return sortTitle;
}
public void setSortTitle(String sortTitle) {
this.sortTitle = sortTitle;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getRibat() {
return ribat;
}
public void setRibat(String ribat) {
this.ribat = ribat;
}
public String getBought() {
return bought;
}
public void setBought(String bought) {
this.bought = bought;
}
public String getMaxQuota() {
return maxQuota;
}
public void setMaxQuota(String maxQuota) {
this.maxQuota = maxQuota;
}
public String getPost() {
return post;
}
public void setPost(String post) {
this.post = post;
}
public String getSoldOut() {
return soldOut;
}
public void setSoldOut(String soldOut) {
this.soldOut = soldOut;
}
public String getTip() {
return tip;
}
public void setTip(String tip) {
this.tip = tip;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public boolean isRefund() {
return isRefund;
}
public void setRefund(boolean isRefund) {
this.isRefund = isRefund;
}
public boolean isOverTime() {
return isOverTime;
}
public void setOverTime(boolean isOverTime) {
this.isOverTime = isOverTime;
}
public String getMinquota() {
return minquota;
}
public void setMinquota(String minquota) {
this.minquota = minquota;
}
public Shop getShop() {
return shop;
}
public void setShop(Shop shop) {
this.shop = shop;
}
}
| [
"lj199117@gmail.com"
] | lj199117@gmail.com |
df66ab65353c25f9661192c9909d69231ced5ed3 | 26f57455f15e0afd6d731bd0dcf19a65f1d6addc | /Calendar+/gen/com/example/calendar_plus/BuildConfig.java | 5ae8b600a399ac9f042da5b2c2ad5594284c2c88 | [] | no_license | HHansi/Calendar_Plus | 77d4b1a2c98a80c8554e90681f7ec6bdd445c7b4 | b4cbcb430a2261507f10f6280de01a86ab5e35cc | refs/heads/master | 2020-06-08T13:15:36.695311 | 2015-08-25T18:26:48 | 2015-08-25T18:26:48 | 41,379,357 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | /** Automatically generated file. DO NOT MODIFY */
package com.example.calendar_plus;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"HHansi@github.com"
] | HHansi@github.com |
3304767de59b96b1f3baa227f3f68cb8a8df3b80 | 9be64fba5d6cee82d687a2799d3f728ee2d52508 | /app/src/androidTest/java/com/practice2/owen/myapplication/ExampleInstrumentedTest.java | c296efd0c75b72cab1180448ee699fc149ff8d46 | [] | no_license | owenryan96/OutdoorActivitiesApp | 837e36556ca6b6cf400ff9dfb84e19e90e8c6c80 | 9c323056494955023e315dfaceb518277e10647d | refs/heads/master | 2021-05-13T13:58:03.356339 | 2018-01-09T00:14:34 | 2018-01-09T00:14:34 | 116,724,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.practice2.owen.myapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.practice2.owen.myapplication", appContext.getPackageName());
}
}
| [
"oxr6760@g.rit.edu"
] | oxr6760@g.rit.edu |
d5c648721a111f9f4273fc9b65cf76609f2a8426 | 21b1db1932cbcfded187c51fa0f47f85e871c1ed | /ddbuy_freemarker_test/src/main/java/com/kgc/FreeMarkerTest.java | 78d567ba7297b8e9d716ea1baf1bc8b000915dc7 | [] | no_license | FlarneZzz/ddbuy | 452235636ce524414bc7fa856eb8aef4e747ba77 | 7e4efc0083a6d300b799983c4c211ca98281d8fc | refs/heads/master | 2023-08-10T04:36:20.227830 | 2019-08-09T02:32:36 | 2019-08-09T02:32:36 | 201,164,589 | 0 | 0 | null | 2023-07-22T13:00:00 | 2019-08-08T02:43:39 | JavaScript | UTF-8 | Java | false | false | 1,514 | java | package com.kgc;
import freemarker.template.Configuration;
import freemarker.template.Template;
import java.io.File;
import java.io.FileWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class FreeMarkerTest {
public static void main(String[] args)throws Exception {
//利用FreeMarker生成静态页面的步骤
//1.导入依赖
//2.生成静态页面的步骤
//2.1创建Configuration对象
Configuration configuration = new Configuration(Configuration.getVersion());
//2.2设置相关参数
//设置编码
configuration.setDefaultEncoding("utf-8");
//2.3设置模板目录
File file = new File("G:\\IdeaMode\\ddbuy_parent\\ddbuy_freemarker_test\\src\\main\\resources");
configuration.setDirectoryForTemplateLoading(file);
//2.3获取模板对象
Template template = configuration.getTemplate("first.ftl");
//2.4创建模板对应的模型数据
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("name", "隔壁老王");
maps.put("content", "冲啊,弟弟们");
maps.put("names", Arrays.asList("李老八", "阿布多", "于超"));
//2.5生成静态页面
FileWriter w = new FileWriter("G:\\IdeaMode\\ddbuy_parent\\ddbuy_freemarker_test\\src\\main\\resources\\auto.html");
template.process(maps,w);
w.close();
System.out.println("生成静态页面成功");
}
}
| [
"2463424980@qq.com"
] | 2463424980@qq.com |
6659917c3fa9b42a8ea3b82df4accb577f3338f1 | af47de31351f6c0c0ad1b66b1dc5192d44d75d92 | /examples/src/main/java/example/ExampleProviders.java | e1490ebdd75390ebf7f7ae52d595c128cdcd97b7 | [] | no_license | svenrienstra/hapi-fhir | f401e4bbc69ff619f9bce42de707c4791ce5f80c | 9828d27eec7e8c06ab84143916f126e4c5a5c938 | refs/heads/master | 2021-01-18T09:51:38.627160 | 2015-02-10T03:26:17 | 2015-02-10T03:26:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,589 | java | package example;
import java.util.ArrayList;
import java.util.List;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.annotation.RequiredParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
@SuppressWarnings(value= {"serial"})
public class ExampleProviders {
//START SNIPPET: plainProvider
public class PlainProvider {
/**
* This method is a Patient search, but HAPI can not automatically
* determine the resource type so it must be explicitly stated.
*/
@Search(type=Patient.class)
public Bundle searchForPatients(@RequiredParam(name="name") StringDt theName) {
Bundle retVal = new Bundle();
// perform search
return retVal;
}
}
//END SNIPPET: plainProvider
//START SNIPPET: plainProviderServer
public class ExampleServlet extends RestfulServer {
public ExampleServlet() {
/*
* Plain providers are passed to the server in the same way
* as resource providers. You may pass both resource providers
* and and plain providers to the same server if you like.
*/
List<Object> plainProviders=new ArrayList<Object>();
plainProviders.add(new PlainProvider());
setPlainProviders(plainProviders);
List<IResourceProvider> resourceProviders = new ArrayList<IResourceProvider>();
// ...add some resource providers...
setResourceProviders(resourceProviders);
}
}
//END SNIPPET: plainProviderServer
}
| [
"jamesagnew@gmail.com"
] | jamesagnew@gmail.com |
566424a72aa6582c8333da527a41b38b863299a0 | a852f09f801024ab02ada3495eaab5828abe8e13 | /BowlingGame/src/Game.java | 8261f01834b8267ab3a0f254b77b2c038cf4d0b6 | [] | no_license | 2020-2-Ajou-TDD-Assignment/201723269_jeong_jaewook | b9317db6341e4e49d3ab6eac867a3d4bbacc8e87 | bd99fa7e45dc29661deb04f18f1d734a5ae46313 | refs/heads/master | 2022-12-27T02:08:17.472401 | 2020-10-07T08:56:01 | 2020-10-07T08:56:01 | 301,115,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java |
public class Game {
private int score = 0;
private int rolls[] = new int[21];
private int currentRoll = 0;
public void roll(int pins) {
// TODO Auto-generated method stub
score += pins;
rolls[currentRoll++] = pins;
}
public int score() {
// TODO Auto-generated method stub
int score = 0;
int frameIndex=0;
for (int frame=0; frame<10; frame++) {
if (isStrike(frameIndex))
{
score += 10 + strikeBonus(frameIndex);
frameIndex++;
}
else if (isSpare(frameIndex))
{
score += 10 + spareBonus(frameIndex);
frameIndex += 2;
} else {
score += sumOfBallsInFrame(frameIndex);
frameIndex += 2;
}
}
return score;
}
private int spareBonus(int frameIndex) {
return rolls[frameIndex+2];
}
private int sumOfBallsInFrame(int frameIndex) {
return rolls[frameIndex] + rolls[frameIndex+1];
}
private boolean isStrike(int frameIndex) {
return rolls[frameIndex] == 10;
}
private boolean isSpare(int frameIndex) {
return sumOfBallsInFrame(frameIndex) == 10;
}
private int strikeBonus(int frameIndex) {
return rolls[frameIndex+1]+spareBonus(frameIndex);
}
}
| [
"br12345678@ajou.ac.kr"
] | br12345678@ajou.ac.kr |
98c75e045c8cae65416e073a211475f4b3c0552f | 6fe8e13182edfffb61315375b9bf715c8e0eec2c | /app/src/main/java/com/example/dell/imgfrmgallery/MainActivity.java | a988b29f98fbe51c80b2240bb79eaee8e853efcf | [] | no_license | RozinaDarediya/Android_S7A3_ImgFrmGallery | ebd5724ad8d2d5ebff15e331f427a79309f76bb6 | 9775e0d4c8f49cd14279f7c660c53f5d77a01884 | refs/heads/master | 2021-01-19T08:30:41.356733 | 2017-05-07T07:25:33 | 2017-05-07T07:25:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,570 | java | package com.example.dell.imgfrmgallery;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
//A button will be displayed as the app will launch .
//Clicking on that button galary will be open and you can select any image
//That will be placed in the imageview.
public class MainActivity extends AppCompatActivity {
private static int RESULT_LOAD_IMG;
String imgDecodableString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
//picImag() will be called as we click on the button and lead us to galary and allow us to pick an image from galary
//startActivityForResult will load the image img
public void pickImg(View view){
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent,RESULT_LOAD_IMG);
}
//If we are picking up the image it will get the image from out image path and load into the imageview
// else it will show toast message saying we have not pick any image.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) {
// Get the Image from data
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
// Get the cursor
Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
// Move to first row
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
imgDecodableString = cursor.getString(columnIndex);
cursor.close();
ImageView imgView = (ImageView) findViewById(R.id.imgview);
// Set the Image in ImageView after decoding the String
imgView.setImageBitmap(BitmapFactory
.decodeFile(imgDecodableString));
} else {
Toast.makeText(this, "You haven't picked Image",
Toast.LENGTH_LONG).show();
}
}
}
| [
"rozy_darediya@ymail.com"
] | rozy_darediya@ymail.com |
cd47dcbe2061dfbf025b68c6d8772843a335ae89 | ddd2901812c4ceb4ad6f48097c3ccf7db8a66343 | /src/main/java/com/xiangwen/service/UserService.java | 3c5b054098f61f53dfd7c3fa438ddcbaf6bd1af2 | [] | no_license | wenwen1289/MyBaitsDemo | 22c0bfd31947b6df47e623f1233052c4f6237e53 | 4aa37d32e4b7359cc7e96404deac3c9dadb85ec1 | refs/heads/master | 2023-04-19T11:32:40.828953 | 2021-04-28T06:17:11 | 2021-04-28T06:17:11 | 362,356,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,812 | java | package com.xiangwen.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiangwen.mapper.ClassModerMapper;
import com.xiangwen.mapper.UserMapper;
import com.xiangwen.model.ClassModel;
import com.xiangwen.model.ClassNew;
import com.xiangwen.model.Teacher;
import com.xiangwen.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private ClassModerMapper classModerMapper;
public int insertSelective(User record){
int res=userMapper.insert(record);
log.info("新增res:"+res+",userId:"+record.getUserId());
return record.getUserId();
}
public PageInfo<User> findListUser(int startPage,int pageSize){
PageHelper.startPage(startPage, pageSize);
List<User> users=userMapper.findListUser();
PageInfo<User> pageInfo = new PageInfo<User>(users);
return pageInfo;
}
public User findUserById(int id){
User user=userMapper.selectByPrimaryKey(id);
return user;
}
public ClassModel findClassById(int id){
ClassModel classModel=classModerMapper.findById(id);
return classModel;
}
public ClassModel findClassById2(int id){
ClassModel classModel=classModerMapper.findByIdTwo(id);
return classModel;
}
public ClassNew findClassNewById(int id){
ClassNew classModel=classModerMapper.findNewClass(id);
return classModel;
}
public ClassNew findClassNewById2(int id){
ClassNew classModel=classModerMapper.findNewClassTwo(id);
return classModel;
}
}
| [
"1289389257@qq.com"
] | 1289389257@qq.com |
341d926f048044e8585978ebe8bc2d2cc26c54e6 | 8ca3d0e278784ab9e5ababd363a9c44773738714 | /src/org/apollo/game/content/skills/thieving/Stalls.java | c50f4bf17f21a14e4033dd178a4dced39f2ba3cd | [
"ISC"
] | permissive | LukeSAV/ProtoScape | fa9dd5be9b24b949f08ea14cf41911bf4af5fb6a | ba6c21b3a8b36e8bd8c750a5e13dc000ef88a4fa | refs/heads/master | 2020-12-11T01:38:29.980772 | 2014-10-30T04:10:46 | 2014-10-30T04:10:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,102 | java | package org.apollo.game.content.skills.thieving;
import org.apollo.game.GameConstants;
/**
* Stalls.java
* @author The Wanderer
*/
public enum Stalls {
VEGETABLE(new int[]{4706, 4708}, 2, 10, 10, new int[]{1957, 1965, 1550, 1942, 1982}),
CAKE(new int[]{2561, 630, 6163}, 5, 16, 2.5, new int[]{1891, 2309, 1901}),
GENERAL(new int[]{4876}, 5, 16, 10, new int[]{590, 2347, 1931}),
CRAFTING(new int[]{4874, 6166}, 5, 16, 10, new int[]{1755, 1597, 1592}),
FOOD(new int[]{4875}, 5, 16, 10, new int[]{1963}),
TEA(new int[]{635, 6574}, 5, 16, 2.5, new int[]{1978}),
ROCK_CAKE(new int[]{2793}, 15, 10, 5, new int[]{2379}),
SILK(new int[]{629, 2560, 6568}, 20, 24, 5, new int[]{950}),
WINE(new int[]{14011}, 22, 27, 15, new int[]{1987, 1935, 7919, 1993, 1937}),
SEED(new int[]{7053}, 27, 10, 5, new int[]{5318, 5319, 5324, 5322, 5320, 5323, 5321, 5305, 5306, 5307, 5308, 5309, 5310, 5311, 5097}),
FUR(new int[]{632, 2563, 4278, 6571}, 35, 36, 15, new int[]{958}),
FISH(new int[]{4705, 4707, 4277}, 42, 42, 15, new int[]{359, 331, 359, 331, 359, 331, 359, 331, 377}),
SILVER(new int[]{628, 2565, 6164}, 50, 54, 30, new int[]{442}),
MAGIC(new int[]{4877}, 65, 100, 60, new int[]{554, 555, 556, 557}),
SPICE(new int[]{633, 2564, 6572}, 65, 81.3, 80, new int[]{2007}),
SCIMITAR(new int[]{4878}, 65, 100, 60, new int[]{1323}),
GEM(new int[]{631, 2562, 6162, 6570}, 75, 160, 180, new int[]{1617, 1619, 1621, 1623});
int levelReq;
int[] objects, loot;
double exp, time;
private Stalls(int[] objects, int levelReq, double exp, double time, int[] loot) {
this.objects = objects;
this.levelReq = levelReq;
this.exp = exp;
this.time = time;
this.loot = loot;
}
public int getLevelReq() {
return levelReq;
}
public int[] getObjects() {
return objects;
}
public int[] getLoot() {
return loot;
}
public double getExp() {
return exp * GameConstants.EXP_MODIFIER;
}
public double getTime() {
return time;
}
} | [
"wild.ridge@live.com"
] | wild.ridge@live.com |
5b8b1c255b385a4bf0377a79c494968f3e20cba1 | 776528dcdbb93051e4b18f330b0c58d159ba7c3b | /src/test/java/inf112/skeleton/app/game/MainGameTests.java | 7fce06e9caf495f5b5e567d714ce921ba025d0e9 | [] | no_license | sondreid/RoboRally | ea254c40f1f15664b6c479d2b5104500bb0decca | 4c601a3d4ac182950c340b84070de97b9d9430a9 | refs/heads/master | 2023-08-05T08:29:22.697115 | 2021-04-23T13:57:05 | 2021-04-23T13:57:05 | 406,660,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | package inf112.skeleton.app.game;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import inf112.skeleton.app.GdxTestRunner;
import inf112.skeleton.app.assetManager.Assets;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
@RunWith(GdxTestRunner.class)
public class MainGameTests {
//Get map
private TiledMap map = new TmxMapLoader().load("Maps/MapForJunitTests.tmx");
//Splits player texture into the 3 parts. Live/Dead/Win
private TextureRegion[][] textures = new TextureRegion(new Texture("Images/Robot/robot.png")).split(300, 300);
private MainGame mainGame;
@Before
public void initialise() {
Assets.load();
Assets.manager.finishLoading();
mainGame = new MainGame();
mainGame.setup(map); //Make game board
}
@Test
public void setNamesTest() {
String[] names = {"Alan Turing"};
mainGame.setNumPlayers(1, names);
String name = mainGame.robots.get(0).getRobotName();
assertEquals("Alan Turing", name);
}
} | [
"sondre.eide@gmail.com"
] | sondre.eide@gmail.com |
283bd39efcf20348e7f2a2ccbe0547ea05fa0984 | 62a951321c80ce68248f0f3ab428a4ca6e7efdc8 | /src/servicos/interfaces/ICalculadoraResources.java | 58830363960f3339e06d6d618492315ed8544fa2 | [] | no_license | marciosn/CalculadoraRESTful | c3b7c6210de031870c7181b0a61f565162e12e24 | 78af6612433a5954350bd59d5981587dcfbcdc6b | refs/heads/master | 2021-01-01T17:48:22.636874 | 2014-12-18T23:37:20 | 2014-12-18T23:37:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package servicos.interfaces;
import java.util.List;
import servicos.utils.MyException;
public interface ICalculadoraResources {
String calcularSoma(double n1, double n2);
String calcularSubtracao(double n1, double n2);
String calcularMultiplicao(double n1, double n2);
String calcularDivisao(double n1, double n2) throws MyException;
String calcularRaiz(double n);
String calcularEquacao(double a, double b, double c);
}
| [
"marciosouzanobre@gmail.com"
] | marciosouzanobre@gmail.com |
529a64896b058c5cb5da80bd2a6d7a9981b53c92 | f690e3348e4d69724a506adbc071182f5c9e59e3 | /Primeee.java | b88606ced66f96e177a82bd8c920a83d0b7f2d46 | [] | no_license | abarnaramaraj/edit | fd877b51906b9c0f4fa1c9a0b883a9e66f89fa1f | 8a71a84bd316c2e661dd909759c6cb3da0bc59e4 | refs/heads/master | 2020-06-06T07:15:08.162549 | 2019-06-19T13:12:11 | 2019-06-19T13:12:11 | 192,675,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | import java.util.*;
import java.lang.*;
import java.io.*;
public class Primeee
{
public static void main (String[] args)
{
int s1, s2,count = 0, i, j;
Scanner s = new Scanner(System.in);
s1 = s.nextInt();
s2 = s.nextInt();
for(i = s1; i <= s2; i++)
{
for( j = 2; j < i; j++)
{
if(i % j == 0)
{
count = 0;
break;
}
else
{
count = 1;
}
}
if(count == 1)
{
System.out.println(i);
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
18b715ca07b9a2a3305066014e5d7d2c26499b05 | 36b2bf6bf7b60dc8eb1c782e976bb988dd775912 | /Loon-0.5-Alpha/Loon-Neo/src/loon/component/AbstractBox.java | eb34f9bc2df18f88de295589a18929b7e0456c44 | [
"Apache-2.0"
] | permissive | ylck/LGame | 4a75334325b3d968901f33dc56e0fd85487450b3 | 5691e3d9ae0ee1f10cb605e95bca32e38c8a7005 | refs/heads/master | 2021-01-18T18:58:57.893673 | 2015-11-08T03:29:31 | 2015-11-08T03:29:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,594 | java | package loon.component;
import loon.LTexture;
import loon.canvas.LColor;
import loon.opengl.GLEx;
import loon.opengl.ShadowFont;
public abstract class AbstractBox {
protected int _width;
protected int _height;
protected int _boxWidth;
protected int _boxHeight;
protected float _boxX;
protected float _boxY;
protected float _borderW;
protected LColor borderColor = new LColor(LColor.white);
protected float _alpha;
protected ShadowFont font;
protected LColor fontColor = new LColor(LColor.white);
protected LTexture _textureBox;
protected int _radius;
protected AbstractBox(ShadowFont font) {
this.font = font;
}
protected void init(int w, int h) {
this._width = w;
this._height = h;
this._alpha = 0.65f;
this._borderW = 3f;
this._radius = 0;
this.dirty();
}
public abstract void dirty();
public void setFont(ShadowFont font) {
this.font = font;
dirty();
}
public void setBorderWidth(float b) {
this._borderW = b;
dirty();
}
public void setBoxAlpha(float alpha) {
this._alpha = alpha;
dirty();
}
public void setCornerRadius(int r) {
this._radius = r;
}
public int getWidth() {
return this._boxWidth;
}
public int getHeight() {
return this._boxHeight;
}
public void setLocation(float x, float y) {
this._boxX = x;
this._boxY = y;
}
protected void drawBorder(GLEx g, float x, float y) {
if (this._textureBox != null) {
g.draw(_textureBox, x, y);
}
}
protected void setFontColor(LColor color) {
this.fontColor = color;
}
protected void setBorderColor(LColor color) {
this.borderColor = color;
}
}
| [
"longwind2012@hotmail.com"
] | longwind2012@hotmail.com |
843a8c08e2ab82635f82fe9da0c67ff0ac99ad77 | 8810972d0375c0a853e3a66bd015993932be9fad | /org.modelica.uml.sysml.diagram2/src/org/modelica/uml/sysml/diagram2/edit/parts/SatisfiedBySatisfiedByCompartmentEditPart.java | dc042ca4f4fe5ea60bb596c9f294ca9a0a8788e9 | [] | no_license | OpenModelica/MDT | 275ffe4c61162a5292d614cd65eb6c88dc58b9d3 | 9ffbe27b99e729114ea9a4b4dac4816375c23794 | refs/heads/master | 2020-09-14T03:35:05.384414 | 2019-11-27T22:35:04 | 2019-11-27T23:08:29 | 222,999,464 | 3 | 2 | null | 2019-11-27T23:08:31 | 2019-11-20T18:15:27 | Java | UTF-8 | Java | false | false | 2,666 | java | package org.modelica.uml.sysml.diagram2.edit.parts;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.draw2d.IFigure;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.modelica.uml.sysml.diagram2.edit.policies.SatisfiedBySatisfiedByCompartmentCanonicalEditPolicy;
import org.modelica.uml.sysml.diagram2.edit.policies.SatisfiedBySatisfiedByCompartmentItemSemanticEditPolicy;
import org.modelica.uml.sysml.diagram2.part.Messages;
/**
* @generated
*/
public class SatisfiedBySatisfiedByCompartmentEditPart extends
ListCompartmentEditPart {
/**
* @generated
*/
public static final int VISUAL_ID = 5013;
/**
* @generated
*/
public SatisfiedBySatisfiedByCompartmentEditPart(View view) {
super(view);
}
/**
* @generated
*/
protected boolean hasModelChildrenChanged(Notification evt) {
return false;
}
/**
* @generated
*/
public String getCompartmentName() {
return Messages.SatisfiedBySatisfiedByCompartmentEditPart_title;
}
/**
* @generated
*/
public IFigure createFigure() {
ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
.createFigure();
result.setTitleVisibility(false);
return result;
}
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
new ResizableCompartmentEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
new SatisfiedBySatisfiedByCompartmentItemSemanticEditPolicy());
installEditPolicy(EditPolicyRoles.CREATION_ROLE,
new CreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
new DragDropEditPolicy());
installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
new SatisfiedBySatisfiedByCompartmentCanonicalEditPolicy());
}
/**
* @generated
*/
protected void setRatio(Double ratio) {
if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
super.setRatio(ratio);
}
}
}
| [
"adrian.pop@liu.se"
] | adrian.pop@liu.se |
ff4760057712c0210c856be68732a8f5e469ff71 | 64138d52a08880bf39c6b917474e17f317448f6e | /Server/AtTicketProject/src/com/test/admin/show/HallDTO.java | 6f3f570e1c99c3ccd5016b21a078fcf1b708c6dc | [] | no_license | moods2/At-Ticket | 5cb1a13c12118b917905d1f54c10986587389836 | 7fc577740bc316add14d6f9ade86d96315e41461 | refs/heads/master | 2022-12-17T07:50:10.041638 | 2020-09-06T08:52:29 | 2020-09-06T08:52:29 | 280,045,924 | 0 | 6 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package com.test.admin.show;
public class HallDTO {
private String seq;
private String region;
private String name;
private String addr;
public void setAddr(String addr) {
this.addr = addr;
}
public String getAddr() {
return addr;
}
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"isk03214@gmail.com"
] | isk03214@gmail.com |
bd8f0d3b1e75b113fc505219799e12f0eb3e89b2 | ab2f17baaa048835407f9767af21756bf0934b47 | /Week_03/RequestClient.java | b1265998fb98deebd004b7965f1f7cab1b4c8c61 | [] | no_license | xt00002003/JAVA-000 | 651e6771edf9090bdae2a6140fc3ba7e8553e806 | 67bff8325bfe503009a437733ad5c5c065fd6b7e | refs/heads/main | 2023-02-26T18:10:56.470456 | 2021-01-31T09:25:30 | 2021-01-31T09:25:30 | 303,084,469 | 0 | 0 | null | 2020-10-11T09:24:32 | 2020-10-11T09:24:32 | null | UTF-8 | Java | false | false | 580 | java | /**
* @author teng.xue
* @date 2020/10/27
* @since
**/
package week2;
import okhttp3.Response;
import week2.vo.GetRequest;
public class RequestClient {
private static final String URL="http://localhost:8088/";
public static void main(String[] args) throws Exception {
OkHttpUtil okHttpUtil=OkHttpUtil.getInstance();
GetRequest getRequest=new GetRequest();
getRequest.setUrl(URL+"api/hello");
Response result=okHttpUtil.get(getRequest);
String strResult=result.body().string();
System.out.println(strResult);
}
}
| [
"xt0000201101@163.com"
] | xt0000201101@163.com |
c3bb793ecd1ffd8f0008549d47f0cd5b1802a424 | 6187d02627230d731bede19049423e19e63cdafa | /src/org/wzg/start/adapter/GridViewAdapter.java | 4b56b3eed3eea902d242ef0426e2190dd50b9486 | [] | no_license | WilsonLuck/BingoGame | 75b71616324216f4679d4305baa93690d5012d14 | a72faf580ace5e0ebf35a83187599642e3270c9c | refs/heads/master | 2021-06-01T00:56:29.211401 | 2016-05-02T11:19:56 | 2016-05-02T11:19:56 | 57,389,714 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,410 | java | package org.wzg.start.adapter;
import java.util.List;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.GridView;
import com.wzg.bingogame.R;
public class GridViewAdapter extends BaseAdapter {
private Context mcontext;
private List<String> mlist;
public GridViewAdapter(Context mcontext, List<String> mlist) {
this.mcontext = mcontext;
this.mlist = mlist;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mlist.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return mlist.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@SuppressLint({ "ViewHolder", "InflateParams" }) @Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(mcontext).inflate(
R.layout.gridview_item, null);
CheckBox mCheckBox = (CheckBox) convertView.findViewById(R.id.gv_item);
mCheckBox.setText((mlist.get(position)));
if (position == 12) {
mCheckBox.setChecked(true);
mCheckBox.setClickable(false);
} else {
mCheckBox.setClickable(false);
}
return convertView;
}
}
| [
"466959515@qq.com"
] | 466959515@qq.com |
9dbff934c6f2b7231731ddd8f9f0b03a747ffcbf | 38902ce7929e25236c141c0137b65e3f9c50fb28 | /src/main/java/pl/szymonziemak/taskmanager/controller/ButtonEditController.java | 43665afa5f48eeef95b2ee2d2eb68ceaac9e812d | [] | no_license | szymonziemak/TaskManager | 661c2a768f8182f3400100970aa700e098dcec84 | fbe5c1c7b65d4bf234a13d7db77d95f0bf341a78 | refs/heads/master | 2022-12-24T00:10:41.535749 | 2019-08-05T14:28:16 | 2019-08-05T14:28:16 | 200,500,121 | 0 | 0 | null | 2022-12-16T05:02:43 | 2019-08-04T14:04:55 | Java | UTF-8 | Java | false | false | 990 | java | package pl.szymonziemak.taskmanager.controller;
import pl.szymonziemak.taskmanager.model.Task;
import pl.szymonziemak.taskmanager.service.TaskService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/edit")
public class ButtonEditController extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String stringTaskId = request.getParameter("editButton");
Long longTaskId = Long.parseLong(stringTaskId);
TaskService taskService = new TaskService();
Task taskToEdit = taskService.getTaskById(longTaskId);
request.setAttribute("taskToEdit", taskToEdit);
request.getRequestDispatcher("WEB-INF/edited.jsp").forward(request, response);
}
}
| [
"szymonziemak@users.noreply.github.com"
] | szymonziemak@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.