blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c43f1db03bbc84b415a0683c6017a68c55eb010e | 804c951741fc0ba070e17f961cd304e1795315f6 | /app/src/main/java/cn/edu/swufe/dice_of_coc/WelcomeGuideActivity.java | e1170ff422c84528414476a282b4ae2d450f6f06 | []
| no_license | RTigerAsh/Dice_of_COC | 03694c8a024e574f9a5b32eea6aba2887733c870 | 353bb7636d67a17a8d0cadd324617072516011af | refs/heads/master | 2020-05-30T04:50:30.694498 | 2019-08-13T09:06:44 | 2019-08-13T09:06:44 | 189,540,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,550 | java | package cn.edu.swufe.dice_of_coc;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import java.util.ArrayList;
import java.util.List;
public class WelcomeGuideActivity extends Activity implements View.OnClickListener {
private ViewPager viewPager;
private GuideViewPagerAdapter adapter;
private List<View> views;
private Button startBtn;
/*引导页图片资源*/
private static final int[] pics = { R.layout.guid_view1,
R.layout.guid_view2, R.layout.guid_view3, R.layout.guid_view4 };
/*底部小点图片*/
private ImageView[] dots;
/*用于记录当前选中位置*/
private int currentIndex;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome_guide);
views = new ArrayList<View>();
/*初始化引导页视图列表,需要对资源进行处理*/
for(int i = 0; i < pics.length; i++){
View view = LayoutInflater.from(this).inflate(pics[i], null);
if(i == pics.length - 1){
startBtn = (Button)view.findViewById(R.id.btn_login);
/*这里使用setTag方法进行标注。在View中的setTag(Onbect)表示给View
添加一个格外的数据,以后可以用getTag()将这个数据取出来。可以用在
多个Button添加一个监听器,每个Button都设置不同的setTag。这个监听
器就通过getTag来分辨是哪个Button 被按下。*/
startBtn.setTag("enter");
startBtn.setOnClickListener(this);
}
views.add(view);
}
viewPager = (ViewPager)findViewById(R.id.vp_guide);
/*初始化adapter*/
adapter = new GuideViewPagerAdapter(views);
viewPager.setAdapter(adapter);
viewPager.addOnPageChangeListener(new PageChangeListener());
initDots();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
/*如果切换到后台,就设置下次不进入功能引导页*/
SharedPreferencesUtil.setBoolean(WelcomeGuideActivity.this, SharedPreferencesUtil.FIRST_OPEN, false);
finish();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
private void initDots(){
LinearLayout linearLayout = (LinearLayout)findViewById(R.id.ll);
dots = new ImageView[pics.length];
/*循环取得小点图片*/
for(int i = 0; i < pics.length; i++){
/*得到一个LinearLayout下面的每一个子元素*/
dots[i] = (ImageView)linearLayout.getChildAt(i);
dots[i].setEnabled(false);//设置成灰色
dots[i].setOnClickListener(this);
dots[i].setTag(i);//设置位置tag,方便取出与当前位置对应,原理同上
}
currentIndex = 0;
dots[currentIndex].setEnabled(true); // 设置为白色,即选中状态
}
/**
* 设置当前view position
*/
private void setCurrentView(int position){
if(position < 0 || position > pics.length){
return;
}
viewPager.setCurrentItem(position);
}
/**
* 设置当前指示点 position
*/
private void setCurDot(int position) {
if (position < 0 || position > pics.length || currentIndex == position) {
return;
}
dots[position].setEnabled(true);
dots[currentIndex].setEnabled(false);
currentIndex = position;
}
@Override
public void onClick(View v) {
if(v.getTag().equals("enter")){
enterMainActivity();
return;
}
int position = (Integer) v.getTag();
setCurrentView(position);
setCurDot(position);
}
private void enterMainActivity(){
Intent intent = new Intent(WelcomeGuideActivity.this, WelcomeActivity.class);
startActivity(intent);
SharedPreferencesUtil.setBoolean(WelcomeGuideActivity.this, SharedPreferencesUtil.FIRST_OPEN, false);
finish();
}
private class PageChangeListener implements ViewPager.OnPageChangeListener{
/*当滑动状态改变时调用*/
@Override
public void onPageScrollStateChanged(int state) {
/*arg0 ==1的时辰默示正在滑动,arg0==2的时辰默示滑动完毕了,arg0==0的时辰默示什么都没做。*/
}
/*当前页面被滑动时调用*/
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// arg0 :当前页面,及你点击滑动的页面
// arg1:当前页面偏移的百分比
// arg2:当前页面偏移的像素位置
}
/*当新的页面被选中时调用*/
@Override
public void onPageSelected(int position) {
setCurDot(position);
}
}
}
| [
"[email protected]"
]
| |
c735f7bdbbb5da12b9cdeed04fde02fa694252c4 | 9f957a8735543f524a85ed263f2a9a5b2e9a4fc2 | /EstruturaDadosFatec/src/Lista03/testePilhaFila.java | 2c480db4d991177710198ab96896da3f5d2d8c4b | []
| no_license | elisio-ricardo/FatecEstruturaDeDados | 6a5e675f50d92690e54da2eba3e3af1226848204 | 7ff2b99cdf4cce3ab4a46421cc1df4413171741e | refs/heads/master | 2023-07-09T10:30:43.132142 | 2021-08-11T00:24:10 | 2021-08-11T00:24:10 | 338,889,806 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,195 | java | package Lista03;
import javax.swing.JOptionPane;
public class testePilhaFila {
public static void main(String[] args) {
Fila fila = new Fila();
Pilha pilha = new Pilha();
int opc = 0;
while (opc != 9) {
opc = Integer.parseInt(JOptionPane.showInputDialog("Escolha a opção: \n 1 - Adicionar elemento Fila"
+ "\n 2 - Remover elemento Fila \n 3 - Adicionar Elemento Pilha \n 4 - Remover elemento Pilha"
+ "\n 9 - Finalizar"));
int numero;
switch (opc) {
case 1:
numero = Integer.parseInt(JOptionPane.showInputDialog("Digite o numero: "));
fila.adicionaFila(numero);
break;
case 2:
numero = fila.remove();
pilha.adicionaPilha(numero);
break;
case 3:
numero = Integer.parseInt(JOptionPane.showInputDialog("Digite o numero: "));
pilha.adicionaPilha(numero);
break;
case 4:
numero =pilha.removePilha();
fila.adicionaFila(numero);
break;
case 9:
JOptionPane.showMessageDialog(null, "Finalizando",
null, JOptionPane.INFORMATION_MESSAGE);
break;
default:
JOptionPane.showMessageDialog(null, "Opção inválida",
null, JOptionPane.INFORMATION_MESSAGE);
}
}
}
}
| [
"[email protected]"
]
| |
077e8e0f502fe99a016d6c13470f6c2ccded67ad | 3f07ef5f7723e4c5c8a45d72adfad323393849d5 | /app/build/generated/source/buildConfig/debug/com/example/bluechip/BuildConfig.java | a6b1f9fe85aaef38ba4ce07d6e5a83ad10e45d9b | []
| no_license | Chester-King/slider | 2258e699cab3acb6b0931b1f16a849d8d2d964a3 | e9a4f2ac1703e00f55b325813587dd6c1e17b9de | refs/heads/master | 2020-08-24T19:38:18.521586 | 2019-10-22T19:21:09 | 2019-10-22T19:21:09 | 216,892,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.bluechip;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.bluechip";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"[email protected]"
]
| |
8e5d90a30ec4be374e3ab122f025415287b49b4f | 6d4b19b800e6a77d36e5c0595fc97ec0a05cf499 | /src/main/java/br/com/kproj/salesman/assistants/calendar/activities/specialization/application/impl/ActivitySaleableServiceImpl.java | ec024632c1509c11d90a895852b1f248da84eb86 | []
| no_license | mmaico/salesman-crm | 5252d72bb90130c6d4eff5e11990c1fa16bcc842 | 16614306f486b3ecdb78e202277e14b55b116774 | refs/heads/master | 2023-03-12T11:01:51.567003 | 2023-02-25T12:53:29 | 2023-02-25T12:53:29 | 92,890,395 | 7 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,642 | java | package br.com.kproj.salesman.assistants.calendar.activities.specialization.application.impl;
import br.com.kproj.salesman.assistants.calendar.activities.specialization.application.ActivitySaleableFacade;
import br.com.kproj.salesman.assistants.calendar.activities.specialization.application.validations.ActivitySaleableBusinessRules;
import br.com.kproj.salesman.assistants.calendar.activities.specialization.domain.model.activity.ActivitySaleable;
import br.com.kproj.salesman.assistants.calendar.activities.specialization.domain.model.activity.ActivitySaleableRepository;
import br.com.kproj.salesman.infrastructure.repository.BaseRepository;
import br.com.kproj.salesman.infrastructure.service.BaseModelServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class ActivitySaleableServiceImpl extends BaseModelServiceImpl<ActivitySaleable> implements ActivitySaleableFacade {
private ActivitySaleableRepository repository;
private ActivitySaleableBusinessRules rules;
@Autowired
public ActivitySaleableServiceImpl(ActivitySaleableRepository repository, ActivitySaleableBusinessRules rules) {
this.repository = repository;
this.rules = rules;
}
@Override
public BaseRepository<ActivitySaleable, Long> getRepository() {
return repository;
}
@Override
public Optional<ActivitySaleable> makeSpecialization(ActivitySaleable activitySaleable) {
rules.checkRules(activitySaleable);
return repository.makeSpecialization(activitySaleable);
}
}
| [
"[email protected]"
]
| |
0b1546643d281ed1e0b314f3ae3ac50cd0d5e42d | f401020de03ba065d5a3fa0041ae77ca375c1a6e | /Codechef/Beginner/16.SumOfDigits.java | a9e0a1aae35bc10b6d875ff915278cce1c91a82c | []
| no_license | itch96/CompetitivePrograming | 76030dbc9905bf08d601f078dd7944aec86c79ee | c2238d4821f2ed66d1345f2804afc866c00a4663 | refs/heads/master | 2021-01-18T03:06:37.193241 | 2018-01-28T05:10:57 | 2018-01-28T05:10:57 | 68,452,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | import java.io.*;
class SumOfDigits {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// System.out.print("Enter the Test Cases: ");
int T = Integer.parseInt(br.readLine());
for(int i = 0; i < T; i ++) {
// System.out.print("\nEnter the number: ");
String N = br.readLine();
SumOfDigits sod = new SumOfDigits();
// System.out.println("\nThe sum of Digits are: " + sod.sumOfDigits(N));
System.out.println(sod.sumOfDigits(N));
}
}
public int sumOfDigits(String s) {
int sum = 0;
for(int i = 0; i < s.length(); i ++) {
sum += Integer.parseInt(s.substring(i, i + 1));
}
return sum;
}
} | [
"[email protected]"
]
| |
5114be2398a4f56559981dc13604658012c42c7c | 8aa54d9505a968909b05d268704fea4804639b95 | /src/main/java/com/ljfl/server/dto/UserDTO.java | eeb5ec796321db1146c6a7500fa35205f497594f | []
| no_license | cugb-zwx/ljfl | 4ed483ccc434658fcdf595b0054fcbc238472d68 | 53fc297fd16e51763048d6c64a1001feaac7aa77 | refs/heads/master | 2022-06-26T23:35:40.231983 | 2020-08-22T08:54:02 | 2020-08-22T08:54:02 | 228,611,913 | 2 | 1 | null | 2022-06-21T02:28:07 | 2019-12-17T12:28:58 | Java | UTF-8 | Java | false | false | 3,237 | java | package com.ljfl.server.dto;
/**
* @Description: java类作用描述
* @Author: zwx
* @CreateDate: 2019/12/13 21:26
*/
public class UserDTO {
private String id;
private String name;
private String nickName;
private String headImg;
private String passward;
private String passward2;
private String openid;
private Boolean sex;
private Byte age;
private Long loginTime;
private String cityCode;
private String mobile;
private Integer count;
private String isDelete;
private Long createTime;
private Long updateTime;
private Long points;
private String note;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
public String getPassward() {
return passward;
}
public void setPassward(String passward) {
this.passward = passward;
}
public String getPassward2() {
return passward2;
}
public void setPassward2(String passward2) {
this.passward2 = passward2;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public Boolean getSex() {
return sex;
}
public void setSex(Boolean sex) {
this.sex = sex;
}
public Byte getAge() {
return age;
}
public void setAge(Byte age) {
this.age = age;
}
public Long getLoginTime() {
return loginTime;
}
public void setLoginTime(Long loginTime) {
this.loginTime = loginTime;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public String getIsDelete() {
return isDelete;
}
public void setIsDelete(String status) {
this.isDelete = status;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public Long getPoints() {
return points;
}
public void setPoints(Long points) {
this.points = points;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
}
| [
"[email protected]"
]
| |
01bcc9e0d8f0575550a5d38283eed6774f073c16 | 92c864aca093026a50bfe3fa5bb69b60659caf26 | /algorithm/src/swexpert/D3/Solution1493_수의새로운연산.java | 20c8724cabeadc2344b5fe2e8844bf521871dc95 | []
| no_license | rlaguswhd19/algo | 2a06803b8919e54736dddc3cf402c19e5b9872ac | cddc373f58e2657c977bd9d9ffed2689e698fccb | refs/heads/master | 2022-01-21T03:53:28.361194 | 2022-01-07T05:07:49 | 2022-01-07T05:07:49 | 206,754,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | package swexpert.D3;
import java.io.IOException;
import java.util.Scanner;
public class Solution1493_수의새로운연산 {
public static void main(String[] args) throws NumberFormatException, IOException {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int[][] map = new int[301][301];
Point[] map2 = new Point[10001];
int cnt = 0; // 기준
int plus = 0; // 더하기
for (int i = 1; i < 301; i++) {
cnt = map[i - 1][1] + i;
plus = i;
for (int j = 1; j < 301; j++) {
if (j == 1) {
map[i][j] = cnt;
} else {
cnt += plus;
map[i][j] = cnt;
plus++;
}
if (cnt <= 10000) {
map2[cnt] = new Point(i, j);
}
}
}
for (int tc = 1; tc <= t; tc++) {
int p = sc.nextInt();
int q = sc.nextInt();
cnt = 0;
Point p1 = map2[p];
Point p2 = map2[q];
int x = p1.x + p2.x;
int y = p1.y + p2.y;
//
System.out.println("#" + tc + " " + map[x][y]);
}
}
static class Point {
int x, y;
public Point(int x, int y) {
super();
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "Point [x=" + x + ", y=" + y + "]";
}
}
}
| [
"[email protected]"
]
| |
c3cc19090ba631904cc05e35512f0863f00ee6e9 | 084800c3a65de638952b3c7612948b444a90b68b | /CadProdutos/src/cadprodutos/Dao/TipoProdutoDao.java | fedcdb4be374364e3afa47b56dd2816af7e0a4a5 | []
| no_license | thiagorizzo/projeto-produtos-java | 3f1cc741f4e2fcee1cfddfc3077a46c39d896d9b | bf4c9afa3887e043aa4f058e8113d76fdd441dc8 | refs/heads/master | 2020-05-25T08:59:58.344145 | 2019-05-22T23:36:19 | 2019-05-22T23:36:19 | 187,725,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,241 | java | package cadprodutos.Dao;
import cadprodutos.models.TipoProduto;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class TipoProdutoDao extends BaseDao {
public TipoProdutoDao() throws ClassNotFoundException, SQLException{
super();
}
public ArrayList<TipoProduto> Listar() throws SQLException{
PreparedStatement st = connection.prepareStatement("Select * from TipoProduto");
ResultSet rs = st.executeQuery();
ArrayList<TipoProduto> tipoprodutos = new ArrayList<TipoProduto>();
while(rs.next()){
TipoProduto tp = new TipoProduto();
tp.setCodigo(rs.getInt(1));
tp.setNome(rs.getString(2));
tipoprodutos.add(tp);
}
return tipoprodutos;
}
public void Inserir(TipoProduto novo) throws ClassNotFoundException, SQLException {
Connection conexao = Database.getConexao();
PreparedStatement ps = conexao.prepareStatement("Insert into TipoProduto(Nome)"
+ "Values (?)");
ps.setString(1, novo.getNome());
ps.executeUpdate();
}
}
| [
"[email protected]"
]
| |
5d19183b1f6f06326dec273624fabcdc5a0f946f | fbc59070e19f9c714890dad3412db21647305f35 | /Projeto 06 ArrayList/pulaPulaNoParquinho/PulaPula.java | 4549c127c4d9607170b97cf0a3d9d952cfe20f33 | []
| no_license | aSTRonuun/Poo-2020.2 | 4788cb21514261c85e09bfcb27407c2a3e6a5c52 | 7fd39d2afc9779b1dbe0bf022a00ce0809a1fd70 | refs/heads/main | 2023-04-05T11:46:30.239926 | 2021-04-13T00:51:14 | 2021-04-13T00:51:14 | 317,557,303 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,768 | java | import java.util.ArrayList;
import java.util.Scanner;
class Kid{
private String name;
private int age;
public Kid(String name, int age){
this.name = name;
this.age = age;
}
public int getAge() {
return age;
}
public String getName() {
return name;
}
@Override
public String toString() {
return name
+ ":"
+ age;
}
}
class PulaPula{
ArrayList<Kid> kidsWaiting;
ArrayList<Kid> kidsPlaying;
int limit;
double cashBox;
public PulaPula(int limit){
this.kidsWaiting = new ArrayList<>();
this.kidsPlaying = new ArrayList<>();
this.limit = limit;
this.cashBox = 0;
}
public double getCashBox() {
return cashBox;
}
public void arrive(Kid kid){
kidsWaiting.add(0, kid);
}
public void in(){
if(kidsWaiting.isEmpty()){
System.out.println("Não ná nenhuma criança no fila.");
return;
}
if(kidsPlaying.size() == limit){
System.out.println("Limite superado, espere uma criança sair");
return;
}
Kid kidFirst = kidsWaiting.get(kidsWaiting.size() - 1);
kidsWaiting.remove(kidsWaiting.size() - 1);
kidsPlaying.add(0, kidFirst);
cashBox += 2.00;
return;
}
public void out(){
if(kidsPlaying.isEmpty()){
System.out.println("Não há nenhuma criança no PulaPula.");
return;
}
Kid kidFirst = kidsPlaying.get(kidsPlaying.size() - 1);
kidsPlaying.remove(kidsPlaying.size() - 1);
kidsWaiting.add(0, kidFirst);
return;
}
public boolean removeKid(String name){
if(kidsPlaying.isEmpty() && kidsWaiting.isEmpty())
return false;
for(Kid kids : kidsWaiting){
if(kids.getName().equals(name)){
Kid kidsair = kids;
kidsWaiting.remove(kidsair);
return true;
}
}
for(Kid kids : kidsPlaying){
if(kids.getName().equals(name)){
Kid kidsair = kids;
kidsPlaying.remove(kidsair);
return true;
}
}
System.out.println("Nome inválido, tente novamente...");
return false;
}
@Override
public String toString() {
return "Caixa: " + cashBox + " Limit: " + kidsPlaying.size() + "/" + limit + "\n"
+ "=> " + kidsWaiting + "=> " + kidsPlaying + " ";
}
public static void main(String[] args) {
PulaPula pulapula = new PulaPula(0);
Scanner sc = new Scanner(System.in);
while(true){
String line = sc.nextLine();
String[] usrIn = line.split(" ");
if(usrIn[0].equals("init")){
int limit = Integer.parseInt(usrIn[1]);
pulapula = new PulaPula(limit);
}else if(usrIn[0].equals("chegou")){
String name = usrIn[1];
int age = Integer.parseInt(usrIn[2]);
pulapula.arrive(new Kid(name, age));
}else if(usrIn[0].equals("entrar")){
pulapula.in();
}else if(usrIn[0].equals("sair")){
pulapula.out();
}else if(usrIn[0].equals("papaichegou")){
String name = usrIn[1];
pulapula.removeKid(name);
}else if(usrIn[0].equals("show")){
System.out.println(pulapula);
}else if(usrIn[0].equals("end")){
break;
}else{
System.out.println("Comando inválido");
}
}
sc.close();
}
} | [
"[email protected]"
]
| |
710a43ca0c17631792ee0f34484713a39a9e32b6 | c1870170568cb28adbcd8c7cb526bce04d6a9e90 | /module_main/src/main/java/com/idealbank/module_main/mvp/contract/SearchListContract.java | 46edef426caf7cd03a4bd23ac09319d4958cbe03 | []
| no_license | xiangli19930605/IB_SecretassetAPP | c87128e230666f8e02241213303dfff070f245ae | 625ac030d385ca60b756c139d0bbfe0214fb40cf | refs/heads/master | 2021-07-16T00:12:35.253329 | 2020-09-28T12:39:23 | 2020-09-28T12:39:23 | 188,334,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,110 | java | package com.idealbank.module_main.mvp.contract;
import android.app.Activity;
import com.idealbank.module_main.bean.Location;
import com.idealbank.module_main.bean.UpAssetsBean;
import com.idealbank.module_main.mvp.model.entity.UpLoad;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
import me.jessyan.armscomponent.commonsdk.bean.BaseResponseBean;
import me.jessyan.armscomponent.commonsdk.bean.Historyrecord.AssetsBean;
import me.jessyan.armscomponent.commonsdk.bean.Historyrecord.HistoryData;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 02/19/2019 09:59
* <a href="mailto:[email protected]">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface SearchListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
Activity getActivity();
/**
* Load all history data
*
* @return all history data
*/
void loadAllHistoryData( List<HistoryData> list);
/**
* Add history data
*
* @param data history data
*/
void addHistoryData(String data);
/**
* Clear history data
*/
void clearHistoryData();
void receiveResult(ArrayList<AssetsBean> list);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
List<HistoryData> loadAllHistoryData();
Observable<BaseResponseBean<ArrayList<AssetsBean>>> getListByRfid(UpAssetsBean task);
}
}
| [
"[email protected]"
]
| |
6c09c86eeaf3cee4ecc44acc31986667080bda62 | b4e9b2777ff7808efcef8652ef2ce9849d574317 | /i209/app/src/main/java/com/example/anan/AAChartCore/ChartsDemo/MainContent/DeleteAlarmActivity.java | f1eedf9adb5873d5737689b7250240c6745b9c01 | [
"Apache-2.0",
"MIT"
]
| permissive | wangcomplex/i209team | d77758ae5fe160cbb7872f979e7eadb2316fb6fc | b81f7f5652f90a45a7f86965448924a8263504d6 | refs/heads/master | 2022-12-01T10:16:53.023550 | 2020-08-15T01:24:10 | 2020-08-15T01:24:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,112 | java | package com.example.anan.AAChartCore.ChartsDemo.MainContent;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.widget.CursorAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
public class DeleteAlarmActivity extends AppCompatActivity {
ListView listView;
MyListViewAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_delete_view);
ImageButton button = (ImageButton) findViewById(R.id.calcel_delete);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
listView = (ListView)findViewById(R.id.delete_alarm_list);
initData();
}
private void initData(){
MyDataBaseHelper1 helper = MyDataBaseHelper1.getInstance(this);
SQLiteDatabase dWriter = helper.getWritableDatabase();
Cursor cursor = dWriter.query(MyDataBaseHelper1.ALARM_TB_NAME,null,null,null,null,null,null);
String[] alarmColums = new String[]{MyDataBaseHelper1.COL_TIME,MyDataBaseHelper1.COL_ALARM_REPEAT_TIMES,MyDataBaseHelper1.COL_ALARM_LABLE};
int[] layoutId = new int[]{R.id.alarm_delete_time,R.id.alarm_name_delete,R.id.alarm_lable_delete};
adapter = new MyListViewAdapter(this,R.layout.activity_delete_item,cursor,alarmColums,layoutId, CursorAdapter.FLAG_AUTO_REQUERY);
listView.setAdapter(adapter);
}
public class MyListViewAdapter extends SimpleCursorAdapter {
public MyListViewAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) {
super(context, layout, c, from, to, flags);
}
@Override
public void bindView(View view, final Context context, final Cursor cursor) {
super.bindView(view, context, cursor);
final int id = cursor.getInt(0);
ImageButton imageButton = (ImageButton)view.findViewById(R.id.alarm_delete_button);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DataBaseOperator operator = new DataBaseOperator(context);
LampSharePreference pre = LampSharePreference.getInstance(context);
int nums= pre.getInt(LampSharePreference.ALARM_NUMBERS,0);
nums--;
pre.setInt(LampSharePreference.ALARM_NUMBERS,0);
operator.delete(id);
cursor.requery();
adapter.notifyDataSetChanged();
}
});
}
}
}
| [
"[email protected]"
]
| |
927d662c2394e708ac897f7434b6f24e31eb204c | 021b7d0d6f7ad5778cd5418ca4aa8a3f1e176eff | /com/amazonaws/services/s3/model/OwnerOverride.java | 8033af34441e380bdb7fb9c431e5e2922b4ec99d | []
| no_license | WakesyChen/s3_jdk1.5_api | 537db2101cd03d2c0b7026a3ac1334ee398748c4 | 93dd5e72b2d0763df8b2669c5de20a40859f03dd | refs/heads/master | 2020-04-11T12:10:16.790190 | 2018-12-17T13:12:35 | 2018-12-17T13:12:35 | 161,771,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,609 | java | /*
* Copyright 2011-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://aws.amazon.com/apache2.0
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and
* limitations under the License.
*/
package com.amazonaws.services.s3.model;
/**
* The override value for the owner of the replica object.
*/
public enum OwnerOverride {
DESTINATION("Destination"),;
private final String id;
OwnerOverride(String id) {
this.id = id;
}
public String toString() {
return id;
}
/**
* Use this in place of valueOf.
*
* @param value real value
* @return OwnerOverride corresponding to the value
* @throws IllegalArgumentException If the specified value does not map to one of the known values in this enum.
*/
public static OwnerOverride fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (OwnerOverride enumEntry : OwnerOverride.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
| [
"[email protected]"
]
| |
1ce3723d447ce09f1cdfef6bda0aad6a5f57390d | 67f8d931266cd7cd08d2b96db0ef7f51e11d5f0e | /src/main/java/com/demo/subsystem/main/service/IMainService.java | cd4f650f1ec4a019d8f489dbeee7659c07934b8e | []
| no_license | aaron3323/DemoSSO | 5275ba70b6e552c1d6648c16e706ca9ea032f85b | a30dcc97b843f8ffa670f70868b166483b8d9405 | refs/heads/master | 2020-12-24T14:26:57.677674 | 2015-02-06T12:38:34 | 2015-02-06T12:38:34 | 28,255,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | package com.demo.subsystem.main.service;
public interface IMainService {
}
| [
"[email protected]"
]
| |
053de516c39c72f4defb8fe86db83d77629ba0dd | cc3f1edb10ba64622f41f8751b933323956d26cb | /src/Kapitel_2_exercises/Exercise_2_5/Exercise_2_5.java | 6a527ab99dbf7957f7f546ac45eef1d667c02afe | []
| no_license | KRL1991/Programmering_chp02_exercises | aaad3a94cec8d95fa6fea29ece5660b276a5fb9a | 00c6c16776e760383737ebe1be780112eb9278cd | refs/heads/master | 2022-12-27T10:23:44.200993 | 2020-10-15T10:12:06 | 2020-10-15T10:12:06 | 295,363,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package Kapitel_2_exercises.Exercise_2_5;
import java.util.Scanner;
public class Exercise_2_5 {
public static void main(String[] args) {
//Create Scanner object
Scanner input = new Scanner(System.in);
//Promt the user to enter subtotal
System.out.println(" Enter subtotal ");
double subtotal = input.nextDouble();
System.out.println(" Enter gratuity ");
double gratuity = input.nextDouble();
//Compute subtotal and gratuity
double totalgratuity = gratuity / 100 * subtotal;
double totalsubtotal = subtotal + totalgratuity;
//Display result
System.out.println(totalgratuity+"$ is the gratuity " + " and "+ totalsubtotal+ "$ is subtotal you have to pay ");
}
}
| [
"[email protected]"
]
| |
f189906eb3372f3a5282e4db43d5c189c862e453 | 3089fe0cddd997d7b4707e0cccdb58db07edbca3 | /mysol/Easy/E796_Rotate_String/src/com/rotateString/E796_Rotate_String.java | dff41f62bc3f43156f94eddb5a10745631fea855 | [
"MIT"
]
| permissive | specter01wj/Leetcode_Java | f263cfb7a14e59986ced91741366e74c12505a46 | 7a243dd5292868acd2c0e2b4ecddd42d7c64346b | refs/heads/master | 2023-03-18T22:43:33.779879 | 2023-03-12T19:29:23 | 2023-03-12T19:29:23 | 74,169,851 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | package com.rotateString;
import java.util.*;
/*
Given two strings s and goal, return true if and only if s can become
goal after some number of shifts on s.
A shift on s consists of moving the leftmost character of s to the
rightmost position.
For example, if s = "abcde", then it will be "bcdea" after one shift.
Example 1:
Input: s = "abcde", goal = "cdeab"
Output: true
Example 2:
Input: s = "abcde", goal = "abced"
Output: false
*/
public class E796_Rotate_String {
public static void main(String[] args) {
String input1 = "abcde";
String input2 = "cdeab";
boolean output = rotateString(input1, input2);
System.out.println("input1: " + (input1) + "; input2: " + input2 + "\noutput: " + (output));
}
/*
solution:
it is rotated if B can be found in (A + A).
*/
/**
* @param s: an array of char
* @param goal: an array of char
* @return: boolean whether s can become goal after some number of shifts on s
*/
public static boolean rotateString(String s, String goal) {
return (s.length() == goal.length()) && (s + s).contains(goal);
}
}
| [
"[email protected]"
]
| |
4068fd0ae5fc9cf9bab29f0b70797d2bb448e749 | 0019dea829d84aac5b5f63a32dd265b26c481704 | /src/com/OO/Room.java | 45ae4e03fbcfee14794aa814c5248f39842e28b0 | []
| no_license | aebenw/java_exercises | e437d99ba5dcb9a13bcb9e727af8b7aa04dc5a86 | 6c605774182f8f06e5d354c4c30777498ee4e21e | refs/heads/master | 2020-04-10T00:33:14.165335 | 2019-01-21T00:04:37 | 2019-01-21T00:04:37 | 160,688,752 | 0 | 0 | null | 2019-01-21T00:04:38 | 2018-12-06T14:47:21 | Java | UTF-8 | Java | false | false | 250 | java | package com.OO;
public class Room {
private Table table;
private Lamp lamp;
private int size;
public Room(Table table, Lamp lamp, int size) {
this.table = table;
this.lamp = lamp;
this.size = size;
}
}
| [
"github email address"
]
| github email address |
6c00a7df5a748e263f01da909734ab2a5ba793ff | 6de9ccacc57aafebf8f27371df4e97221eb4a9a8 | /QoSNegotiation/NegotiationGA/src/negotiation_broker/Main.java | b7d9da7f4a3759fbe879daa35b917d637ef535f1 | []
| no_license | GeorgianaCopil/qos-negotiation | bc17d155b528a1539cef519edd4b0a6cafc7dc69 | 1bd75d8d565febc1b3cd9521d9dc8952e572e00c | refs/heads/master | 2020-05-17T17:52:04.786496 | 2012-04-11T07:40:12 | 2012-04-11T07:40:12 | 32,218,219 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package negotiation_broker;
/**
*
* @author Administrator
*/
public class Main {
public static void main(String[] args){
String[] jadeArgs = new String[]{"-mtp jamr.jademtp.http.MessageTransportProtocol", "-gui", GlobalVars.NEGOTIATION_STARTER_NAME + ":" + NegotiationAdministratorAgent.class.getName()};
jade.Boot.main(jadeArgs);
}
}
| [
"[email protected]@83c1a0d6-d801-7df7-618c-fccd54b72b5a"
]
| [email protected]@83c1a0d6-d801-7df7-618c-fccd54b72b5a |
c5d860b193d4704b32619fd5409b19e19a4b3efe | fab91b2f5b8a9ef24622c26988e1126dd6a24f05 | /src/com/creational/designpattern/TestMain.java | d87e23581f716c33a36c212e39cb48469b391fb2 | []
| no_license | ArunKr1612/DesignPattern | 2e0e490438d1ad72abb8a6e65c842cac7ea14791 | f5823278e9f4ec6923120f8830dcda4142a1d339 | refs/heads/master | 2021-09-10T20:09:41.202529 | 2018-04-01T11:48:35 | 2018-04-01T11:48:35 | 125,365,773 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package com.creational.designpattern;
import com.creational.designpattern.singleton.EagerInitializedSingleton;
public class TestMain {
public static void main(String[] args) {
EagerInitializedSingleton instance1 = EagerInitializedSingleton.getInstance();
EagerInitializedSingleton instance2 = EagerInitializedSingleton.getInstance();
System.out.println("instance1 Hashcode = [" + instance1.hashCode() + "]");
System.out.println("instance2 Hashcode = [" + instance2.hashCode() + "]");
}
}
| [
"[email protected]"
]
| |
a788a810074a42aaa04cb9d5a8aee9c0a41b2d58 | edc6a31c70a5e81b34a96d6d99bca7f32d0f1dd3 | /CriminalIntent/src/com/example/criminalintent/v8/ImageFragment.java | 4c48891bc9e2bc95b239fed3cfcad3f362bae6a1 | []
| no_license | bluhar/AndroidCook | 7670de3f1b3dd9cc15bb5cc9b57dfbed2998d4f0 | d5f5c7c1a9772dd9a1a1a03866dd473677a3a303 | refs/heads/master | 2021-01-25T00:17:12.219308 | 2015-04-24T15:44:36 | 2015-04-24T15:44:36 | 25,334,302 | 0 | 0 | null | null | null | null | ISO-8859-13 | Java | false | false | 1,443 | java | package com.example.criminalintent.v8;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class ImageFragment extends DialogFragment {
public static final String EXTRA_IMAGE_PATH = "com.example.criminalintent.v8.image_path";
private ImageView mImageView;
@Override
public void onDestroyView() {
super.onDestroyView();
PictureUtils.cleanImageView(mImageView);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mImageView = new ImageView(getActivity());
String path = (String) getArguments().getSerializable(EXTRA_IMAGE_PATH);
BitmapDrawable image = PictureUtils.getScaledDrawable(getActivity(), path);
mImageView.setImageDrawable(image);
return mImageView;
}
public static ImageFragment newInstance(String path) {
ImageFragment fragment = new ImageFragment();
Bundle args = new Bundle();
args.putSerializable(EXTRA_IMAGE_PATH, path);
fragment.setArguments(args);
//Č„µōdialogµÄtitle
fragment.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
return fragment;
}
}
| [
"anelm@anelm_pc"
]
| anelm@anelm_pc |
17f0f12863f8ad61b651e214bacbd3e751396b0e | fe7db5f26c757924dcb222b9b9c6d6651b4a0207 | /vn.mannd.pde/src/vn/mannd/pde/rule/checker/AvoidUsingStringTokenizerChecker.java | 559249f9c5d3c466aba78f2d845107bcbceb5f23 | []
| no_license | manndphd/PMD | e94888f7a9987a40aa620535775481e44d6b0e25 | fd2e407a6dc94c0c43fa7827e6edf3435574cb55 | refs/heads/master | 2020-06-24T10:57:51.809005 | 2019-07-26T14:32:19 | 2019-07-26T14:32:19 | 198,944,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | package vn.mannd.pde.rule.checker;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ClassInstanceCreation;
import org.eclipse.jdt.core.dom.ITypeBinding;
import vn.mannd.pde.PluginConstants;
import vn.mannd.pde.adt.CompositeParameter;
import vn.mannd.pde.rule.checker.core.ConditionalChecker;
import vn.mannd.pde.util.TypeUtil;
import vn.mannd.pde.util.ValidatorUtil;
public class AvoidUsingStringTokenizerChecker extends ConditionalChecker
{
private final ASTNode rootNode;
private final ClassInstanceCreation creation;
public AvoidUsingStringTokenizerChecker(CompositeParameter parameter)
throws NullPointerException
{
super(parameter);
rootNode = TypeUtil.cast(parameter.getParameter(PARSED_ROOT_NODE));
creation = TypeUtil.cast(parameter.getParameter(PARSED_NODE));
}
@Override
protected boolean checkParameters()
{
return ValidatorUtil.notNull(rootNode, creation);
}
@Override
protected boolean checkDetails()
{
final ITypeBinding binding = creation.resolveTypeBinding();
final String typeName = binding.getQualifiedName();
return typeName.equalsIgnoreCase(PluginConstants.STRING_TOKENIZER_CLASS_NAME);
}
private final void readObject(java.io.ObjectInputStream in) throws java.io.IOException
{
throw new java.io.IOException("Class cannot be deserialized");
}
}
| [
"[email protected]"
]
| |
6f0b03067c81f8ea46ced810c34bea52b8b9684f | 9902e008d21b9f0e85c12b63f1bde415e8a9f1ed | /corelibs/src/main/java/com/zhxh/corelibs/glide/transform/RoundTransformation.java | 05541e54b3e58dd73bc0901035aee16f2926b6a5 | []
| no_license | zhxhcoder/XMVPDemo | 0ebad763ed34fe48482ff7475f755f12c36085e1 | 64ca266c4881ff7e4acc0d245fbc368352065c0d | refs/heads/master | 2021-10-27T12:21:35.566486 | 2019-04-17T07:06:53 | 2019-04-17T07:06:53 | 118,404,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,436 | java | package com.zhxh.corelibs.glide.transform;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
import java.security.MessageDigest;
/**
* 图片转为圆角
*/
public class RoundTransformation extends BitmapTransformation {
private static final String ID = RoundTransformation.class.getName();
private static final byte[] ID_BYTES = ID.getBytes(Key.CHARSET);
private float radius = 0f;
public RoundTransformation(Context context) {
this(context, 0);
}
public RoundTransformation(Context context, int dp) {
super();
this.radius = Resources.getSystem().getDisplayMetrics().density * dp;
}
@Override
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
Bitmap bitmap = TransformationUtils.centerCrop(pool, toTransform, outWidth, outHeight);
return roundCrop(pool, bitmap);
}
private Bitmap roundCrop(BitmapPool pool, Bitmap source) {
if (source == null) return null;
Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
if (result == null) {
result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
}
Canvas canvas = new Canvas(result);
Paint paint = new Paint();
paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
paint.setAntiAlias(true);
RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
canvas.drawRoundRect(rectF, radius, radius, paint);
return result;
}
@Override
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
@Override
public boolean equals(Object o) {
return o instanceof RoundTransformation;
}
@Override
public int hashCode() {
return ID.hashCode();
}
}
| [
"[email protected]"
]
| |
fcaf241ce66a8c1ea72c88277286025dda0307da | 8870fa16fe6f0fe3e791c1463c5ee83c46f86839 | /mmoarpg/mmoarpg-core/src/main/java/com/wanniu/core/game/ServerSessionHandler.java | 46a8e03fe7a2976d499b7da5ded9ab85b011f99e | []
| no_license | daxingyou/yxj | 94535532ea4722493ac0342c18d575e764da9fbb | 91fb9a5f8da9e5e772e04b3102fe68fe0db5e280 | refs/heads/master | 2022-01-08T10:22:48.477835 | 2018-04-11T03:18:37 | 2018-04-11T03:18:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | package com.wanniu.core.game;
import java.io.IOException;
import com.wanniu.core.GGame;
import com.wanniu.core.GGlobal;
import com.wanniu.core.game.entity.GPlayer;
import com.wanniu.core.logfs.Out;
import com.wanniu.core.tcp.protocol.Packet;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.DecoderException;
/**
* IO处理器,所有接收到的消息put到队列里,等待处理器分发处理
*
* @author agui
* @author 周明凯([email protected])
*/
public final class ServerSessionHandler extends ChannelInboundHandlerAdapter {
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
Out.info("连接被建立,Session:", ctx.channel().remoteAddress());
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
// IO异常,只输出概要信息就可以了...
if (cause instanceof IOException || cause instanceof DecoderException) {
Out.debug("Netty try IOException||DecoderException.", ctx.channel().remoteAddress(), cause.getMessage());
} else {
Out.error("Netty try exception.", ctx.channel().remoteAddress(), cause);
}
ctx.close();
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
Channel session = ctx.channel();
Out.info("连接被关闭:", session.remoteAddress());
try {
if (session.attr(GGlobal.__KEY_PLAYER) != null) {
GPlayer player = session.attr(GGlobal.__KEY_PLAYER).get();
if (player != null && player.getSession() == session) {
player.doLogout(false);
}
}
} finally {
GGame.getInstance().onSessionClose(session);
}
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object packet) throws Exception {
GGame.getInstance().addPacket((Packet) packet);
}
} | [
"[email protected]"
]
| |
d97d47aca82e7da0d371748de6907aa23d19ecd3 | 8ce57f3d8730091c3703ad95f030841a275d8c65 | /test/testsuite/ouroboros/parent_test/RT0143-rt-parent-ThreadGroupExObjectnotifyAllIllegalMonitorStateException/ThreadGroupExObjectnotifyAllIllegalMonitorStateException.java | 2146abd966889e189c8b78219ceee6acc856a27e | []
| no_license | TanveerTanjeem/OpenArkCompiler | 6c913ebba33eb0509f91a8f884a87ef8431395f6 | 6acb8e0bac4ed3c7c24f5cb0196af81b9bedf205 | refs/heads/master | 2022-11-17T21:08:25.789107 | 2020-07-15T09:00:48 | 2020-07-15T09:00:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,302 | java | /*
* Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
* You may obtain a copy of Mulan PSL v1 at:
*
* http://license.coscl.org.cn/MulanPSL
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR
* FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v1 for more details.
* -@TestCaseID: ThreadGroupExObjectnotifyAllIllegalMonitorStateException.java
* -@TestCaseName: Exception in ThreadGroup: final void notifyAll()
* -@TestCaseType: Function Test
* -@RequirementName: 补充重写类的父类方法
* -@Brief:
* -#step1:Prepare current thread is not the owner of the object's monitor
* -#step2:Test api notifyAll extends from Object
* -#step3:Throw IllegalMonitorStateException
* -@Expect:0\n
* -@Priority: High
* -@Source: ThreadGroupExObjectnotifyAllIllegalMonitorStateException.java
* -@ExecuteClass: ThreadGroupExObjectnotifyAllIllegalMonitorStateException
* -@ExecuteArgs:
*/
import java.lang.Thread;
public class ThreadGroupExObjectnotifyAllIllegalMonitorStateException {
static int res = 99;
ThreadGroup gr1 = new ThreadGroup("Thread8023");
public static void main(String argv[]) {
System.out.println(new ThreadGroupExObjectnotifyAllIllegalMonitorStateException().run());
}
/**
* main test fun
*
* @return status code
*/
public int run() {
int result = 2; /*STATUS_FAILED*/
try {
result = threadGroupExObjectnotifyAllIllegalMonitorStateException1();
} catch (Exception e) {
ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res = ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res - 20;
}
Thread t1 = new Thread(new ThreadGroupExObjectnotifyAllIllegalMonitorStateException11(1));
t1.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
System.out.println(t.getName() + " : " + e.getMessage());
}
});
t1.start();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (result == 4 && ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res == 58) {
result = 0;
}
return result;
}
private int threadGroupExObjectnotifyAllIllegalMonitorStateException1() {
int result1 = 4; /*STATUS_FAILED*/
// IllegalMonitorStateException - if the current thread is not the owner of the object's monitor.
// final void notifyAll()
try {
gr1.notifyAll();
ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res = ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res - 10;
} catch (IllegalMonitorStateException e2) {
ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res = ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res - 1;
}
return result1;
}
private class ThreadGroupExObjectnotifyAllIllegalMonitorStateException11 implements Runnable {
// final void notifyAll()
private int remainder;
private ThreadGroupExObjectnotifyAllIllegalMonitorStateException11(int remainder) {
this.remainder = remainder;
}
/**
* Thread run fun
*/
public void run() {
synchronized (gr1) {
try {
gr1.notifyAll();
ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res = ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res - 40;
} catch (IllegalMonitorStateException e2) {
ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res = ThreadGroupExObjectnotifyAllIllegalMonitorStateException.res - 30;
}
}
}
}
}
// EXEC:%maple %f %build_option -o %n.so
// EXEC:%run %n.so %n %run_option | compare %f
// ASSERT: scan 0\n | [
"[email protected]"
]
| |
29d7d30500ab89f7e033c6708b91de998ad061a4 | 838579dd468636fa4ea9667f08b7fc6dc962d22e | /src/main/Java/team/ustc/sse/blockly/service/impl/StudentServiceImpl.java | 174180eda60a950033f0e82fd0a716c5ff4ab242 | []
| no_license | rgzhang2018/web-backEnd | 4ee9810da54e2e3495c7516cfb7743112c47ed4d | 0f447ede255a4211cd84cdb5e9569dcc9336f67f | refs/heads/master | 2020-04-28T03:05:29.676459 | 2019-06-18T13:54:32 | 2019-06-18T13:54:32 | 174,922,791 | 0 | 1 | null | 2019-03-11T03:58:52 | 2019-03-11T03:58:51 | null | UTF-8 | Java | false | false | 4,635 | java | package team.ustc.sse.blockly.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import team.ustc.sse.blockly.entity.*;
import team.ustc.sse.blockly.mapper.StudentMapper;
import team.ustc.sse.blockly.mapper.StudentloginMapper;
import team.ustc.sse.blockly.mapper.StudentloginmessageMapper;
import team.ustc.sse.blockly.service.inte.StudentService;
import team.ustc.sse.blockly.util.TimeUtil;
import java.util.Date;
import java.util.List;
/**
* description:
* author: rgzhang
* create time: 2019-05-31
**/
@Service
public class StudentServiceImpl implements StudentService {
private final StudentMapper studentMapper;
private final StudentloginMapper studentloginMapper;
private final StudentloginmessageMapper studentloginmessageMapper;
public StudentServiceImpl(StudentMapper studentMapper, StudentloginMapper studentloginMapper, StudentloginmessageMapper studentloginmessageMapper) {
this.studentMapper = studentMapper;
this.studentloginMapper = studentloginMapper;
this.studentloginmessageMapper = studentloginmessageMapper;
}
@Override
public boolean deleteStudentByAccount(String studentAccount) {
return false;
}
@Override
public boolean changeStudentPassword(String studentAccount,String newPassword) {
int studentID = getStudentIdByAccount(studentAccount);
return false;
}
@Override
public boolean changeStudentMessage(Student student) {
studentMapper.updateByPrimaryKey(student);
return false;
}
@Override
public Student getStudentMessageByID(int studentid) {
return studentMapper.selectByPrimaryKey(studentid);
}
@Override
public Studentlogin getStudenloginByID(int studentid) {
return studentloginMapper.selectByPrimaryKey(studentid);
}
@Override
public List<Student> getAllStudents() {
StudentExample studentExample = new StudentExample();
StudentExample.Criteria criteria = studentExample.createCriteria();
criteria.andStudentidBetween(0,10); //前10条学生信息
List<Student> students = studentMapper.selectByExample(studentExample);
return students;
}
@Override
public List<Studentlogin> getAllStudentLogins() {
StudentloginExample studentloginExample = new StudentloginExample();
StudentloginExample.Criteria criteria = studentloginExample.createCriteria();
criteria.andStudentidIsNotNull();
List<Studentlogin> studentlogins = studentloginMapper.selectByExample(studentloginExample);
return studentlogins;
}
@Override
public List<Studentloginmessage> getTenStudentLoginMessages() {
List<Studentloginmessage> lists = studentloginmessageMapper.selectLastTen();
return lists;
}
@Override
public List<Studentloginmessage> getLoginMessagePast(int pastDay) {
Date date = TimeUtil.getPastDate(new Date(),pastDay);
StudentloginmessageExample studentloginmessageExample = new StudentloginmessageExample();
StudentloginmessageExample.Criteria criteria = studentloginmessageExample.createCriteria();
criteria.andLogindataGreaterThanOrEqualTo(date);
List<Studentloginmessage> list = studentloginmessageMapper.selectByExample(studentloginmessageExample);
return list;
}
@Override
public List<Studentloginmessage> getStudentLoginMessages(int studentID) {
StudentloginmessageExample studentloginmessageExample = new StudentloginmessageExample();
StudentloginmessageExample.Criteria criteria = studentloginmessageExample.createCriteria();
criteria.andStudentidEqualTo(studentID);
List<Studentloginmessage> studentloginmessages = studentloginmessageMapper.selectByExample(studentloginmessageExample);
return studentloginmessages;
}
@Override
public List<Studentloginmessage> getStudentLoginMessages(String studentAccount) {
int id = getStudentIdByAccount(studentAccount);
return getStudentLoginMessages(id);
}
private int getStudentIdByAccount(String studentAccount){
StudentloginExample studentExample = new StudentloginExample();
StudentloginExample.Criteria criteria = studentExample.createCriteria();
criteria.andStudentaccountEqualTo(studentAccount);
List<Studentlogin> studentList = studentloginMapper.selectByExample(studentExample);
if(studentList.isEmpty()){
return -1;
}
return studentList.get(0).getStudentid();
}
}
| [
"[email protected]"
]
| |
0acbeb519958aec0d1a884278f33a254d6ab0c62 | 79e4da87d5cd334d449d6819bbfe10e24fe9f14c | /kontroll-api/kontroll-persistence/src/test/java/com/tmt/kontroll/persistence/daos/AbstractCrudServiceIntegerIdTest.java | e280e0a6bd8b8fc91e897a19a85b8bc28ebda074 | []
| no_license | SergDerbst/Kontroll | 0a1a9563dfc83cba361a6999ff978b0996f9e484 | 6b07b8a511ba4b0b4bd7522efdce08cc9dd5c0dd | refs/heads/master | 2021-01-11T00:11:13.768181 | 2015-04-19T11:28:42 | 2015-04-19T11:28:42 | 15,509,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,902 | java | package com.tmt.kontroll.persistence.daos;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Abstract base implementation of {@link AbstractCrudServiceTest} defining basic values
* for entity ids and the number of entities needed for testing dao services of entities with an
* id of type (@link Integer}.
* <p/>
* The getter methods implemented here may be overriden in case a test needs
* different values.
*
* @param <ENTITY> - the entity this service is for.
* @param <REPO> - the repository of this entity.
* @param <S> - the dao service type to test.
*
* @author Sergio Weigel
*/
public abstract class AbstractCrudServiceIntegerIdTest<ENTITY extends Object, REPO extends JpaRepository<ENTITY, Integer>, S extends CrudDao<ENTITY, Integer>> extends AbstractCrudServiceTest<ENTITY, REPO, Integer, S> {
protected static final int Id_1st = 777;
protected static final int Id_2nd = 778;
private static final int Id_Of_Entity = 1;
private final int numberOfInitialEntities;
protected AbstractCrudServiceIntegerIdTest() {
super();
this.numberOfInitialEntities = 2;
}
protected AbstractCrudServiceIntegerIdTest(final int numberOfExtraInitialEntities) {
super(numberOfExtraInitialEntities);
this.numberOfInitialEntities = 2;
}
protected AbstractCrudServiceIntegerIdTest( final int numberOfInitialEntities,
final int numberOfExtraInitialEntities) {
super(numberOfExtraInitialEntities);
this.numberOfInitialEntities = numberOfInitialEntities;
}
@Override
protected Integer getDeleteId() {
return new Integer(Id_Of_Entity);
}
@Override
protected Integer getExistsId() {
return new Integer(Id_Of_Entity);
}
@Override
protected Integer getFindId() {
return new Integer(Id_Of_Entity);
}
@Override
protected Long getNumberOfInitialEntities() {
return new Long(numberOfInitialEntities);
}
}
| [
"[email protected]"
]
| |
f839619544f0bce3e5c3e31b1636535a47cb0199 | c2cedca1420552f6f6279c7351bead41e2a949cb | /src/org/model/HistoryText.java | edf484c65030a8a45687016ea8da68ef915cc65e | []
| no_license | windmxa1/mnt_new2 | 23c171da8bfb808d1fe1aeba84a75147c1bad8fa | b3915dcf312265dd4a125a25012693f4f25ac601 | refs/heads/master | 2021-10-24T10:05:30.631189 | 2019-03-25T05:26:21 | 2019-03-25T05:26:21 | 103,639,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,108 | java | package org.model;
/**
* HistoryText entity. @author MyEclipse Persistence Tools
*/
public class HistoryText implements java.io.Serializable {
// Fields
private Long id;
private Long itemid;
private Integer clock;
private String value;
private Integer ns;
// Constructors
/** default constructor */
public HistoryText() {
}
/** full constructor */
public HistoryText(Long itemid, Integer clock, String value, Integer ns) {
this.itemid = itemid;
this.clock = clock;
this.value = value;
this.ns = ns;
}
// Property accessors
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Long getItemid() {
return this.itemid;
}
public void setItemid(Long itemid) {
this.itemid = itemid;
}
public Integer getClock() {
return this.clock;
}
public void setClock(Integer clock) {
this.clock = clock;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getNs() {
return this.ns;
}
public void setNs(Integer ns) {
this.ns = ns;
}
} | [
"[email protected]"
]
| |
433296f539ae8534639e5719f7151918acc7be53 | d7f8381fc6ba787579a55c9e3bb3afe2dcc2ec00 | /BMS/src/ui/loginFrame.java | 49e36256f1bfee2228371436f1f296cda2118646 | []
| no_license | daidai53/Java-curriculum-design-named-Bike-Management-System | 3be9729e7b9a610be506c7cb4d9ee54a82f544f0 | e36f0b34c5106d25023ff8d93a9c920370859938 | refs/heads/master | 2020-04-18T19:18:11.145111 | 2019-01-26T16:27:54 | 2019-01-26T16:27:54 | 167,708,726 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,647 | java | package ui;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import com.sun.glass.events.KeyEvent;
import userVerify.userVerify;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.sql.SQLException;
import javax.swing.JTextField;
import java.awt.Color;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPasswordField;
/**
* @author 李豐庭 登录页
*/
public class loginFrame extends JDialog implements ActionListener, WindowListener, KeyListener {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JTextField textField;
private JPasswordField passwordField;
private JButton loginButton;
private JButton cancelButton;
/**
* Create the frame.
*/
public loginFrame(JFrame jf, boolean model) {
super(jf, model);
setFont(new Font("楷体", Font.PLAIN, 17));
setTitle("\u767B\u9646");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setBounds(100, 100, 449, 250);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
this.setLocationRelativeTo(null);
JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
label.setFont(new Font("楷体", Font.PLAIN, 17));
label.setBounds(77, 35, 82, 28);
contentPane.add(label);
textField = new JTextField();
textField.setBounds(187, 35, 134, 28);
contentPane.add(textField);
textField.setColumns(10);
JLabel label_1 = new JLabel("\u5BC6\u7801\uFF1A");
label_1.setForeground(Color.BLACK);
label_1.setFont(new Font("楷体", Font.PLAIN, 17));
label_1.setBounds(77, 88, 82, 28);
contentPane.add(label_1);
loginButton = new JButton("\u767B\u9646");
loginButton.setFont(new Font("楷体", Font.PLAIN, 17));
loginButton.setBounds(98, 150, 93, 23);
contentPane.add(loginButton);
cancelButton = new JButton("\u53D6\u6D88");
cancelButton.setFont(new Font("楷体", Font.PLAIN, 17));
cancelButton.setBounds(240, 150, 93, 23);
contentPane.add(cancelButton);
passwordField = new JPasswordField();
passwordField.setBounds(187, 87, 134, 28);
contentPane.add(passwordField);
passwordField.addKeyListener(this);
this.addWindowListener(this);
loginButton.addActionListener(this);
cancelButton.addActionListener(this);
this.setVisible(true);
}
/*登录按钮事件监听*/
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == loginButton) {
String staff = textField.getText().trim();
String password = new String(passwordField.getPassword()).trim();
//判断登录名输入是否为空
if (staff.equals("")) {
JOptionPane.showMessageDialog(this, "用户名不能为空");
} else if (password.equals("")) {
JOptionPane.showMessageDialog(this, "密码不能为空");
} else {
try {
if (userVerify.loginCheck(staff, password)) {
JOptionPane.showMessageDialog(this, "登录成功");
if (password.equals("0000")) {
JOptionPane.showMessageDialog(this, "当前密码为[初始密码],请及时修改!");
}
this.setVisible(false);
} else {
JOptionPane.showMessageDialog(this, "登录验证失败,请重新输入");
passwordField.setText("");
}
} catch (HeadlessException | ClassNotFoundException | SQLException e1) {
JOptionPane.showMessageDialog(this, "数据库连接失败");
e1.printStackTrace();
}
}
}
if (e.getSource() == cancelButton) {
System.exit(0);
}
}
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
}
@Override
public void windowClosed(WindowEvent e) {
System.exit(0);
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
@Override
public void keyTyped(java.awt.event.KeyEvent e) {
// TODO 自动生成的方法存根
}
/*监听密码框的回车键*/
@Override
public void keyPressed(java.awt.event.KeyEvent e) {
// TODO 自动生成的方法存根
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
loginButton.doClick();
}
}
@Override
public void keyReleased(java.awt.event.KeyEvent e) {
// TODO 自动生成的方法存根
}
}
| [
"[email protected]"
]
| |
35f720b2e71996571c164a2404ea077667bb5042 | 6d5dcad989ebe9a41d97cddf7f6ccb93e6b53101 | /src/dacortez/minaDeOuro/Agent.java | 705018ab428528119cb16d55456dd3241b19c105 | []
| no_license | dacortez/MinaDeOuro | 63504a4357fe03ee358505ae9ef1344c3a3550cc | a635400e1a30ff76febdf027ccbf2eb2fc522e0d | refs/heads/master | 2021-01-01T17:31:28.395789 | 2013-09-28T23:45:05 | 2013-09-28T23:45:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,166 | java | /**
* MAC0425 - Inteligência Artificial
* EP1 - Mina de Ouro
*
* Daniel Augusto Cortez - 2960291
*/
package dacortez.minaDeOuro;
import java.util.List;
import java.util.ArrayList;
/**
* O agente é responsável por efetuar o procedimento de busca adequado
* na mina. O método de busca da solução getSolution() é abstrato e deve
* ser implementado pela instância concreta do agente que deriva desta
* classe. A estrutura comum a todos esses agentes, entretanto, estão
* presentes nesta classe base.
*
* @author dacortez
* @version 2013.09.26
*/
public abstract class Agent {
// Armazena a posição inicial do agente e onde ele deve encerrar a busca.
protected Position startPosition;
// Lista dos estados já visitados pelo agente.
protected List<State> closed;
// Nó raiz da árvore de busca gerada.
protected Node root;
// Número de pepitas a serem coletadas como objetivo de busca.
private int goldGoal;
/**
* @param startPosition Define a posição do agente na mina e a
* posição para onde ele deve voltar no final da sua exploração.
*/
public Agent(Position startPosition) {
this.startPosition = startPosition;
closed = new ArrayList<State>();
setRoot();
}
/**
* @return O número de pepitas a serem coletadas como objetivo de busca.
*/
protected int getGoldGoal() {
return goldGoal;
}
/**
* Inicializa o nó raiz da árvore de busca a partir do estado onde
* o agente se encontra na posição inicial.
*/
private void setRoot() {
State state = new State(startPosition);
root = new Node();
root.setState(state);
root.setParentNode(null);
root.setAction(null);
root.setPathCost(0);
root.setDepth(0);
}
/**
* A partir da estratégia de busca do agente, explora a mina tentando
* coletar 1, 2, ..., todas as pepitas da mina, retornando a melhor
* solução possível.
* @return O objeto Solution correspondente a melhor solução encontrada
* pelo agente de acordo com a sua estratégia de busca.
*/
public Solution search() {
Solution best = new Solution(root);
int totalGold = Main.getEnvironment().getTotalGold();
for (goldGoal = 1; goldGoal <= totalGold; goldGoal++) {
Solution solution = getSolution();
if (solution != null && !(solution instanceof Cutoff))
if (solution.getCost() > best.getCost())
best = solution;
}
return best;
}
/**
* @return O objeto Solution correspondente a melhor solução encontrada
* pelo agente de acordo com a sua estratégia de busca, considerando o
* número de pepitas a serem coletadas da variável goldGoal.
*/
protected abstract Solution getSolution();
/**
* Testa se o estado atual do agente é o estado objetivo. O estado objetivo é aquele
* em que o agente retorna a sua posição inicial após ter coletado o número correto
* de pepitas (variável goldGoal).
* @param state O estado atual do agente.
* @return true se o estado atual do agente é o estado objetivo, false caso contrário.
*/
protected boolean goalTest(State state) {
if (state.getTotalPicked() == goldGoal)
return startPosition.equals(state.getPosition());
return false;
}
}
| [
"[email protected]"
]
| |
67b988642a65232b745cc62730938965f814c677 | fc9f68e310ad7bcd974417c6d22deb20d1a20272 | /Week10/CarTest.java | 8e1ca29487a3a799cb52ae1984b5328466c3fa11 | []
| no_license | Glacier-Han/JavaProgramming | de38e252f2cbc0ef6edcdbf436a86bdf84b0c7d0 | af0cd8165d67d21cae0669bb1cd29deb7ab768e0 | refs/heads/main | 2023-06-26T22:56:31.859681 | 2021-07-30T07:22:58 | 2021-07-30T07:22:58 | 351,644,180 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,268 | java | import java.util.*;
class Car{ //자동차 클래스
//속성:필드 , 멤버변수
double speed;
double mileage; //일반변수(Main 안, 초기화 필수) | 멤버변수, 필드변수 (초기화하지 않으면 자료형에 맞는 0으로 자동 초기화 됨, boolean -> false)
String color;
//동작:메소드 , 멤버함수
void goStraight(double distance){
System.out.println(distance + "m 직진합니다. ");
mileage += distance;
}
void stop(){
System.out.println("정지합니다. ");
}
void turnLeft(){
System.out.println("좌회전 합니다. ");
}
void turnRight(){
System.out.println("우회전 합니다. ");
}
void milageShow(){
System.out.println(mileage + "m");
}
}
class CarTest{
public static void main(String [] args){
//자동차 테스트
//1. 자동차 생성
Car myCar = new Car(); //자동차 객체, 인스턴스
//2. 자동차 테스트
myCar.goStraight(5.4); //직진test
myCar.stop(); //정지test
//3.주행테스트
myCar.goStraight(20);
myCar.turnRight();
myCar.goStraight(15);
myCar.turnLeft();
myCar.goStraight(30);
myCar.turnRight();
myCar.goStraight(15);
myCar.stop();
myCar.milageShow();
}
} | [
"[email protected]"
]
| |
05b6890507a5a1167be5b5738202cbf1f772064b | e38bac98219d4ae42607b17aad0a9c4baad2a1f6 | /src/Visao/JogoFrame.java | e79230908f970540a59e5756e9e644157f9dcd8c | []
| no_license | thiagok00/INF1636-Object-Oriented-Programming | 4a3d962d793e596c85e7a8e3f7e080cf904e49c7 | b9257ee2cc5dfe17b16b30823110d3bd653965f6 | refs/heads/master | 2021-01-18T12:06:51.711209 | 2016-03-17T13:42:53 | 2016-03-17T13:42:53 | 44,216,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package Visao;
import javax.swing.*;
import Jogo.*;
public class JogoFrame extends JFrame {
private static final long serialVersionUID = 1L;
public final int WIDTH_DEFAULT = 850;
public final int HEIGHT_DEFAULT =720;
TabuleiroPainel tabuleiro;
MenuPainel menu;
BancoImobiliarioFacade jogo;
ControladorEventos controladorEventos;
public JogoFrame(){
this.setLayout(null);
setSize(WIDTH_DEFAULT, HEIGHT_DEFAULT);
setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(false);
controladorEventos = new ControladorEventosSwing(this);
jogo = BancoImobiliarioFacade.getIstance();
tabuleiro = new TabuleiroPainel();
getContentPane().add(tabuleiro);
menu = new MenuPainel();
menu.frame = this;
getContentPane().add(menu);
}
public static void main(String[] args) {
JogoFrame tab = new JogoFrame();
tab.setVisible(true);
}
}//End of Class
| [
"[email protected]"
]
| |
b97038dc447aab29ad4a6a9c306dfef72a1369c8 | 2405d8eae75a7ff7176308bdd63df8c67db9f596 | /src/并行模式与算法/矩阵乘法的并行/MatrixMulTask.java | 471cc98474d6bd1e0f77eb02244eadb360e6fa32 | []
| no_license | Leonhatemath/High-concurrency-Java | 25970ea006c7a78ee2b1bd0d348210e0c3459b5c | 3913f25941464d00be1378468e4a641b6f028469 | refs/heads/master | 2020-05-23T22:10:17.000083 | 2019-06-03T12:29:05 | 2019-06-03T12:29:05 | 186,968,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package 并行模式与算法.矩阵乘法的并行;
import java.util.concurrent.RecursiveTask;
/**
* @author WangXu
* @date 2019/5/30 0030 - 17:16
*/
public class MatrixMulTask {
}
| [
"[email protected]"
]
| |
7c9a525e6d165f8dd72e2f7e51a38506eafea968 | f1213aa2843b4ed9ce8d7fbc03314c4c48cd35f5 | /db-tools/src/main/java/ru/inedtest/dbtools/services/BooksService.java | 56a014c4250ee3440eb3d7de04e23900fccf208c | []
| no_license | Slavko13/ined-main | 55a045e0d1f91f3cc7ec680b16e8a79257544e1a | 6318ddb22d2e82ad7b8afa7d6926b665bbf099e3 | refs/heads/master | 2023-01-09T09:42:26.325644 | 2020-11-08T15:45:43 | 2020-11-08T15:45:43 | 310,521,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package ru.inedtest.dbtools.services;
import ru.inedtest.dbtools.domains.books.Books;
import ru.inedtest.dbtools.dto.adminDTO.BookDTO;
import ru.inedtest.dbtools.dto.adminDTO.BookStyleDTO;
import java.util.List;
public interface BooksService {
List<Books> getAllBooks();
Books getBookByID(Long id);
void deleteBookByID(Long id);
Books addBook(BookDTO bookDTO);
List<Books> getAllByBookStyle(Long id);
Books updateBook(BookDTO bookDTO);
}
| [
"[email protected]"
]
| |
1641ba4913fd1f155aa63c8552eccd2793595fe6 | edae9856f6d8610622664d5535d8ced38ce8823a | /text/text_3/Text_3_4.java | 41275699cebc6136ccde5b4fc78238bb3fbf7098 | []
| no_license | blessed-19901108/-JAVA | 039c30ba5d00ad30c9353b5aa3ba7787339ff8df | 400f7a96a4dbf1643cb302b320ea90b7eb2cea69 | refs/heads/main | 2023-08-05T02:37:22.914640 | 2021-09-18T01:49:09 | 2021-09-18T01:49:09 | 358,589,413 | 0 | 0 | null | 2021-04-22T14:25:37 | 2021-04-16T12:18:18 | Java | UTF-8 | Java | false | false | 5,121 | java | package text;
import java.util.*;
public class Txet_3_4 {//goto语句!!!!!!!
/*public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
System.out.println("请输入一个数");
int a = read.nextInt();
boolean flag = true;
for(int i=2;i<a;i++)
{
if(a%i==0)
{
flag = false;
System.out.println("不是素数");
break;
}
System.out.println("是素数");
}*/
/*System.out.println("请投币");
int balance = 0;
while(true)
{
int amount = in.nextInt();
balance = balance+amount;
if(balance>=10)
{
System.out.println("******************");
System.out.println("*******车站票*******");
System.out.println("******************");
System.out.println("找您"+(balance-10)+"元");
break;
}else
{
System.out.println("投币金额不足,按1选择继续投币,按2选择取走投入的金额");
int a = in.nextInt();
switch(a)
{
case 1:
System.out.println("请继续投币");
break;
case 2:
System.out.println("返还给您"+amount+"元");
break;
}
}
}
}*/
//P32 4.1 数组元素的访问与数组长度的属性
/*public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int i=0;
int[]a=new int[10];
for(i=0;i<a.length;i++)
{
System.out.println("a["+i+"]="+a[i]+"");
}
System.out.println();
for(i=a.length-1;i>=0;i--)
{
a[i]=i;
System.out.println("a["+i+"]="+a[i]+"");
}
}*/
//P33 4.2 从键盘输入数据给数组元素
/*public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int i,min,max;
int[] a=new int[5];
System.out.println("请输入5个整数");
for(i=0;i<a.length;i++)
{
a[i] = in.nextInt();
}
max = Integer.MIN_VALUE;//这是给max最小的值
min = Integer.MAX_VALUE;//这是给min最大的值
for(i=0;i<a.length;i++)
{
if(a[i]>max)
{
max = a[i];
}
if(a[i]<min)
{
min = a[i];
}
}
System.out.println("最大的数是:"+max);
System.out.println("最小的数是:"+min);
}*/
//P35 3.4 定义一个2行3列的整形二维数组 对其赋随机值,分别对第一行和第二行的元素排列
/*public static void main(String[] args) {
// TODO Auto-generated method stub
int i,j;
int[][]a = new int[2][3];
for(i=0;i<a.length;i++) //i<a[0].length 这是错的,这句表示第一行有多少个数字,并不是有几行
{ //表示几行的是a.length
for(j=0;j<a[1].length;j++)
{
a[i][j] = (int)(Math.random()*100)+1;
System.out.println("a["+i+"]["+j+"]="+a[i][j]+"");
System.out.println();
}
}
Arrays.sort(a[0]);//对数组的第一行进行从小到大的排序 在二维数组中a[0]表示第一行
Arrays.sort(a[1]);
for(i=0;i<a.length;i++)
{
if(i==0)
{
System.out.println("排序后,第一行元素从小到大是:");
}
if(i==1)
{
System.out.println("排序后,第二行元素从小到大是:");
}
for(j=0;j<a[1].length;j++)
{
System.out.println("a["+i+"]["+j+"]="+a[i][j]+"");
System.out.println();
}
}
}*/
//P36 4.4字符串的比较
/*public static void main(String[] args) {
// TODO Auto-generated method stub
String s1 = "wby";
String s2 = "wby";
String s3 = new String("wby");
String s4 = new String("wby");
System.out.println("用运算符==比较的结果如下");
if(s1==s2)
System.out.println("s1==s2");
else
System.out.println("s1!=s2");
if(s3==s4)
System.out.println("s3==s4");
else
System.out.println("s3!=s4");
if(s2==s3)
System.out.println("s2==s3");
else
System.out.println("s2!=s3");
System.out.println("用equals()方法比较的结果如下");
if(s1.equals(s2))
System.out.println("s1==s2");
else
System.out.println("s1!=s2");
if(s3.equals(s4))
System.out.println("s3==s4");
else
System.out.println("s3!=s4");
if(s2.equals(s3))
System.out.println("s2==s3");
else
System.out.println("s2!=s3");
}*/
//P38 4.5 字符串方法的调用
/*public static void main(String[] args) {
// TODO Auto-generated method stub
String str1 = "wby";
String str2 = "Hello";
String str = str1+str2;
System.out.println("str="+str);
System.out.println(str.length());
System.out.println(str.charAt(6));//显示第8个位置的字符 //注意不要越界
System.out.println(str.indexOf("wb"));//显示字符串“wb”第一次出现的位置 //错误:str.indexOf(wb) 没加双引号
System.out.println(str.toLowerCase());//全部转换为小写
System.out.println("str="+str);
System.out.println(str.toUpperCase());
System.out.println("str="+str);
}*/
//P39 4.6 命令行参数的使用
/*public static void main(String[] args) {
// TODO Auto-generated method stub
if(args.length==0)
{
System.out.println("没有输入参数");
}
else
{
System.out.println(args.length);
for(int i=0;i<args.length;i++)
{
System.out.println(args[i]);
}
}
}*/
}
| [
"[email protected]"
]
| |
831771a31bf60da3d03b4bdac50d3f64464d43d4 | 35612153612f8d51eb3d5ab813267db50cdfeb06 | /rock-portal/src/main/java/org/flybird/rock/portal/domain/SmsCouponHistoryDetail.java | 93378ebd3f475b8b60b9ce1eecce26b9071ad0d0 | [
"Apache-2.0"
]
| permissive | dlxqlig/rock | bd21093979661ed747f79800cccd4fb08660e88d | 2866f62f7ad60309f4f455015cadab3da4199cd0 | refs/heads/master | 2022-06-30T14:40:24.805473 | 2020-03-04T06:26:27 | 2020-03-04T06:26:27 | 235,589,257 | 1 | 0 | Apache-2.0 | 2022-06-21T02:41:14 | 2020-01-22T14:19:47 | Java | UTF-8 | Java | false | false | 1,384 | java | package org.flybird.rock.portal.domain;
import org.flybird.rock.model.SmsCoupon;
import org.flybird.rock.model.SmsCouponHistory;
import org.flybird.rock.model.SmsCouponProductCategoryRelation;
import org.flybird.rock.model.SmsCouponProductRelation;
import java.util.List;
/**
* 优惠券领取历史详情封装
* Created by flybird on 2018/8/29.
*/
public class SmsCouponHistoryDetail extends SmsCouponHistory {
//相关优惠券信息
private SmsCoupon coupon;
//优惠券关联商品
private List<SmsCouponProductRelation> productRelationList;
//优惠券关联商品分类
private List<SmsCouponProductCategoryRelation> categoryRelationList;
public SmsCoupon getCoupon() {
return coupon;
}
public void setCoupon(SmsCoupon coupon) {
this.coupon = coupon;
}
public List<SmsCouponProductRelation> getProductRelationList() {
return productRelationList;
}
public void setProductRelationList(List<SmsCouponProductRelation> productRelationList) {
this.productRelationList = productRelationList;
}
public List<SmsCouponProductCategoryRelation> getCategoryRelationList() {
return categoryRelationList;
}
public void setCategoryRelationList(List<SmsCouponProductCategoryRelation> categoryRelationList) {
this.categoryRelationList = categoryRelationList;
}
}
| [
"[email protected]"
]
| |
0ddfbeac55fc2dcefb390eac74ba663683f61efa | e5e3d6c6376d54bbadb3db7912b7ec4e9db19b83 | /src/main/java/com/rdeconti/controleponto/repository/UsuarioRepository.java | 58b47b632469ab03dd6536ef69e8e043c4f9e392 | [
"MIT"
]
| permissive | rdeconti/Projeto-DIO-Java-Spring-Controle-Ponto | 8c0cd36f900c3c33f534d18de7e67bf7aedcff61 | 86d102555fa17dc734a43b09c3b4141845154e18 | refs/heads/main | 2023-06-13T22:15:33.960175 | 2021-07-14T18:32:53 | 2021-07-14T18:32:53 | 383,535,151 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.is4ii4s.controlepontoacesso.repository;
import com.is4ii4s.controlepontoacesso.model.JornadaTrabalho;
import com.is4ii4s.controlepontoacesso.model.Usuario;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UsuarioRepository extends JpaRepository<Usuario, Long> {
} | [
"[email protected]"
]
| |
1abb26016b667b33cdc163be70da65899917b879 | 1a32d704493deb99d3040646afbd0f6568d2c8e7 | /BOOT-INF/lib/org/springframework/web/servlet/tags/TransformTag.java | cc2f79ffc9a3348048637816c4caac0e1612460f | []
| no_license | yanrumei/bullet-zone-server-2.0 | e748ff40f601792405143ec21d3f77aa4d34ce69 | 474c4d1a8172a114986d16e00f5752dc019cdcd2 | refs/heads/master | 2020-05-19T11:16:31.172482 | 2019-03-25T17:38:31 | 2019-03-25T17:38:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,198 | java | /* */ package org.springframework.web.servlet.tags;
/* */
/* */ import java.beans.PropertyEditor;
/* */ import java.io.IOException;
/* */ import javax.servlet.jsp.JspException;
/* */ import javax.servlet.jsp.JspWriter;
/* */ import javax.servlet.jsp.PageContext;
/* */ import javax.servlet.jsp.tagext.TagSupport;
/* */ import org.springframework.web.util.TagUtils;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class TransformTag
/* */ extends HtmlEscapingAwareTag
/* */ {
/* */ private Object value;
/* */ private String var;
/* 50 */ private String scope = "page";
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setValue(Object value)
/* */ {
/* 61 */ this.value = value;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setVar(String var)
/* */ {
/* 71 */ this.var = var;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setScope(String scope)
/* */ {
/* 82 */ this.scope = scope;
/* */ }
/* */
/* */ protected final int doStartTagInternal()
/* */ throws JspException
/* */ {
/* 88 */ if (this.value != null)
/* */ {
/* 90 */ EditorAwareTag tag = (EditorAwareTag)TagSupport.findAncestorWithClass(this, EditorAwareTag.class);
/* 91 */ if (tag == null) {
/* 92 */ throw new JspException("TransformTag can only be used within EditorAwareTag (e.g. BindTag)");
/* */ }
/* */
/* */
/* 96 */ String result = null;
/* 97 */ PropertyEditor editor = tag.getEditor();
/* 98 */ if (editor != null)
/* */ {
/* 100 */ editor.setValue(this.value);
/* 101 */ result = editor.getAsText();
/* */ }
/* */ else
/* */ {
/* 105 */ result = this.value.toString();
/* */ }
/* 107 */ result = htmlEscape(result);
/* 108 */ if (this.var != null) {
/* 109 */ this.pageContext.setAttribute(this.var, result, TagUtils.getScope(this.scope));
/* */ }
/* */ else {
/* */ try
/* */ {
/* 114 */ this.pageContext.getOut().print(result);
/* */ }
/* */ catch (IOException ex) {
/* 117 */ throw new JspException(ex);
/* */ }
/* */ }
/* */ }
/* */
/* 122 */ return 0;
/* */ }
/* */ }
/* Location: C:\Users\ikatwal\Downloads\bullet-zone-server-2.0.jar!\BOOT-INF\lib\spring-webmvc-4.3.14.RELEASE.jar!\org\springframework\web\servlet\tags\TransformTag.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
9e089e4461aa0f6b64c2ad654ac7d847f9761ea6 | e3272419127727fdf2b3c7a840e8e5a5fa740fba | /spring-mvc-demo/src/com/sachin/springdemo/controller/HomeController.java | 8b5291afa5f5162090e06eefde15361de46921b8 | []
| no_license | BansodeSachin/git-github | acbf2dfd66e97cb66853c1e2eb3ddff7f7ffc8af | 455b38683f5589799994c2e4c66e93bbc99eae7e | refs/heads/master | 2022-12-20T08:02:05.668222 | 2019-08-21T05:45:18 | 2019-08-21T05:45:18 | 143,000,439 | 0 | 0 | null | 2022-12-15T23:58:54 | 2018-07-31T10:39:33 | Java | UTF-8 | Java | false | false | 279 | java | package com.sachin.springdemo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/")
public String showMyPage() {
return "main-menu";
}
}
| [
"[email protected]"
]
| |
ede4b24bc239f95b05a59611059742975f57461d | 02e81b9f68d861ff3e0473cb3e80682b893315bc | /src/main/java/io/nkdtrdr/mrktmkr/TerminateBean.java | 1e5fb3e03bec7023162c9607d18d46bb6fdaf557 | [
"MIT"
]
| permissive | gmcnicol/marketmaker | add91a8bac04371ea20376001d89de3959f4e035 | aed7380825da8e450fd5897a7029f37f6904784a | refs/heads/main | 2023-07-07T07:31:34.927886 | 2021-08-09T23:35:45 | 2021-08-09T23:35:45 | 372,975,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package io.nkdtrdr.mrktmkr;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.PreDestroy;
@Service
public class TerminateBean {
private static final Logger LOGGER = LoggerFactory.getLogger(TerminateBean.class);
@PreDestroy
public void onTerminate() {
LOGGER.info("Terminating MrktMkr");
}
}
| [
"[email protected]"
]
| |
7feb2c199cf920c8d3568a800a0d6d10dbdaa192 | d4ce294547368a41b9dfeb0373839911d1537fbb | /AlgorithmsQuestions/src/TopKElements.java | 07c93002ad27f4111ebe0bb8028a0c6f06ef4b7f | []
| no_license | gmorris2021/Algorithm-Questions | ea006350aac08cc6479116172f72961e538c801c | 0e1aebe0ec7d74442f86f9e45904887a8ccef23d | refs/heads/master | 2020-07-21T13:19:06.374885 | 2019-09-06T23:03:46 | 2019-09-06T23:03:46 | 206,877,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,947 | java |
import java.util.*;
public class TopKElements {
public List<Integer> topKFrequent(int[] nums, int k) {
HashMap<Integer, Boolean> inHeap = new HashMap<Integer, Boolean>();
PriorityQueue<Entry> a = new PriorityQueue<Entry>();
HashMap<Integer,Integer> out = new HashMap<Integer, Integer>();
int count;
for (int i = 0; i < nums.length; i++) {
count = out.getOrDefault(nums[i], 0) + 1;
out.put(nums[i], count);
}
for (int i = 0; i < nums.length; i++) {
count = out.get(nums[i]);
if (a.size() == 0) {
a.add(new Entry(nums[i], count));
inHeap.put(nums[i], true);
} else if (!inHeap.getOrDefault(nums[i] ,false) && a.size() < k) {
a.add(new Entry(nums[i], count));
inHeap.put(nums[i], true);
} else if (!inHeap.getOrDefault(nums[i] ,false) && out.get(a.peek().val) < count) {
inHeap.put(nums[i], true);
inHeap.put(a.poll().val, false);
a.add(new Entry(nums[i], count));
}
}
List<Integer> oout = new LinkedList<Integer>();
int size = a.size();
for (int i = 0; i < size; i++) {
oout.add(a.poll().val);
}
return oout;
}
class Entry implements Comparable<Entry>{
int val;
int num;
public Entry(int val, int num) {
this.val = val;
this.num = num;
}
@Override
public int compareTo(Entry a) {
return this.num - a.num;
}
@Override
public String toString() {
return val + ":" + num;
}
public boolean is(int a) {
return val == a;
}
}
}
| [
"[email protected]"
]
| |
a803f287b745047c9aad519281c62eb8ea16e7d3 | 0944adebd38966c540eebcc1fbbc07225aa9a040 | /app/src/test/java/com/example/disproject/ExampleUnitTest.java | bdc1ea43c7dcb21fb0c2524ff7e90e3c9de29f2c | []
| no_license | TakshKamlesh/Wild-Animal-Intrusion-Detection-and-Alerting-System | 19c03e2d5945cb5774363c697db4fd3674a466dc | 849ebe662a52fffaee8e3d06e6c925211bc9cd07 | refs/heads/main | 2023-01-25T01:05:32.548416 | 2020-12-08T19:41:21 | 2020-12-08T19:41:21 | 319,707,850 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.example.disproject;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
9184e43809d98db9e758db31ef6d33fa49c7eb7d | 3d4349c88a96505992277c56311e73243130c290 | /Preparation/processed-dataset/data-class_4_390/61.java | cca1f164a2c08b69bbbd788e813d486a8aac64de | []
| no_license | D-a-r-e-k/Code-Smells-Detection | 5270233badf3fb8c2d6034ac4d780e9ce7a8276e | 079a02e5037d909114613aedceba1d5dea81c65d | refs/heads/master | 2020-05-20T00:03:08.191102 | 2019-05-15T11:51:51 | 2019-05-15T11:51:51 | 185,272,690 | 7 | 4 | null | null | null | null | UTF-8 | Java | false | false | 207 | java | /*
* (non-Javadoc)
* @see megamek.common.Entity#canTransferCriticals(int)
*/
@Override
public boolean canTransferCriticals(int loc) {
// BAs can never transfer crits
return false;
}
| [
"[email protected]"
]
| |
0659f2d1a316acf64333cd40acc680dc6a467391 | eb86fd2cbc4567b1106035f0926d4022c99c1b4e | /src/test/java/com/itaim/application/config/timezone/HibernateTimeZoneIT.java | be1a20b8988fda101108bcf7118cd692acc718a7 | []
| no_license | Sherlyhalli/jhipster-itaim-application | 099bdeafb2d2ee3dacbaa9983e2d07d0859afc9a | ae6771b108808678d3c89c78070cc4cdd97cbb11 | refs/heads/master | 2022-12-23T23:29:22.207241 | 2020-01-10T06:04:16 | 2020-01-10T06:04:16 | 232,977,261 | 0 | 0 | null | 2022-12-16T04:43:20 | 2020-01-10T06:04:08 | Java | UTF-8 | Java | false | false | 6,860 | java | package com.itaim.application.config.timezone;
import com.itaim.application.ItaimApp;
import com.itaim.application.repository.timezone.DateTimeWrapper;
import com.itaim.application.repository.timezone.DateTimeWrapperRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.transaction.annotation.Transactional;
import java.time.*;
import java.time.format.DateTimeFormatter;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for the UTC Hibernate configuration.
*/
@SpringBootTest(classes = ItaimApp.class)
public class HibernateTimeZoneIT {
@Autowired
private DateTimeWrapperRepository dateTimeWrapperRepository;
@Autowired
private JdbcTemplate jdbcTemplate;
private DateTimeWrapper dateTimeWrapper;
private DateTimeFormatter dateTimeFormatter;
private DateTimeFormatter timeFormatter;
private DateTimeFormatter dateFormatter;
@BeforeEach
public void setup() {
dateTimeWrapper = new DateTimeWrapper();
dateTimeWrapper.setInstant(Instant.parse("2014-11-12T05:50:00.0Z"));
dateTimeWrapper.setLocalDateTime(LocalDateTime.parse("2014-11-12T07:50:00.0"));
dateTimeWrapper.setOffsetDateTime(OffsetDateTime.parse("2011-12-14T08:30:00.0Z"));
dateTimeWrapper.setZonedDateTime(ZonedDateTime.parse("2011-12-14T08:30:00.0Z"));
dateTimeWrapper.setLocalTime(LocalTime.parse("14:30:00"));
dateTimeWrapper.setOffsetTime(OffsetTime.parse("14:30:00+02:00"));
dateTimeWrapper.setLocalDate(LocalDate.parse("2016-09-10"));
dateTimeFormatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd HH:mm:ss.S")
.withZone(ZoneId.of("UTC"));
timeFormatter = DateTimeFormatter
.ofPattern("HH:mm:ss")
.withZone(ZoneId.of("UTC"));
dateFormatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd");
}
@Test
@Transactional
public void storeInstantWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("instant", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeFormatter.format(dateTimeWrapper.getInstant());
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalDateTime()
.atZone(ZoneId.systemDefault())
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeOffsetDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("offset_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getOffsetDateTime()
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeZoneDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("zoned_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getZonedDateTime()
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalTime()
.atDate(LocalDate.of(1970, Month.JANUARY, 1))
.atZone(ZoneId.systemDefault())
.format(timeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeOffsetTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("offset_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getOffsetTime()
.toLocalTime()
.atDate(LocalDate.of(1970, Month.JANUARY, 1))
.atZone(ZoneId.systemDefault())
.format(timeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalDateWithUtcConfigShouldBeStoredWithoutTransformation() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_date", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalDate()
.format(dateFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
private String generateSqlRequest(String fieldName, long id) {
return format("SELECT %s FROM jhi_date_time_wrapper where id=%d", fieldName, id);
}
private void assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(SqlRowSet sqlRowSet, String expectedValue) {
while (sqlRowSet.next()) {
String dbValue = sqlRowSet.getString(1);
assertThat(dbValue).isNotNull();
assertThat(dbValue).isEqualTo(expectedValue);
}
}
}
| [
"[email protected]"
]
| |
7a88610ffca05672da3b2b826be0642c32b305f1 | 671ced91a7c37fa441f5f9e4b9967e8d32621814 | /movie-feign-hystrix-fallback-factory/src/main/java/com/consumer/moviefeignhystrixfallbackfactory/entity/User.java | 06345a15005831c1d867bdcff10cca5ada681e1b | []
| no_license | cyh756085049/spring-cloud-study | 413bca06627d1d008555d05451d46d56f0a26c69 | 7f9d88e1cfb0954188dcca0f3d2ff8ba53be9d31 | refs/heads/master | 2021-07-09T22:23:54.476860 | 2020-10-29T01:33:58 | 2020-10-29T01:33:58 | 211,300,491 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.consumer.moviefeignhystrixfallbackfactory.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
private Long id;
private String username;
private String name;
private Integer age;
private BigDecimal balance;
}
| [
"[email protected]"
]
| |
8add740e4b49946672baa43e801239e8deffb2c4 | 5eaeaf764bdcbdb8ee783cdaa5d2dbb1d7978ace | /spring/src/main/java/com/cap/TestDeps.java | d430f1c63c278b5a6ef16ccb2163be831ce47cd9 | []
| no_license | code-say/capjavareact | fe91de8bc53818104980340631ad660fef53d869 | e8004fcf344232be62361eb0f21d9cccfa5d9018 | refs/heads/main | 2023-03-27T05:36:40.980666 | 2021-03-23T05:33:25 | 2021-03-23T05:33:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package com.cap;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestDeps {
public static void main(String[] args) {
// B b = new B();
// A a = new A(b);
// spring specific code
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
// get instance from spring
A a = context.getBean(A.class);
a.execute();
System.out.println(" _ ___ __------- ___ __ _");
WorkoutRepository workoutRepository = context.getBean(WorkoutRepository.class);
WorkoutRepository workoutRepository2 = context.getBean(WorkoutRepository.class);
if(workoutRepository == workoutRepository2) {
System.out.println("Single object");
}
else {
System.out.println("different object");
}
workoutRepository.assignWorkoutToUser();
// b = new B1();
// a = new A(b);
// a.execute();
}
}
| [
"[email protected]"
]
| |
3fe80d4c183d5345ce213c9de0aaa260cfcbc5aa | c900ea3d73e53ba289417729ba0fa269f81aabf0 | /src/test/java/BowlingScore/Render/UtilTest.java | 359d635041d37c3250784dac1a835a943b722d2d | []
| no_license | lette1394/TDDpractice | bfdf429336db03a55179df85ff428baf4b578c4c | 9dfa927a6ba73dd27408afcde9d3e5c8b5d6ce52 | refs/heads/master | 2020-04-02T04:43:28.460548 | 2018-10-29T14:47:15 | 2018-10-29T14:47:15 | 154,031,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package BowlingScore.Render;
import BowlingScore.Render.Util;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class UtilTest {
@Test
void generate_string_1() throws Exception {
String expected = "aaa";
String actual = Util.generateStringXTimes("a", 3);
assertThat(actual).isEqualTo(expected);
}
@Test
void generate_string_2() throws Exception {
String expected = "_____";
String actual = Util.generateStringXTimes("_", 5);
assertThat(actual).isEqualTo(expected);
}
@Test
void generate_empty_string() throws Exception {
String expected = "";
String actual = Util.generateStringXTimes("abc", 0);
assertThat(actual).isEqualTo(expected);
}
@Test
void insert_string_to_1() throws Exception {
String expected = "___a___";
String actual = Util.insertStringTo("_______", "a");
assertThat(actual).isEqualTo(expected);
}
@Test
void insert_string_to_2() throws Exception {
String expected = "k";
String actual = Util.insertStringTo("_", "k");
assertThat(actual).isEqualTo(expected);
}
}
| [
"[email protected]"
]
| |
ed417e14f9f39dc5e7beef73ba5500d500145ce4 | ce44e9fec5f4ee3eff79c3e6fbb0064fbb94753d | /main/feature/test/boofcv/alg/feature/detect/extract/TestNonMaxCandidateRelaxed.java | 7e3b25c0d10ece9c747af2a7c815b7f1e692a5aa | [
"Apache-2.0"
]
| permissive | wsjhnsn/BoofCV | 74fc0687e29c45df1d2fc125b28d777cd91a8158 | bdae47003090c03386b6b23e2a884bceba242241 | refs/heads/master | 2020-12-24T12:34:02.996379 | 2014-06-27T21:15:21 | 2014-06-27T21:15:21 | 21,334,100 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,479 | java | /*
* Copyright (c) 2011-2013, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* 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 boofcv.alg.feature.detect.extract;
import boofcv.struct.QueueCorner;
import boofcv.struct.image.ImageFloat32;
/**
* @author Peter Abeles
*/
public class TestNonMaxCandidateRelaxed extends GenericNonMaxCandidateTests{
public TestNonMaxCandidateRelaxed() {
super(false, true, true);
}
@Override
public void findMaximums(ImageFloat32 intensity, float threshold, int radius, int border,
QueueCorner candidatesMin, QueueCorner candidatesMax,
QueueCorner foundMinimum, QueueCorner foundMaximum)
{
NonMaxCandidateRelaxed alg = new NonMaxCandidateRelaxed();
alg.radius = radius;
alg.ignoreBorder = border;
alg.thresholdMin = -threshold;
alg.thresholdMax = threshold;
alg.process(intensity, candidatesMin, candidatesMax, foundMinimum, foundMaximum);
}
}
| [
"[email protected]"
]
| |
bd821c9e013cac4c4af8367ee0402a17b155d4a4 | dbb8f8642ca95a2e513c9afae27c7ee18b3ab7d8 | /anchor-test-image/src/main/java/org/anchoranalysis/test/image/stackwriter/SavedFiles.java | 602c19110de0bf9fa61fe352a8f689c75fc3f1ab | [
"MIT"
]
| permissive | anchoranalysis/anchor | 19c2a40954515e93da83ddfc99b0ff4a95dc2199 | b3b589e0d76f51b90589893cfc8dfbb5d7753bc9 | refs/heads/master | 2023-07-19T17:38:19.940164 | 2023-07-18T08:33:10 | 2023-07-18T08:33:10 | 240,029,306 | 3 | 0 | MIT | 2023-07-18T08:33:11 | 2020-02-12T14:12:28 | Java | UTF-8 | Java | false | false | 3,088 | java | /*-
* #%L
* anchor-test-image
* %%
* Copyright (C) 2010 - 2020 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* #L%
*/
package org.anchoranalysis.test.image.stackwriter;
import java.nio.file.Path;
import java.util.Optional;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.anchoranalysis.test.TestLoader;
import org.anchoranalysis.test.image.DualComparer;
import org.anchoranalysis.test.image.DualComparerFactory;
/**
* Access previously saved-files in resources.
*
* <p>Different sets of saved-files exist, indexed by their file {@code extension}.
*
* @author Owen Feehan
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class SavedFiles {
private static final String SAVED_FILES_IN_RESOURCES_DIRECTORY = "stackWriter/formats/";
/**
* Creates a comparer between a directory and saved-files in a directory in the resources.
*
* @param directory the directory (forms the first element to compare).
* @param extension a file-extension to identify a set of saved-files (forms the second element
* to compare).
* @return a newly created comparer.
*/
public static DualComparer createComparer(Path directory, String extension) {
return DualComparerFactory.compareTemporaryDirectoryToTest(
directory, Optional.empty(), relativeResourcesDirectory(extension));
}
/**
* Creates a loader for reading from a particular set of saved-files in a directory in the
* resources.
*
* @param extension a file-extension to identify a set of saved-files (forms the second element
* to compare).
* @return a newly created loader
*/
public static TestLoader createLoader(String extension) {
return TestLoader.createFromMavenWorkingDirectory(relativeResourcesDirectory(extension));
}
private static String relativeResourcesDirectory(String extension) {
return SAVED_FILES_IN_RESOURCES_DIRECTORY + extension;
}
}
| [
"[email protected]"
]
| |
32e727293188d740262943927fc9ec739d353187 | 29170aefc4c7a1c3c89fca93d0bd7574016022bd | /java-solution/src/com/amazon/SuperUglyNumber313M.java | 8b866ba7e34e9017b1d532b97c96d45fa9a618a2 | []
| no_license | MaggieFang/LeetCodePractiseAndSummary | 1eb2a751e4cb892262f0740598996ae833c5cd16 | 8b497aaa6d4cd72e582a58bac85277c824a1dbdf | refs/heads/master | 2021-06-30T07:38:06.101241 | 2019-11-14T03:45:28 | 2019-11-14T03:45:28 | 168,401,490 | 5 | 4 | null | 2020-10-01T00:08:14 | 2019-01-30T19:26:25 | Java | UTF-8 | Java | false | false | 1,036 | java | package com.amazon;
import java.util.TreeSet;
/**
* Author by Maggie Fang. Email [email protected]. Date on 2019-05-09
* Talk is cheap,show me the Code.
**/
public class SuperUglyNumber313M {
/**
* Clarification:
* * same as UglyNumberII264M
* </p>
* Keypoints:
* TreeSet. put 1 into it firstly, and pollFirst out. and use this min poll value multiply all the primes, and push to the treeset.
* after n-1 times pollFirst. the next pollFirst is what we want.
*
* we should use treeset instead of pq, since pq will have the problem of duplicate number in the queue.
* </p>
* TIME COMPLEXITY:
* SPACE COMPLEXITY:
* </p>
**/
public int nthSuperUglyNumber(int n, int[] primes) {
TreeSet<Long> set = new TreeSet<>();
set.add(1L);
for (int i = 1; i < n; i++) {
long e = set.pollFirst();
for (int p : primes) {
set.add(e * p);
}
}
return set.first().intValue();
}
}
| [
"[email protected]"
]
| |
31183618cf860677dd28004c4d99aa92e896b308 | e596722316bf0b2db80a5711c311e318752a6276 | /termend-manager/termend-manager-pojo/src/main/java/com/termend/pojo/OrderItemExample.java | 025688719adf603c04bb9cc88ce8fb8b3a3bc7b9 | []
| no_license | xiaohui-cpu/UploadMaven | 0fbcf614626fda0ec9468558e1a51048c68a25a7 | 61e274d8b9e1b5da375cfd613fc50c3330a67890 | refs/heads/master | 2022-12-21T15:02:15.892167 | 2019-12-24T06:57:41 | 2019-12-24T06:57:41 | 228,996,105 | 2 | 0 | null | 2022-12-16T07:18:16 | 2019-12-19T07:07:55 | JavaScript | UTF-8 | Java | false | false | 24,043 | java | package com.termend.pojo;
import java.util.ArrayList;
import java.util.List;
public class OrderItemExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OrderItemExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andOrderItemIsNull() {
addCriterion("order_item is null");
return (Criteria) this;
}
public Criteria andOrderItemIsNotNull() {
addCriterion("order_item is not null");
return (Criteria) this;
}
public Criteria andOrderItemEqualTo(Integer value) {
addCriterion("order_item =", value, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemNotEqualTo(Integer value) {
addCriterion("order_item <>", value, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemGreaterThan(Integer value) {
addCriterion("order_item >", value, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemGreaterThanOrEqualTo(Integer value) {
addCriterion("order_item >=", value, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemLessThan(Integer value) {
addCriterion("order_item <", value, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemLessThanOrEqualTo(Integer value) {
addCriterion("order_item <=", value, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemIn(List<Integer> values) {
addCriterion("order_item in", values, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemNotIn(List<Integer> values) {
addCriterion("order_item not in", values, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemBetween(Integer value1, Integer value2) {
addCriterion("order_item between", value1, value2, "orderItem");
return (Criteria) this;
}
public Criteria andOrderItemNotBetween(Integer value1, Integer value2) {
addCriterion("order_item not between", value1, value2, "orderItem");
return (Criteria) this;
}
public Criteria andDiskIdIsNull() {
addCriterion("disk_id is null");
return (Criteria) this;
}
public Criteria andDiskIdIsNotNull() {
addCriterion("disk_id is not null");
return (Criteria) this;
}
public Criteria andDiskIdEqualTo(Integer value) {
addCriterion("disk_id =", value, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdNotEqualTo(Integer value) {
addCriterion("disk_id <>", value, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdGreaterThan(Integer value) {
addCriterion("disk_id >", value, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdGreaterThanOrEqualTo(Integer value) {
addCriterion("disk_id >=", value, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdLessThan(Integer value) {
addCriterion("disk_id <", value, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdLessThanOrEqualTo(Integer value) {
addCriterion("disk_id <=", value, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdIn(List<Integer> values) {
addCriterion("disk_id in", values, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdNotIn(List<Integer> values) {
addCriterion("disk_id not in", values, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdBetween(Integer value1, Integer value2) {
addCriterion("disk_id between", value1, value2, "diskId");
return (Criteria) this;
}
public Criteria andDiskIdNotBetween(Integer value1, Integer value2) {
addCriterion("disk_id not between", value1, value2, "diskId");
return (Criteria) this;
}
public Criteria andOrderIdIsNull() {
addCriterion("order_id is null");
return (Criteria) this;
}
public Criteria andOrderIdIsNotNull() {
addCriterion("order_id is not null");
return (Criteria) this;
}
public Criteria andOrderIdEqualTo(String value) {
addCriterion("order_id =", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotEqualTo(String value) {
addCriterion("order_id <>", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThan(String value) {
addCriterion("order_id >", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThanOrEqualTo(String value) {
addCriterion("order_id >=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThan(String value) {
addCriterion("order_id <", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThanOrEqualTo(String value) {
addCriterion("order_id <=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLike(String value) {
addCriterion("order_id like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotLike(String value) {
addCriterion("order_id not like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdIn(List<String> values) {
addCriterion("order_id in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotIn(List<String> values) {
addCriterion("order_id not in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdBetween(String value1, String value2) {
addCriterion("order_id between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotBetween(String value1, String value2) {
addCriterion("order_id not between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andNumIsNull() {
addCriterion("num is null");
return (Criteria) this;
}
public Criteria andNumIsNotNull() {
addCriterion("num is not null");
return (Criteria) this;
}
public Criteria andNumEqualTo(Integer value) {
addCriterion("num =", value, "num");
return (Criteria) this;
}
public Criteria andNumNotEqualTo(Integer value) {
addCriterion("num <>", value, "num");
return (Criteria) this;
}
public Criteria andNumGreaterThan(Integer value) {
addCriterion("num >", value, "num");
return (Criteria) this;
}
public Criteria andNumGreaterThanOrEqualTo(Integer value) {
addCriterion("num >=", value, "num");
return (Criteria) this;
}
public Criteria andNumLessThan(Integer value) {
addCriterion("num <", value, "num");
return (Criteria) this;
}
public Criteria andNumLessThanOrEqualTo(Integer value) {
addCriterion("num <=", value, "num");
return (Criteria) this;
}
public Criteria andNumIn(List<Integer> values) {
addCriterion("num in", values, "num");
return (Criteria) this;
}
public Criteria andNumNotIn(List<Integer> values) {
addCriterion("num not in", values, "num");
return (Criteria) this;
}
public Criteria andNumBetween(Integer value1, Integer value2) {
addCriterion("num between", value1, value2, "num");
return (Criteria) this;
}
public Criteria andNumNotBetween(Integer value1, Integer value2) {
addCriterion("num not between", value1, value2, "num");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andPriceIsNull() {
addCriterion("price is null");
return (Criteria) this;
}
public Criteria andPriceIsNotNull() {
addCriterion("price is not null");
return (Criteria) this;
}
public Criteria andPriceEqualTo(Float value) {
addCriterion("price =", value, "price");
return (Criteria) this;
}
public Criteria andPriceNotEqualTo(Float value) {
addCriterion("price <>", value, "price");
return (Criteria) this;
}
public Criteria andPriceGreaterThan(Float value) {
addCriterion("price >", value, "price");
return (Criteria) this;
}
public Criteria andPriceGreaterThanOrEqualTo(Float value) {
addCriterion("price >=", value, "price");
return (Criteria) this;
}
public Criteria andPriceLessThan(Float value) {
addCriterion("price <", value, "price");
return (Criteria) this;
}
public Criteria andPriceLessThanOrEqualTo(Float value) {
addCriterion("price <=", value, "price");
return (Criteria) this;
}
public Criteria andPriceIn(List<Float> values) {
addCriterion("price in", values, "price");
return (Criteria) this;
}
public Criteria andPriceNotIn(List<Float> values) {
addCriterion("price not in", values, "price");
return (Criteria) this;
}
public Criteria andPriceBetween(Float value1, Float value2) {
addCriterion("price between", value1, value2, "price");
return (Criteria) this;
}
public Criteria andPriceNotBetween(Float value1, Float value2) {
addCriterion("price not between", value1, value2, "price");
return (Criteria) this;
}
public Criteria andDisPriceIsNull() {
addCriterion("dis_price is null");
return (Criteria) this;
}
public Criteria andDisPriceIsNotNull() {
addCriterion("dis_price is not null");
return (Criteria) this;
}
public Criteria andDisPriceEqualTo(Float value) {
addCriterion("dis_price =", value, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceNotEqualTo(Float value) {
addCriterion("dis_price <>", value, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceGreaterThan(Float value) {
addCriterion("dis_price >", value, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceGreaterThanOrEqualTo(Float value) {
addCriterion("dis_price >=", value, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceLessThan(Float value) {
addCriterion("dis_price <", value, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceLessThanOrEqualTo(Float value) {
addCriterion("dis_price <=", value, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceIn(List<Float> values) {
addCriterion("dis_price in", values, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceNotIn(List<Float> values) {
addCriterion("dis_price not in", values, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceBetween(Float value1, Float value2) {
addCriterion("dis_price between", value1, value2, "disPrice");
return (Criteria) this;
}
public Criteria andDisPriceNotBetween(Float value1, Float value2) {
addCriterion("dis_price not between", value1, value2, "disPrice");
return (Criteria) this;
}
public Criteria andTotalPriceIsNull() {
addCriterion("total_price is null");
return (Criteria) this;
}
public Criteria andTotalPriceIsNotNull() {
addCriterion("total_price is not null");
return (Criteria) this;
}
public Criteria andTotalPriceEqualTo(Float value) {
addCriterion("total_price =", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceNotEqualTo(Float value) {
addCriterion("total_price <>", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceGreaterThan(Float value) {
addCriterion("total_price >", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceGreaterThanOrEqualTo(Float value) {
addCriterion("total_price >=", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceLessThan(Float value) {
addCriterion("total_price <", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceLessThanOrEqualTo(Float value) {
addCriterion("total_price <=", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceIn(List<Float> values) {
addCriterion("total_price in", values, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceNotIn(List<Float> values) {
addCriterion("total_price not in", values, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceBetween(Float value1, Float value2) {
addCriterion("total_price between", value1, value2, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceNotBetween(Float value1, Float value2) {
addCriterion("total_price not between", value1, value2, "totalPrice");
return (Criteria) this;
}
public Criteria andImgIsNull() {
addCriterion("img is null");
return (Criteria) this;
}
public Criteria andImgIsNotNull() {
addCriterion("img is not null");
return (Criteria) this;
}
public Criteria andImgEqualTo(String value) {
addCriterion("img =", value, "img");
return (Criteria) this;
}
public Criteria andImgNotEqualTo(String value) {
addCriterion("img <>", value, "img");
return (Criteria) this;
}
public Criteria andImgGreaterThan(String value) {
addCriterion("img >", value, "img");
return (Criteria) this;
}
public Criteria andImgGreaterThanOrEqualTo(String value) {
addCriterion("img >=", value, "img");
return (Criteria) this;
}
public Criteria andImgLessThan(String value) {
addCriterion("img <", value, "img");
return (Criteria) this;
}
public Criteria andImgLessThanOrEqualTo(String value) {
addCriterion("img <=", value, "img");
return (Criteria) this;
}
public Criteria andImgLike(String value) {
addCriterion("img like", value, "img");
return (Criteria) this;
}
public Criteria andImgNotLike(String value) {
addCriterion("img not like", value, "img");
return (Criteria) this;
}
public Criteria andImgIn(List<String> values) {
addCriterion("img in", values, "img");
return (Criteria) this;
}
public Criteria andImgNotIn(List<String> values) {
addCriterion("img not in", values, "img");
return (Criteria) this;
}
public Criteria andImgBetween(String value1, String value2) {
addCriterion("img between", value1, value2, "img");
return (Criteria) this;
}
public Criteria andImgNotBetween(String value1, String value2) {
addCriterion("img not between", value1, value2, "img");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
]
| |
4db89817db778571a61bbb3688319d7eee79bb12 | d65bdbd074eb948897ae2e798396624cf0494429 | /src/com/mikemyzhao/MediatorPattern/StockExample/Mediator/Stock.java | 471437b2cf973498cb65140742f8110de6b8ad9a | []
| no_license | tjzhaomengyi/DesignPattern | 9af1bdd58761193b743c3f5aa9bd3d4e9a23c6bf | 808c3edff3e3f6c1d3cee7445d3802d6d44c1f4c | refs/heads/master | 2023-05-20T15:56:55.728820 | 2021-06-11T09:18:35 | 2021-06-11T09:18:35 | 375,937,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 976 | java | package com.mikemyzhao.MediatorPattern.StockExample.Mediator;
public class Stock extends AbstractColleage{
//刚开始有100台电脑
private static int COMPUTER_NUMBER = 100;
public Stock(AbstractMediator _mediator) {
super(_mediator);
}
//库存增加
public void increase(int number){
COMPUTER_NUMBER = COMPUTER_NUMBER + number;
System.out.println("库存数量为:"+COMPUTER_NUMBER);
}
//库存减少
public void decrease(int number){
COMPUTER_NUMBER = COMPUTER_NUMBER - number;
System.out.println("库存数量为:"+COMPUTER_NUMBER);
}
//获得库存数量
public int getStockNumber(){
return COMPUTER_NUMBER;
}
//库存压力大了,就要通知采购人员不要采购,采购人员应该尽快销售
public void clearStock(){
System.out.println("清理存货数量为:"+COMPUTER_NUMBER);
super.mediator.execute("stock.clear");
}
}
| [
"[email protected]"
]
| |
23bee7f6cb55dad4889c4f8b4c83b204209049fe | d76fcb961bb9a710847bc94b7c70ac44e6c1f53c | /android/library/src/main/java/com/wink/sdk/util/StatusBarCompat.java | 74c89deeeb452f62f49314950ad802627440291a | []
| no_license | ywinker/sdk | 83f77249e630bf1beebf82dee91d7452c1b6fb92 | d82c098bed015513beb604a0b2c4a164ad32bfcc | refs/heads/master | 2020-12-05T03:38:22.980962 | 2020-01-10T08:25:52 | 2020-01-10T08:25:52 | 231,999,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,543 | java | package com.wink.sdk.util;
import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import java.lang.ref.WeakReference;
import java.util.Objects;
/**
* 类名称
* 内容摘要:
* 修改备注:
* 创建时间: 2019/12/20
* 公司: winker
* 作者: yingzy
*/
public class StatusBarCompat {
public static void setStatusBarColorByActivity(Activity activity, boolean isBlack) {
WeakReference<Activity> activityWeakReference = new WeakReference<>(activity);
activityWeakReference.get().getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activityWeakReference.get().getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && isBlack){
activityWeakReference.get().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
public static void setStatusBarColorByDialog(AlertDialog dialog, boolean isBlack) {
Objects.requireNonNull(dialog.getWindow()).addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = dialog.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && isBlack){
dialog.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
}
| [
"[email protected]"
]
| |
a698571fbbe6857e21b5026b9c0d93e76fa48e02 | 25b975b7ead14be1b3c1a022c213a96bdde8b570 | /src/main/java/group/guangdong/controller/AdminController.java | 8d7ea1b29a89e3e053570d2dfd0f65aa272e8a3e | []
| no_license | jiawei1063442492/gitTest | f42211f131796d20d147ba9c5bf02cdadf54aa51 | e428d24570153c505cf9e5f87bf93ea4d4cff6de | refs/heads/master | 2022-11-18T20:01:23.106428 | 2020-07-20T09:09:06 | 2020-07-20T09:09:06 | 281,036,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,093 | java | package group.guangdong.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.RestController;
import group.guangdong.pojo.User;
import group.guangdong.service.UserService;
@RestController
@Controller
@RequestMapping("/admin")
public class AdminController {
@Autowired
private UserService userservice;
@RequestMapping(value = "/selectall", method = RequestMethod.GET)
public List<User> findAllUsers() {
return userservice.findAll();
}
@RequestMapping(value = "/selectone/{id}", method = RequestMethod.GET)
public List<Map> selectone(@PathVariable Integer id) {
User user = userservice.findUserById(id);
if (user != null) {
Map<String, String> map1 = new HashMap<String, String>();
map1.put("status", "OK");
ArrayList<Map> list = new ArrayList<Map>();
Map<String, User> map = new HashMap<String, User>();
map.put("user", user);
list.add(map1);
list.add(map);
return list;
} else {
Map<String, String> map = new HashMap<String, String>();
map.put("status", "ERROR");
ArrayList<Map> list = new ArrayList<Map>();
list.add(map);
return list;
}
}
@RequestMapping(value = "/register", method = RequestMethod.GET)
public Map<String, String> register() {
User user = new User();
user.setUserId(111);
user.setPassword("1234");
user.setUsername("啊啊啊啊啊");
user.setAuthority(0);
User existUser = userservice.findUserById(user.getUserId());
if (existUser == null) {
int flag = userservice.addUser(user);
if (flag == 1) {
Map<String, String> map = new HashMap<String, String>();
map.put("msg", "添加成功");
return map;
} else {
Map<String, String> map = new HashMap<String, String>();
map.put("msg", "添加失败");
return map;
}
} else {
Map<String, String> map = new HashMap<String, String>();
map.put("msg", "用户已存在");
return map;
}
}
@RequestMapping(value = "/update", method = RequestMethod.GET)
public Map<String, String> update(User user) {
user.setUserId(106);
user.setPassword("777");
user.setUsername("l吕");
user.setAuthority(0);
int flag = userservice.updateUser(user);
System.out.println(flag);
if (flag == 1) {
Map<String, String> map = new HashMap<String, String>();
map.put("msg", "更新成功");
return map;
} else {
Map<String, String> map = new HashMap<String, String>();
map.put("msg", "更新失败");
return map;
}
}
@RequestMapping(value = "/deleteany", method = RequestMethod.GET)
public Map<String, Integer> deleteany() {
String ids = "456,111";
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("msg", userservice.deleteUsers(ids));
return map;
}
}
| [
"[email protected]"
]
| |
6dd5c2af38f149b20665f25df9a565e776e0707e | db4863f359b54555a4567bb84037bd820ae346b9 | /src/Actions/Main_sensitivity.java | c30eb79e87cdd4a7a5d30c2f4e0e6d560deaaed6 | []
| no_license | liweizhuo001/GMap | d886839e41e8d6c3ffdfe853847de28d34e55dba | 22e7a724d88f8f2918880df25ed288a2eb2fb182 | refs/heads/master | 2020-04-23T20:21:18.219847 | 2018-04-02T02:26:07 | 2018-04-02T02:26:07 | 37,916,026 | 5 | 0 | null | null | null | null | GB18030 | Java | false | false | 84,904 | java | package Actions;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import SPNs.SPNProcessing;
import Tools.HeuristicRule_Tools;
import Tools.OAEIAlignmentOutput;
import Tools.Pellet_tools;
import Tools.Refine_Tools;
import Tools.Sim_Tools;
import Tools.TreeMap_Tools;
public class Main_sensitivity {
static Sim_Tools tool=new Sim_Tools();
static BufferedWriter bfw_Result= null;
static double a=0.6;
static double contribution=0.3;
static double threshold=0.9;
static double average_f_measure=0;
//static BufferedWriter bfw_middle= null;
public static void main(String args[]) throws Exception
{
String resultPath="Results/1.txt";
//String resultPath2="Results/middle_Result.txt";
try
{
bfw_Result=new BufferedWriter(new FileWriter(resultPath));
//bfw_middle=new BufferedWriter(new FileWriter(resultPath2));
}
catch(IOException e)
{
e.printStackTrace();
}
tool.initialPOS();
String dictionary1="anatomy";
String Read_path1="dic/"+dictionary1+".txt";
BufferedReader Result1 = new BufferedReader(new FileReader(new File(Read_path1)));
ArrayList<String> dic1= new ArrayList<String>();
String lineTxt = null;
while ((lineTxt = Result1.readLine()) != null) {
String line = lineTxt.trim(); // 去掉字符串首位的空格,避免其空格造成的错误
//line=line.toLowerCase();//全部变成小写
dic1.add(line);
}
HashMap<String, String> anatomy=transformToHashMap(dic1);
long tic1 = 0 ;
long toc1= 0;
long tic = 0 ;
long toc= 0;
tic1=System.currentTimeMillis();
/* String []Ontology1={"101","103","104","201","201-2","201-4","201-6","201-8","202","202-2","202-4","202-6","202-8",
"221","222","223","224","225","228","232","233","236","237","238","239","240","241","246",
"247","248","248-2","248-4","248-6","248-8","249","249-2","249-4","249-6","249-8","250","250-2",
"250-4","250-6","250-8","251","251-2","251-4","251-6","251-8","252","252-2","252-4","252-6",
"252-8","253","253-2","253-4","253-6","253-8","254","254-2","254-4","254-6","254-8","257",
"257-2","257-4","257-6","257-8","258","258-2","258-4","258-6","258-8","259","259-2","259-4",
"259-6","259-8","260","260-2","260-4","260-6","260-8","261","261-2","261-4","261-6","261-8",
"262","262-2","262-4","262-6","262-8","265", "266","301","302","303","304"}; */
/* String []Ontology1={"101","201","201-2","201-4","201-6","201-8","202","202-2","202-4","202-6","202-8",
"221","222","223","224","225","228","232","233","236","237","238","239","240","241","246",
"247","248","248-2","248-4","248-6","248-8","249","249-2","249-4","249-6","249-8","250","250-2",
"250-4","250-6","250-8","251","251-2","251-4","251-6","251-8","252","252-2","252-4","252-6",
"252-8","253","253-2","253-4","253-6","253-8","254","254-2","254-4","254-6","254-8","257",
"257-2","257-4","257-6","257-8","258","258-2","258-4","258-6","258-8","259","259-2","259-4",
"259-6","259-8","260","260-2","260-4","260-6","260-8","261","261-2","261-4","261-6","261-8",
"262","262-2","262-4","262-6","262-8","265", "266"};
String []Ontology2={"101"};
for (int x=0;x<Ontology1.length;x++)
{
String ontologyName1 = Ontology1[x]+"onto";
for(int y=0;y<Ontology2.length;y++)
{
String ontologyName2 = Ontology2[y]+"onto";
String ontologyName1="261-2onto";
String ontologyName2="101onto";
String readPath1="Datasets/benchmarks/"+ontologyName1+".rdf";
String readPath2="Datasets/benchmarks/"+ontologyName2+".rdf";
String classAlignmentPath="Results/Benchmark_alignments/"+ontologyName1+"-"+ontologyName2+"_class.txt";
String propertyAlignmentPath="Results/Benchmark_alignments/"+ontologyName1+"-"+ontologyName2+"_property.txt";*/
/* String []Ontology1={"cmt","Conference","confOf","edas","ekaw","iasted","sigkdd"};
String []Ontology2={"cmt","Conference","confOf","edas","ekaw","iasted","sigkdd"};
for (int x=0;x<Ontology1.length;x++)
{
String ontologyName1 = Ontology1[x];
for(int y=x+1;y<Ontology2.length;y++)
{
String ontologyName2 = Ontology1[y];
String ontologyName1="cmt";
String ontologyName2="Conference";
String readPath1="Datasets/conference_ontologys/"+ontologyName1+".owl";
String readPath2="Datasets/conference_ontologys/"+ontologyName2+".owl";
String classAlignmentPath="Results/Conference_alignments/"+ontologyName1+"-"+ontologyName2+"_class.txt";
String propertyAlignmentPath="Results/Conference_alignments/"+ontologyName1+"-"+ontologyName2+"_property.txt";*/
String []Ontology={"animals","hotel","network","people+pets","russia"};
//String []Ontology={"pefople+pets"};
for (int x=0;x<Ontology.length;x++)
{
String ontologyName1 = Ontology[x]+"A";
String ontologyName2 = Ontology[x]+"B";
/*String ontologyName1="people+petsA";
String ontologyName2="people+petsB";*/
String readPath1="Datasets/I3CON_ontologys/"+ontologyName1+".owl";
String readPath2="Datasets/I3CON_ontologys/"+ontologyName2+".owl";
String classAlignmentPath="Results/I3CON_alignments/"+ontologyName1+"B"+"_class.txt";
String propertyAlignmentPath="Results/I3CON_alignments/"+ontologyName1+"B"+"_property.txt";
tic = System.currentTimeMillis();
/* String ontologyName1="mouse";
String ontologyName2="human";
String readPath1="Datasets/anatomy/"+ontologyName1+".owl";
String readPath2="Datasets/anatomy/"+ontologyName2+".owl";
String classAlignmentPath="Results/Anatomy_alignments/"+ontologyName1+"-"+ontologyName2+"_class.txt";
String propertyAlignmentPath="Results/Anatomy_alignments/"+ontologyName1+"-"+ontologyName2+"_property.txt";*/
Pellet_tools onto1=new Pellet_tools();
Pellet_tools onto2=new Pellet_tools();
//Loading
onto1.readOnto(readPath1);
onto2.readOnto(readPath2);
TreeMap_Tools resultClassMap=new TreeMap_Tools(classAlignmentPath);
TreeMap_Tools resultPropertyMap=new TreeMap_Tools(propertyAlignmentPath);
/**
* acquire ontology information
*/
ArrayList<String> classes1=onto1.GetAllConcept();
ArrayList<String> classlabel1=onto1.GetAllConceptLabel();
ArrayList<String> objectProperties1=onto1.GetObjectProperty();
ArrayList<String> objectPropertieslabel1=onto1.GetObjectPropertyLabel();
ArrayList<String> dataProperties1=onto1.GetDataProperty();
ArrayList<String> dataPropertieslabel1=onto1.GetDataPropertyLabel();
ArrayList<String> propertiesInverse1=onto1.GetPropertyAndInverse();//其实只有objectproperty有这个性质
ArrayList<String> objectRelations1=onto1.New_GetObjectRelations();
//ArrayList<String> objectRelations1=onto1.GetObjectRelations();
ArrayList<String> dataRelations1=onto1.GetDataPropertyRelations();
ArrayList<String> instances1=filterCommand(onto1.GetConcept_Instances());
ArrayList<String> subclasses1=filterCommand(onto1.GetSubclass());
ArrayList<String> superclasses1=filterCommand(onto1.GetSuperclass());
ArrayList<String> subclassesDirect1=filterCommand(onto1.GetSubclass_Direct());
ArrayList<String> siblings1=filterCommand(onto1.GetSibling(subclassesDirect1));
ArrayList<String> disjoint1=filterCommand(onto1.GetDisjointwith());
ArrayList<String> EquivalentClass1=onto1.GetEquivalentClass();
ArrayList<String> EquivalentProperty1=onto1.GetEquivalentProperty();
ArrayList<String> Restrictions1=onto1.GetSomeRestrictions();
/*subclasses1=onto1.enhancedSubClasses(subclasses1,EquivalentClass1);
superclasses1=onto1.enhancedSuperClasses(superclasses1,EquivalentClass1);
disjoint1=onto1.enhancedClassesDisjoint(disjoint1,subclasses1,EquivalentClass1);*/
objectRelations1=onto1.enhancedRelation(objectRelations1,EquivalentClass1);
System.out.println("**********");
objectRelations1=onto1.enhancedRelation(objectRelations1,Restrictions1);
ArrayList<String> classes2=onto2.GetAllConcept();
ArrayList<String> classlabel2=onto2.GetAllConceptLabel();
ArrayList<String> objectProperties2=onto2.GetObjectProperty();
ArrayList<String> objectPropertieslabel2=onto2.GetObjectPropertyLabel();
ArrayList<String> dataProperties2=onto2.GetDataProperty();
ArrayList<String> dataPropertieslabel2=onto2.GetDataPropertyLabel();
ArrayList<String> propertiesInverse2=onto2.GetPropertyAndInverse();//其实只有objectproperty有这个性质
ArrayList<String> objectRelations2=onto2.New_GetObjectRelations();
//ArrayList<String> objectRelations2=onto2.GetObjectRelations();
ArrayList<String> dataRelations2=onto2.GetDataPropertyRelations();
ArrayList<String> instances2=filterCommand(onto2.GetConcept_Instances());
ArrayList<String> subclasses2=filterCommand(onto2.GetSubclass());
ArrayList<String> superclasses2=filterCommand(onto2.GetSuperclass());
ArrayList<String> subclassesDirect2=filterCommand(onto2.GetSubclass_Direct());
ArrayList<String> siblings2=filterCommand(onto2.GetSibling(subclassesDirect2));
ArrayList<String> disjoint2=filterCommand(onto2.GetDisjointwith());
ArrayList<String> EquivalentClass2=onto2.GetEquivalentClass();
ArrayList<String> EquivalentProperty2=onto2.GetEquivalentProperty();
ArrayList<String> Restrictions2=onto2.GetSomeRestrictions();
/*subclasses2=onto2.enhancedSubClasses(subclasses2,EquivalentClass2);
superclasses2=onto2.enhancedSuperClasses(superclasses2,EquivalentClass2);
disjoint2=onto2.enhancedClassesDisjoint(disjoint2,subclasses2,EquivalentClass2);*/
objectRelations2=onto2.enhancedRelation(objectRelations2,EquivalentClass2);
System.out.println("**********");
objectRelations2=onto2.enhancedRelation(objectRelations2,Restrictions2);
/**
* calculate the similarities by ontology information
*/
/**
* Instances
*/
toc = System.currentTimeMillis();
System.out.println(toc-tic);
//父子中只有一个儿子且不为空的情况,可能导致相似度是一样的(仍需改进空间)
tic = System.currentTimeMillis();
System.out.println(toc-tic);
ArrayList<String> InstanceSim=tool.instancesSim2(classes1,classes2,instances1, instances2);
System.out.println("*************************************");
System.out.println(InstanceSim.size());
toc = System.currentTimeMillis();
System.out.println(toc-tic);
/**
* concepts
*/
//类只是一个编号,而真正的名字是label
/*toc = System.currentTimeMillis();
System.out.println(toc-tic);*/
ArrayList<String> editSimClass=new ArrayList<String>();
ArrayList<String> newEditSimClass=tool.initialClass(classes1, classes2);
// newEditSimClass=tool.ClassDisjoint(, );
ArrayList<String> semanticSimClass=new ArrayList<String>();
ArrayList<String> newSemanticSimClass=tool.initialClass(classes1, classes2);
ArrayList<String> tfidfSim=new ArrayList<String>();
TreeMap_Tools partOf1=new TreeMap_Tools();
TreeMap_Tools partOf2=new TreeMap_Tools();
TreeMap_Tools hasPart1=new TreeMap_Tools();
TreeMap_Tools hasPart2=new TreeMap_Tools();
HashMap<String,String> classLabels1=new HashMap<String,String>();
HashMap<String,String> classLabels2=new HashMap<String,String>();
System.out.println(InstanceSim.get(0));
boolean labelflag=classes1.size()==classlabel1.size()&&classes2.size()==classlabel2.size();//只有在医学本体中才会出现
if(labelflag==true)
{
classLabels1=tool.transformToHashMap(classlabel1);//存储一份对应形式
classLabels2=tool.transformToHashMap(classlabel2);//存储一份对应形式
classlabel1=tool.keepLabel(classlabel1);
classlabel2=tool.keepLabel(classlabel2);
tic = System.currentTimeMillis();
editSimClass=tool.editSimClass(classlabel1, classlabel2);
System.out.println("*************************************");
System.out.println(editSimClass.size());
toc = System.currentTimeMillis();
System.out.println("编辑距离相似度计算消耗的时间为:"+(toc-tic));
//bfw_Result.append("编辑距离相似度计算消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
tic = System.currentTimeMillis();
//semanticSimClass=tool.semanticSimClass(classlabel1, classlabel2);//这里也词典就利用上面的判断条件引入
semanticSimClass=tool.NewsemanticSimClass4(classlabel1, classlabel2);//这里也词典就利用上面的判断条件引入
System.out.println("*************************************");
System.out.println(semanticSimClass.size());
toc = System.currentTimeMillis();
System.out.println("语义相似度计算消耗的时间为:"+(toc-tic));
//bfw_Result.append("语义相似度计算消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
classlabel1=Normalize(classlabel1,anatomy);
classlabel2=Normalize(classlabel2,anatomy);
tic = System.currentTimeMillis();
newEditSimClass=tool.editSimClass(classlabel1, classlabel2);
System.out.println("*************************************");
System.out.println(editSimClass.size());
toc = System.currentTimeMillis();
System.out.println("编辑距离相似度计算消耗的时间为:"+(toc-tic));
//bfw_Result.append("编辑距离相似度计算消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
//这里要将class--label进行一步处理,只保留label
tic = System.currentTimeMillis();
//semanticSimClass=tool.semanticSimClass(classlabel1, classlabel2);//这里也词典就利用上面的判断条件引入
newSemanticSimClass=tool.NewsemanticSimClass4(classlabel1, classlabel2);//这里也词典就利用上面的判断条件引入
System.out.println("*************************************");
System.out.println(semanticSimClass.size());
toc = System.currentTimeMillis();
System.out.println("语义相似度计算消耗的时间为:"+(toc-tic));
//bfw_Result.append("语义相似度计算消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
tic = System.currentTimeMillis();
tfidfSim=tool.tfidfSim(classlabel1, classlabel2);
System.out.println("*************************************");
System.out.println(tfidfSim.size());
toc = System.currentTimeMillis();
System.out.println("TFIDF相似度计算消耗的时间为:"+(toc-tic));
//bfw_Result.append("TFIDF相似度计算消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
/*objectRelations1=onto1.transformToRelation(objectRelations1,Restrictions1,subclasses1);
objectRelations2=onto2.transformToRelation(objectRelations2,Restrictions2,subclasses2);*/
partOf1=onto1.transformToPartOf(Restrictions1,subclassesDirect1);
partOf2=onto2.transformToPartOf(Restrictions2,subclassesDirect2);
hasPart1=onto1.transformToHaspart(Restrictions1,subclassesDirect1);
hasPart2=onto2.transformToHaspart(Restrictions2,subclassesDirect2);
/*partOf1=onto1.transformToPartOf(Restrictions1,subclasses1);
partOf2=onto2.transformToPartOf(Restrictions2,subclasses2);
hasPart1=onto1.transformToHaspart(Restrictions1,subclasses1);
hasPart2=onto2.transformToHaspart(Restrictions2,subclasses2);*/
}
else
{
classlabel1=tool.briefLabel(classlabel1);
classlabel2=tool.briefLabel(classlabel2);
tic = System.currentTimeMillis();
editSimClass=tool.editSimClassWithLabel(classes1, classes2,classlabel1,classlabel2);
//editSimClass=tool.editSimClass(classlabel1,classlabel2);
System.out.println("*************************************");
System.out.println(editSimClass.size());
toc = System.currentTimeMillis();
System.out.println(toc-tic);
//从时间开销来考虑的话,下面2者的计算,只能用label替换来计算
classlabel1=tool.replaceLabel(classes1,classlabel1);
classlabel2=tool.replaceLabel(classes2,classlabel2);
tic = System.currentTimeMillis();
semanticSimClass=tool.semanticSimClass(classlabel1,classlabel2);//这里也词典就利用上面的判断条件引入
System.out.println("*************************************");
System.out.println(semanticSimClass.size());
toc = System.currentTimeMillis();
System.out.println(toc-tic);
tic = System.currentTimeMillis();
tfidfSim=tool.tfidfSim(classlabel1,classlabel2);
System.out.println("*************************************");
System.out.println(tfidfSim.size());
toc = System.currentTimeMillis();
System.out.println(toc-tic);
}
/**
* ObjectProperties
*/
ArrayList<String> editSimObjectProperty=new ArrayList<String>();
ArrayList<String> SemanticSimObjectProperty=new ArrayList<String>();
boolean objectproperty_lableflag=false;
objectproperty_lableflag=objectProperties1.size()==objectPropertieslabel1.size()&&objectProperties2.size()==objectPropertieslabel2.size();//只有在医学本体中才会出现
ArrayList<String> objectPropertyPair=new ArrayList<String>();
for(int i=0;i<objectProperties1.size();i++)
{
String objectproperty1=objectProperties1.get(i);
for(int j=0;j<objectProperties2.size();j++)
{
String objectproperty2=objectProperties2.get(j);
objectPropertyPair.add(objectproperty1+","+objectproperty2);
}
}
if(objectproperty_lableflag==true)
{
//只用label来进行计算,一般这种情况只出现在医学本体中
objectPropertieslabel1=tool.keepLabel(objectPropertieslabel1);
objectPropertieslabel2=tool.keepLabel(objectPropertieslabel2);
editSimObjectProperty=tool.editSimProperty(objectPropertieslabel1, objectPropertieslabel2);
System.out.println("*************************************");
System.out.println(editSimObjectProperty.size());
SemanticSimObjectProperty=tool.semanticSimProperty(objectPropertieslabel1, objectPropertieslabel2);
System.out.println("*************************************");
System.out.println(SemanticSimObjectProperty.size());
}
else
{
//editSimClass=tool.editSimClassWithLabel(classes1, classes2,classlabel1,classlabel2);
//将label替换来计算编辑距离(分开算代价太高)
objectPropertieslabel1=tool.briefLabel(objectPropertieslabel1);
objectPropertieslabel2=tool.briefLabel(objectPropertieslabel2);
editSimObjectProperty=tool.editSimPropertyWithLabel(objectProperties1, objectProperties2,objectPropertieslabel1,objectPropertieslabel2);
System.out.println("*************************************");
System.out.println(editSimObjectProperty.size());
objectPropertieslabel1=tool.replaceLabel(objectProperties1,objectPropertieslabel1);
objectPropertieslabel2=tool.replaceLabel(objectProperties2,objectPropertieslabel2);
SemanticSimObjectProperty=tool.semanticSimProperty(objectPropertieslabel1, objectPropertieslabel2);
System.out.println("*************************************");
System.out.println(SemanticSimObjectProperty.size());
}
/**
* datatypeProperties
*/
ArrayList<String> editSimDatatypeProperty=new ArrayList<String>();
ArrayList<String> SemanticSimDatatypeProperty=new ArrayList<String>();
boolean dataproperty_lableflag=false;
dataproperty_lableflag=dataProperties1.size()==dataPropertieslabel1.size()&&dataProperties2.size()==dataPropertieslabel2.size();//只有在医学本体中才会出现
ArrayList<String> dataPropertyPair=new ArrayList<String>();
for(int i=0;i<dataProperties1.size();i++)
{
String dataProperty1=dataProperties1.get(i);
for(int j=0;j<dataProperties2.size();j++)
{
String dataProperty2=dataProperties2.get(j);
dataPropertyPair.add(dataProperty1+","+dataProperty2);
}
}
if(dataproperty_lableflag==true)
{
dataPropertieslabel1=tool.keepLabel(dataPropertieslabel1);
dataPropertieslabel2=tool.keepLabel(dataPropertieslabel2);
editSimDatatypeProperty=tool.editSimProperty(dataPropertieslabel1, dataPropertieslabel2);
System.out.println("*************************************");
System.out.println(editSimDatatypeProperty.size());
SemanticSimDatatypeProperty=tool.semanticSimProperty(dataPropertieslabel1, dataPropertieslabel2);
System.out.println("*************************************");
System.out.println(SemanticSimDatatypeProperty.size());
}
else
{
//将label替换来计算编辑距离(分开算代价太高)
dataPropertieslabel1=tool.briefLabel(dataPropertieslabel1);
dataPropertieslabel2=tool.briefLabel(dataPropertieslabel2);
editSimDatatypeProperty=tool.editSimPropertyWithLabel(dataProperties1,dataProperties2,dataPropertieslabel1, dataPropertieslabel2);
System.out.println("*************************************");
System.out.println(editSimDatatypeProperty.size());
dataPropertieslabel1=tool.replaceLabel(dataProperties1,dataPropertieslabel1);
dataPropertieslabel2=tool.replaceLabel(dataProperties2,dataPropertieslabel2);
SemanticSimDatatypeProperty=tool.semanticSimProperty(dataPropertieslabel1, dataPropertieslabel2);
System.out.println("*************************************");
System.out.println(SemanticSimDatatypeProperty.size());
}
/*ArrayList<String> editSimDatatypeProperty=tool.editSimProperty(dataProperties1, dataProperties2);
System.out.println("*************************************");
System.out.println(editSimDatatypeProperty.size());
ArrayList<String> SemanticSimDatatypeProperty=tool.semanticSimProperty(dataProperties1, dataProperties2);
System.out.println("*************************************");
System.out.println(SemanticSimDatatypeProperty.size());
System.out.println();*/
//以后肯定是循环模式(而且应该是ArrayList的格式进行写入)
/**
* statistic the number of each pair that satisfys heuristic rules by ontology information
*/
/*String classAlignmentPath="Results/Benchmark_alignments/"+ontologyName1+"-"+ontologyName2+"_class.txt";
String propertyAlignmentPath="Results/Benchmark_alignments/"+ontologyName1+"-"+ontologyName2+"_property.txt";*/
/*String classAlignmentPath="Results/First_line_matcher/"+ontologyName1+"-"+ontologyName2+"_class.txt";
String propertyAlignmentPath="Results/First_line_matcher/"+ontologyName1+"-"+ontologyName2+"_property.txt";*/
ArrayList<String> classesMap=new ArrayList<String>();
ArrayList<String> propertiesMap=new ArrayList<String>();
ArrayList<String> objectPropertiesMap=new ArrayList<String>();
ArrayList<String> dataPropertiesMap=new ArrayList<String>();
ArrayList<String> oldClassesMap=new ArrayList<String>();
ArrayList<String> oldPropertiesMap=new ArrayList<String>();
ArrayList<String> hiddenClassesMap=new ArrayList<String>();
ArrayList<String> hiddenObjectPropertiesMap=new ArrayList<String>();
ArrayList<String> hiddenDataPropertiesMap=new ArrayList<String>();
Refine_Tools refineTools=new Refine_Tools();
int iteration=0;
boolean flag=false;
boolean needComplementClass=true;
boolean needComplementProperty=true;
HashMap<String, Integer[]> Assignments=new HashMap<String, Integer[]>();
SPNProcessing action=new SPNProcessing();
ArrayList<String> fathers=new ArrayList<String>();
ArrayList<String> children=new ArrayList<String>();
ArrayList<String> siblings=new ArrayList<String>();
ArrayList<String> hasPart=new ArrayList<String>();
ArrayList<String> partOf=new ArrayList<String>();
ArrayList<String> domains=new ArrayList<String>();
ArrayList<String> ranges=new ArrayList<String>();
ArrayList<String> datatype=new ArrayList<String>();
ArrayList<String> disjointSim=new ArrayList<String>();
disjointSim=tool.ClassDisjoint(classes1,classes2);//开放世界假设,将所有的匹配对初始化为'*'
ArrayList<String> classesAlignments=new ArrayList<String>();
ArrayList<String> propertyAlignments=new ArrayList<String>();
HeuristicRule_Tools ruleTools=new HeuristicRule_Tools(classesAlignments,propertyAlignments);
long iteration_tic=0;
long iteration_toc=0;
do
{
iteration_tic=System.currentTimeMillis();
//进行一轮存储赋值
oldClassesMap.clear();
oldPropertiesMap.clear();
//hiddenClassesMap.clear();
//hiddenPropertiesMap.clear();
/* for(int i=0;i<classesMap.size();i++)
{
String parts[]=classesMap.get(i).split(",");
String label1=classLabels1.get(parts[0]);
String label2=classLabels2.get(parts[1]);
System.out.println(label1+","+label2+","+parts[2]);
}*/
classesAlignments=changeToAlignments(classesMap);
propertyAlignments=changeToAlignments(propertiesMap);
for(int i=0;i<classesAlignments.size();i++)
{
oldClassesMap.add(classesAlignments.get(i));
}
for(int i=0;i<propertyAlignments.size();i++)
{
oldPropertiesMap.add(propertyAlignments.get(i));
}
ruleTools.refreshAllMaps(classesAlignments,propertyAlignments);
//HeuristicRule_Tools ruleTools=new HeuristicRule_Tools(classAlignmentPath,propertyAlignmentPath);
/**
* find candidate maps among classes
*/
// bfw_Result.append("当前迭代次数为:"+iteration+" 概念匹配个数为:"+classesAlignments.size()+" 属性匹配个数为:"+propertyAlignments.size()+"\n");
if(iteration>0)
{
tic=System.currentTimeMillis();
//fathers=ruleTools.fatherRule(classes1,classes2,superclasses1,superclasses2);
fathers=ruleTools.fatherRule2(subclasses1,subclasses2);
System.out.println("*************************************");
System.out.println(fathers.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" fatherRule计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
//bfw_Result.append("当前迭代次数为:"+iteration+" fathers的大小为:"+fathers.size()+"\n");
tic=System.currentTimeMillis();
//children=ruleTools.childrenRule(classes1,classes2,subclasses1,subclasses2);
children=ruleTools.childrenRule2(superclasses1,superclasses2);
System.out.println("*************************************");
System.out.println(children.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" childrenRule计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
//bfw_Result.append("当前迭代次数为:"+iteration+" children的大小为:"+children.size()+"\n");
tic=System.currentTimeMillis();
//siblings=ruleTools.siblingsRule(classes1,classes2,siblings1,siblings2);
siblings=ruleTools.siblingsRule2(siblings1,siblings2);
System.out.println("*************************************");
System.out.println(siblings.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" siblingsRule计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
//bfw_Result.append("当前迭代次数为:"+iteration+" siblings的大小为:"+siblings.size()+"\n");
tic=System.currentTimeMillis();
//partOf=ruleTools.partOfRule(classes1,classes2,partOf1,partOf2);
hasPart=ruleTools.hasPartRule2(hasPart1,hasPart2);
System.out.println("*************************************");
System.out.println(hasPart.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" hasPart计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
//bfw_Result.append("当前迭代次数为:"+iteration+" hasPart的大小为:"+hasPart.size()+"\n");
tic=System.currentTimeMillis();
//partOf=ruleTools.partOfRule(classes1,classes2,partOf1,partOf2);
partOf=ruleTools.partOfRule2(partOf1,partOf2);
System.out.println("*************************************");
System.out.println(partOf.size());
/*for(int t=0;t<partOf.size();t++)
{
bfw_partOf.append(partOf.get(t)+"\n");
}*/
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" partOf计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
//bfw_Result.append("当前迭代次数为:"+iteration+" partOf的大小为:"+partOf.size()+"\n");
tic=System.currentTimeMillis();
ArrayList<String> lowerCaseClasses1=changeToLowerCase(classes1);
ArrayList<String> lowerCaseClasses2=changeToLowerCase(classes2);
domains=ruleTools.domainRule(lowerCaseClasses1,lowerCaseClasses2,objectRelations1,objectRelations2);
System.out.println("*************************************");
System.out.println(domains.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" domainRule的个数大小为:"+domains.size()+"\n");
//bfw_Result.append("当前迭代次数为:"+iteration+" domainRule计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
tic=System.currentTimeMillis();
ranges=ruleTools.rangeRule(lowerCaseClasses1,lowerCaseClasses2,objectRelations1,objectRelations2);
System.out.println("*************************************");
System.out.println(ranges.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" rangeRule的个数大小为:"+ranges.size()+"\n");
//bfw_Result.append("当前迭代次数为:"+iteration+" rangeRule计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
tic=System.currentTimeMillis();
datatype=ruleTools.dataTypeRule(lowerCaseClasses1,lowerCaseClasses2,dataRelations1,dataRelations2);
System.out.println("*************************************");
System.out.println(datatype.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" dataTypeRule计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
tic=System.currentTimeMillis();
disjointSim=ruleTools.disjointRule(lowerCaseClasses1, lowerCaseClasses2, subclasses1, subclasses2, superclasses1, superclasses2, disjoint1, disjoint2);
//disjointSim=ruleTools.disjointRule(lowerCaseClasses1, lowerCaseClasses2, subclasses1, subclasses2, disjoint1, disjoint2);
System.out.println("*************************************");
System.out.println(disjointSim.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" disjointRule计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
}
//这里要将属性的规则加上,最初是没有的,因为Class与属性的Map均为空
TreeMap_Tools fatherRule=new TreeMap_Tools(fathers);
TreeMap_Tools childrenRule=new TreeMap_Tools(children);
TreeMap_Tools siblingsRule=new TreeMap_Tools(siblings);
TreeMap_Tools partOfRule=new TreeMap_Tools(partOf);
TreeMap_Tools hasPartRule=new TreeMap_Tools(hasPart);
TreeMap_Tools domainsRule=new TreeMap_Tools(domains);
TreeMap_Tools rangesRule=new TreeMap_Tools(ranges);
TreeMap_Tools datatypeRule=new TreeMap_Tools(datatype);
tic=System.currentTimeMillis();
//SPNProcessing action=new SPNProcessing();
//HashMap<String, Integer[]> Assignments=new HashMap<String, Integer[]>();//定义为全局的或者省空间
ArrayList<String> roughMap=new ArrayList<String>();
int classPairSize=InstanceSim.size();
for(int i=0;i<classPairSize;i++)
{
/**
* combine the lexical similarities of each pair
*/
double S0=0;
//i=600;
double editSimValue1=getTripleValue(editSimClass.get(i));
double editSimValue2= getTripleValue(newEditSimClass.get(i));
double editSimValue=Math.max(editSimValue1, editSimValue2);
int editSize=getEditValue(editSimClass.get(i));
double semanticSimValue1=getTripleValue(semanticSimClass.get(i));
double semanticSimValue2=getTripleValue(newSemanticSimClass.get(i));
double semanticSimValue=Math.max(semanticSimValue1, semanticSimValue2);
double tfidfSimValue=getTripleValue(tfidfSim.get(i));
String conceptPairs[]={};
if(semanticSimValue==semanticSimValue1)
conceptPairs=semanticSimClass.get(i).split(",");
else
conceptPairs=newSemanticSimClass.get(i).split(",");
/*String concept1=conceptPairs[3];
String concept2=conceptPairs[4];
int length1=tool.tokeningWord(concept1).split(" ").length;
int length2=tool.tokeningWord(concept2).split(" ").length;*/
int length1=Integer.parseInt(conceptPairs[3]);
int length2=Integer.parseInt(conceptPairs[4]);
if(length1==1&&length2==1)
S0=Math.max(editSimValue, semanticSimValue);
else if(length1==length2&&length1!=1)//组合词,长度相等的比较
S0=Math.max(editSimValue, Math.max(semanticSimValue, tfidfSimValue));
else
S0=Math.max(semanticSimValue, tfidfSimValue);
if(editSimValue==1||(editSize==1&&semanticSimValue>=0.9)) //部分切词的问题统一进行处理,还有可能出现1个词的情况
S0=1.0;
/* if(length1==1&&length2==1)//单个词的比较,主要看编辑距离与语义相似度
S0=0.7*Math.max(editSimValue, semanticSimValue);
else if(length1==length2&&length1!=1)//组合词,长度相等的比较
// S0=0.7*Math.max(semanticSimValue, tfidfSimValue);
S0=0.7*Math.max(editSimValue, Math.max(semanticSimValue, tfidfSimValue));
else if(editSimValue!=1)//长度不相等.如果有词组的比较,由于组合来切词的时候会造成一定相似度的压缩
S0=Math.min(0.8* Math.max(semanticSimValue, tfidfSimValue), 0.7);//最大也不能超出编辑距离的0.7!
//S0=0.8* Math.max(semanticSimValue, tfidfSimValue);
//S0=0.8*Math.max(editSimValue, Math.max(semanticSimValue, tfidfSimValue));
if(editSimValue==1||(editSize==1&&semanticSimValue>=1-0.0000001)) //部分切词的问题统一进行处理,还有可能出现1个词的情况
S0=Math.max(0.7000001, S0+0.0000001);*/
/**
* Use Instances similarity and Disjoint similarity to calculate the assignment of M in SPN.
*/
String pairInstanceValue[]=InstanceSim.get(i).split(",");
String pairDisjointValue[]=disjointSim.get(i).split(",");
String instance=pairInstanceValue[2];
String disjoint=pairDisjointValue[2];
Assignments.clear();
Integer assignmentM[]={1,1,1};
/*System.out.println(instance.equals("1"));
System.out.println(disjoint.equals("*"));*/
if(instance.equals("1")&&disjoint.equals("0"))
{
Integer assignmentD[]={0,1};
Integer assignmentI[]={1,0,0};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else if(instance.equals("1")&&disjoint.equals("1"))
{
Integer assignmentD[]={1,0};
Integer assignmentI[]={1,0,0};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else if(instance.equals("1")&&disjoint.equals("*"))
{
Integer assignmentD[]={1,1};
Integer assignmentI[]={1,0,0};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else if(instance.equals("0")&&disjoint.equals("0"))
{
Integer assignmentD[]={0,1};
Integer assignmentI[]={0,1,0};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else if(instance.equals("0")&&disjoint.equals("1"))
{
Integer assignmentD[]={1,0};
Integer assignmentI[]={0,1,0};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else if(instance.equals("0")&&disjoint.equals("*"))
{
Integer assignmentD[]={1,1};
Integer assignmentI[]={0,1,0};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else if(instance.equals("*")&&disjoint.equals("0"))
{
Integer assignmentD[]={0,1};
Integer assignmentI[]={0,0,1};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else if(instance.equals("*")&&disjoint.equals("1"))
{
Integer assignmentD[]={1,0};
Integer assignmentI[]={0,0,1};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
else //全部未知的情况
{
Integer assignmentD[]={1,1};
Integer assignmentI[]={0,0,1};
Assignments.put("D", assignmentD);
Assignments.put("I", assignmentI);
}
Assignments.put("M", assignmentM);
//action=new SPNProcessing();//执行怎么将初始值还原
ArrayList<String> newAssignments=action.process(Assignments);
String dAssign="",mAssign="";
if(newAssignments.size()==1)//D是已经指派了情况
{
dAssign="D"+Integer.parseInt(disjoint);
mAssign=newAssignments.get(0);
}
else//D是unknown的情况
{
dAssign=newAssignments.get(0);
mAssign=newAssignments.get(1);
}
double A=a;
//a=0.7;
if(length1!=length2&&editSimValue!=1)
A=A+0.1;
/* if(length1>length2&&editSimValue!=1)
{
double offset=((float)length1-(float)length2)*(length1-1)/Math.pow(length1, 2);
a=a*(1+offset);
}
else if(length2>length1&&editSimValue!=1)
{
double offset=((float)length2-(float)length1)*(length2-1)/Math.pow(length2, 2);
a=a*(1+offset);
}*/
//SPN的后续操作
//根据概念长度计算不同的补偿系数
/* double offset=Math.abs((float)length1-(float)length2)/Math.max(length1,length2);
offset=1+Math.pow(offset, 2);
S0=S0*offset;*/
S0=Math.min(A*S0,a);
if(dAssign.equals("D1"))
S0=0;
else if(dAssign.equals("D0")&&mAssign.equals("M1"))
{
S0=Math.min(S0+contribution, 1);
}
else if(dAssign.equals("D0")&&mAssign.equals("M2"))
S0=Math.max(S0-contribution, 0);
/* if(length1!=length2) //补偿机制
S0=S0;*/
//S0=Math.min(S0,a);
/**
* Use heuristic rules to improve the similarity in Noisy-OR model
*/
String pairName=pairInstanceValue[0]+","+pairInstanceValue[1];
double finalPositive=0;
if(S0==0) //如果满足不相交性质,则后面其实无需计算,因为相似度为0
finalPositive=0;
else
{
double N1=0;
if(satisfiedNum(fatherRule,pairName)>0)
N1=1/(1+Math.exp(-satisfiedNum(fatherRule,pairName)));//这里用sigmoid函数来限制它的上限
double N2=0;
if(satisfiedNum(childrenRule,pairName)>0)
N2=1/(1+Math.exp(-satisfiedNum(childrenRule,pairName)));
double N3=0;//兄弟结点,往往第一次可信度并不高
if(satisfiedNum(siblingsRule,pairName)>0)
N3=1/(1+Math.exp(-satisfiedNum(siblingsRule,pairName)+1));
double N4=0;
if(satisfiedNum(domainsRule,pairName)>0)
N4=1/(1+Math.exp(-satisfiedNum(domainsRule,pairName)));
double N5=0;
if(satisfiedNum(rangesRule,pairName)>0)
N5=1/(1+Math.exp(-satisfiedNum(rangesRule,pairName)));
double N6=0;
if(satisfiedNum(datatypeRule,pairName)>0)
N6=1/(1+Math.exp(-satisfiedNum(datatypeRule,pairName)));
double N7=0;
if(satisfiedNum(partOfRule,pairName)>0)
N7=1/(1+Math.exp(-satisfiedNum(partOfRule,pairName)));
double N8=0;
if(satisfiedNum(hasPartRule,pairName)>0)
N8=1/(1+Math.exp(-satisfiedNum(hasPartRule,pairName)));
/*double N4=satisfiedNum(domainsRule,pairName);
double N5=satisfiedNum(rangesRule,pairName);*/
//1-Math.sin(Math.acos(value));
//这里的Si指的是对应规则发生的概率(但每个规则都有影响最终匹配结果的上界)
//注意父对子比子对父要大,1次就帮助0.7的匹配对冲破阈值
//子对父相当 3次就帮助0.7的匹配对冲破阈值
//兄弟结点有时候并不可信,多一次会造成很多本质上的区别
//定义域与值域影响相当,但比上述都小 无法就帮助0.7的匹配对冲破阈值
//最小则是Datatype,很多都是由于String类型才匹配的 无法就帮助0.7的匹配对冲破阈值
double S1=0.45,S2=0.35,S3=0.35,S4=0.3,S5=0.3,S6=0.2,S7=0.35,S8=0.45;
double finalNegative=(1-S0)*Math.pow(1-S1, N1)*Math.pow(1-S2, N2)*Math.pow(1-S3, N3)*
Math.pow(1-S4, N4)*Math.pow(1-S5, N5)*Math.pow(1-S6, N6)*Math.pow(1-S7, N7)*Math.pow(1-S8, N8);
finalPositive=1-finalNegative;
}
if(finalPositive>=threshold)
{
//System.out.println(pairName+","+finalPositive);
roughMap.add(pairName+","+finalPositive+","+length1+","+length2);
}
else if(iteration==0&&finalPositive>=a*0.85&&finalPositive<=a)//很多隐藏的点,由于知识不完备(实例未给出,关系未给出),导致其无法被识别
{
/*String label1=classLabels1.get(pairInstanceValue[0].toLowerCase());
String label2=classLabels2.get(pairInstanceValue[1].toLowerCase());
System.out.println(label1+","+label2+","+finalPositive);
bfw_middle.append(label1+","+label2+","+finalPositive+"\n");*/
hiddenClassesMap.add(pairName+","+finalPositive+","+length1+","+length2);
}
/*ArrayList<String> hiddenClassesMap=new ArrayList<String>();
ArrayList<String> hiddenPropertiesMap=new ArrayList<String>();*/
}
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" SPN+Noisy_OR模型计算消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
//将原来的补上(false针对的是属性,true针对的是class)
roughMap=addMaps(classesMap,roughMap); //classesMap加到roughMap中去。一般后者比前者大,主要是一种更新
//System.out.println("候选匹配对的个数为:"+roughMap.size());
for(int i=0;i<roughMap.size();i++)
{
String parts[]=roughMap.get(i).split(",");
String label1=classLabels1.get(parts[0]);
String label2=classLabels2.get(parts[1]);
//System.out.println(label1+","+label2+","+parts[2]);
//System.out.println(roughMap.get(i));
}
//Refine(十字交叉和1对1的限制)
ArrayList<String> refinedMap1=new ArrayList<String>();
tic=System.currentTimeMillis();
refinedMap1=refineTools.removeCrissCross(roughMap, superclasses1, superclasses2);
//System.out.println("基于十字交叉精炼后的匹配对的个数为:"+refinedMap1.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" 基于概念十字交叉精炼计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
for(int i=0;i<refinedMap1.size();i++)
{
String parts[]=refinedMap1.get(i).split(",");
String label1=classLabels1.get(parts[0]);
String label2=classLabels2.get(parts[1]);
//System.out.println(label1+","+label2+","+parts[2]);
//System.out.println(refinedMap1.get(i));
}
ArrayList<String> refinedMap2=new ArrayList<String>();
tic=System.currentTimeMillis();
refinedMap2=refineTools.keepOneToOneAlignment(refinedMap1);
//System.out.println("基于1对1的精炼后的匹配对的个数为:"+refinedMap2.size());
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" 基于One-One精炼计算消耗的时间为:"+(toc-tic)+"ms"+"\n");
classesMap.clear();
for(int i=0;i<refinedMap2.size();i++)
{
String part[]=refinedMap2.get(i).split(",");
if(Double.parseDouble(part[2])>0)
{
/*String parts[]=refinedMap2.get(i).split(",");
String label1=classLabels1.get(parts[0]);
String label2=classLabels2.get(parts[1]);
System.out.println(label1+","+label2+","+parts[2]);*/
//System.out.println(refinedMap2.get(i));
classesMap.add(refinedMap2.get(i));
}
}
/**
* find candidate maps among properties
*/
classesAlignments=changeToAlignments(classesMap);
ruleTools.refreshClassMaps(classesAlignments);
ArrayList<String> lowerCaseObjectProperties1=changeToLowerCase(objectProperties1);
ArrayList<String> lowerCaseObjectProperties2=changeToLowerCase(objectProperties2);
ArrayList<String> objectProperties=ruleTools.objectPropertyRule(lowerCaseObjectProperties1, lowerCaseObjectProperties2, objectRelations1, objectRelations2);
//System.out.println("*************************************");
//System.out.println(objectProperties.size());
ArrayList<String> lowerCaseDataProperties1=changeToLowerCase(dataProperties1);
ArrayList<String> lowerCaseDataProperties2=changeToLowerCase(dataProperties2);
ArrayList<String> dataProperties=ruleTools.dataPropertyRule(lowerCaseDataProperties1, lowerCaseDataProperties2, dataRelations1, dataRelations2);
//System.out.println("*************************************");
//System.out.println(dataProperties.size());
TreeMap_Tools OPrule=new TreeMap_Tools(objectProperties);
TreeMap_Tools DPrule=new TreeMap_Tools(dataProperties);
ArrayList<String> roughObjectPropertyMap=new ArrayList<String>();
/*ArrayList<String> editSimObjectProperty=tool.editSimProperty(objectProperties1, objectProperties2);
ArrayList<String> SemanticSimObjectProperty=tool.semanticSimProperty(objectProperties1, objectProperties2);
ArrayList<String> editSimDatatypeProperty=tool.editSimProperty(objectProperties1, objectProperties2);
ArrayList<String> SemanticSimDatatypeProperty=tool.semanticSimProperty(objectProperties1, objectProperties2);*/
int objectPropertyPairSize=editSimObjectProperty.size();
for(int i=0;i<objectPropertyPairSize;i++)
{
double P0=0;
double editSimValue=getTripleValue(editSimObjectProperty.get(i));
double semanticSimValue=getTripleValue(SemanticSimObjectProperty.get(i));
P0=0.7*Math.max(editSimValue, semanticSimValue);//pooling的方法更合适一些吧
if(editSimValue==1)//指得是相同的字符串的优势
P0=P0+0.0000001;
/*if(editSimValue==semanticSimValue&&semanticSimValue>0)//指得是相同的字符串的优势
P0=P0+0.0000001;*/
//P0=Math.min(Math.max(editSimValue, semanticSimValue), 0.7);//pooling的方法更合适一些吧
/**
* Use heuristic rules to improve the similarity of properties in Noisy-OR model
*/
String part[]=editSimObjectProperty.get(i).split(",");
String pairName=objectPropertyPair.get(i);
double M1=0;
if(satisfiedNum(OPrule,pairName)>0)
M1=1/(1+Math.exp(-satisfiedNum(OPrule,pairName))); //基于定义域、值域的匹配并用sigmoid函数限制它的上限
double S1=0.2;//必须要2次才能冲破阈值0.75。
double finalNegative=(1-P0)*Math.pow(1-S1, M1);
double finalPositive=1-finalNegative;
if(finalPositive>=0.75)
{
//System.out.println(pairName+","+finalPositive);
roughObjectPropertyMap.add(pairName+","+finalPositive+","+part[3]+","+part[4]+","+part[5]+","+part[6]);//应该保留5维信息
}
else if(finalPositive>0.7&&finalPositive<0.75&&iteration==0)//很多隐藏的点,由于知识不完备(实例未给出,关系未给出),导致其无法被识别
{
hiddenObjectPropertiesMap.add(pairName+","+finalPositive+","+part[3]+","+part[4]+","+part[5]+","+part[6]);
}
}
//将原来的补上(false针对的是属性,true针对的是class)
roughObjectPropertyMap=addMaps(objectPropertiesMap,roughObjectPropertyMap);//objectPropertiesMap加到roughObjectPropertyMap中去。一般后者比前者大,主要是一种更新
/*System.out.println("候选属性的匹配对个数为:"+roughObjectPropertyMap.size());
for(int i=0;i<roughObjectPropertyMap.size();i++)
{
String part[]=roughObjectPropertyMap.get(i).split(",");
System.out.println(part[0]+","+part[1]+","+part[2]);
}*/
//基于属性匹配对的一个Refine的过程
ArrayList<String> refinedObjectPropertyMap1=new ArrayList<String>();
//用更新后的classMap来精炼propertyMap
refinedObjectPropertyMap1=refineTools.removeCrissCrossInProperty(roughObjectPropertyMap,classesAlignments,objectRelations1,objectRelations2);
//refinedPropertyMap1=refineTools.removeCrissCrossInProperty(roughPropertyMap,classAlignmentPath,relations1,relations2);
/*System.out.println("过滤基于定义域与值域反向匹配的个数为:"+refinedObjectPropertyMap1.size());
for(int i=0;i<refinedObjectPropertyMap1.size();i++)
{
String part[]=refinedObjectPropertyMap1.get(i).split(",");
System.out.println(part[0]+","+part[1]+","+part[2]);
}*/
//propertiesInverse1; editSimProperty后两维提供信息来进行过滤
ArrayList<String> refinedObjectPropertyMap2=new ArrayList<String>();
//stemObjectPropery=tool.findStemPair(refinedObjectPropertyMap1);
refinedObjectPropertyMap2=refineTools.removeStemConflict(refinedObjectPropertyMap1,propertiesInverse1,propertiesInverse2);
/*System.out.println("过滤基于inverse情况的匹配:"+refinedObjectPropertyMap2.size());
for(int i=0;i<refinedObjectPropertyMap2.size();i++)
{
System.out.println(refinedObjectPropertyMap2.get(i));
}*/
ArrayList<String> refinedObjectPropertyMap3=new ArrayList<String>();
refinedObjectPropertyMap3=refineTools.keepOneToOneAlignment(refinedObjectPropertyMap2);
//System.out.println("基于1对1的精炼后的匹配对的个数为:"+refinedObjectPropertyMap3.size());
propertiesMap.clear();
objectPropertiesMap.clear();
for(int i=0;i<refinedObjectPropertyMap3.size();i++)
{
String part[]=refinedObjectPropertyMap3.get(i).split(",");
if(Double.parseDouble(part[2])>0)
{
/*System.out.println(refinedObjectPropertyMap3.get(i));
String propertyMapPair=part[0]+"--"+part[1];
objectPropertiesMap.add(propertyMapPair);
propertiesMap.add(propertyMapPair); */
objectPropertiesMap.add(refinedObjectPropertyMap3.get(i));
propertiesMap.add(refinedObjectPropertyMap3.get(i));
}
}
ArrayList<String> roughDataPropertyMap=new ArrayList<String>();
int dataPropertyPairSize=editSimDatatypeProperty.size();
for(int i=0;i<dataPropertyPairSize;i++)
{
double P0=0;
double editSimValue=getTripleValue(editSimDatatypeProperty.get(i));
double semanticSimValue=getTripleValue(SemanticSimDatatypeProperty.get(i));
P0=0.7*Math.max(editSimValue, semanticSimValue);//pooling的方法更合适一些吧
if(editSimValue==1)//指得是相同的字符串的优势
P0=P0+0.0000001;
/*if(editSimValue==semanticSimValue&&semanticSimValue>0)//指得是相同的字符串的优势
P0=P0+0.0000001;*/
//P0=Math.min(Math.max(editSimValue, semanticSimValue), 0.7);//pooling的方法更合适一些吧
/**
* Use heuristic rules to improve the similarity of properties in Noisy-OR model
*/
String part[]=editSimDatatypeProperty.get(i).split(",");
String pairName=dataPropertyPair.get(i);
double M2=0;
if(satisfiedNum(DPrule,pairName)>0)
M2=1/(1+Math.exp(-satisfiedNum(DPrule,pairName)));//基于DataType的匹配,并用sigmoid函数限制它的上限
double S2=0.18;
//必须要3次才能冲破阈值0.75。
double finalNegative=(1-P0)*Math.pow(1-S2, M2);
double finalPositive=1-finalNegative;
if(finalPositive>=0.75)
{
//System.out.println(pairName+","+finalPositive);
roughDataPropertyMap.add(pairName+","+finalPositive+","+part[3]+","+part[4]+","+part[5]+","+part[6]);//应该保留5维信息
}
else if(finalPositive>0.7&&finalPositive<0.75&&iteration==0)//很多隐藏的点,由于知识不完备(实例未给出,关系未给出),导致其无法被识别
{
hiddenDataPropertiesMap.add(pairName+","+finalPositive+","+part[3]+","+part[4]+","+part[5]+","+part[6]);
}
}
//将原来的补上(false针对的是属性,true针对的是class)
roughDataPropertyMap=addMaps(dataPropertiesMap,roughDataPropertyMap);//dataPropertiesMap加到roughDataPropertyMap中去。一般后者比前者大,主要是一种更新
/*System.out.println("候选属性的匹配对个数为:"+roughDataPropertyMap.size());
for(int i=0;i<roughDataPropertyMap.size();i++)
{
String part[]=roughDataPropertyMap.get(i).split(",");
System.out.println(part[0]+","+part[1]+","+part[2]);
}*/
//基于数值属性匹配对的一个Refine的过程
ArrayList<String> refinedPropertyMap=new ArrayList<String>();
refinedPropertyMap=refineTools.keepOneToOneAlignment(roughDataPropertyMap);
//System.out.println("基于1对1的精炼后的匹配对的个数为:"+refinedPropertyMap.size());
dataPropertiesMap.clear();
for(int i=0;i<refinedPropertyMap.size();i++)
{
String part[]=refinedPropertyMap.get(i).split(",");
if(Double.parseDouble(part[2])>0)
{
/*System.out.println(refinedPropertyMap.get(i));
String propertyMapPair=part[0]+"--"+part[1];
dataPropertiesMap.add(propertyMapPair);
propertiesMap.add(propertyMapPair); */
dataPropertiesMap.add(refinedPropertyMap.get(i));
propertiesMap.add(refinedPropertyMap.get(i));
}
}
//如果概念的匹配对,与属性的匹配对不再发生变化,或者迭代次数已经有5次,跳出循环。
propertyAlignments=changeToAlignments(propertiesMap);
flag=unChange(classesAlignments,propertyAlignments,oldClassesMap,oldPropertiesMap);
////如果为空的话,需要将一些看起来十分合适的点进行导入,这相当于人工指定
if(classesMap.size()==0)
{
tic=System.currentTimeMillis();
needComplementClass=true;
String type="class";
classesMap=complementMaps(classesMap,hiddenClassesMap,type);
//classesMap=complementMaps(classesMap,hiddenClassesMap,type,needComplementClass);
needComplementClass=false;
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" 补充缺省first-liner_class消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
}
if(propertiesMap.size()==0)
{
tic=System.currentTimeMillis();
String type="property";
//needComplementProperty=true;
objectPropertiesMap=complementMaps(objectPropertiesMap,hiddenObjectPropertiesMap,type);
objectPropertiesMap=refineTools.removeStemConflict(objectPropertiesMap,propertiesInverse1,propertiesInverse2);
objectPropertiesMap=refineTools.keepOneToOneAlignment(objectPropertiesMap);
propertiesMap=addMaps(propertiesMap,objectPropertiesMap);//前面是老的,后面是新的
dataPropertiesMap=complementMaps(dataPropertiesMap,hiddenDataPropertiesMap,type);
dataPropertiesMap=refineTools.keepOneToOneAlignment(dataPropertiesMap);
propertiesMap=addMaps(propertiesMap,dataPropertiesMap);//前面是老的,后面是新的
needComplementProperty=false;
toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+iteration+" 补充缺省first-liner_property消耗的时间为:"+(toc-tic)/1000+"s"+"\n");
}
iteration++;
Boolean jump=!(iteration<4&&flag==false);
if(jump==true)
{
if(needComplementClass==true)
{
classesMap=complementMaps(classesMap,hiddenClassesMap,"class");
classesMap=refineTools.removeCrissCross(classesMap, superclasses1, superclasses2);
}
else//这里的refine只是剪枝,不会增加,因为已经添加过了,所以进行了1对1的限制操作
classesMap=newRefineClass(classesMap);
//classesMap=refineClass(classesMap,classes1,classes2);
//如果一开始没有补充,则为在循环内就会补充好,needComplementProperty的值则会变为false,这里则是之前被激活,而一直没补充的情况
if(needComplementProperty==true)
{
propertiesMap=complementMaps(propertiesMap,hiddenObjectPropertiesMap,"property");
classesAlignments=changeToAlignments(classesMap);
propertiesMap=refineTools.removeCrissCrossInProperty(propertiesMap,classesAlignments,objectRelations1,objectRelations2);
propertiesMap=refineTools.removeStemConflict(propertiesMap,propertiesInverse1,propertiesInverse2);
propertiesMap=complementMaps(propertiesMap,hiddenDataPropertiesMap,"property");
}
/*else //暂时不需要考虑
propertiesMap=refineProperty(propertiesMap);*/
}
iteration_toc=System.currentTimeMillis();
//bfw_Result.append("当前迭代次数为:"+(iteration-1)+" 迭代消耗的时间为:"+(iteration_toc-iteration_tic)/1000+"s"+"\n");
}while(iteration<4&&flag==false);
//最后,也需要进行适当的补充
//考虑到信息不完备的时候,将这些潜藏的匹配进行补充(这个过程如果能省略也应该能节约不少时间)
/*if(needComplementClass==true)
classesMap=complementMaps(classesMap,hiddenClassesMap,"class");
else
classesMap=refineClass(classesMap);
//如果一开始没有补充,则为在循环内就会补充好,needComplementProperty的值则会变为false,这里则是之前被激活,而一直没补充的情况
if(needComplementProperty==true)
propertiesMap=complementMaps(propertiesMap,hiddenObjectPropertiesMap,"property");
else
propertiesMap=refineProperty(propertiesMap);*/
/*ArrayList<String> EquivalentClass2=onto2.GetEquivalentClass();
ArrayList<String> EquivalentProperty2=onto2.GetEquivalentProperty();*/
classesMap=enhancedMap(classesMap,EquivalentClass1);
classesMap=enhancedMap(classesMap,EquivalentClass2);
propertiesMap=enhancedMap(propertiesMap,EquivalentProperty1);
propertiesMap=enhancedMap(propertiesMap,EquivalentProperty2);
/* String alignmentPath="Results/"+ontologyName1+"-"+ontologyName2;
OAEIAlignmentOutput out=new OAEIAlignmentOutput(alignmentPath,ontologyName1,ontologyName2);
for(int i=0;i<classesMap.size();i++)
{
String parts[]=classesMap.get(i).split(",");
out.addMapping2Output(parts[0],parts[1]);
}
for(int i=0;i<propertiesMap.size();i++)
{
String parts[]=propertiesMap.get(i).split(",");
out.addMapping2Output(parts[0],parts[1]);
}
out.saveOutputFile();*/
/* System.out.println("最终的概念匹配对为:");
for(int i=0;i<classesMap.size();i++)
{
System.out.println(classesMap.get(i));
}
System.out.println("找到概念匹配对的个数为:"+classesMap.size());*/
/*System.out.println("最终的属性匹配对为:");
for(int i=0;i<propertiesMap.size();i++)
{
System.out.println(propertiesMap.get(i));
}*/
//System.out.println("找到属性匹配对的个数为:"+propertiesMap.size());
/*ArrayList<String> classAlignments=changeToAlignments(classesMap);
ArrayList<String> propertyAlignments=changeToAlignments(propertiesMap);*/
System.out.println("The result of "+ontologyName1+" and "+ontologyName2+" :");
bfw_Result.append("The result of "+ontologyName1+" and "+ontologyName2+" :"+"\n");
//printResult(classAlignments,propertyAlignments,resultClassMap,resultPropertyMap);
if(labelflag==true)
{
//只是为打印医学本体提供方法
printAnatomyResult(classesMap,propertiesMap,classLabels1,classLabels2,resultClassMap,resultPropertyMap);
}
else
{
printResult(classesMap,propertiesMap,resultClassMap,resultPropertyMap);
}
System.out.println(ontologyName1+" "+ontologyName2+" has been done!");
bfw_Result.append("\n\n");
}//1层循环I3CON
/* }//2层循环Conference、Benchmark
}*/
/* static double a=0.7;
static double contribution=0.2;
static double threshold=0.8; */
System.out.println("When alpha="+a+" lambda="+contribution +" theta="+threshold+","+"the average of f1-measure:"+average_f_measure/5);
bfw_Result.append("When alpha="+a+" lambda="+contribution +" theta="+threshold+","+"\n");
bfw_Result.append("The average of f1-measure:"+average_f_measure/5+"\n");
toc1=System.currentTimeMillis();
System.out.println("Time consumption:"+(toc1-tic1)/1000+"s");
//bfw_Result.append("The average of f1-measure:"+average_f_measure/5+"\n");
bfw_Result.append("Time consumption:"+(toc1-tic1)/1000+"s"+"\n");
bfw_Result.close();
//bfw_middle.close();
}
/**
* these function are just for preproccess
*/
public static ArrayList<String> filterCommand(ArrayList<String> maps)
{
ArrayList<String> fiteredMaps=new ArrayList<String>();
for(int i=0;i<maps.size();i++)
{
String a=maps.get(i);
fiteredMaps.add(a.replace("--,", "--"));
}
return fiteredMaps;
}
public static ArrayList<String> changeToLowerCase(ArrayList<String> things)
{
ArrayList<String> lowCaseArrayList=new ArrayList<String>();
for(int i=0;i<things.size();i++)
{
lowCaseArrayList.add(things.get(i).toLowerCase());
}
return lowCaseArrayList;
}
public static int satisfiedNum(TreeMap_Tools rule,String pair)
{
ArrayList<String> value=rule.GetKey_Value(pair.toLowerCase());
if(value!=null)
{
return (int) Double.parseDouble(value.get(0));
}
return 0;
}
public static double getTripleValue(String triple)
{
String part[]=triple.split(",");
double value=Double.parseDouble(part[2]);
return value;
}
public static int getEditValue(String triple)
{
String part[]=triple.split(",");
int value=Integer.parseInt(part[3]);
return value;
}
public static boolean unChange(ArrayList<String> classesMap,ArrayList<String> propertiesMap,ArrayList<String> oldClassesMap, ArrayList<String> oldPropertiesMap)
{
boolean classUnChange=false;
boolean propertyUnChange=false;
if(oldClassesMap.size()!=classesMap.size())
{
return false;
}
if(oldPropertiesMap.size()!=propertiesMap.size())
{
return false;
}
for(int i=0;i<classesMap.size();i++)
{
if(oldClassesMap.contains(classesMap.get(i)))
classUnChange=true;
else
{
classUnChange=false;
break;
}
}
if(propertiesMap.size()==0)
propertyUnChange=true;
for(int j=0;j<propertiesMap.size();j++)
{
if(oldPropertiesMap.contains(propertiesMap.get(j)))
propertyUnChange=true;
else
{
propertyUnChange=false;
break;
}
}
boolean change=classUnChange&&propertyUnChange;
return change;
}
/*public static ArrayList<String> complementMaps(ArrayList<String> maps,ArrayList<String> hiddenmaps,boolean flag)
{
Refine_Tools tools=new Refine_Tools();
ArrayList<String> preciseMaps=new ArrayList<String>();
if(flag==false)//这种情况的maps是为空的
{
for(int i=0;i<hiddenmaps.size();i++)
{
maps.add(hiddenmaps.get(i));
}
preciseMaps=tools.keepOneToOneAlignment(maps);//针对Class的时候还是需要的。极有可能出现1对多的情况
maps.clear();
for(int i=0;i<preciseMaps.size();i++)
{
String parts[]=preciseMaps.get(i).split(",");
if(Double.parseDouble(parts[2])>0)
maps.add(preciseMaps.get(i));
}
return maps; //注意,这里返回的格式仍需要修改
}
else //默认缺省时添加的情况
{
//要求1对1的匹配,更相信通过模型计算出来的结果。其他的结果只能作为辅助
preciseMaps=tools.keepOneToOneAlignment(hiddenmaps);
for(int i=0;i<preciseMaps.size();i++)
{
boolean index=false;
String parts1[]=preciseMaps.get(i).split(",");
for(int j=0;j<maps.size();j++)
{
String parts2[]=maps.get(j).split(",");
if(parts2[0].equals(parts1[0])||parts2[1].equals(parts1[1])||Double.parseDouble(parts1[2])==0)//1对1的限制
{
index=true;
break;
}
}
if(index==false)
{
System.out.println(parts1[0]+" "+parts1[1]);
String concept1=parts1[0];
String concept2=parts1[1];
int length1=tool.tokeningWord(concept1).split(" ").length;
int length2=tool.tokeningWord(concept2).split(" ").length;
if(length1==length2&&length1==1&&Double.parseDouble(parts1[2])>0.7)//仅名字相同才给予考虑,因为有很多WordNet计算会存在一定错误,导致召回率很低
maps.add(preciseMaps.get(i));
if((length1==1&&length2>1)||(length1==1&&length2>1)) //单个词与组合词的情况。
maps.add(preciseMaps.get(i));
if(length1>1&&length2>1&&Double.parseDouble(parts1[2])>0.6) //组合词的token均超过2个。
maps.add(preciseMaps.get(i));
}
//maps.add(parts1[0]+"--"+parts1[1]);
}
return maps;
}
}*/
public static ArrayList<String> complementMaps(ArrayList<String> maps,ArrayList<String> hiddenmaps,String type)
{
Refine_Tools tools=new Refine_Tools();
ArrayList<String> preciseMaps=new ArrayList<String>();
if(type.equals("class")&&maps.size()==0)//Class为空时的补充
{
for(int i=0;i<hiddenmaps.size();i++)
{
maps.add(hiddenmaps.get(i));
}
preciseMaps=tools.keepOneToOneAlignment(maps);//针对Class的时候还是需要的。极有可能出现1对多的情况
maps.clear();
for(int i=0;i<preciseMaps.size();i++)
{
String parts[]=preciseMaps.get(i).split(",");
if(Double.parseDouble(parts[2])>0)
maps.add(preciseMaps.get(i));
}
return maps; //注意,这里返回的格式仍需要修改
}
else if(type.equals("class")&&maps.size()!=0)//Class不为空时的补充
{
preciseMaps=tools.keepOneToOneAlignment(hiddenmaps);
for(int i=0;i<preciseMaps.size();i++)
{
boolean index=false;
String parts1[]=preciseMaps.get(i).split(",");
for(int j=0;j<maps.size();j++)
{
String parts2[]=maps.get(j).split(",");
if(parts2[0].equals(parts1[0])||parts2[1].equals(parts1[1])||Double.parseDouble(parts1[2])==0)//1对1的限制
{
index=true;
break;
}
}
if(index==false)
{
System.out.println(parts1[0]+" "+parts1[1]);
int length1=Integer.parseInt(parts1[3]);
int length2=Integer.parseInt(parts1[4]);
/*String concept1=parts1[0];
String concept2=parts1[1];
int length1=tool.tokeningWord(concept1).split(" ").length;
int length2=tool.tokeningWord(concept2).split(" ").length;*/
if(length1==length2&&Double.parseDouble(parts1[2])>=a)//仅名字相同才给予考虑,因为有很多WordNet计算会存在一定错误,导致召回率很低
maps.add(preciseMaps.get(i));
else if(length1!=length2&&Double.parseDouble(parts1[2])>=a*0.85)
maps.add(preciseMaps.get(i));
/* if(length1==length2&&length1==1&&Double.parseDouble(parts1[2])>=a)//仅名字相同才给予考虑,因为有很多WordNet计算会存在一定错误,导致召回率很低
maps.add(preciseMaps.get(i));
if((length1==1&&length2>1)||(length1>1&&length2==1)) //单个词与组合词的情况。
maps.add(preciseMaps.get(i));
if(length1>1&&length2>1&&Double.parseDouble(parts1[2])>a*0.85) //组合词的token均超过2个。
maps.add(preciseMaps.get(i));*/
}
}
return maps;
}
else if((type.equals("property")&&maps.size()!=0))//属性不为空的情况
{
preciseMaps=tools.keepOneToOneAlignment(hiddenmaps);
for(int i=0;i<preciseMaps.size();i++)
{
boolean index=false;
String parts1[]=preciseMaps.get(i).split(",");
for(int j=0;j<maps.size();j++)
{
String parts2[]=maps.get(j).split(",");
if(parts2[0].equals(parts1[0])||parts2[1].equals(parts1[1])||Double.parseDouble(parts1[2])==0)//1对1的限制
{
index=true;
break;
}
}
if(index==false)//不冲突的情况添加
maps.add(preciseMaps.get(i));
}
return maps;
}
else
//else if(type.equals("property"))//因为最初肯定为空,后续的过程必须在循环中预先做一次精炼
{
for(int i=0;i<hiddenmaps.size();i++)
{
maps.add(hiddenmaps.get(i));
}
return maps; //注意,这里返回的格式仍需要修改
}
}
public static ArrayList<String> addMaps(ArrayList<String> maps,ArrayList<String> newMaps)//前面是老的,后面是新的 classesMap,roughMap
{
//Sim_Tools tools=new Sim_Tools();
ArrayList<String> preciseMaps=new ArrayList<String>();
for(int i=0;i<newMaps.size();i++)
{
preciseMaps.add(newMaps.get(i));
}
ArrayList<String> alignments=changeToAlignments(preciseMaps);
for(int i=0;i<maps.size();i++)//添加新的Maps要考虑值的大小,新的比原来的值要大
{
String parts[]=maps.get(i).split(",");
String conceptPair=parts[0]+"--"+parts[1];
if(alignments.contains(conceptPair))//因为新的值一定比前者大,所以可以pass掉
{
continue;
}
else
preciseMaps.add(maps.get(i));
}
return preciseMaps;
}
public static ArrayList<String> refineClass(ArrayList<String> maps,ArrayList<String>Classes1,ArrayList<String> Classes2)//方便将一些最初不太可靠,但又没有在SPN与Noisy-OR中的加强的匹配对过滤掉
{
Refine_Tools tools=new Refine_Tools();
ArrayList<String> lowerCaseClasses1=changeToLowerCase(Classes1);
ArrayList<String> lowerCaseClasses2=changeToLowerCase(Classes2);
ArrayList<String> preciseMaps=new ArrayList<String>();
for(int i=0;i<maps.size();i++)
{
String parts[]=maps.get(i).split(",");
//因为最终的匹配都转换成了小写,必须还原之后才知道其真实的长度
int index1=tools.find_index(lowerCaseClasses1, parts[0]);
int index2=tools.find_index(lowerCaseClasses2, parts[1]);
int length1=tool.tokeningWord(Classes1.get(index1)).split(" ").length;
int length2=tool.tokeningWord(Classes2.get(index2)).split(" ").length;
if(length1==length2&&length1==1&&Double.parseDouble(parts[2])>=a)//仅名字相同才给予考虑,因为有很多WordNet计算会存在一定错误,导致召回率很低
preciseMaps.add(maps.get(i));
else if(length1==length2&&length1!=1&&Double.parseDouble(parts[2])>a*0.85)//仅名字相同才给予考虑,因为有很多WordNet计算会存在一定错误,导致召回率很低
preciseMaps.add(maps.get(i));
else if(length1!=length2&&Double.parseDouble(parts[2])>=a*0.85)
preciseMaps.add(maps.get(i));
}
return preciseMaps;
}
public static ArrayList<String> newRefineClass(ArrayList<String> maps)//方便将一些最初不太可靠,但又没有在SPN与Noisy-OR中的加强的匹配对过滤掉
{
//Refine_Tools tools=new Refine_Tools();
ArrayList<String> preciseMaps=new ArrayList<String>();
for(int i=0;i<maps.size();i++)
{
String parts[]=maps.get(i).split(",");
int length1=Integer.parseInt(parts[3]);
int length2=Integer.parseInt(parts[4]);
if(length1==length2&&length1==1&&Double.parseDouble(parts[2])>=a)//对于字符长度为1(语义相似度为0.9) 但并无太多增长的情况
preciseMaps.add(maps.get(i));
else if(length1==length2&&length1!=1&&Double.parseDouble(parts[2])>a*0.9)//对于字符长度相等,
preciseMaps.add(maps.get(i));
else if(length1!=length2&&Double.parseDouble(parts[2])>=a*0.85)
preciseMaps.add(maps.get(i));
}
return preciseMaps;
}
/*public static ArrayList<String> refineProperty(ArrayList<String> maps)//方便将一些最初不太可靠,但又没有在SPN与Noisy-OR中的加强的匹配对过滤掉
{
ArrayList<String> preciseMaps=new ArrayList<String>();
for(int i=0;i<maps.size();i++)
{
String parts[]=maps.get(i).split(",");
int length1=tool.tokeningWord(parts[0]).split(" ").length;
int length2=tool.tokeningWord(parts[1]).split(" ").length;
if(length1==length2&&length1==1&&Double.parseDouble(parts[2])>0.7)//仅名字相同才给予考虑,因为有很多WordNet计算会存在一定错误,导致召回率很低
preciseMaps.add(maps.get(i));
if((length1==1&&length2>1)||(length1>1&&length2==1)) //单个词与组合词的情况。
preciseMaps.add(maps.get(i));
if(length1>1&&length2>1&&Double.parseDouble(parts[2])>0.6) //组合词的token均超过2个。
preciseMaps.add(maps.get(i));
}
return preciseMaps;
}*/
public static ArrayList<String> changeToAlignments(ArrayList<String> maps)
{
ArrayList<String> alignments=new ArrayList<String>();
for(int i=0;i<maps.size();i++)
{
String parts[]=maps.get(i).split(",");
alignments.add(parts[0]+"--"+parts[1]);
}
return alignments;
}
public static ArrayList<String> enhancedMap(ArrayList<String> Map,ArrayList<String> Equivalent)
{
for(int i=0;i<Equivalent.size();i++)
{
String equivalent[]=Equivalent.get(i).split(",");
if(equivalent.length==3&&equivalent[2].equals("Equal")) //parts[0]是parts[1]的儿子
{
int index =findIndex(Map,equivalent[0]);
if(index!=-1)
{
String newMap=Map.get(index).replaceFirst(equivalent[0], equivalent[1]);//针对属性
String newMap2=Map.get(index).replaceFirst(equivalent[0].toLowerCase(), equivalent[1].toLowerCase());//针对类
if(!Map.contains(newMap))
Map.add(newMap);
else if(!Map.contains(newMap2))
{
Map.add(newMap2);
}
}
}
}
return Map;
}
public static int findIndex(ArrayList<String> Map,String index)
{
//ArrayList<String> Triples=new ArrayList<String>();
for(int i=0;i<Map.size();i++)
{
String parts[]=Map.get(i).split(",");
if(index.toLowerCase().equals(parts[0].toLowerCase()))
{
return i;
}
}
return -1;
}
public static HashMap<String,String> transformToHashMap(ArrayList<String> originalMap)
{
HashMap<String,String> standardMap=new HashMap<String,String>();
for(int i=0;i<originalMap.size();i++)
{
String part[]=originalMap.get(i).split("--");
standardMap.put(part[0],part[1]);
//standardMap.add();
}
return standardMap;
}
public static ArrayList<String> Normalize(ArrayList<String> object,HashMap<String,String> dic)
{
ArrayList<String> normalizedThings=new ArrayList<String>();
int num=0;
for(int i=0;i<object.size();i++)
{
//String part[]=object.get(i).split("--");
String normalized=dic.get(object.get(i));
if(normalized!=null)
{
String parts[]=normalized.split(" ");
String pos= tool.findPOS(parts[0]);
if(pos.equals("CD")||pos.equals("NNP"))//考虑到首字母缩写的问题
{
String abbr_letter = parts[1].charAt(0)+parts[0];
normalized=normalized.replace(parts[0], abbr_letter).replace(parts[1]+" ", "");
}
normalizedThings.add(normalized);
num++;
}
else
normalizedThings.add(object.get(i));
//standardMap.add();
}
//String candidate_num[]={"1","2","3","4","5","6","7","8","9"};
System.out.println("规范化概念的个数为:"+num);
return normalizedThings;
}
public static void printResult(ArrayList<String> classesMap,ArrayList<String> propertiesMap,TreeMap_Tools resultClassMap,TreeMap_Tools resultPropertyMap) throws IOException
{
double alignmentClassNumbers=resultClassMap.getNumberOfMap();
double alignmentPropertyNumbers=resultPropertyMap.getNumberOfMap();
double findClassNumbers=classesMap.size();
double findPropertyNumbers=propertiesMap.size();
double rightClassNumber=0,rightPropertyNumber=0;
double R,P,F1;
System.out.println("**************************************");
bfw_Result.append("**************************************"+"\n");
ArrayList<String> notFoundClassMaps=new ArrayList<String>();//O2的概念
for(int i=0;i<classesMap.size();i++)
{
//String part[]=classesMap.get(i).split("--");
String part[]=classesMap.get(i).split(",");
String concept1=part[0].toLowerCase();
String concept2=part[1].toLowerCase();
//可能给出的reference alignment是反的
if(resultClassMap.has_relation(concept1, concept2))
{
System.out.println(classesMap.get(i)+" (Right)");
bfw_Result.append(classesMap.get(i)+" (Right)"+"\n");
rightClassNumber++;
resultClassMap.remove(concept1, concept2);
}
else if(resultClassMap.has_relation(concept2,concept1))
{
System.out.println(classesMap.get(i)+" (Right)");
bfw_Result.append(classesMap.get(i)+" (Right)"+"\n");
rightClassNumber++;
resultClassMap.remove(concept2, concept1);
}
else
{
System.out.println(classesMap.get(i));
bfw_Result.append(classesMap.get(i)+"\n");
notFoundClassMaps.add(classesMap.get(i));
}
}
if(resultClassMap.size()==0)
{
System.out.println("All the concept pairs are found! ");
bfw_Result.append("All the concept pairs are found! "+"\n");
}
else
{
System.out.println("Concept pairs that was not found:");
bfw_Result.append("Concept pairs that was not found:"+"\n");
ArrayList<String> result=new ArrayList<String>();
result=resultClassMap.Print_Value();
for(String a:result)
{
bfw_Result.append(a+"\n");
}
}
System.out.println("The number of concept pairs that is right:"+rightClassNumber);
bfw_Result.append("The number of concept pairs that is right:"+rightClassNumber+"\n");
System.out.println("**************************************");
bfw_Result.append("**************************************"+"\n");
ArrayList<String> notFoundPropertyMaps=new ArrayList<String>();//O2的概念
for(int i=0;i<propertiesMap.size();i++)
{
//String part[]=propertiesMap.get(i).split("--");
String part[]=propertiesMap.get(i).split(",");
String property1=part[0].toLowerCase();
String property2=part[1].toLowerCase();
//System.out.println(property1+","+property2);
//可能给出的reference alignment是反的
if(resultPropertyMap.has_relation(property1, property2))
{
System.out.println(part[0]+","+part[1]+","+part[2]+" "+" (Right)");
//System.out.println(propertiesMap.get(i)+" (Right)");
bfw_Result.append(part[0]+","+part[1]+","+part[2]+" "+" (Right)"+"\n");
//bfw_Result.append(propertiesMap.get(i)+" (Right)"+"\n");
rightPropertyNumber++;
resultPropertyMap.remove(property1, property2);
}
else if(resultPropertyMap.has_relation(property2, property1))
{
System.out.println(part[0]+","+part[1]+","+part[2]+" "+" (Right)");
//System.out.println(propertiesMap.get(i)+" (Right)");
bfw_Result.append(part[0]+","+part[1]+","+part[2]+" "+" (Right)"+"\n");
//bfw_Result.append(propertiesMap.get(i)+" (Right)"+"\n");
rightPropertyNumber++;
resultPropertyMap.remove(property2, property1);
}
else
{
System.out.println(part[0]+","+part[1]+","+part[2]);
//System.out.println(propertiesMap.get(i));
bfw_Result.append(part[0]+","+part[1]+","+part[2]+"\n");
//bfw_Result.append(propertiesMap.get(i)+"\n");
notFoundPropertyMaps.add(propertiesMap.get(i));
}
}
if(resultPropertyMap.size()==0)
{
System.out.println("All the property pairs are found! ");
bfw_Result.append("All the property pairs are found! " +"\n");
}
else
{
System.out.println("Property pairs that was not found:");
bfw_Result.append("Property pairs that was not found:"+"\n");
ArrayList<String> result=new ArrayList<String>();
result=resultPropertyMap.Print_Value();
for(String a:result)
{
bfw_Result.append(a+"\n");
}
}
System.out.println("The number of property pairs that is right :"+rightPropertyNumber);
bfw_Result.append("The number of property pairs that is right :"+rightPropertyNumber+"\n");
P=(rightClassNumber+rightPropertyNumber)/(findClassNumbers+findPropertyNumbers);
R=(rightClassNumber+rightPropertyNumber)/(alignmentClassNumbers+alignmentPropertyNumbers);
R=Math.min(R, 1);
if(P==0&&R==0)
F1=0;
else
F1=(2*P*R)/(P+R);
System.out.println("==========================================");
System.out.println("Precision:"+P+" "+" Recall:"+R+" "+" f1-measure:"+F1);
bfw_Result.append("=========================================="+"\n");
bfw_Result.append("Precision:"+P+" "+" Recall:"+R+" "+" f1-measure:"+F1+"\n");
average_f_measure=average_f_measure+F1;
}
public static void printAnatomyResult(ArrayList<String> classesMap,ArrayList<String> propertiesMap,HashMap<String,String> ClassLabel1,HashMap<String,String> ClassLabel2,TreeMap_Tools resultClassMap,TreeMap_Tools resultPropertyMap) throws IOException
{
double alignmentClassNumbers=resultClassMap.getNumberOfMap();
double alignmentPropertyNumbers=resultPropertyMap.getNumberOfMap();
double findClassNumbers=classesMap.size();
double findPropertyNumbers=propertiesMap.size();
double rightClassNumber=0,rightPropertyNumber=0;
double R,P,F1;
System.out.println("**************************************");
bfw_Result.append("**************************************"+"\n");
ArrayList<String> notFoundClassMaps=new ArrayList<String>();//O2的概念
for(int i=0;i<classesMap.size();i++)
{
//String part[]=classesMap.get(i).split("--");
String part[]=classesMap.get(i).split(",");
String concept1=part[0].toLowerCase();
String concept2=part[1].toLowerCase();
String label1=ClassLabel1.get(concept1);
String label2=ClassLabel2.get(concept2);
//可能给出的reference alignment是反的
if(resultClassMap.has_relation(concept1, concept2))
{
/*System.out.println(classesMap.get(i)+" (Right)");
bfw_Result.append(classesMap.get(i)+" (Right)"+"\n");
rightClassNumber++;
resultClassMap.remove(concept1, concept2);*/
System.out.println(label1+","+label2+","+part[2]+" (Right)");
bfw_Result.append(label1+","+label2+","+part[2]+" (Right)"+"\n");
rightClassNumber++;
resultClassMap.remove(concept1, concept2);
}
else if(resultClassMap.has_relation(concept2,concept1))
{
/*System.out.println(classesMap.get(i)+" (Right)");
bfw_Result.append(classesMap.get(i)+" (Right)"+"\n");
rightClassNumber++;
resultClassMap.remove(concept2, concept1);*/
System.out.println(label1+","+label2+","+part[2]+" (Right)");
bfw_Result.append(label1+","+label2+","+part[2]+" (Right)"+"\n");
rightClassNumber++;
resultClassMap.remove(concept1, concept2);
}
else
{
/*System.out.println(classesMap.get(i));
bfw_Result.append(classesMap.get(i)+"\n");
notFoundClassMaps.add(classesMap.get(i));*/
System.out.println(label1+","+label2+","+part[2]);
bfw_Result.append(label1+","+label2+","+part[2]+"\n");
notFoundClassMaps.add(classesMap.get(i));
}
}
if(resultClassMap.size()==0)
{
System.out.println("All the concept pairs are found! ");
bfw_Result.append("All the concept pairs are found! "+"\n");
}
else
{
System.out.println("Concept pairs that was not found:");
bfw_Result.append("Concept pairs that was not found:"+"\n");
ArrayList<String> keySet=resultClassMap.GetKey();
for(int i=0;i<keySet.size();i++)
{
String concept1=keySet.get(i);
ArrayList<String> concepts2=resultClassMap.GetKey_Value(concept1);
String label1=ClassLabel1.get(concept1);
String label2="";
for(int j=0;j<concepts2.size();j++)
{
label2=label2+ClassLabel2.get(concepts2.get(j))+",";
}
label2=label2+"]";
label2.replace(",]", "]");
bfw_Result.append(label1+",["+label2+"\n");
}
}
System.out.println("The number of concept pairs that is right:"+rightClassNumber);
bfw_Result.append("The number of concept pairs that is right:"+rightClassNumber+"\n");
System.out.println("**************************************");
bfw_Result.append("**************************************"+"\n");
ArrayList<String> notFoundPropertyMaps=new ArrayList<String>();//O2的概念
for(int i=0;i<propertiesMap.size();i++)
{
//String part[]=propertiesMap.get(i).split("--");
String part[]=propertiesMap.get(i).split(",");
String property1=part[0].toLowerCase();
String property2=part[1].toLowerCase();
//System.out.println(property1+","+property2);
//可能给出的reference alignment是反的
if(resultPropertyMap.has_relation(property1, property2))
{
System.out.println(part[0]+","+part[1]+","+part[2]+" "+" (Right)");
//System.out.println(propertiesMap.get(i)+" (Right)");
bfw_Result.append(part[0]+","+part[1]+","+part[2]+" "+" (Right)"+"\n");
//bfw_Result.append(propertiesMap.get(i)+" (Right)"+"\n");
rightPropertyNumber++;
resultPropertyMap.remove(property1, property2);
}
else if(resultPropertyMap.has_relation(property2, property1))
{
System.out.println(part[0]+","+part[1]+","+part[2]+" "+" (Right)");
//System.out.println(propertiesMap.get(i)+" (Right)");
bfw_Result.append(part[0]+","+part[1]+","+part[2]+" "+" (Right)"+"\n");
//bfw_Result.append(propertiesMap.get(i)+" (Right)"+"\n");
rightPropertyNumber++;
resultPropertyMap.remove(property2, property1);
}
else
{
System.out.println(part[0]+","+part[1]+","+part[2]);
//System.out.println(propertiesMap.get(i));
bfw_Result.append(part[0]+","+part[1]+","+part[2]+"\n");
//bfw_Result.append(propertiesMap.get(i)+"\n");
notFoundPropertyMaps.add(propertiesMap.get(i));
}
}
if(resultPropertyMap.size()==0)
{
System.out.println("All the property pairs were found!!");
bfw_Result.append("All the property pairs were found! "+"\n");
}
else
{
System.out.println("Property pairs that was not found:");
bfw_Result.append("Property pairs that was not found:"+"\n");
ArrayList<String> result=new ArrayList<String>();
result=resultPropertyMap.Print_Value();
for(String a:result)
{
bfw_Result.append(a+"\n");
}
}
System.out.println("The number of property pairs that is right :"+rightPropertyNumber);
bfw_Result.append("The number of property pairs that is right :"+rightPropertyNumber+"\n");
P=(rightClassNumber+rightPropertyNumber)/(findClassNumbers+findPropertyNumbers);
R=(rightClassNumber+rightPropertyNumber)/(alignmentClassNumbers+alignmentPropertyNumbers);
R=Math.min(R, 1);
if(P==0&&R==0)
F1=0;
else
F1=(2*P*R)/(P+R);
System.out.println("==========================================");
System.out.println("Precision:"+P+" "+" Recall:"+R+" "+" f1-measure:"+F1);
bfw_Result.append("=========================================="+"\n");
bfw_Result.append("Precision:"+P+" "+" Recall:"+R+" "+" f1-measure:"+F1+"\n");
}
}
| [
"[email protected]"
]
| |
e5282bfc90866591f7aeee1fab495e9c11b6b7b8 | 4930718607bf54f6224b71e8c47c0343c10eddbc | /Back end/src/main/java/acs/dal/UserDao.java | 5a81e4369f017d95b8bd782d2017854017b1464c | []
| no_license | ItaiZeilig/Places-Behind-You | cba1a9a4e1995ccb51f6b4792b2d35a3530f09ad | 61b444754a5624ffe3095819e9ba08e93dc1394d | refs/heads/master | 2022-12-12T12:35:19.477409 | 2020-08-20T08:22:25 | 2020-08-20T08:22:25 | 288,948,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package acs.dal;
import java.util.List;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import acs.data.UserEntity;
import acs.data.entityProperties.UserIDEntity;
@Repository
public interface UserDao extends MongoRepository<UserEntity,UserIDEntity>{
public List<UserEntity> findAllByUsername(
@Param("username") String username,
Pageable pageable);
}
| [
"[email protected]"
]
| |
d3491270a93c9c74a328eaac0762609b269350ba | 56e5c42640fb9f34c9888478fc2c613a3a130d15 | /src/main/java/com/shtoone/qms/app/entity/Departxinxi.java | bbc5f24f87acbf8c104908c3fc8a162f0987a860 | []
| no_license | Time-Boat/hntInterface | fc5fc8d2170314b446bab9d48d86b27c0ea8074c | c654fce099bc64ec515edbd265f81a8b97a88dbe | refs/heads/master | 2021-04-29T08:35:13.677809 | 2017-01-12T07:28:08 | 2017-01-12T07:28:08 | 77,673,757 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,584 | java | package com.shtoone.qms.app.entity;
import java.io.Serializable;
@SuppressWarnings("serial")
public class Departxinxi implements Serializable{
private String ID;
private String departname;
private String description;
private String parentdepartid;
private String lft;
private String rgt;
private String departorderid;
private String lng;
private String lat;
private String type;
public String getID() {
return ID;
}
public void setID(String iD) {
ID = iD;
}
public String getDepartname() {
return departname;
}
public void setDepartname(String departname) {
this.departname = departname;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getParentdepartid() {
return parentdepartid;
}
public void setParentdepartid(String parentdepartid) {
this.parentdepartid = parentdepartid;
}
public String getLft() {
return lft;
}
public void setLft(String lft) {
this.lft = lft;
}
public String getRgt() {
return rgt;
}
public void setRgt(String rgt) {
this.rgt = rgt;
}
public String getDepartorderid() {
return departorderid;
}
public void setDepartorderid(String departorderid) {
this.departorderid = departorderid;
}
public String getLng() {
return lng;
}
public void setLng(String lng) {
this.lng = lng;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"[email protected]"
]
| |
fda1e151b6bf83b95604b916c1d8aa82b2da64ac | 7b00bbfc20c89e8ba0398026510a49e29f8ce319 | /src/main/java/com/monetware/ringsurvey/business/pojo/vo/questionnaire/QnaireFileDelVO.java | 0dbcd47b99fef897affa671c296d368efbf2cef4 | []
| no_license | Ayahaiii/ring-survey-api | 31475c3ba43073c5e6fb2ccfef74552b937fb5ba | 1e056e72e26990681be8fdf45afce687515be353 | refs/heads/master | 2023-07-10T08:48:17.378188 | 2021-08-16T07:01:05 | 2021-08-16T07:01:05 | 396,663,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package com.monetware.ringsurvey.business.pojo.vo.questionnaire;
import lombok.Data;
/**
* @author Simo
* @date 2020-04-13
*/
@Data
public class QnaireFileDelVO {
private String fileName;
}
| [
"[email protected]"
]
| |
3dc6c8f998b44feb87fec72f4b46221dd1c8129f | 115c2c44c2b75fb76261d112441e00e467513199 | /Gundan/src/main/java/com/ui/MaintabActivity.java | 53038c71ea5079fe06c0ffa53f5efb5a6387ab4a | []
| no_license | teamCZF/GunDan | dda89c1828fb1c4a220f3ae3e4ea465eb49a8ede | 2e5244bfc88b01cbe09321f4402053aeb3b7cdda | refs/heads/master | 2020-07-01T17:16:06.205007 | 2017-01-02T20:43:26 | 2017-01-02T20:43:26 | 74,268,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | package com.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import com.Data.UserData;
import com.utils.DbUtils;
import java.util.List;
/**
* Created by Administrator on 2016/12/29 0029.
*/
public class MaintabActivity extends Activity{
private String DB_NAME = "GunDan";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DbUtils.createDb(this,DB_NAME);
SharedPreferences sp=getSharedPreferences("userInfo", Activity.MODE_PRIVATE);
String name=sp.getString("USER_NAME","");
String passwd=sp.getString("PASSWORD","");
if (TextUtils.isEmpty(name) && TextUtils.isEmpty(passwd))
{
Intent intent=new Intent(MaintabActivity.this,LoginActivity.class);
startActivity(intent);
}
else
{
List<UserData> list=DbUtils.getQueryByWhere(UserData.class,"userName",new String[]{name});
Intent intent=new Intent(MaintabActivity.this,MainActivity.class);
intent.putExtra("user_data",list.get(0));
startActivity(intent);
finish();
}
}
}
| [
"[email protected]"
]
| |
60623dcb019fb65e59f7588ef632d371c7f490a5 | 2ecfc9104bde47ff6916324dee5c3e1ef44dfe8a | /AoC9a.java | fba4bca1b878c6c7770d82a67947dfcecbf75414 | []
| no_license | benjgibbs/AOC2016 | 9cbfeb87be33c387c659b3c5e9849e4944501b7e | e868153fd3a60641be03b8f6188e9471f3ab9e08 | refs/heads/master | 2021-01-12T10:13:51.922736 | 2016-12-25T09:14:35 | 2016-12-25T09:14:35 | 76,392,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | import java.util.*;
class AoC9a {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
StringBuilder out = new StringBuilder();
int i = 0;
while (i < line.length()) {
if (line.charAt(i) == '(') {
int j = i+4;
while (line.charAt(j) != ')')
j++;
String[] parts = line.substring(i+1, j).split("x");
int n = Integer.parseInt(parts[0]); // this many chars
int m = Integer.parseInt(parts[1]); // this many times
String toRepeat = line.substring(j+1, j+n+1);
for (int k = 0; k < m; k++) {
out.append(toRepeat);
}
i = j+n+1;
} else {
out.append(line.charAt(i));
i++;
}
}
System.out.println("Length: " + out.length());
}
}
}
| [
"[email protected]"
]
| |
0879b27f02361303f988f99ba94b198907b56d97 | 55c99d45af07e5d5d3ff96945983ab95373c37fb | /app/src/main/java/com/theanhdev97/fragment/Presenter/NewTweetFragment/NewTweetFragmentPresenterImpl.java | 89cec1889a89700962d8d44d57d4df450a37dcde | []
| no_license | theanh97/Twitter_MVP | d7bc4536af25307ca5e938d14aea05b88d2c956b | 9fc88e76c1f7414cae265616298424236e3460ab | refs/heads/master | 2021-05-11T16:32:15.642719 | 2018-01-17T03:28:42 | 2018-01-17T03:28:42 | 117,768,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package com.theanhdev97.fragment.Presenter.NewTweetFragment;
import com.theanhdev97.fragment.Interactor.InteractorListener.OnPostNewTweetListener;
import com.theanhdev97.fragment.Interactor.TwitterInteractor;
import com.theanhdev97.fragment.Interactor.TwitterInteractorImpl;
import com.theanhdev97.fragment.View.NewTweetFragment.NewTweetFragment;
import com.theanhdev97.fragment.View.NewTweetFragment.NewTweetFragmentView;
/**
* Created by DELL on 13/01/2018.
*/
public class NewTweetFragmentPresenterImpl implements NewTweetFragmentPresenter {
NewTweetFragmentView mView;
TwitterInteractor mTwitterInteractor;
public NewTweetFragmentPresenterImpl(NewTweetFragment newTweetFragment) {
this.mView = newTweetFragment;
mTwitterInteractor = new TwitterInteractorImpl();
}
@Override
public void onCloseDialogClicked() {
mView.dismissNewTweetDialog();
}
@Override
public void onNewTweetClicked() {
if (mView.isNetworkAvailable()) {
mView.showWaitingProgressDialog();
String tweetContent = mView.getTweetContent();
mTwitterInteractor.postNewTweet(tweetContent, new OnPostNewTweetListener() {
@Override
public void onSuccess() {
mView.dismissWaitingProgressDialog();
mView.callbackTweetSuccessfulToHomeActivity();
mView.dismissNewTweetDialog();
}
@Override
public void onFailure(String error) {
mView.dismissWaitingProgressDialog();
mView.showError(error);
}
});
} else {
mView.showError("");
}
}
}
| [
"[email protected]"
]
| |
dcc310bf0f99f650086a5257a0e2ccdf4e1ea808 | dea18e7c41034fb04bf11d52ae2a86e1e263d71a | /standard-client/generated-service/src/main/java/org/bndly/ebx/client/service/impl/CustomExternalObjectServiceImpl.java | 5ca452aad2be5ef68ab8fc1ee011b0d2a9da608c | [
"Apache-2.0"
]
| permissive | bndly/bndly-ebx | be3288d028a6e6dc79c900a62c95792ecdc7600d | 384179bce2cac1ce55cd3d9ddb6ec12b188f3a78 | refs/heads/master | 2022-11-30T09:14:09.011802 | 2020-08-11T09:28:43 | 2020-08-11T09:28:43 | 281,734,099 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,845 | java | package org.bndly.ebx.client.service.impl;
/*-
* #%L
* org.bndly.ebx.client.generated-service
* %%
* Copyright (C) 2013 - 2020 Cybercon GmbH
* %%
* 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.
* #L%
*/
import org.bndly.common.service.cache.api.CacheKeyParameter;
import org.bndly.common.service.cache.api.CacheLevel;
import org.bndly.common.service.cache.api.Cached;
import org.bndly.ebx.model.ExternalObject;
import org.bndly.ebx.model.impl.ExternalObjectImpl;
import org.bndly.ebx.client.service.api.CustomExternalObjectService;
import org.bndly.common.service.shared.api.ProxyAware;
import org.bndly.ebx.client.service.api.ExternalObjectService;
import org.bndly.rest.client.exception.ClientException;
import org.bndly.rest.client.exception.UnknownResourceClientException;
/**
* Created by alexp on 18.06.15.
*/
public class CustomExternalObjectServiceImpl implements CustomExternalObjectService, ProxyAware<ExternalObjectService> {
private ExternalObjectService thisProxy;
@Override
@Cached(levels = {CacheLevel.APPLICATION})
public ExternalObject assertExternalObjectExists(@CacheKeyParameter("externalIdentifier") String externalIdentifier) throws ClientException {
ExternalObject eo = readByExternalIdentifier(externalIdentifier);
if(eo == null) {
eo = new ExternalObjectImpl();
eo.setIdentifier(externalIdentifier);
eo = thisProxy.create(eo);
}
return eo;
}
@Override
@Cached(levels = {CacheLevel.APPLICATION})
public ExternalObject readById(@CacheKeyParameter("id") long id) throws ClientException {
ExternalObjectImpl o = new ExternalObjectImpl();
o.setId(id);
try {
return thisProxy.find(o);
} catch (UnknownResourceClientException e) {
return null;
}
}
@Override
@Cached(levels = {CacheLevel.APPLICATION})
public ExternalObject readByExternalIdentifier(@CacheKeyParameter("externalIdentifier") String identifier) throws ClientException {
ExternalObject o = new ExternalObjectImpl();
o.setIdentifier(identifier);
try {
return thisProxy.find(o);
} catch (UnknownResourceClientException e) {
return null;
}
}
@Override
public void setThisProxy(ExternalObjectService serviceProxy) {
thisProxy = serviceProxy;
}
}
| [
"[email protected]"
]
| |
bc01af8a61bdec406c5d1748f29e389692e117a7 | 078338447876bde45dcd2584ad13e68ef9a4212c | /src/main/java/com/shibo/demo/designPattern/test1.java | a0239ffb5a9d915edde95c1ccf53c787f9eb8ae5 | []
| no_license | Gegeroufv/testDemo | 7fdebb39dab58a89a6b6f8426e6918263f0349fc | e69e3f86cd51079508eb4f3866045743dd55a106 | refs/heads/master | 2022-07-10T23:19:34.168423 | 2019-07-05T09:47:38 | 2019-07-05T09:47:38 | 194,010,101 | 0 | 0 | null | 2022-06-21T01:21:15 | 2019-06-27T02:38:50 | Java | UTF-8 | Java | false | false | 646 | java | package com.shibo.demo.designPattern;
/**
* 1.开闭原则(对扩展开放,对修改关闭,鼓励使用接口和抽象类)
* 2.里氏替换原则(任何基类可以出现的地方,子类一定可以出现,对实现抽象化的具体步骤的规范)
* 3.依赖倒转原则(面向接口而不是依赖于具体)
* 4.接口隔离原则(多个接口优于单个几口,降低类之间的耦合度)
* 5.最少知道原则(一个实体类应当尽可能少的与其它实体类之间发生作用,模块之间独立)
* 6.合成复用原则(尽量使用合成/聚合的方式,而不是使用继承)
*/
public class test1 {
}
| [
"[email protected]"
]
| |
0d12c1e8adc6edf5cbd4e6957dcf490c85a7e06e | 2cb9b3b6e0ed58ccb6a84afdd174c629d101c553 | /src/myblog/myblog-model/src/main/java/com/truward/myblog/impl/dao/jdbc/layout/DbLayout.java | 81e1ecb7a6254f7ffc9b209416facc9a0d72fd21 | []
| no_license | avshabanov/examples | 6d2ee2247cf597de3e2d8b1d040155579561357f | 98915b67d18f7129c0efefe585d9030470ddd904 | refs/heads/master | 2021-06-13T16:41:34.681605 | 2021-03-14T07:48:38 | 2021-03-14T07:48:38 | 1,865,187 | 1 | 6 | null | 2021-02-21T02:46:19 | 2011-06-08T12:48:26 | Java | UTF-8 | Java | false | false | 4,379 | java | package com.truward.myblog.impl.dao.jdbc.layout;
import java.io.*;
/**
* Determines db layout.
*/
public final class DbLayout {
private static String schema;
public static String getSchema() {
if (schema == null) {
final InputStream inputStream = DbLayout.class.getResourceAsStream("hsqldb_schema.sql");
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final byte[] buffer = new byte[1024];
try {
for (;;) {
final int bytesRead = inputStream.read(buffer);
outputStream.write(buffer, 0, bytesRead);
if (bytesRead < buffer.length) {
break;
}
}
schema = new String(outputStream.toByteArray(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Can't convert source schema file's contents", e);
} catch (IOException e) {
throw new IllegalStateException("Can't read source schema file", e);
}
}
return schema;
}
// table names
public static final String PROFILE_TABLE_NAME = "PROFILE";
public static final String ROLE_TABLE_NAME = "ROLE";
public static final String PROFILE_TO_ROLE_TABLE_NAME = "PROFILE_TO_ROLE";
// column names
public static final String COL_ID = "ID";
public static final String COL_PROFILE_LOGIN = "LOGIN";
public static final String COL_PROFILE_EMAIL = "EMAIL";
public static final String COL_PROFILE_PASSWORD = "PASSWORD";
public static final String COL_PROFILE_CREATED = "CREATED";
public static final String COL_ROLE_NAME = "NAME";
public static final String COL_PROFILE_TO_ROLE_PROFILE_ID = "PROFILE_ID";
public static final String COL_PROFILE_TO_ROLE_ROLE_ID = "ROLE_ID";
// common name for ID parameter
public static final String PAR_ID = "PAR_ID";
//
// parameter names
//
public static final String PAR_PROFILE_ID = "PAR_PROFILE_ID";
public static final String PAR_PROFILE_LOGIN = "PAR_PROFILE_LOGIN";
public static final String PAR_PROFILE_EMAIL = "PAR_PROFILE_EMAIL";
public static final String PAR_PROFILE_PASSWORD = "PAR_PROFILE_PASSWORD";
public static final String PAR_PROFILE_CREATED = "PAR_PROFILE_CREATED";
public static final String PAR_ROLE_NAME = "PAR_ROLE_NAME";
//
// queries
//
//
// public static final String INSERT_PROFILE_QUERY = "insert into PROFILE(LOGIN, EMAIL, PASSWORD, CREATED)\n" +
// "values (:PAR_PROFILE_LOGIN, :PAR_PROFILE_EMAIL, :PAR_PROFILE_PASSWORD, now())";
public static final String GET_PROFILES_QUERY = "select\n" +
" ID as PAR_ID, LOGIN as PAR_PROFILE_LOGIN, EMAIL as PAR_PROFILE_EMAIL,\n" +
" PASSWORD as PAR_PROFILE_PASSWORD, CREATED as PAR_PROFILE_CREATED\n" +
" from PROFILE order by CREATED";
public static final String GET_PROFILE_BY_LOGIN_QUERY = "select\n" +
" ID as PAR_ID, LOGIN as PAR_PROFILE_LOGIN, EMAIL as PAR_PROFILE_EMAIL,\n" +
" PASSWORD as PAR_PROFILE_PASSWORD, CREATED as PAR_PROFILE_CREATED\n" +
" from PROFILE where LOGIN = :PAR_PROFILE_LOGIN";
public static final String UPDATE_PROFILE_QUERY = "update PROFILE set\n" +
" LOGIN = :PAR_PROFILE_LOGIN, EMAIL = :PAR_PROFILE_EMAIL,\n" +
" PASSWORD = :PAR_PROFILE_PASSWORD\n" +
"where ID = :PAR_ID";
public static final String REMOVE_PROFILE_QUERY = "delete from PROFILE where ID = :PAR_ID";
public static final String GET_ROLE_BY_NAME_QUERY = "select\n" +
" ID as PAR_ID, NAME as PAR_ROLE_NAME\n" +
"from ROLE where NAME = :PAR_ROLE_NAME";
public static final String GET_ROLES_FOR_PROFILE_QUERY = "select\n" +
" R.ID as PAR_ID, R.NAME as PAR_ROLE_NAME\n" +
"from PROFILE_TO_ROLE as PR\n" +
"inner join ROLE as R on R.ID = PR.ROLE_ID and PR.PROFILE_ID = :PAR_PROFILE_ID";
public static final String REMOVE_PROFILE_ROLES_QUERY = "delete from PROFILE_TO_ROLE\n" +
"where PROFILE_ID = :PAR_PROFILE_ID";
/**
* Hidden constructor.
*/
private DbLayout() {}
}
| [
"[email protected]"
]
| |
4a6485eb044ea7cb3161bd7ffede23dcf2c20daf | bfc60444deb0977ac6d964d2e73d57998439ac0f | /6semestr/Rozprochy/Jan_Gorski_4/generated/lab/TelePrx.java | 73ef47797a588360aa5a5a0b19295899883db026 | []
| no_license | nagrael/first_degree | 2522874bb8427168fadc9c0e39977f237940abf6 | b712e90a15bfe98df5e77fd7ba8454e1b56d028d | refs/heads/master | 2020-03-07T05:04:51.595178 | 2018-03-29T12:33:53 | 2018-03-29T12:33:53 | 127,285,167 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,896 | java | // **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// Ice version 3.6.3
//
// <auto-generated>
//
// Generated from file `lab.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package lab;
public interface TelePrx extends EquipmentPrx
{
public int move(int x, int y, int z);
public int move(int x, int y, int z, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_move(int x, int y, int z);
public Ice.AsyncResult begin_move(int x, int y, int z, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_move(int x, int y, int z, Ice.Callback __cb);
public Ice.AsyncResult begin_move(int x, int y, int z, java.util.Map<String, String> __ctx, Ice.Callback __cb);
public Ice.AsyncResult begin_move(int x, int y, int z, Callback_Tele_move __cb);
public Ice.AsyncResult begin_move(int x, int y, int z, java.util.Map<String, String> __ctx, Callback_Tele_move __cb);
public Ice.AsyncResult begin_move(int x,
int y,
int z,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
public Ice.AsyncResult begin_move(int x,
int y,
int z,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
public Ice.AsyncResult begin_move(int x,
int y,
int z,
java.util.Map<String, String> __ctx,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
public Ice.AsyncResult begin_move(int x,
int y,
int z,
java.util.Map<String, String> __ctx,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
public int end_move(Ice.AsyncResult __result);
public int zoom(int zo);
public int zoom(int zo, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_zoom(int zo);
public Ice.AsyncResult begin_zoom(int zo, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_zoom(int zo, Ice.Callback __cb);
public Ice.AsyncResult begin_zoom(int zo, java.util.Map<String, String> __ctx, Ice.Callback __cb);
public Ice.AsyncResult begin_zoom(int zo, Callback_Tele_zoom __cb);
public Ice.AsyncResult begin_zoom(int zo, java.util.Map<String, String> __ctx, Callback_Tele_zoom __cb);
public Ice.AsyncResult begin_zoom(int zo,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
public Ice.AsyncResult begin_zoom(int zo,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
public Ice.AsyncResult begin_zoom(int zo,
java.util.Map<String, String> __ctx,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
public Ice.AsyncResult begin_zoom(int zo,
java.util.Map<String, String> __ctx,
IceInternal.Functional_IntCallback __responseCb,
IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
public int end_zoom(Ice.AsyncResult __result);
}
| [
"[email protected]"
]
| |
291de0c4dacab7508482187268ff23642e71e1dc | 6dbc091c80bd30fb5d7607c4e646620f1cebcac6 | /src/main/java/com/baojk/we/vo/SimpleArticlePageVO.java | 14b90a9ad0d0a5f8bf7fabbb7f24d69c32ecd07c | []
| no_license | BobWr/we | 0ec53a072a915e4372d7e5d7129aea8194212f4c | 39114f7c6edf898da7ff811add2905b906f3ffb2 | refs/heads/master | 2020-04-01T19:48:07.484056 | 2018-12-25T05:56:52 | 2018-12-25T05:56:52 | 153,571,992 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | package com.baojk.we.vo;
import com.baojk.we.base.Page;
import lombok.Data;
/**
* @author baojikui ([email protected])
* @date 2018/10/18
*/
@Data
public class SimpleArticlePageVO {
private Page<SimpleArticleVO> page;
}
| [
"[email protected]"
]
| |
5517ad1617b3dc3e4b3a823cf4a61f235c5555f1 | ada8baa7f9756ac879a6f941b7c2a9a65ea75c3e | /android-sdk/realtime-sample-app/src/main/java/cn/leancloud/realtime_sample_app/MyApplication.java | 13a02a28a887d4d576038751c26d83ba390025d7 | [
"Apache-2.0"
]
| permissive | PurpleMoonlight/java-unified-sdk | 24adf078ee8ab36755241c0cf90472f92d349c15 | a50c28bcb738000e9df69f6c60582fc60ac277be | refs/heads/master | 2020-08-08T04:49:40.411272 | 2019-10-08T13:48:40 | 2019-10-08T13:48:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,291 | java | package cn.leancloud.realtime_sample_app;
import android.app.Application;
import android.os.StrictMode;
import cn.leancloud.AVInstallation;
import cn.leancloud.AVLogger;
import cn.leancloud.AVOSCloud;
import cn.leancloud.AVObject;
import cn.leancloud.push.PushService;
import cn.leancloud.utils.LogUtil;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
/**
* Created by fengjunwen on 2018/8/9.
*/
public class MyApplication extends Application {
private static final AVLogger LOGGER = LogUtil.getLogger(MyApplication.class);
private static final String APPID = "dYRQ8YfHRiILshUnfFJu2eQM-gzGzoHsz";
private static final String APPKEY = "ye24iIK6ys8IvaISMC4Bs5WK";
private static final String APP_SERVER_HOST = "https://dyrq8yfh.lc-cn-n1-shared.com";
@Override
public void onCreate() {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectNetwork() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
super.onCreate();
AVOSCloud.setLogLevel(AVLogger.Level.DEBUG);
AVOSCloud.initialize(this, APPID, APPKEY, APP_SERVER_HOST);
LOGGER.d("onCreate in thread:" + this.getMainLooper().getThread().getId());
AVInstallation currentInstallation = AVInstallation.getCurrentInstallation();
currentInstallation.saveInBackground().subscribe(new Observer<AVObject>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(AVObject avObject) {
LOGGER.d("saveInstallation response in thread:" + Thread.currentThread().getId());
System.out.println("succeed to save Installation. result: " + avObject);
}
@Override
public void onError(Throwable e) {
LOGGER.d("saveInstallation response in thread:" + Thread.currentThread().getId());
System.out.println("failed to save Installation. cause:" + e.getMessage());
}
@Override
public void onComplete() {
}
});
PushService.setDefaultPushCallback(this, MainActivity.class);
}
}
| [
"[email protected]"
]
| |
0f80cee03370d7dd4355fab29e874be3f58c2c9c | f81d89310657440b4e8a36baa7195cbfae78dcc2 | /src/lab5/calculator/LogicalOp.java | 94b7f071160f9747395069ae84a8029b6a08787d | []
| no_license | Paulh19/primuljava | 88be527690d3116b35b057dce3f44d26f355f8f2 | 17a78cd96bebfce0a2691dc677384343a53d0786 | refs/heads/master | 2020-12-07T06:00:55.430186 | 2020-02-26T19:35:50 | 2020-02-26T19:35:50 | 232,651,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,737 | java | package lab5.calculator;
public class LogicalOp {
public int[] arrayToTen() {
int[] array = new int[10];
for (int i = 1; i <= 10; i++) {
array[i - 1] = i;
}
return array;
}
public void printArray(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print("a["+i+"]= "+array[i]+", ");
}
System.out.println();
}
public float averageOfArray(int[] array) {
float sum = 0;
for (int i = 0; i < array.length; i++) {
sum += array[i];
}
return sum/array.length;
}
public int adunare(int a, int b) {
int adunare = a + b;
return adunare;
}
public float adunare (float a, float b){
float adunare = a + b;
return adunare;
}
public int adunare(int a, int b, int c) {
int adunare = a + b + c;
return adunare;
}
public float adunare(float a, int b) {
float adunare = a + b;
return adunare;
}
public short scadere(short a, short b) {
short scadere = (short) (a - b);
return scadere;
}
public double scadere(double a, double b) {
double scadere = a - b;
return scadere;
}
public double scadere(int a, double b) {
double scadere = a - b;
return scadere;
}
public long inmultire(long a, long b) {
long inmultire = (long) (a * b);
return inmultire;
}
public int inmultire(int a, int b, int c) {
int inmultire = a * b*c;
return inmultire;
}
public float inmultire(float a, int b) {
float inmultire = a * b;
return inmultire;
}
public float inmultire(float a, float b) {
float inmultire = a * b;
return inmultire;
}
public double impartire(double a, double b) {
double impartire = a / b;
return impartire;
}
public int impartire(int a, int b) {
int impartire = a / b;
return impartire;
}
public double impartire(double a, double b,double c) {
double impartire = a / b/c;
return impartire;
}
public int[] arrayToHundred() {
int[] array = new int[100];
for (int i = 1; i <= 100; i++) {
array[i - 1] = i;
}
return array;
}
public int[] arrayToGivenLength(int n) {
int[] array = new int[n];
for (int i = 1; i <= n; i++) {
array[i - 1] = 0;
}
return array;
}
public int[] populare(int[] array){
for (int i = 1; i <=array.length; i++) {
array[i - 1] = 2*i;
}
return array;
}
public void printArray(String[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print("a["+i+"]= "+array[i]+", ");
}
System.out.println();
}
public boolean findStringInArray (String[] array, String text){
boolean x=false;
for (int i=0; i<array.length; i++){
if (array[i].equals(text)) {
x= true;
}
}
return x;
}
public int verifyIfNumberINArray( int []array, int number){
int pozition= -1;
for (int i=0; i<array.length; i++){
if (array[i]==number) {
pozition= i;
}
}
return pozition;
}
public void afis_(){
String [][] a= new String[10][10];
for (int i=0; i<10;i++){
for (int j=0; j<10;j++){
System.out.print("_ ");
}
System.out.println();
}
}
public int[] removeNumberFromArray(int [] array, int number){
int j=0;
for (int i=0; i<array.length; i++){
if (array[i]!=number){
j++;
}
}
int [] mArray= new int[j];
j=0;
for (int i=0; i<array.length;i++) {
if (array[i] != number) {
mArray[j] = array[i];
j++;
}
}
return mArray;
}
public int secondSmallestNumber(int[] array){
int max=0;
for (int i=0; i<array.length;i++) {
if (array[i] > max) {
max = array[i];
}
}
int smallest=max;
if (array.length<=1){
System.out.println("The array is to short");
}
int secondSmallest=array[0];
for (int i=0; i<array.length;i++) {
if (array[i] < smallest) {
secondSmallest = smallest;
smallest = array[i];
} else if (array[i] < secondSmallest && array[i] != smallest) {
secondSmallest = array[i];
}
}
return secondSmallest;
/* Al doilea cel mai mic, se mai poate face si prin alte metode.
1. Ordonarea sirului print-o bucla while si a variabila booleana care opreste bucla cand sirul este ordonat.
Odata sirul ordonat se afiseaza a doua(sau penultima, depinde cum este ordonat sirul) variabila.
2. Se parcurge odata sirul integistrand cea mai mica valoare.
Se elimina cea mai mica valoare (se poate folosi removeNumberFromArray(int [] array, int number)).
Se mai parcurge odata sirul si se afiseaza cea mai mica valoare.
*/
}
public int [] copyArray (int [] array, int [] anotherArray){
if (array.length<anotherArray.length){
System.out.println("The length of the first array needs to be at least the size of the empty array");
}
for (int i=0; i<array.length; i++){
anotherArray[i]=array[i];
}
return anotherArray;
}
}
| [
"[email protected]"
]
| |
cf56eec266953bf180b5c27c95042c4038b9ee8e | e5b596bede1896d4b73b05422233921fce2985b3 | /2xg Server/src/server/model/players/Curse.java | 73a670c17a9686ff62b41f7a0b07f904d5848540 | []
| no_license | Monsterray/2xG-Server | 2d8857507bc2f1b4d42639f96d1fd9b24045197e | 9b82c8340bdc99848dece3c64064379289e98866 | refs/heads/master | 2021-01-20T08:07:35.985758 | 2017-05-03T02:57:20 | 2017-05-03T02:57:20 | 90,101,451 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 9,442 | java | package server.model.players;
import server.Config;
public class Curse {
public int[] def = {13, 19};
public int[] str = {14, 19};
public int[] atk = {1, 10, 19};
public int[] rng = {2, 11, 19};
public int[] mge = {3, 12, 19};
public int[] sprt = {4, 16};//spirit
boolean deactive = false;
private Client c;
public Curse(Client c) {
this.c = c;
}
public void resetCurse() {
for(int p = 0; p < c.curseActive.length; p++) {
c.curseActive[p] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
}
c.headIcon = -1;
c.getPA().requestUpdates();
}
public void deactivateLeeches() {
if(c.curseActive[13]) {
c.curseDefence -= 5;
}
if(c.curseActive[10]) {
c.curseAttack -= 5;
}
if(c.curseActive[12]) {
c.curseMagic -= 5;
}
if(c.curseActive[11]) {
c.curseRange -= 5;
}
if(c.curseActive[14]) {
c.curseStrength -= 5;
}
}
public void prayDrop() {
if (c.playerLevel[5] == 0) {
c.curseDefence = 0;
c.curseStrength = 0;
c.curseAttack = 0;
c.curseMagic = 0;
c.curseRange = 0;
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
}
}
public void curseStat(int curseId) {
switch(curseId) {
case 19:
if(!c.curseActive[19]) {
turmBonus();
}else {
deactivateTurmoil();
}
//deactivateLeeches();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
prayDrop();
break;
case 10:
deactivateTurmoil();
if(!c.curseActive[10]) {
c.curseAttack += 5;
}else if (c.curseActive[10] == false) {
c.curseAttack -= 5;
}
prayDrop();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
break;
case 11:
deactivateTurmoil();
if(!c.curseActive[11]) {
c.curseRange += 5;
}else if (c.curseActive[11] == false) {
c.curseRange -= 5;
}
prayDrop();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
break;
case 12:
deactivateTurmoil();
if(!c.curseActive[12]) {
c.curseMagic += 5;
}else if (c.curseActive[12]) {
c.curseMagic -= 5;
}
prayDrop();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
break;
case 14:
deactivateTurmoil();
if(!c.curseActive[14]) {
c.curseStrength += 5;
}else if (c.curseActive[14]) {
c.curseStrength -= 5;
}
prayDrop();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
break;
case 13:
deactivateTurmoil();
if(!c.curseActive[13]) {
c.curseDefence += 5;
}else if (c.curseActive[13]) {
c.curseDefence -= 5;
}
prayDrop();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
break;
case 15:
case 16:
case 17:
case 18:
deactivateLeeches();
deactivateTurmoil();
prayDrop();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
break;
}
}
public void turmBonus() {
if (c.curseActive[19] == false) {
c.curseDefence = 0;
c.curseStrength = 0;
c.curseAttack = 0;
deactive = false;
}else if (c.inCombat == true && deactive == false) {
c.curseDefence = 30;
c.curseStrength = 33;
c.curseAttack = 30;
} else if (c.inCombat == false && deactive == false) {
c.curseDefence = 15;
c.curseStrength = 23;
c.curseAttack = 15;
}
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
}
public void deactivateTurmoil() {
if(c.curseActive[19]) {
deactive = true;
turmBonus();
}
}
public void strCurse(int i) {
for (int j = 0; j < str.length; j++) {
if (str[j] != i) {
c.curseActive[str[j]] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[str[j]], 0);
}
}
}
public void atkCurse(int i) {
for (int j = 0; j < atk.length; j++) {
if (atk[j] != i) {
c.curseActive[atk[j]] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[atk[j]], 0);
}
}
}
public void defCurse(int i) {
for (int j = 0; j < def.length; j++) {
if (def[j] != i) {
c.curseActive[def[j]] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[def[j]], 0);
}
}
}
public void rngCurse(int i) {
for (int j = 0; j < rng.length; j++) {
if (rng[j] != i) {
c.curseActive[rng[j]] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[rng[j]], 0);
}
}
}
public void mgeCurse(int i) {
for (int j = 0; j < mge.length; j++) {
if (mge[j] != i) {
c.curseActive[mge[j]] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[mge[j]], 0);
}
}
}
public void sprtCurse(int i) {
for (int j = 0; j < sprt.length; j++) {
if (sprt[j] != i) {
c.curseActive[sprt[j]] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[sprt[j]], 0);
}
}
}
public void activateCurse(int i) {
if(c.duelRule[7]) {
resetCurse();
c.sendMessage("Prayer has been disabled in this duel!");
return;
}
if (c.playerLevel[1] < 30) {
c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
c.sendMessage("You need 30 Defence to use this prayer.");
return;
}
if (c.inBarbDef) {
c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
c.sendMessage("The barbarians are strongly against the use of prayers!");
return;
}
//0 = pItem//1 = sapWar//2 = sapRng//3 = sapMge//4 = sapSprt
//5 = berserk//6 = defSum//7 = defMge//8 = defRng//9 = defMel
//10 = leechAtk//11 = leechRng//12 = leechMge//13 = leechDef//14 = leechStr
//15 = leechEnrgy//16 = leechSpec//17 = wrath//18 = soul//19 = turmoil
if(c.playerLevel[5] > 0 || !Config.PRAYER_POINTS_REQUIRED) {
if(c.getPA().getLevelForXP(c.playerXP[5]) >= c.CURSE_LEVEL_REQUIRED[i] || !Config.PRAYER_LEVEL_REQUIRED) {
boolean headIcon = false;
switch(i) {
case 0:
if(c.prayerActive[10] == false) {
c.startAnimation(12567);
c.gfx0(2213);
c.prayerActive[10] = true;
c.lastProtItem = System.currentTimeMillis();
} else {
c.prayerActive[10] = false;
}
break;
//case 1:
case 10:
if (c.curseActive[i] == false) {
atkCurse(i); //
}
break;
case 2:
case 11:
if (c.curseActive[i] == false) {
rngCurse(i); //
}
break;
case 3:
case 12:
if (c.curseActive[i] == false) {
mgeCurse(i); //
}
break;
case 4:
case 16:
if (c.curseActive[i] == false) {
sprtCurse(i); //
}
break;
case 5:
if(c.prayerActive[5] == false) {
c.startAnimation(12589);
c.gfx0(2266);
c.prayerActive[5] = true;
} else {
c.prayerActive[5] = false;
}
break;
case 13:
if (c.curseActive[i] == false) {
defCurse(i); //
}
break;
case 14:
if (c.curseActive[i] == false) {
strCurse(i); //
}
break;
case 6:
case 7:
case 8:
case 9:
if(System.currentTimeMillis() - c.stopPrayerDelay < 5000) {
c.sendMessage("You have been injured and can't use this prayer!");
c.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
c.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
c.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
return;
}
if (i == 7)
c.protMageDelay = System.currentTimeMillis();
else if (i == 8)
c.protRangeDelay = System.currentTimeMillis();
else if (i == 9)
c.protMeleeDelay = System.currentTimeMillis();
case 17:
case 18:
headIcon = true;
for(int p = 6; p < 19; p++) {
if(i != p && p != 10 && p != 11 && p != 10 && p != 12 && p != 13 && p != 14 && p != 15 && p != 16) {
c.curseActive[p] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
}
}
break;
case 19:
if (c.curseActive[i] == false) {
c.startAnimation(12565);
c.gfx0(2226);
strCurse(i);
atkCurse(i);
defCurse(i);
mgeCurse(i);
rngCurse(i);
}
break;
}
if(!headIcon) {
if(c.curseActive[i] == false) {
c.curseActive[i] = true;
c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);
} else {
c.curseActive[i] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
}
} else {
if(c.curseActive[i] == false) {
c.curseActive[i] = true;
c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);
c.headIcon = c.CURSE_HEAD_ICONS[i];
c.getPA().requestUpdates();
} else {
c.curseActive[i] = false;
c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
c.headIcon = -1;
c.getPA().requestUpdates();
}
}
} else {
c.getPA().sendFrame36(c.CURSE_GLOW[i],0);
c.getPA().sendFrame126("You need a @blu@Prayer level of "+c.CURSE_LEVEL_REQUIRED[i]+" to use "+c.CURSE_NAME[i]+".", 357);
c.getPA().sendFrame126("Click here to continue", 358);
c.getPA().sendFrame164(356);
}
} else {
c.getPA().sendFrame36(c.CURSE_GLOW[i],0);
c.sendMessage("You have run out of Prayer points!");
c.sendMessage("You can recharge at an altar.");
}
}
}
| [
"[email protected]"
]
| |
ad96eb13384478b614148f66c961039da0ff55ed | 18e1994ac51186ecea056597378054a4bd3f39ce | /src/main/java/com/sell/pojo/OrderMasterExample.java | 454c6626b0d068d7df596772cadd1684258a190d | []
| no_license | springboot-wxsell/weixin_sell | e8bf61acd89f1424a290b41cc2aa60f9c4453d9c | 4a3b992478f4ed2e992cb916758e606d91487555 | refs/heads/master | 2020-04-10T20:07:49.520220 | 2019-01-31T06:03:17 | 2019-01-31T06:03:17 | 161,257,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,175 | java | package com.sell.pojo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class OrderMasterExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OrderMasterExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andOrderIdIsNull() {
addCriterion("order_id is null");
return (Criteria) this;
}
public Criteria andOrderIdIsNotNull() {
addCriterion("order_id is not null");
return (Criteria) this;
}
public Criteria andOrderIdEqualTo(String value) {
addCriterion("order_id =", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotEqualTo(String value) {
addCriterion("order_id <>", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThan(String value) {
addCriterion("order_id >", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThanOrEqualTo(String value) {
addCriterion("order_id >=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThan(String value) {
addCriterion("order_id <", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThanOrEqualTo(String value) {
addCriterion("order_id <=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLike(String value) {
addCriterion("order_id like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotLike(String value) {
addCriterion("order_id not like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdIn(List<String> values) {
addCriterion("order_id in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotIn(List<String> values) {
addCriterion("order_id not in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdBetween(String value1, String value2) {
addCriterion("order_id between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotBetween(String value1, String value2) {
addCriterion("order_id not between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andBuyerNameIsNull() {
addCriterion("buyer_name is null");
return (Criteria) this;
}
public Criteria andBuyerNameIsNotNull() {
addCriterion("buyer_name is not null");
return (Criteria) this;
}
public Criteria andBuyerNameEqualTo(String value) {
addCriterion("buyer_name =", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotEqualTo(String value) {
addCriterion("buyer_name <>", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameGreaterThan(String value) {
addCriterion("buyer_name >", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameGreaterThanOrEqualTo(String value) {
addCriterion("buyer_name >=", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameLessThan(String value) {
addCriterion("buyer_name <", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameLessThanOrEqualTo(String value) {
addCriterion("buyer_name <=", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameLike(String value) {
addCriterion("buyer_name like", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotLike(String value) {
addCriterion("buyer_name not like", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameIn(List<String> values) {
addCriterion("buyer_name in", values, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotIn(List<String> values) {
addCriterion("buyer_name not in", values, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameBetween(String value1, String value2) {
addCriterion("buyer_name between", value1, value2, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotBetween(String value1, String value2) {
addCriterion("buyer_name not between", value1, value2, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerPhoneIsNull() {
addCriterion("buyer_phone is null");
return (Criteria) this;
}
public Criteria andBuyerPhoneIsNotNull() {
addCriterion("buyer_phone is not null");
return (Criteria) this;
}
public Criteria andBuyerPhoneEqualTo(String value) {
addCriterion("buyer_phone =", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneNotEqualTo(String value) {
addCriterion("buyer_phone <>", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneGreaterThan(String value) {
addCriterion("buyer_phone >", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneGreaterThanOrEqualTo(String value) {
addCriterion("buyer_phone >=", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneLessThan(String value) {
addCriterion("buyer_phone <", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneLessThanOrEqualTo(String value) {
addCriterion("buyer_phone <=", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneLike(String value) {
addCriterion("buyer_phone like", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneNotLike(String value) {
addCriterion("buyer_phone not like", value, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneIn(List<String> values) {
addCriterion("buyer_phone in", values, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneNotIn(List<String> values) {
addCriterion("buyer_phone not in", values, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneBetween(String value1, String value2) {
addCriterion("buyer_phone between", value1, value2, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerPhoneNotBetween(String value1, String value2) {
addCriterion("buyer_phone not between", value1, value2, "buyerPhone");
return (Criteria) this;
}
public Criteria andBuyerAddressIsNull() {
addCriterion("buyer_address is null");
return (Criteria) this;
}
public Criteria andBuyerAddressIsNotNull() {
addCriterion("buyer_address is not null");
return (Criteria) this;
}
public Criteria andBuyerAddressEqualTo(String value) {
addCriterion("buyer_address =", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressNotEqualTo(String value) {
addCriterion("buyer_address <>", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressGreaterThan(String value) {
addCriterion("buyer_address >", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressGreaterThanOrEqualTo(String value) {
addCriterion("buyer_address >=", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressLessThan(String value) {
addCriterion("buyer_address <", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressLessThanOrEqualTo(String value) {
addCriterion("buyer_address <=", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressLike(String value) {
addCriterion("buyer_address like", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressNotLike(String value) {
addCriterion("buyer_address not like", value, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressIn(List<String> values) {
addCriterion("buyer_address in", values, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressNotIn(List<String> values) {
addCriterion("buyer_address not in", values, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressBetween(String value1, String value2) {
addCriterion("buyer_address between", value1, value2, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerAddressNotBetween(String value1, String value2) {
addCriterion("buyer_address not between", value1, value2, "buyerAddress");
return (Criteria) this;
}
public Criteria andBuyerOpenidIsNull() {
addCriterion("buyer_openid is null");
return (Criteria) this;
}
public Criteria andBuyerOpenidIsNotNull() {
addCriterion("buyer_openid is not null");
return (Criteria) this;
}
public Criteria andBuyerOpenidEqualTo(String value) {
addCriterion("buyer_openid =", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidNotEqualTo(String value) {
addCriterion("buyer_openid <>", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidGreaterThan(String value) {
addCriterion("buyer_openid >", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidGreaterThanOrEqualTo(String value) {
addCriterion("buyer_openid >=", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidLessThan(String value) {
addCriterion("buyer_openid <", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidLessThanOrEqualTo(String value) {
addCriterion("buyer_openid <=", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidLike(String value) {
addCriterion("buyer_openid like", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidNotLike(String value) {
addCriterion("buyer_openid not like", value, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidIn(List<String> values) {
addCriterion("buyer_openid in", values, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidNotIn(List<String> values) {
addCriterion("buyer_openid not in", values, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidBetween(String value1, String value2) {
addCriterion("buyer_openid between", value1, value2, "buyerOpenid");
return (Criteria) this;
}
public Criteria andBuyerOpenidNotBetween(String value1, String value2) {
addCriterion("buyer_openid not between", value1, value2, "buyerOpenid");
return (Criteria) this;
}
public Criteria andOrderAmountIsNull() {
addCriterion("order_amount is null");
return (Criteria) this;
}
public Criteria andOrderAmountIsNotNull() {
addCriterion("order_amount is not null");
return (Criteria) this;
}
public Criteria andOrderAmountEqualTo(BigDecimal value) {
addCriterion("order_amount =", value, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountNotEqualTo(BigDecimal value) {
addCriterion("order_amount <>", value, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountGreaterThan(BigDecimal value) {
addCriterion("order_amount >", value, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("order_amount >=", value, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountLessThan(BigDecimal value) {
addCriterion("order_amount <", value, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountLessThanOrEqualTo(BigDecimal value) {
addCriterion("order_amount <=", value, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountIn(List<BigDecimal> values) {
addCriterion("order_amount in", values, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountNotIn(List<BigDecimal> values) {
addCriterion("order_amount not in", values, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("order_amount between", value1, value2, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderAmountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("order_amount not between", value1, value2, "orderAmount");
return (Criteria) this;
}
public Criteria andOrderStatusIsNull() {
addCriterion("order_status is null");
return (Criteria) this;
}
public Criteria andOrderStatusIsNotNull() {
addCriterion("order_status is not null");
return (Criteria) this;
}
public Criteria andOrderStatusEqualTo(Byte value) {
addCriterion("order_status =", value, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusNotEqualTo(Byte value) {
addCriterion("order_status <>", value, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusGreaterThan(Byte value) {
addCriterion("order_status >", value, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("order_status >=", value, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusLessThan(Byte value) {
addCriterion("order_status <", value, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusLessThanOrEqualTo(Byte value) {
addCriterion("order_status <=", value, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusIn(List<Byte> values) {
addCriterion("order_status in", values, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusNotIn(List<Byte> values) {
addCriterion("order_status not in", values, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusBetween(Byte value1, Byte value2) {
addCriterion("order_status between", value1, value2, "orderStatus");
return (Criteria) this;
}
public Criteria andOrderStatusNotBetween(Byte value1, Byte value2) {
addCriterion("order_status not between", value1, value2, "orderStatus");
return (Criteria) this;
}
public Criteria andPayStatusIsNull() {
addCriterion("pay_status is null");
return (Criteria) this;
}
public Criteria andPayStatusIsNotNull() {
addCriterion("pay_status is not null");
return (Criteria) this;
}
public Criteria andPayStatusEqualTo(Byte value) {
addCriterion("pay_status =", value, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusNotEqualTo(Byte value) {
addCriterion("pay_status <>", value, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusGreaterThan(Byte value) {
addCriterion("pay_status >", value, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("pay_status >=", value, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusLessThan(Byte value) {
addCriterion("pay_status <", value, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusLessThanOrEqualTo(Byte value) {
addCriterion("pay_status <=", value, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusIn(List<Byte> values) {
addCriterion("pay_status in", values, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusNotIn(List<Byte> values) {
addCriterion("pay_status not in", values, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusBetween(Byte value1, Byte value2) {
addCriterion("pay_status between", value1, value2, "payStatus");
return (Criteria) this;
}
public Criteria andPayStatusNotBetween(Byte value1, Byte value2) {
addCriterion("pay_status not between", value1, value2, "payStatus");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
]
| |
8e920c488e43f9653bed29a162c7c55423b1c24d | 1d856d9a63660a452334e221fbfc2a4d5a00b895 | /Lichee003 Maven Webapp/src/main/java/me/lichee/dao/BaseDao.java | 7bf7854d77138968786331e511e80843a34d1cbd | []
| no_license | PengWei-Dai/Lichee | 379463438b5cc1ba8e648b01c508de14510a210a | d9f103a478f19f103e6c31b28749e4be4eb7c0e8 | refs/heads/master | 2021-01-19T16:26:47.598394 | 2014-11-04T13:45:03 | 2014-11-04T13:45:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package me.lichee.dao;
public interface BaseDao<T> {
/**
* 查找
*/
public T findEntity(String hql , Object args);
/*
* 增加
*/
public void saveEntity(T entity);
/**
* 删除
*/
public void deleltEntity(T entity);
/*
* 更新
*/
public void updateEntity(T entity);
}
| [
"[email protected]"
]
| |
c1fdcdd7def23e1c197ab069428295ddeb2cf83c | ea413c65eed9642d782f6be8b5b1ca715382ca9f | /src/compiler/ir/MemoryRead.java | dcf8974701f1801d71fa01cf92b80753288ab58d | []
| no_license | volzkzg/Mx | 9aed5495cf2d348b3cc4c0fb804c326cd6865d39 | 08790dec297cc19ed2ea656c472bd49d80137f95 | HEAD | 2016-09-14T08:14:01.357045 | 2016-05-01T16:51:39 | 2016-05-01T16:51:39 | 56,956,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | package compiler.ir;
/**
* Created by bluesnap on 16/4/28.
*/
public class MemoryRead extends Quadruple {
public Address dest, src;
public IntegerConst offset;
public int size;
public MemoryRead() {
dest = null;
src = null;
offset = null;
size = 4;
}
public MemoryRead(Address dest, Address src, IntegerConst offset) {
this.dest = dest;
this.offset = offset;
this.src = src;
this.size = 4;
}
public MemoryRead(Address dest, MemoryAddress memoryAddress) {
this.dest = dest;
this.offset = memoryAddress.offset;
this.src = memoryAddress.start;
this.size = 4;
}
public String print() {
String ret = dest.print() + " = " + "load" + " " + "4" + " " + src.print() + " " + offset.print();
return ret;
}
}
| [
"[email protected]"
]
| |
491dd8349b8b0fa0fe2989588b94d22e7988ea6f | 997d49e8e75e6d5d7e89e7f7b76d08d396354653 | /src/com/dhiva/ArraysAndStrings/FindAllPalindromesInString.java | fdcb2fb4c4da3881066d570f6f0929f9036236cb | []
| no_license | dhivashini/Interview | d180dd6fd739ebb819aa7da887710d439a32c253 | 3e56f940047f27fff9aa862e013c7666bc835b79 | refs/heads/master | 2020-04-10T22:48:40.568654 | 2017-06-12T01:20:03 | 2017-06-12T01:20:03 | 68,260,177 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,126 | java | package com.dhiva.ArraysAndStrings;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
public class FindAllPalindromesInString {
// static ArrayList<String> list = new ArrayList<>();
//
// public static ArrayList<String> findPalindromes(String input) {
// return findpalindromesUtil("", input);
// }
//
// public static ArrayList<String> findpalindromesUtil(String seen, String input) {
// if (input.isEmpty()) {
// String newSeen = seen;
// StringBuilder s = new StringBuilder(newSeen);
// if(s.reverse().toString().equals(seen))
// list.add(seen);
// return list;
// }
// findpalindromesUtil(seen + input.charAt(0), input.substring(1));
// findpalindromesUtil(seen, input.substring(1));
// return list;
// }
public static int findCount(String input) {
Set<String> set = new HashSet<String>();
int[][] countMatrix = new int[input.length()][input.length()];
int maxLen = 1;
for (int i = 0; i < input.length() - 1; i++) {
countMatrix[i][i] = 1;
// if(!set.contains(input.charAt(i)))
// set.add(String.valueOf(input.charAt(i)));
}
for (int i = 0; i < input.length() - 1; i++) {
if (input.charAt(i) == input.charAt(i + 1)) {
countMatrix[i][i + 1] = 1;
// if(!set.contains(input.charAt(i)))
// set.add(String.valueOf(input.charAt(i)));
maxLen = 2;
} else
countMatrix[i][i + 1] = 0;
}
String longestStr = null;
for (int i = 3; i < input.length(); i++) {
for (int j = 0; j < input.length() - i; j++) {
int k = j + i - 1;
if (input.charAt(j) == input.charAt(k)) {
countMatrix[j][k] = countMatrix[j + 1][k - 1];
if (countMatrix[j][k] == 1) {
if (i > maxLen) {
maxLen = i;
longestStr = input.substring(j, k + 1);
}
}
}
else
countMatrix[j][k]=0;
}
}
for (int i = 0; i < input.length(); i++) {
for (int j = 0; j < input.length(); j++) {
if(countMatrix[i][j]==1){
if(!set.contains(input.substring(i, j+1)))
set.add(input.substring(i, j+1));
}
}
}
System.out.println(longestStr);
System.out.println(set);
return maxLen;
}
}
| [
"[email protected]"
]
| |
f307048e6bc43bb5057ef594e8ba255b7bb4218d | aa9e0d78eb85195b4403ff34399b79589a006596 | /04_hibernate-code-first/shampoocompany/src/main/java/shampoos/Shampoo.java | f582c9ac13542e85a81c5dee6d9926dfeffc939e | []
| no_license | zvezdomirov/hibernate-and-spring-data-course | 341f8238b257d10b2af393feb80b026cc12d4f09 | 17e77b2ffe28fdfec099d0f88f21fa0f177c7c23 | refs/heads/master | 2022-07-08T15:45:06.200816 | 2019-06-20T06:54:00 | 2019-06-20T06:54:00 | 173,076,098 | 0 | 0 | null | 2022-06-21T04:05:28 | 2019-02-28T08:51:40 | Java | UTF-8 | Java | false | false | 573 | java | package shampoos;
import ingredients.BasicIngredient;
import labels.BasicLabel;
import labels.Size;
import java.math.BigDecimal;
import java.util.Set;
public interface Shampoo {
long getId();
void setId(long id);
String getBrand();
void setBrand(String brand);
BigDecimal getPrice();
void setPrice(BigDecimal price);
Size getSize();
void setSize(Size size);
BasicLabel getLabel();
void setLabel(BasicLabel label);
Set<BasicIngredient> getIngredients();
void setIngredients(Set<BasicIngredient> ingredients);
}
| [
"[email protected]"
]
| |
6b6b1c36d3891399d5c77547bdfd28877543c250 | 44aa0afe31411ee5746815fa7c480f40d63ca824 | /src/main/java/Sabri/DatabaseTodo/api/TodoController.java | 297248aff191dab1d231afaa9f1cfe3b46c89185 | []
| no_license | bavel22/DatabaseTodo | e13afa015731f07cf7389d63d6aab787ae514d34 | 1735fec2414bcf0eb92725e58f8558ffbf41f0f9 | refs/heads/master | 2020-07-10T09:12:26.786709 | 2019-11-06T05:03:59 | 2019-11-06T05:03:59 | 204,228,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,500 | java | package Sabri.DatabaseTodo.api;
import Sabri.DatabaseTodo.model.Todo;
import Sabri.DatabaseTodo.model.TodoNotFoundException;
import Sabri.DatabaseTodo.service.TodoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.swing.text.html.Option;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@CrossOrigin
@RestController
@RequestMapping("/todos")
public class TodoController {
// This is Spring boot JPA, MVC, Hibernate?, RESTful API supporting REACT/Redux front end
private TodoService todoService;
@Autowired
public TodoController(TodoService todoService) {
this.todoService = todoService;
}
//CREATE
// works both on front end and back end
@PostMapping
public Todo addTodo(@RequestBody Todo todo) {
return todoService.addTodo(todo);
}
// GETS all
// works on back and front end
@GetMapping
public ResponseEntity<Iterable<Todo>> getAllTodo() {
return new ResponseEntity<>(todoService.getAllTodo(), HttpStatus.OK);
}
// GETS by name
// only works on back end
@RequestMapping(method = RequestMethod.GET, path = "/name/{name}")
public ResponseEntity<Todo> findTodoByName(@PathVariable String name) {
return new ResponseEntity<>(todoService.findTodoByName(name), HttpStatus.OK);
}
// GETS by id
// only works on back end
@GetMapping(path = "/{id}")
public ResponseEntity<Todo> findTodoById(@PathVariable final UUID id) {
System.out.println(id);
return ResponseEntity.ok(todoService.findTodoById(id).orElseThrow());
}
// DELETE by id
// works on both front and back end
@DeleteMapping(path = "/{id}")
public void deleteTodoById(@PathVariable UUID id) {
System.out.println(id);
todoService.deleteTodoById(id);
System.out.println(id);
}
// UPDATE by id
// works on both front end and back end
@PutMapping( path = "/{id}")
public void putTodo(@PathVariable final UUID id, @RequestBody Todo todo) {
todoService.putTodo(todo);
}
@GetMapping( path = "/completed")
public ResponseEntity<Iterable<Todo>> getAllCompletedTodos() {
return new ResponseEntity<>(todoService.getAllCompletedTodos(), HttpStatus.OK);
}
}
| [
"[email protected]"
]
| |
765dcbd084c829cb509060999e03fd801fc23236 | ac05f11911d366dfba699e6e506aee212d86d243 | /app/src/main/java/com/ifdroids/scripty/libs/BaseFragmentSaveView/interfaces/OnFragmentViewLoadListener.java | 7d9e4ec6220e63f0cc1738072b1bc6140690c267 | []
| no_license | ifDroids/Scripty | 9033841978fdbfd4d61ea1c00ebd65fa29fa4006 | 4b8a40c9358b18c9694530a377c4fa6543070bf4 | refs/heads/master | 2021-04-08T21:27:21.432723 | 2020-04-05T09:39:34 | 2020-04-05T09:39:34 | 248,811,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package com.ifdroids.scripty.libs.BaseFragmentSaveView.interfaces;
import android.view.View;
public interface OnFragmentViewLoadListener {
View onFragmentViewLoadNow();
}
| [
"[email protected]"
]
| |
d0f3ec1b5b9157bd6f5b6e76efeb0b2fdd7ae1b2 | 38c4451ab626dcdc101a11b18e248d33fd8a52e0 | /identifiers/batik-1.7/sources/org/apache/batik/dom/svg/SVGOMFEBlendElement.java | f7543712bd43bad97d0f3ece6c9f9624f018d4e4 | []
| no_license | habeascorpus/habeascorpus-data | 47da7c08d0f357938c502bae030d5fb8f44f5e01 | 536d55729f3110aee058ad009bcba3e063b39450 | refs/heads/master | 2020-06-04T10:17:20.102451 | 2013-02-19T15:19:21 | 2013-02-19T15:19:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,735 | java | org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
batik PACKAGE_IDENTIFIER false
dom PACKAGE_IDENTIFIER false
svg PACKAGE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
batik PACKAGE_IDENTIFIER false
dom PACKAGE_IDENTIFIER false
AbstractDocument TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
batik PACKAGE_IDENTIFIER false
util PACKAGE_IDENTIFIER false
DoublyIndexedTable TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
batik PACKAGE_IDENTIFIER false
util PACKAGE_IDENTIFIER false
SVGTypes TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
w3c PACKAGE_IDENTIFIER false
dom PACKAGE_IDENTIFIER false
Node TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
w3c PACKAGE_IDENTIFIER false
dom PACKAGE_IDENTIFIER false
svg UNKNOWN_IDENTIFIER false
SVGAnimatedEnumeration UNKNOWN_IDENTIFIER false
org PACKAGE_IDENTIFIER false
w3c PACKAGE_IDENTIFIER false
dom PACKAGE_IDENTIFIER false
svg UNKNOWN_IDENTIFIER false
SVGAnimatedString UNKNOWN_IDENTIFIER false
org PACKAGE_IDENTIFIER false
w3c PACKAGE_IDENTIFIER false
dom PACKAGE_IDENTIFIER false
svg UNKNOWN_IDENTIFIER false
SVGFEBlendElement UNKNOWN_IDENTIFIER false
SVGOMFEBlendElement TYPE_IDENTIFIER true
SVGOMFilterPrimitiveStandardAttributes TYPE_IDENTIFIER false
SVGFEBlendElement UNKNOWN_IDENTIFIER false
DoublyIndexedTable TYPE_IDENTIFIER false
xmlTraitInformation VARIABLE_IDENTIFIER true
DoublyIndexedTable TYPE_IDENTIFIER false
t VARIABLE_IDENTIFIER true
DoublyIndexedTable TYPE_IDENTIFIER false
SVGOMFilterPrimitiveStandardAttributes TYPE_IDENTIFIER false
xmlTraitInformation VARIABLE_IDENTIFIER false
t VARIABLE_IDENTIFIER false
put METHOD_IDENTIFIER false
SVG_IN_ATTRIBUTE VARIABLE_IDENTIFIER false
TraitInformation TYPE_IDENTIFIER false
SVGTypes TYPE_IDENTIFIER false
TYPE_CDATA VARIABLE_IDENTIFIER false
t VARIABLE_IDENTIFIER false
put METHOD_IDENTIFIER false
SVG_SURFACE_SCALE_ATTRIBUTE VARIABLE_IDENTIFIER false
TraitInformation TYPE_IDENTIFIER false
SVGTypes TYPE_IDENTIFIER false
TYPE_NUMBER VARIABLE_IDENTIFIER false
t VARIABLE_IDENTIFIER false
put METHOD_IDENTIFIER false
SVG_DIFFUSE_CONSTANT_ATTRIBUTE VARIABLE_IDENTIFIER false
TraitInformation TYPE_IDENTIFIER false
SVGTypes TYPE_IDENTIFIER false
TYPE_NUMBER VARIABLE_IDENTIFIER false
t VARIABLE_IDENTIFIER false
put METHOD_IDENTIFIER false
SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE VARIABLE_IDENTIFIER false
TraitInformation TYPE_IDENTIFIER false
SVGTypes TYPE_IDENTIFIER false
TYPE_NUMBER_OPTIONAL_NUMBER VARIABLE_IDENTIFIER false
xmlTraitInformation VARIABLE_IDENTIFIER false
t VARIABLE_IDENTIFIER false
String TYPE_IDENTIFIER false
MODE_VALUES VARIABLE_IDENTIFIER true
SVG_NORMAL_VALUE VARIABLE_IDENTIFIER false
SVG_MULTIPLY_VALUE VARIABLE_IDENTIFIER false
SVG_SCREEN_VALUE VARIABLE_IDENTIFIER false
SVG_DARKEN_VALUE VARIABLE_IDENTIFIER false
SVG_LIGHTEN_VALUE VARIABLE_IDENTIFIER false
SVGOMAnimatedString TYPE_IDENTIFIER false
in VARIABLE_IDENTIFIER true
SVGOMAnimatedString TYPE_IDENTIFIER false
in2 VARIABLE_IDENTIFIER true
SVGOMAnimatedEnumeration TYPE_IDENTIFIER false
mode VARIABLE_IDENTIFIER true
SVGOMFEBlendElement METHOD_IDENTIFIER false
SVGOMFEBlendElement METHOD_IDENTIFIER false
String TYPE_IDENTIFIER false
prefix VARIABLE_IDENTIFIER true
AbstractDocument TYPE_IDENTIFIER false
owner VARIABLE_IDENTIFIER true
prefix VARIABLE_IDENTIFIER false
owner VARIABLE_IDENTIFIER false
initializeLiveAttributes METHOD_IDENTIFIER false
initializeAllLiveAttributes METHOD_IDENTIFIER true
initializeAllLiveAttributes METHOD_IDENTIFIER false
initializeLiveAttributes METHOD_IDENTIFIER false
initializeLiveAttributes METHOD_IDENTIFIER true
in VARIABLE_IDENTIFIER false
createLiveAnimatedString METHOD_IDENTIFIER false
SVG_IN_ATTRIBUTE VARIABLE_IDENTIFIER false
in2 VARIABLE_IDENTIFIER false
createLiveAnimatedString METHOD_IDENTIFIER false
SVG_IN2_ATTRIBUTE VARIABLE_IDENTIFIER false
mode VARIABLE_IDENTIFIER false
createLiveAnimatedEnumeration METHOD_IDENTIFIER false
SVG_MODE_ATTRIBUTE VARIABLE_IDENTIFIER false
MODE_VALUES VARIABLE_IDENTIFIER false
String TYPE_IDENTIFIER false
getLocalName METHOD_IDENTIFIER true
SVG_FE_BLEND_TAG VARIABLE_IDENTIFIER false
SVGAnimatedString UNKNOWN_IDENTIFIER false
getIn1 UNKNOWN_IDENTIFIER true
in VARIABLE_IDENTIFIER false
SVGAnimatedString UNKNOWN_IDENTIFIER false
getIn2 UNKNOWN_IDENTIFIER true
in2 VARIABLE_IDENTIFIER false
SVGAnimatedEnumeration UNKNOWN_IDENTIFIER false
getMode UNKNOWN_IDENTIFIER true
mode VARIABLE_IDENTIFIER false
Node TYPE_IDENTIFIER false
newNode METHOD_IDENTIFIER true
SVGOMFEBlendElement TYPE_IDENTIFIER false
DoublyIndexedTable TYPE_IDENTIFIER false
getTraitInformationTable METHOD_IDENTIFIER true
xmlTraitInformation VARIABLE_IDENTIFIER false
| [
"[email protected]"
]
| |
005c6d327aada7ab1e189178f5dfcd15975be356 | 32b4e5f7e5c5573b48d6654384264da205b25bbb | /app/src/main/java/com/example/antonius/homy/LoginPage.java | b4f86cadeedfcc546c0bbb233f8e2d0ddd589d21 | []
| no_license | antoniuskevin/homy | f6b09cf65b4fd8c428f124801f1524971409edc0 | 76a5b271f829fd84788d752ccec83a496ca6378b | refs/heads/master | 2021-08-14T12:36:30.781055 | 2017-11-15T18:34:45 | 2017-11-15T18:34:45 | 110,850,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.example.antonius.homy;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class LoginPage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_page);
}
}
| [
"[email protected]"
]
| |
1edff9ae67ab74aec9898f5c8c5d19573237c53f | ff35865ffdae6164a85e1b84d8ec2b4abc145d64 | /src/main/java/mz/com/centropontoencontro/service/DevolucaoService.java | 4735361ec7000187abde0a692f0adfd490a8fa0c | []
| no_license | AyrtonPereira1996/centropontoencontro-webapplication | a41725446a3a201451e5daa247290f4db582eb14 | ecf7d35ebeed739a7ec999a5aca7be3f233064fc | refs/heads/master | 2020-12-31T21:21:15.936306 | 2020-02-07T21:42:47 | 2020-02-07T21:42:47 | 239,025,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package mz.com.centropontoencontro.service;
import java.util.List;
import mz.com.centropontoencontro.domain.Devolucao;
public interface DevolucaoService {
void salvar(Devolucao devolucao);
void editar(Devolucao devolucao);
void delete(Long id);
Devolucao pesquisarPorId(Long id);
List<Devolucao> pesquisarTodos();
Long obterTotalDevolucao();
List<Devolucao> pesquisarTodosDesc();
}
| [
"[email protected]"
]
| |
b21edce847b4495ddef21be947f01c6ab9333859 | 3760fc59292cf776c86cda9d48dd887a961e5a42 | /src/main/java/com/topcoder/api/logging/LoggingAspect.java | d67041612f0a0a22a5c452d7ef6d683cc44753b9 | [
"MIT"
]
| permissive | moulyg/springbootapp | 1039f820483f0f659db1f82ff51ae3e64e07549b | c5d2cd6284e2d70bcb73fad3ed88639a2b895e38 | refs/heads/master | 2020-09-10T17:05:59.312549 | 2019-11-14T19:53:58 | 2019-11-14T19:53:58 | 221,771,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,634 | java | /**
* Copyright (c) 2019 TopCoder, Inc. All rights reserved.
*/
package com.topcoder.api.logging;
import java.util.Arrays;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Aspect for logging execution of Spring components.
*
* @author TCSCODER
* @version 1.0
*/
@Aspect
public class LoggingAspect {
/**
* The logger.
*/
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* Point-cut that matches all controllers, services, and repositories.
*/
@Pointcut("within(com.topcoder.api.controllers..*) || within(com.topcoder.api.services..*) || "
+ "within(com.topcoder.api.repositories..*)")
public void loggingPointcut() {
// Method is empty as this is just a Point-cut, the implementations are in the
// advises.
}
/**
* Advice that logs methods throwing exceptions.
*
* @param joinPoint the join point
* @param ex the throwable
*/
@AfterThrowing(pointcut = "loggingPointcut()", throwing = "ex")
public void logAfterThrowing(JoinPoint joinPoint, Throwable ex) {
logger.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'",
joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(),
ex.getCause() != null ? ex.getCause() : "NULL", ex.getMessage(), ex);
}
/**
* Advice that logs when a method is entered and exited.
*
* @param joinPoint the join point
* @throws Throwable when there is any error
*/
@Around("loggingPointcut()")
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
if (logger.isDebugEnabled()) {
logger.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs()));
}
try {
Object result = joinPoint.proceed();
if (logger.isDebugEnabled()) {
logger.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), result);
}
return result;
} catch (IllegalArgumentException ex) {
logger.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()),
joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
throw ex;
}
}
}
| [
"[email protected]"
]
| |
76b6168ed5e2800e1479e09bde1cad910753e117 | 2ab6c2ddfc133ca2870c2e31146e19447dfceefe | /Framework/Step1_DriverScript1.java | a65910e2a5cce42d8cdd84af3d635f719e4c97d4 | []
| no_license | rakeshkumarpanda/FrameworkDesignStepsSampleCV | 448e137a30258ffdf41978d11b15dbc77f85ddf5 | f5b505f16c3b4c3f61472cc4f5b2f5dac9b6e844 | refs/heads/master | 2021-02-14T18:00:03.498778 | 2020-03-04T06:32:17 | 2020-03-04T06:32:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,228 | java | package com.seleniumeasy.RunnerClass;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;
public class DriverScript
{
@Test
public void submitFormTest() throws InterruptedException
{
//1. Opening the Browser
String chromeDriverPath = System.getProperty("user.dir")+"\\BrowserDrivers\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", chromeDriverPath);
WebDriver driver = new ChromeDriver();
//2. Maximize the web browser and navigate to application
driver.manage().window().maximize();
driver.get("https://www.seleniumeasy.com/");
//Home Page Elements
//3. Click on Demo Website! link
driver.findElement(By.xpath("//a[contains(text(),'Demo Website!')]")).click();
//Demo Page Elements
//4. Click on Input Forms tab
driver.findElement(By.xpath("//li[@class='dropdown']/a[contains(text(),'Input Forms')]")).click();
//5. Click on Input Form Submit Link
driver.findElement(By.xpath("//ul[@class='dropdown-menu']//a[contains(text(),'Input Form Submit')]")).click();
//Submit Form Page Elements
//6. Enter First Name
driver.findElement(By.xpath("//label[contains(text(),'First Name')]/following-sibling::div//input")).sendKeys("First1");
//7. Enter Last Name
driver.findElement(By.xpath("//label[contains(text(),'Last Name')]/following-sibling::div//input")).sendKeys("Last1");
//8. Enter Email ID
driver.findElement(By.xpath("//label[contains(text(),'E-Mail')]/following-sibling::div//input")).sendKeys("[email protected]");
//9. Select an option from state dropdown
WebElement stateDropdown = driver.findElement(By.name("state"));
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].scrollIntoView()", stateDropdown);
Select sel = new Select(stateDropdown);
sel.selectByVisibleText("Kansas");
//10. Click on Yes Radio Button
driver.findElement(By.xpath("//input[@value='yes']")).click();
//11. Close the browser
Thread.sleep(3000);
driver.quit();
}
}
| [
"[email protected]"
]
| |
575ceb46c73e20ed83de55ba69eed96ba918a146 | 25c8b49d2eb5d39ceb79348e2d9fce3cc06b1d34 | /boggle/src/test/java/TestBoardSolverVerifyPoints_4527.java | 3bf2f1b54b28dca6c97324f3ddf5ce723989efb1 | []
| no_license | pliesveld/algorithm-exercises-java | fd336f145c811424c47499d7847ccbf459a2e3db | a7009874dd27aace2a4bb04d308896018f69349d | refs/heads/master | 2020-12-24T07:59:59.228276 | 2016-01-07T08:58:37 | 2016-01-07T08:58:37 | 59,030,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | public class TestBoardSolverVerifyPoints_4527 extends AbstractBoardVerifyPoints {
@Override
String getBoardFilename() {
return "board-points4527.txt";
}
@Override
int getExpectedPoints() {
return 4527;
}
}
| [
"[email protected]"
]
| |
e56e6c279f554a891463b0f247b7d85fc2ac3884 | 20967aa3a53a21f0ae8c5f0b68f9104f2588b264 | /rssson-master/persistence/src/main/java/com/bitwise/manageme/rssson/domain/students/StudentGroupContactLogEntry.java | e3d58d1d1c2a8f27f1fd915177e125a8f1f2e37a | []
| no_license | bitwiseTek/rivson-web | 25302476578416f17df8e6e5877d13f177517707 | f286324deca5fc1d11054465f7bebb8bd14758fb | refs/heads/master | 2022-12-24T19:35:09.224234 | 2016-11-20T17:00:15 | 2016-11-20T17:00:15 | 71,289,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,849 | java | package com.bitwise.manageme.rssson.domain.students;
/**
*
* @author Sika Kay
* @date 15/06/16
*
*/
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.search.annotations.Field;
import com.bitwise.manageme.rssson.domain.base.ArchivableEntity;
@Entity
@Table(name="WEB_RSSSON_STUDENT_GROUP_CONTACT_LOG_ENTRIES")
@NamedQueries({
@NamedQuery(name="StudentGroupContactLogEntry.findById", query="select distinct s from StudentGroupContactLogEntry s where s.id=:id"),
@NamedQuery(name="StudentGroupContactLogEntry.findAll", query="select s from StudentGroupContactLogEntry s")
})
public class StudentGroupContactLogEntry implements ArchivableEntity, Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private StudentGroup studentGroup;
private String text;
private String creatorName;
private StudentContactLogEntryType type;
private Date entryDate;
private Boolean archived = Boolean.FALSE;
@Id
@Column(name="STUDENT_GROUP_CONTACT_LOG_ENTRY_ID")
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@ManyToOne
@JoinColumn(name="STUDENT_GROUP_ID")
public StudentGroup getStudentGroup() {
return studentGroup;
}
public void setStudentGroup(StudentGroup studentGroup) {
this.studentGroup = studentGroup;
}
@Lob
@Column(name="TEXT")
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Column(name="CREATOR_NAME")
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
@Enumerated(EnumType.STRING)
@Column(name="LOG_ENTRY_TYPE")
public StudentContactLogEntryType getType() {
return type;
}
public void setType(StudentContactLogEntryType type) {
this.type = type;
}
@Temporal(value=TemporalType.TIMESTAMP)
@Column(name="ENTRY_DATE_TIME")
public Date getEntryDate() {
return entryDate;
}
public void setEntryDate(Date entryDate) {
this.entryDate = entryDate;
}
@Field
@Override
@Column(name="ARCHIVED", nullable=false)
public Boolean getArchived() {
return archived;
}
@Override
public void setArchived(Boolean archived) {
this.archived = archived;
}
}
| [
"[email protected]"
]
| |
720265020a4125042c462a392d2c691bc9044b31 | e91196539f77daacd0d3b2e79fc329b7e0a54ff2 | /Date/Date/src/Date.java | 57de86587881a2cc1bc047dcf29ea403d242c847 | []
| no_license | joyeecheung/learning-java | 7420f7765672e3253827770432c2921e594a0188 | 7b4d0d53f5a0163910c5439cfc1b183cc7d6f67a | refs/heads/master | 2016-09-06T10:49:14.999028 | 2014-07-14T00:18:42 | 2014-07-14T00:18:42 | 21,800,685 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,405 | java |
public class Date {
private int day;
private int date;
private int month;
private int year;
public static final String[] DAYS_NAME = {"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"};
public static final String[] MONTHS_NAME = {"", "January", "Febuary",
"March", "April", "May", "June", "July", "August", "September", "October",
"November", "December"};
public int getDate() {
return date;
}
public void setDate(int date) {
this.date = date;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public Date(int year, int month, int date) {
this.year = year;
this.month = month;
this.date = date;
// zeller's formula
int c = year / 100;
int y = year % 100;
int m = month;
int d = date;
if (month < 3) {
m += 12;
c = (year - 1) / 100;
y = (year - 1) % 100;
}
int w = (y + y/4 + c/4 - c*2 + 26*(m+1)/10 + d - 1);
if (year <= 1582 && month <= 10 && date <= 4)
w = (y + y/4 - c + 26*(m+1)/10 + d + 4);
this.day = ( w % 7 + 7 ) % 7;
}
public void printAmerican() {
String dayName = DAYS_NAME[this.day];
String monthName = MONTHS_NAME[this.month];
System.out.printf("%s, %s %d, %d", dayName, monthName, this.date, this.year);
}
} | [
"[email protected]"
]
| |
3ea9ad9cd02aea95af9aa35ff100c53c3cf6d009 | 4bccc80d8c86f75afbc6ea69ca1ce2db4f62b002 | /app/src/main/java/doubihai/testdagger/MainActivityComponent.java | cd2850071385bc0ad192922f2ecc1288381aebfc | []
| no_license | lxqxsyu/TestDagger | f35a789ab4f8baf7c5ceab74403c5b4e2b9f43f5 | f4e1a526a9ae9884a81a1954839ebbd3161a5bfa | refs/heads/master | 2021-09-06T09:53:31.330346 | 2018-02-05T07:22:13 | 2018-02-05T07:22:13 | 111,063,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package doubihai.testdagger;
import dagger.Component;
/**
* Created by 水寒 on 2017/11/16.
*/
@Component
public interface MainActivityComponent {
void inject(MainActivity activity);
}
| [
"[email protected]"
]
| |
cfa70308eda4df6dbbb85c1ff22da3188ae7cd7e | 58c85cc6586af20adab362915829b7336c97f842 | /java/biz/podoliako/carwash/models/PaymentMethod.java | 65c0875bddb77d1779b0dd81917573ef108ec6eb | []
| no_license | Bizon4ik/CarWash | 9cace426394dbe32d88cc4991cfb225a5c03259e | 57db2fb5cef55f7a20deb72a3bbaaf6b82fafba0 | refs/heads/master | 2020-06-01T15:06:24.662850 | 2015-10-07T19:33:42 | 2015-10-07T19:33:42 | 31,734,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package biz.podoliako.carwash.models;
public enum PaymentMethod {
Cash("Наличный"), Beznal("Безналичный");
private String lable;
PaymentMethod(String label) {
this.lable = label;
}
public String getLable() {
return lable;
}
}
| [
"[email protected]"
]
| |
917f11db1784c64dd477827cbe98214f4977fc2e | c02216b45871e9389a05bfeb853f99592018eec8 | /AreaCalculator/src/AreaCalculator.java | 60a0a3016b716130a8d4aec88851801cc74a379f | []
| no_license | ZolBiro/Udemy---Java-Programing-Masterclass-Coding-Exercises-8 | a9def6dcc5967978705b86affb7bb07437dd122b | 29d2492f18940e174d21e30f4c6d9a0e5b192918 | refs/heads/master | 2020-05-07T10:48:02.614083 | 2019-04-09T19:10:09 | 2019-04-09T19:10:09 | 180,432,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | public class AreaCalculator {
public static double area (double radius){
if (radius <0){
System.out.println("Invalid Value");
return -1.0;
}
double circleArea = radius * radius * Math.PI;
System.out.println("The Circle area is= " + circleArea);
return circleArea;
}
public static double area (double x, double y) {
if ((x <0) || (y <0)) {
System.out.println("Invalid Value");
return -1;
}
double rectangleArea = x * y;
System.out.println("The Rectangle area is = " + rectangleArea);
return rectangleArea;
}
}
| [
"[email protected]"
]
| |
392f719875276e0216eb8d92d0c3dd7e8e2dc75c | 3982cc0a73455f8ce32dba330581b4a809988a17 | /platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java | 38fd5b39e5e9a01a37c3ddc983ae04be77200c8a | [
"Apache-2.0"
]
| permissive | lshain-android-source/tools-idea | 56d754089ebadd689b7d0e6400ef3be4255f6bc6 | b37108d841684bcc2af45a2539b75dd62c4e283c | refs/heads/master | 2016-09-05T22:31:43.471772 | 2014-07-09T07:58:59 | 2014-07-09T07:58:59 | 16,572,470 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,808 | java | /*
* Copyright 2000-2013 JetBrains s.r.o.
*
* 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.intellij.openapi.components.impl;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.StateStorage;
import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
import com.intellij.openapi.components.impl.stores.ComponentRoamingManager;
import com.intellij.openapi.components.impl.stores.ComponentVersionProvider;
import com.intellij.openapi.components.impl.stores.XmlElementStorage;
import com.intellij.openapi.options.StreamProvider;
import com.intellij.openapi.util.Disposer;
import com.intellij.testFramework.LightPlatformLangTestCase;
import com.intellij.util.io.fs.IFile;
import org.jdom.Document;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import static com.intellij.openapi.util.JDOMBuilder.*;
/**
* @author mike
*/
public class XmlElementStorageTest extends LightPlatformLangTestCase {
private Disposable myParentDisposable;
public void setUp() throws Exception {
super.setUp();
myParentDisposable = Disposer.newDisposable();
}
public void tearDown() throws Exception {
Disposer.dispose(myParentDisposable);
super.tearDown();
}
public void testGetStateSucceeded() throws Exception {
MyXmlElementStorage storage =
new MyXmlElementStorage(document(tag("root", tag("component", attr("name", "test"), tag("foo")))), myParentDisposable);
Element state = storage.getState(this, "test", Element.class, null);
assertNotNull(state);
assertEquals("component", state.getName());
assertNotNull(state.getChild("foo"));
}
public void testGetStateNotSucceeded() throws Exception {
MyXmlElementStorage storage = new MyXmlElementStorage(document(tag("root")), myParentDisposable);
Element state = storage.getState(this, "test", Element.class, null);
assertNull(state);
}
public void testSetStateOverridesOldState() throws Exception {
MyXmlElementStorage storage =
new MyXmlElementStorage(document(tag("root", tag("component", attr("name", "test"), tag("foo")))), myParentDisposable);
Element newState = tag("component", attr("name", "test"), tag("bar"));
StateStorage.ExternalizationSession externalizationSession = storage.startExternalization();
externalizationSession.setState(this, "test", newState, null);
storage.startSave(externalizationSession).save();
assertNotNull(storage.mySavedDocument);
assertNotNull(storage.mySavedDocument.getRootElement().getChild("component").getChild("bar"));
assertNull(storage.mySavedDocument.getRootElement().getChild("component").getChild("foo"));
}
private class MyXmlElementStorage extends XmlElementStorage {
private final Document myDocument;
private Document mySavedDocument;
public MyXmlElementStorage(final Document document, final Disposable parentDisposable) throws StateStorageException {
super(new MyPathMacroManager(), parentDisposable, "root", StreamProvider.DEFAULT, "", ComponentRoamingManager.getInstance(), ComponentVersionProvider.EMPTY);
myDocument = document;
}
@Override
protected Document loadDocument() throws StateStorageException {
return myDocument;
}
@Override
protected MySaveSession createSaveSession(final MyExternalizationSession externalizationSession) {
return new MySaveSession(externalizationSession) {
@Override
protected void doSave() throws StateStorageException {
mySavedDocument = (Document)getDocumentToSave().clone();
}
@NotNull
@Override
public Collection<IFile> getStorageFilesToSave() throws StateStorageException {
return needsSave() ? getAllStorageFiles() : Collections.<IFile>emptyList();
}
@NotNull
@Override
public List<IFile> getAllStorageFiles() {
throw new UnsupportedOperationException("Method getAllStorageFiles not implemented in " + getClass());
}
};
}
}
private static class MyPathMacroManager implements TrackingPathMacroSubstitutor {
@Override
public void expandPaths(final Element element) {
}
@Override
public void reset() {
}
@Override
public Collection<String> getComponents(Collection<String> macros) {
return Collections.emptyList();
}
@Override
public void collapsePaths(final Element element) {
}
@Override
public String expandPath(final String path) {
throw new UnsupportedOperationException("Method expandPath not implemented in " + getClass());
}
@Override
public String collapsePath(final String path) {
throw new UnsupportedOperationException("Method collapsePath not implemented in " + getClass());
}
@Override
public Collection<String> getUnknownMacros(final String componentName) {
return Collections.emptySet();
}
@Override
public void invalidateUnknownMacros(Set<String> macros) {
}
@Override
public void addUnknownMacros(String componentName, Collection<String> unknownMacros) {
}
}
}
| [
"[email protected]"
]
| |
11a8b999ddaf9b745660459ffe593511ed8448ff | 7df7d3f150e39f0065ec04f3274613f22eec7187 | /aiplatform/src/main/java/aiplatform/DeleteModelSample.java | f3ee72260c69f158c3cb82eb09a3fe69a862c2d4 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
]
| permissive | GoogleCloudPlatform/java-docs-samples | b8bacddd582697c307a85d6aa740fa2a71cdbf00 | f166f36a595c35dbc32bc49cf16e598e5812f43a | refs/heads/main | 2023-09-03T04:07:37.538510 | 2023-08-31T23:16:36 | 2023-08-31T23:16:36 | 32,895,424 | 1,771 | 3,440 | Apache-2.0 | 2023-09-14T20:25:30 | 2015-03-25T22:48:38 | Java | UTF-8 | Java | false | false | 2,824 | java | /*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package aiplatform;
// [START aiplatform_delete_model_sample]
import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.aiplatform.v1.DeleteOperationMetadata;
import com.google.cloud.aiplatform.v1.ModelName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class DeleteModelSample {
public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException, TimeoutException {
// TODO(developer): Replace these variables before running the sample.
String project = "YOUR_PROJECT_ID";
String modelId = "YOUR_MODEL_ID";
deleteModel(project, modelId);
}
static void deleteModel(String project, String modelId)
throws IOException, ExecutionException, InterruptedException, TimeoutException {
ModelServiceSettings modelServiceSettings =
ModelServiceSettings.newBuilder()
.setEndpoint("us-central1-aiplatform.googleapis.com:443")
.build();
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
String location = "us-central1";
ModelName modelName = ModelName.of(project, location, modelId);
OperationFuture<Empty, DeleteOperationMetadata> operationFuture =
modelServiceClient.deleteModelAsync(modelName);
System.out.format("Operation name: %s\n", operationFuture.getInitialFuture().get().getName());
System.out.println("Waiting for operation to finish...");
operationFuture.get(300, TimeUnit.SECONDS);
System.out.format("Deleted Model.");
}
}
}
// [END aiplatform_delete_model_sample]
| [
"[email protected]"
]
| |
9d482663d0782a917018c0b89033f9a8a95dd442 | 1bd4868ac67dc528294735931c75acb28a24a00b | /src/application/OrderController.java | 5608db86528cd14c1365c65c5b0ae45995d841a8 | []
| no_license | WHAT-ROUGH-BEAST/RepositeManage | f7468a9bb62e7b7bc739d31b8407b153b16e161c | 29a240a7d3ad725e493b26687959eabee9873f07 | refs/heads/master | 2022-11-18T11:41:27.334537 | 2020-07-03T04:30:21 | 2020-07-03T04:30:21 | 276,832,051 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,357 | java | package application;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
import ListView.ListItem;
import javaBean.Order;
import javaBean.Product;
import javaBean.Reposite;
import javaBean.Shelf;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.util.Callback;
import util.CheckoutHelper;
import util.XMLUtil;
public class OrderController implements DataShare
{
@FXML private Button addBtn, doneBtn;
@FXML private TextField textField, nameText;
@FXML private ListView<Product> productList;
private Reposite reposite;
private CheckoutHelper checkoutHelper;
@FXML
public void addBtnPress()
{
try
{
Product product = reposite.search(textField.getText());
if (null == product)
throw new Exception();
// .clone()
productList.getItems().add(product.clone());
}
catch (Exception e) {}
}
@FXML
public void doneBtnPress()
{
Order order = (Order) XMLUtil.getBean("Orderconfig");
order.registerRepos(reposite);
try
{
String name = nameText.getText();
order.setBuyerName(name);
nameText.clear();
}
catch (Exception e)
{
UiUtil.showAlert("姓名不合法");
return;
}
for (Product p : productList.getItems())
{
try
{
order.addProduct(p);
}
catch (Exception e)
{
e.printStackTrace();
UiUtil.showAlert(p.getId() + " 库存不足");
return;
}
}
productList.getItems().clear();
textField.clear();
// checkoutHelper;
checkoutHelper.addOrder(order);
UiUtil.showAlert("购物成功");
}
@Override
public void setReposite(Reposite reposite)
{
this.reposite = reposite;
initList();
}
private void initList()
{
ArrayList<Product> list = new ArrayList<>();
productList.setItems(FXCollections.observableArrayList(list));
productList.setCellFactory(new Callback<ListView<Product>, ListCell<Product>>(){
@Override
public ListCell<Product> call(ListView<Product> list) {
ListItem i = new ListItem();
i.setList(productList);
return i;
}
});
}
@Override
public void setCheckoutHelper(CheckoutHelper helper)
{
checkoutHelper = helper;
}
}
| [
"[email protected]"
]
| |
e40426a44090bb678c3bd9b334f193d9373dbdbd | 11900562f47b2228efec027cc8cfcdc95f2d0f4a | /src/main/java/com/progect/GrassCutterShop/exception/ConnectionPoolException.java | d7d8cda9d2a511f858bb13bbb90c3ea08b219411 | []
| no_license | ivan-stankevich/GrassCutterShop | b2c88aa05c488c9f92da2969272976636105ece2 | 80b92e3f537dfb96472f72fe25f036c43de02a7d | refs/heads/main | 2023-05-05T22:10:09.261561 | 2021-05-31T10:26:47 | 2021-05-31T10:26:47 | 370,532,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,014 | java | package com.progect.GrassCutterShop.exception;
public class ConnectionPoolException extends Exception{
/**
* Constructs a new exception with the specified detail message.
*
* @param message the detail message.
*/
public ConnectionPoolException(String message) {
super(message);
}
/**
* Constructs a new exception with the specified detail message and
* cause.
*
* @param message is a message the detail message
* @param cause the cause
*/
public ConnectionPoolException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new connection pool exception with {@code null} as its detail message.
* The cause is not initialized
*/
public ConnectionPoolException() {
super();
}
/**
* Constructs a new exception with cause.
*
* @param cause the cause
*/
public ConnectionPoolException(Throwable cause) {
super(cause);
}
}
| [
"[email protected]"
]
| |
a4125c988b9eac2bc8ce6e42a206cfb54c635298 | ffb08888351db9463ede25b738912a398cf43335 | /app/src/main/java/com/hihoo/materialweather/util/HttpUtil.java | 624502a44ccbf71427edacabd7ada6f5054dc0a8 | [
"Apache-2.0"
]
| permissive | hihooliu/MaterialWeather | 25382132d3be48fcaeea9601280499da0bca1038 | b633ff107950e016bdfd6a2091a1c281fae2fb2e | refs/heads/master | 2021-01-13T13:46:00.598461 | 2016-12-13T15:32:12 | 2016-12-13T15:32:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package com.hihoo.materialweather.util;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/**
* Created by Liuhx on 2016/12/13.
*/
public class HttpUtil {
//通用Http请求方法
public static void sendOkHttpRequest(String address, okhttp3.Callback callback){
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(address).build();
client.newCall(request).enqueue(callback);
}
}
| [
"[email protected]"
]
| |
7b3c65da15b52e81a93dee62f325474eca276b03 | 9e2ba68843f0ad3b9d2b92174e983a3530d63591 | /app/src/main/res/layout/webotoptabview/ExampleUnitTest.java | 94e62b6d4551be25932704b3bb5d87c195c55969 | []
| no_license | wcj98/TabView | d99882cf61fb74ea46d8a72c507098482f6613c0 | 848142435df11fa7f068752bdca0c67f5f4646c9 | refs/heads/master | 2020-07-29T07:05:12.114383 | 2019-12-13T06:39:35 | 2019-12-13T06:39:35 | 209,709,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.example.webotoptabview;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
687c5f926b79f2536941b1781a6dbb0960a5a686 | 73564e3cc9d2c34fccb07c354df90a3ab3981fdb | /src-cv-nonescrow/com/tpcbprocedures/LoadBranch.java | 7dd5e0ef9b706f5ff089f6c7a67d336d94348812 | []
| no_license | eoneil1942/tpc-bc | 1742f5b5db38e2b91c3631054cd2482bbf538e44 | 2c2576759768b2770367f06685cbdc47b73b5e85 | refs/heads/master | 2020-06-05T13:14:29.190638 | 2014-09-14T19:50:12 | 2014-09-14T19:50:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,194 | java | /* This file is part of VoltDB.
* Copyright (C) 2008-2011 VoltDB Inc.
*
* This file contains original code and/or modifications of original code.
* Any modifications made by VoltDB Inc. are licensed under the following
* terms and conditions:
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/* Copyright (C) 2008
* Evan Jones
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package com.tpcbprocedures;
import org.voltdb.ProcInfo;
import org.voltdb.VoltProcedure;
import org.voltdb.VoltTable;
@ProcInfo (
partitionInfo = "BRANCH.B_ID: 0",
singlePartition = true
)
/**
* Loads initial data into TPCB tables.
*/
public class LoadBranch extends VoltProcedure {
public VoltTable[] run(int b_id, VoltTable branches, VoltTable accounts, VoltTable tellers,
VoltTable histories)
throws VoltAbortException {
voltLoadTable("cluster", "database", "BRANCH", branches);
voltLoadTable("cluster", "database", "ACCOUNT", accounts);
voltLoadTable("cluster", "database", "TELLER", tellers);
voltLoadTable("cluster", "database", "HISTORY", histories);
return null;
}
}
| [
"[email protected]"
]
| |
9d8c6ccfc09ae4f4d53a506dad379cc718149c34 | 99cfb76df1c5141d00cdf8c8afbeb694ffefd057 | /dom/src/main/java/domainapp/dom/app/persona/Sexo.java | 7ebc56f2723589a58bffb5772796e7065c98dad6 | []
| no_license | TECH-FDD/ControlVehicular | 9e44abbd372aeb06f5fc37bf7337906d7c472db8 | 6ad1db944112fb098efb76caa03817fe97fe1273 | refs/heads/master | 2020-12-24T17:17:12.749822 | 2015-06-16T02:18:39 | 2015-06-16T02:18:39 | 34,296,484 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79 | java | package domainapp.dom.app.persona;
public enum Sexo {
Femenino, Masculino;
}
| [
"[email protected]"
]
| |
5ca6d9166b0f92b8e15a893ac98893e9be636bfc | 7f4d76c836d9403a15aec47f71f05012c5958b09 | /app/src/androidTest/java/com/delarosa/recognition/ExampleInstrumentedTest.java | b70721df5858063c1061a36ab3b8cb6bad1826a9 | []
| no_license | lauramdelarosa/recognition | ab35c38422fd8f33d784be0839d7078eeae29db6 | 3e5b0257c2432cd1ae55924f48d294601e84dd92 | refs/heads/master | 2020-04-23T03:13:26.015231 | 2019-02-15T13:48:07 | 2019-02-15T13:48:07 | 170,871,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package com.delarosa.recognition;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.delarosa.recognition", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
c44fc658ad1a201a8b7b8ac79105a598ed672c0c | a9d802df4e7e3b9efdad6977e9e6888e0e0c592f | /src/test/java/LibraryTest.java | ee4bf8f970fc62b1f2ec1d07d13f1dd009636a3c | []
| no_license | JoeStafford1986/java_classes_homework | 23bf0ce6de25c54da6a5c9073b19d6d9802010d0 | 2fdcbb72ce3361b208b3465d320bcab255101ac6 | refs/heads/master | 2020-03-17T11:09:25.363485 | 2018-05-16T06:51:09 | 2018-05-16T06:51:09 | 133,540,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,220 | java | import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class LibraryTest {
Library library;
Book book;
String bookRequest;
Book book1;
@Before
public void before(){
library = new Library(10);
book = new Book("LOTR", "Fantasy");
bookRequest = "LOTR";
book1 = new Book("Italian Cookery", "Recipe Book");
}
@Test
public void bookCollectionStartsEmpty(){
assertEquals(0, library.bookCount());
}
@Test
public void canAddBook(){
library.addBook(book);
assertEquals(1, library.bookCount());
}
@Test
public void bookCollectionFull(){
Library smallLibrary = new Library(2);
smallLibrary.addBook(book);
smallLibrary.addBook(book);
smallLibrary.addBook(book);
assertEquals(2, smallLibrary.bookCount());
}
@Test
public void canFindBook(){
library.addBook(book);
assertEquals(true, library.findBook("LOTR"));
}
@Test
public void cannotFindBook(){
library.addBook(book);
assertEquals(false, library.findBook("The Hobbit"));
}
@Test
public void noBooksForFindBook(){
assertEquals(false, library.findBook("The Hobbit"));
}
@Test
public void canGetBookIndex(){
library.addBook(book);
assertEquals(0, library.getBookIndex(book));
}
@Test
public void canLoanBook(){
library.addBook(book);
assertEquals(book, library.loanBook(book));
assertEquals(0, library.bookCount());
}
@Test
public void genreSectionCounterStartsEmpty(){
assertEquals(0, library.getGenreSectionCounter().size());
}
@Test
public void canClassifyBooks(){
library.addBook(book);
library.classifyBooks();
assertEquals(1, library.getGenreSectionCounter().size());
}
@Test
public void canClassifyMultipleBooksToSameGenre(){
library.addBook(book);
library.addBook(book);
library.classifyBooks();
assertEquals(1, library.getGenreSectionCounter().size());
}
@Test
public void genreCounterIncreases(){
library.addBook(book);
library.addBook(book);
library.classifyBooks();
int genreCount = library.getGenreSectionCounter().get(book.getGenre());
assertEquals(2, genreCount);
}
@Test
public void canClassifyMultipleGenres(){
library.addBook(book);
library.addBook(book1);
library.classifyBooks();
assertEquals(2, library.getGenreSectionCounter().size());
}
@Test
public void canClassifyAndCountMultipleGenres(){
library.addBook(book);
library.addBook(book);
library.addBook(book);
library.addBook(book1);
library.addBook(book1);
library.classifyBooks();
int genreCount = library.getGenreSectionCounter().get(book.getGenre());
int genreCount1 = library.getGenreSectionCounter().get(book1.getGenre());
assertEquals(3, genreCount);
assertEquals(2, genreCount1);
assertEquals(2, library.getGenreSectionCounter().size());
}
}
| [
"[email protected]"
]
| |
bc3b358e610ca17671dfb9cee75eda14db22f83e | 9673cdf8ef54b2f6c771a7d08731a0bbe7bee845 | /sample/java_gradle/rev43/subprojects/plugins/src/main/groovy/org/gradle/api/internal/tasks/testing/junit/result/XmlTestSuite.java | 7e55f51fec33592a21c7fc1ec54afd0873e30bb9 | []
| no_license | jvcoutinho/s3m-test-samples | 6d86afe1342a31a95dd45013a0813f1649f2fd21 | 4155bcf60162601358e618be055b8b008928ac8f | refs/heads/master | 2020-04-05T16:28:30.542777 | 2018-11-26T16:33:04 | 2018-11-26T16:33:04 | 157,014,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,210 | java | /*
* Copyright 2012 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.gradle.api.internal.tasks.testing.junit.result;
import org.apache.tools.ant.util.DOMElementWriter;
import org.apache.tools.ant.util.DateUtils;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.testing.TestOutputEvent;
import org.gradle.api.tasks.testing.TestResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.io.*;
import java.util.Collection;
import java.util.EnumMap;
import java.util.Map;
/**
* by Szczepan Faber, created at: 10/3/12
*/
public class XmlTestSuite {
private Document testSuiteReport;
private Element rootElement;
private final String hostname;
private final String className;
private final long startTime;
private Map<TestOutputEvent.Destination, StringBuilder> outputs
= new EnumMap<TestOutputEvent.Destination, StringBuilder>(TestOutputEvent.Destination.class);
private File reportFile;
private long failedCount;
private long testCount;
public XmlTestSuite(File testResultsDir, String className, long startTime, String hostname, Document document) {
this.className = className;
this.startTime = startTime;
this.hostname = hostname;
testSuiteReport = document;
rootElement = testSuiteReport.createElement("testsuite");
testSuiteReport.appendChild(rootElement);
// Add an empty properties element for compatibility
rootElement.appendChild(testSuiteReport.createElement("properties"));
outputs.put(TestOutputEvent.Destination.StdOut, new StringBuilder());
outputs.put(TestOutputEvent.Destination.StdErr, new StringBuilder());
reportFile = new File(testResultsDir, "TEST-" + className + ".xml");
}
public String getClassName() {
return className;
}
public void addTestCase(String testName, TestResult.ResultType resultType, long executionTime, Collection<Throwable> failures) {
String testCase = resultType == TestResult.ResultType.SKIPPED ? "ignored-testcase" : "testcase";
Element element = testSuiteReport.createElement(testCase);
element.setAttribute("name", testName);
element.setAttribute("classname", this.className);
element.setAttribute("time", String.valueOf(executionTime / 1000.0));
if (!failures.isEmpty()) {
failedCount++;
for (Throwable failure : failures) {
Element failureElement = testSuiteReport.createElement("failure");
element.appendChild(failureElement);
failureElement.setAttribute("message", failureMessage(failure));
failureElement.setAttribute("type", failure.getClass().getName());
failureElement.appendChild(testSuiteReport.createTextNode(stackTrace(failure)));
}
}
testCount++;
rootElement.appendChild(element);
}
public void writeSuiteData(long executionTime) {
rootElement.setAttribute("name", this.className);
rootElement.setAttribute("tests", String.valueOf(this.testCount));
rootElement.setAttribute("failures", String.valueOf(this.failedCount));
rootElement.setAttribute("errors", "0");
rootElement.setAttribute("timestamp", DateUtils.format(this.startTime, DateUtils.ISO8601_DATETIME_PATTERN));
rootElement.setAttribute("hostname", this.hostname);
Element stdoutElement = testSuiteReport.createElement("system-out");
stdoutElement.appendChild(testSuiteReport.createCDATASection(outputs.get(TestOutputEvent.Destination.StdOut)
.toString()));
rootElement.appendChild(stdoutElement);
Element stderrElement = testSuiteReport.createElement("system-err");
stderrElement.appendChild(testSuiteReport.createCDATASection(outputs.get(TestOutputEvent.Destination.StdErr)
.toString()));
rootElement.appendChild(stderrElement);
rootElement.setAttribute("time", String.valueOf(executionTime / 1000.0));
outputs.clear();
writeTo(reportFile);
}
private String stackTrace(Throwable throwable) {
try {
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
throwable.printStackTrace(writer);
writer.close();
return stringWriter.toString();
} catch (Throwable t) {
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
t.printStackTrace(writer);
writer.close();
return stringWriter.toString();
}
}
private String failureMessage(Throwable throwable) {
try {
return throwable.toString();
} catch (Throwable t) {
return String.format("Could not determine failure message for exception of type %s: %s",
throwable.getClass().getName(), t);
}
}
public void writeTo(File reportFile) {
try {
OutputStream outstr = new BufferedOutputStream(new FileOutputStream(reportFile));
try {
new DOMElementWriter(true).write(rootElement, outstr);
} finally {
outstr.close();
}
} catch (IOException e) {
throw new GradleException(String.format("Could not write test report file '%s'.", reportFile), e);
}
}
public void addOutput(TestOutputEvent.Destination destination, String message) {
outputs.get(destination).append(message);
}
}
| [
"[email protected]"
]
| |
5ca6be9738b2badbd8746d15a3e83d07cd3426fc | dbfdd9403fa975ee74bd1d9cc9bfa97694ff33ca | /core/src/com/devkasatkin/jackthegiant/scenes/Gameplay.java | 6e5411dd48f0ff5f999b3be0efe4c3ea4fb19366 | []
| no_license | devkasatkin87/Jack_The_Giant | 6c078021b474c4eafa2c470adbdf17665c489ba9 | 23a5246cfcbfdb7a21fd13f9475d5dd17dff2b6d | refs/heads/master | 2023-03-19T15:42:16.603321 | 2021-03-11T18:12:08 | 2021-03-11T18:12:08 | 337,133,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,984 | java | package com.devkasatkin.jackthegiant.scenes;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.*;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.actions.RunnableAction;
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.devkasatkin.jackthegiant.clouds.CloudsController;
import com.devkasatkin.jackthegiant.helpers.GameInfo;
import com.devkasatkin.jackthegiant.helpers.GameManager;
import com.devkasatkin.jackthegiant.huds.UIHud;
import com.devkasatkin.jackthegiant.main.GameMain;
import com.devkasatkin.jackthegiant.player.Player;
public class Gameplay implements Screen, ContactListener {
private final GameMain game;
private Sprite[] bgs;
private OrthographicCamera mainCamera;
private OrthographicCamera box2DCamera;
private Box2DDebugRenderer debugRenderer;
private World world;
private Viewport viewport;
private float lastYposition;
private boolean touchedForTheFirstTime;
private CloudsController cloudsController;
private Player player;
private float lastPlayerY;
private UIHud hud;
private float cameraSpeed = 10;
private float maxSpeed = 10;
private float acceleration = 10;
private Sound coinSound, lifeSound;
public Gameplay(GameMain game) {
this.game = game;
mainCamera = new OrthographicCamera(GameInfo.WIDTH, GameInfo.HEIGHT);
mainCamera.position.set(GameInfo.WIDTH / 2f, GameInfo.HEIGHT / 2f, 0);
viewport = new StretchViewport(GameInfo.WIDTH, GameInfo.HEIGHT, mainCamera);
box2DCamera = new OrthographicCamera();
box2DCamera.setToOrtho(false, GameInfo.WIDTH / GameInfo.PPM,
GameInfo.HEIGHT / GameInfo.PPM);
box2DCamera.position.set(GameInfo.WIDTH / 2f, GameInfo.HEIGHT / 2f, 0);
debugRenderer = new Box2DDebugRenderer();
world = new World(new Vector2(0, -9.8f), true);
//inform the world that the contact listener is the gameplay class
world.setContactListener(this);
cloudsController = new CloudsController(world);
player = cloudsController.positionThePlayer(player);
hud = new UIHud(game);
createBackgrounds();
setCameraSpeed();
coinSound = Gdx.audio.newSound(Gdx.files.internal("Sounds/Coin sound.wav"));
lifeSound = Gdx.audio.newSound(Gdx.files.internal("Sounds/Life sound.wav"));
}
public void handleInput(float dt) {
if (Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
player.movePlayer(-2);
} else if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
player.movePlayer(2);
} else {
player.setWalking(false);
}
}
private void checkForFirstTouch() {
if (!touchedForTheFirstTime) {
if (Gdx.input.justTouched()) {
touchedForTheFirstTime = true;
GameManager.getInstance().isPaused = false;
lastPlayerY = player.getY();
}
}
}
public void update(float dt) {
checkForFirstTouch();
if (!GameManager.getInstance().isPaused) {
handleInput(dt);
moveCamera(dt);
checkBackgroundOutOfBounds();
cloudsController.setCameraY(mainCamera.position.y);
cloudsController.createAndArrangeNewClouds();
cloudsController.removeOffScreenCollectables();
checkPlayerBounds();
countScore();
}
}
private void moveCamera(float delta) {
mainCamera.position.y -= cameraSpeed * delta;
cameraSpeed += acceleration * delta;
if (cameraSpeed > maxSpeed) {
cameraSpeed = maxSpeed;
}
}
private void setCameraSpeed () {
if (GameManager.getInstance().gameData.isEasyDifficilty()) {
System.out.println("Easy");
cameraSpeed = 80;
maxSpeed = 100;
}
if (GameManager.getInstance().gameData.isMediumDifficilty()) {
System.out.println("Medium");
cameraSpeed = 100;
maxSpeed = 120;
}
if (GameManager.getInstance().gameData.isHardDifficilty()) {
System.out.println("Hard");
cameraSpeed = 140;
maxSpeed = 160;
}
}
private void createBackgrounds() {
bgs = new Sprite[3];
for (int i = 0; i < bgs.length; i++) {
bgs[i] = new Sprite(new Texture("Backgrounds/Game BG.png"));
bgs[i].setPosition(0, -(i * bgs[i].getHeight()));
lastYposition = Math.abs(bgs[i].getY());
}
}
private void drawBackgrounds() {
for (Sprite bg : bgs) {
game.getBatch().draw(bg, bg.getX(), bg.getY());
}
}
private void checkBackgroundOutOfBounds() {
for (int i = 0; i < bgs.length; i++) {
if ((bgs[i].getY() - bgs[i].getHeight() / 2f - 5) > mainCamera.position.y) {
float newPosition = bgs[i].getHeight() + lastYposition;
bgs[i].setPosition(0, -newPosition);
lastYposition = Math.abs(newPosition);
}
}
}
private void checkPlayerBounds() {
if ((player.getY() - GameInfo.HEIGHT / 2f - player.getHeight() / 2) > mainCamera.position.y) {
if (!player.isDied()) {
playerDied();
}
}
if ((player.getY() + GameInfo.HEIGHT / 2f + player.getHeight() / 2) < mainCamera.position.y) {
if (!player.isDied()) {
playerDied();
}
}
if (player.getX() - 25 > GameInfo.WIDTH || player.getX() + 25 < 0) {
if (!player.isDied()) {
playerDied();
}
}
}
private void countScore() {
if (lastPlayerY > player.getY()) {
hud.incrementScore(1);
lastPlayerY = player.getY();
}
}
private void playerDied() {
GameManager.getInstance().isPaused = true;
// decrenent life count
hud.decrenentLife();
player.setDied(true);
player.setPosition(1000,1000);
if (GameManager.getInstance().lifeScore < 0) {
//game over
//check new highscore
GameManager.getInstance().checkForNewHighscore();
//show the end score to user
hud.createGameOverPanel();
//load main menu
//Determines the sequence of actions for displaying the main menu
RunnableAction run = new RunnableAction();
run.setRunnable(new Runnable() {
@Override
public void run() {
// add custom code for action
game.setScreen(new MainMenu(game));
}
});
SequenceAction sa = new SequenceAction();
sa.addAction(Actions.delay(3f));
sa.addAction(Actions.fadeOut(1f));
sa.addAction(run);
hud.getStage().addAction(sa);
} else {
//reload the game with continue
RunnableAction run = new RunnableAction();
run.setRunnable(new Runnable() {
@Override
public void run() {
// add custom code for action
game.setScreen(new Gameplay(game));
}
});
SequenceAction sa = new SequenceAction();
sa.addAction(Actions.delay(3f));
sa.addAction(Actions.fadeOut(1f));
sa.addAction(run);
hud.getStage().addAction(sa);
}
}
@Override
public void show() {
}
@Override
public void render(float delta) {
update(delta);
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
game.getBatch().begin();
drawBackgrounds();
cloudsController.drawClouds(game.getBatch());
cloudsController.drawCollectables(game.getBatch());
player.drawIdle(game.getBatch());
player.drawPlayerAnimation(game.getBatch());
game.getBatch().end();
//debugRenderer.render(world, box2DCamera.combined);
game.getBatch().setProjectionMatrix(hud.getStage().getCamera().combined);
hud.getStage().draw();
hud.getStage().act();// necessarily for sequenceActions
game.getBatch().setProjectionMatrix(mainCamera.combined);
mainCamera.update();
player.update();
world.step(Gdx.graphics.getDeltaTime(), 6, 2);
}
@Override
public void resize(int width, int height) {
viewport.update(width, height);
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
@Override
public void dispose() {
world.dispose();
for (int i = 0; i < bgs.length; i++) {
bgs[i].getTexture().dispose();
}
player.getTexture().dispose();
debugRenderer.dispose();
coinSound.dispose();
lifeSound.dispose();
}
@Override
public void beginContact(Contact contact) {
Fixture body1;
Fixture body2;
if (contact.getFixtureA().getUserData() == "Player") {
body1 = contact.getFixtureA();
body2 = contact.getFixtureB();
} else {
body1 = contact.getFixtureB();
body2 = contact.getFixtureA();
}
if (body1.getUserData() == "Player" && body2.getUserData() == "Coin") {
//collided with the coin
hud.incrementCoins();
coinSound.play();
body2.setUserData("Remove");
cloudsController.removeCollectables();
}
if (body1.getUserData() == "Player" && body2.getUserData() == "Life") {
//collided with the life
hud.incrementLifes();
lifeSound.play();
body2.setUserData("Remove");
cloudsController.removeCollectables();
}
if (body1.getUserData() == "Player" && body2.getUserData() == "Dark Cloud") {
if (!player.isDied()) {
playerDied();
}
}
}
@Override
public void endContact(Contact contact) {
}
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
}
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
}
}// gameplay
| [
"[email protected]"
]
| |
ea338a8be0a5a5f74ab947e95be2d488fb036bf3 | fd7685cd3779b68b48611b6f66133b00660a099c | /src/main/java/com/ds/week6/PowerOf2.java | 7c2b70a4c756880d14ff7c426cef0be991a2410f | []
| no_license | Haja49/DataStructuresPractice | 02e8d3735d2ed659b29425e733a612678040c7ae | cf29e675dbc1cac778d785e3ba342b97dc1be34e | refs/heads/master | 2023-08-10T19:08:59.026656 | 2021-09-23T02:16:08 | 2021-09-23T02:16:08 | 383,140,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package com.ds.week6;
import org.junit.Test;
import junit.framework.Assert;
public class PowerOf2 {
/*
* Given an integer n, return true if it is a power of two. Otherwise, return
* false.
*
* An integer n is a power of two, if there exists an integer x such that n ==
* 2x.
*
* https://leetcode.com/problems/power-of-two/
*/
@Test
public void test1() {
Assert.assertEquals(true, findPowerUsingRecursion(1));
}
@Test
public void test2() {
Assert.assertEquals(false, findPowerUsingRecursion(-8));
}
@Test
public void test3() {
Assert.assertEquals(false, findPowerUsingRecursion(5));
}
private boolean findPower(int n) {
if (n <= 0)
return false;
while (n % 2 == 0)
n /= 2;
return n == 1;
}
private boolean findPowerUsingRecursion(int n) {
if (n <= 0)
return false;
return n == 1 || (n % 2 == 0 && findPowerUsingRecursion(n / 2));
}
private boolean findPowerUsingBit(int n) {
if (n <= 0)
return false;
return (n & (n - 1)) == 0;
}
}
| [
"[email protected]"
]
| |
db79348c59f23fca9b3008af7d8e847d97f7a54d | 23172d54fc0e79425780ee1e7a1c96c5c769784b | /fluency-fluentd/src/main/java/org/komamitsu/fluency/fluentd/ingester/sender/SSLSocketBuilder.java | 97f57d10642edd39ba5777c0de1145570980e34b | [
"Apache-2.0"
]
| permissive | komamitsu/fluency | 49784ac006dae8c3cb6769f7e1222480a650bd0c | 97c9ea616a45b9270cbdfd2f60ae22b9122ca35a | refs/heads/master | 2023-04-17T13:47:16.594770 | 2023-01-06T14:27:23 | 2023-01-06T14:27:23 | 43,254,843 | 148 | 34 | Apache-2.0 | 2023-04-07T04:59:16 | 2015-09-27T16:42:26 | Java | UTF-8 | Java | false | false | 2,128 | java | /*
* Copyright 2019 Mitsunori Komatsu (komamitsu)
*
* 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.komamitsu.fluency.fluentd.ingester.sender;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.SocketFactory;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
public class SSLSocketBuilder
{
private final String host;
private final int port;
private final int connectionTimeoutMilli;
private final int readTimeoutMilli;
private final SSLSocketFactory sslSocketFactory;
public SSLSocketBuilder(String host, Integer port, int connectionTimeoutMilli, int readTimeoutMilli, SocketFactory sslSocketFactory)
{
this.host = host;
this.port = port;
this.connectionTimeoutMilli = connectionTimeoutMilli;
this.readTimeoutMilli = readTimeoutMilli;
this.sslSocketFactory = (SSLSocketFactory)sslSocketFactory;
}
public SSLSocket build()
throws IOException
{
Socket socket = this.sslSocketFactory.createSocket();
try {
socket.connect(new InetSocketAddress(host, port), connectionTimeoutMilli);
socket.setTcpNoDelay(true);
socket.setSoTimeout(readTimeoutMilli);
}
catch (Throwable e) {
socket.close();
throw e;
}
return (SSLSocket) socket;
}
@Override
public String toString()
{
return "SSLSocketBuilder{" +
"host='" + host + '\'' +
", port=" + port +
'}';
}
}
| [
"[email protected]"
]
| |
f4381d68ce0097fe63cd4f042079796141865efa | 5a51f185f4e08f0dc9cb9a3b8a1832ecbfd14c7b | /Test/src/tes/socket/TCPClient.java | a2864b166416c1409b669f47cb77515ecae3b9b6 | []
| no_license | jhtlove/Exercise | a224484ca2b3322ab246d651b816fe9726714ca3 | 6fc7d1118469512ae1d7a22a659ff49357f2fa9a | refs/heads/master | 2021-06-23T17:43:23.111296 | 2016-12-01T08:43:32 | 2016-12-01T08:43:32 | 23,207,965 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 896 | java | package tes.socket;
import java.io.*;
import java.net.Socket;
import java.net.UnknownHostException;
public class TCPClient
{
public static void main(String[] args)
{
Socket s = null;
try
{
s = new Socket("127.0.0.1",8888);//申请连接;client端,随机选一个端口
} catch (UnknownHostException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
try
{
OutputStream os = s.getOutputStream();//在client是输出管道
DataOutputStream dos = new DataOutputStream(os);
dos.writeUTF("hello,server!");
dos.flush();
InputStream is = s.getInputStream();
DataInputStream dis = new DataInputStream(is);
System.out.println(dis.readUTF());
dos.close();
dis.close();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.