blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b7b7ef3ef68235516e8d84e1e685ce49d03858f1 | 40967a0d68c0f9986031a2acb8591fd3a6380900 | /src/main/java/com/example/demo/dto/NotificationDTO.java | 1468605c44be1d16c65d653edb243b82c5244a06 | [] | no_license | CNtangksong/trysay | 07864bd4943d4406b05d9bb99b64be24a73b0310 | a1e48078e46544b1d127ac3c4dfdd4b45bd44857 | refs/heads/master | 2022-06-27T02:13:55.336770 | 2020-04-25T06:39:23 | 2020-04-25T06:39:23 | 253,737,097 | 0 | 0 | null | 2022-06-21T03:18:02 | 2020-04-07T08:46:26 | JavaScript | UTF-8 | Java | false | false | 376 | java | package com.example.demo.dto;
import com.example.demo.model.User;
import lombok.Data;
@Data
public class NotificationDTO {
private Long id;
private Long gmtCreate;
private Integer status;
private Long notifier;
private String notifierName;
private String outerTitle;
private Long outerid;
private String typeName;
private Integer type;
}
| [
"1037332097@qq.com"
] | 1037332097@qq.com |
b8de4b8dd1ab859d77441344101b93e8cfbae653 | f6a19af9ba8848ade91dc837fa253a78a816e976 | /dp/UniqueBinarySearchTrees_96.java | 88e370713eae8f45e3ccf5440e5cf72e93f8eba2 | [] | no_license | TianyueHu/shuashua | 39b6fe84acc54c2913c9ea1d56a9b7333e66c032 | 5ed57f673b77f5d915031912a061f1fd7ffce9ef | refs/heads/master | 2020-03-12T03:40:01.272421 | 2019-02-02T09:01:36 | 2019-02-02T09:01:36 | 130,428,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | class UniqueBinarySearchTrees_96{
//flag == false --> right;
//flag == true --> left
//由于返回结果是int,没有考虑溢出的情况
public int numTrees(int n) {
int[] nums = new int[n];
int[] left = new int[n];
int[] right = new int[n];
for(int i = 0; i < n; ++i){
nums[i] = i + 1;
}
return getNumTrees(nums, left, right, true);
}
private int getNumTrees(int[] nums, int[] left, int[] right, boolean flag){
int size = nums.length;
if (size <= 1) return 1;
if (flag && left[size - 1] != 0) return left[size - 1];
if (!flag && right[right.length - size] != 0) return right[right.length - size];
int count = 0;
for(int i = 0; i < size; ++i){
int leftNum = getNumTrees(Arrays.copyOfRange(nums, 0, i), left, right, true);
int rightNum = getNumTrees(Arrays.copyOfRange(nums, i+1, size), left, right, false);
count += (leftNum * rightNum);
}
if(flag) left[nums.length - 1] = count;
else right[right.length - size] = count;
return count;
}
} | [
"huzheting@yeah.net"
] | huzheting@yeah.net |
c0ba5e111fddad3193cc50fd0d0823bc490de17b | 9c5eed6442ce175b0290e9b7167b9e983ca0f51f | /src/basicAdapter/Adaptee.java | 9c4b6cba75ec6557db95c608c7faa6e37e05f52a | [] | no_license | konuhovii/DesignPatterns | bfbc6f6e08857cbd54b16ee28d7e2cef2a546962 | c05b2e7fe4f78e118328160a5076b9aaa2a292e8 | refs/heads/master | 2021-01-01T18:20:54.999874 | 2017-08-10T06:47:12 | 2017-08-10T06:47:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | package basicAdapter;
public class Adaptee {
public void specificRequest() {
System.out.println("Adaptee.specificRequest()");
}
}
| [
"konuhovii@gmail.com"
] | konuhovii@gmail.com |
62e60635b18a547c95ec36deb18c3f04c9e2ab3a | a7839aa49f229bb746e1254fb3a2baa2aa48671c | /clients/java/src/main/java/com/unwired/client/model/GeolocationSchema.java | c632631d3ecc685c673076e935657b3adafd4343 | [
"MIT"
] | permissive | unwiredlabs/locationapi-client-libraries | 959ed437b50540be5fcb2d6d42d213d1d0761768 | e6c2022d9d3531ea9e8b7be39a2def36697ac029 | refs/heads/master | 2023-07-20T10:42:14.946894 | 2023-07-05T05:34:59 | 2023-07-05T05:34:59 | 174,091,095 | 10 | 11 | MIT | 2023-07-05T05:35:00 | 2019-03-06T07:08:15 | C# | UTF-8 | Java | false | false | 9,901 | java | /*
* Location API
* Geolocation, Geocoding and Maps
*
* OpenAPI spec version: 2.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.unwired.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.unwired.client.model.BtSchema;
import com.unwired.client.model.CellSchema;
import com.unwired.client.model.FallbackSchema;
import com.unwired.client.model.GeolocationAddressSchema;
import com.unwired.client.model.RadioSchema;
import com.unwired.client.model.WifiSchema;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* GeolocationSchema
*/
public class GeolocationSchema {
public static final String SERIALIZED_NAME_TOKEN = "token";
@SerializedName(SERIALIZED_NAME_TOKEN)
private String token;
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_RADIO = "radio";
@SerializedName(SERIALIZED_NAME_RADIO)
private RadioSchema radio = null;
public static final String SERIALIZED_NAME_MCC = "mcc";
@SerializedName(SERIALIZED_NAME_MCC)
private Long mcc;
public static final String SERIALIZED_NAME_MNC = "mnc";
@SerializedName(SERIALIZED_NAME_MNC)
private Long mnc;
public static final String SERIALIZED_NAME_CELLS = "cells";
@SerializedName(SERIALIZED_NAME_CELLS)
private List<CellSchema> cells = null;
public static final String SERIALIZED_NAME_WIFI = "wifi";
@SerializedName(SERIALIZED_NAME_WIFI)
private List<WifiSchema> wifi = null;
public static final String SERIALIZED_NAME_FALLBACKS = "fallbacks";
@SerializedName(SERIALIZED_NAME_FALLBACKS)
private FallbackSchema fallbacks = null;
public static final String SERIALIZED_NAME_ADDRESS = "address";
@SerializedName(SERIALIZED_NAME_ADDRESS)
private GeolocationAddressSchema address = null;
public static final String SERIALIZED_NAME_IP = "ip";
@SerializedName(SERIALIZED_NAME_IP)
private String ip;
public static final String SERIALIZED_NAME_BT = "bt";
@SerializedName(SERIALIZED_NAME_BT)
private BtSchema bt = null;
public GeolocationSchema token(String token) {
this.token = token;
return this;
}
/**
* Get token
* @return token
**/
@ApiModelProperty(example = "YOUR_API_TOKEN", value = "")
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public GeolocationSchema id(String id) {
this.id = id;
return this;
}
/**
* ID of the device, in case you are in a per-device plan. This could be any unique string such as an IMEI, IMSI, phone number or a hash of any of the previous values, etc. Maximum accepted length is 20 chars, and values should only be alphanumeric (a-z, 0-9)
* @return id
**/
@ApiModelProperty(example = "IMEI number", value = "ID of the device, in case you are in a per-device plan. This could be any unique string such as an IMEI, IMSI, phone number or a hash of any of the previous values, etc. Maximum accepted length is 20 chars, and values should only be alphanumeric (a-z, 0-9)")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public GeolocationSchema radio(RadioSchema radio) {
this.radio = radio;
return this;
}
/**
* Get radio
* @return radio
**/
@ApiModelProperty(value = "")
public RadioSchema getRadio() {
return radio;
}
public void setRadio(RadioSchema radio) {
this.radio = radio;
}
public GeolocationSchema mcc(Long mcc) {
this.mcc = mcc;
return this;
}
/**
* \"Mobile Country Code of your operator’s network represented by an integer (Optional). Range: 0 to 999.\"
* @return mcc
**/
@ApiModelProperty(example = "310", value = "\"Mobile Country Code of your operator’s network represented by an integer (Optional). Range: 0 to 999.\"")
public Long getMcc() {
return mcc;
}
public void setMcc(Long mcc) {
this.mcc = mcc;
}
public GeolocationSchema mnc(Long mnc) {
this.mnc = mnc;
return this;
}
/**
* Mobile Network Code of your operator’s network represented by an integer (Optional). Range: 0 to 999. On CDMA, provide the System ID or SID, with range: 1 to 32767.
* @return mnc
**/
@ApiModelProperty(example = "404", value = "Mobile Network Code of your operator’s network represented by an integer (Optional). Range: 0 to 999. On CDMA, provide the System ID or SID, with range: 1 to 32767.")
public Long getMnc() {
return mnc;
}
public void setMnc(Long mnc) {
this.mnc = mnc;
}
public GeolocationSchema cells(List<CellSchema> cells) {
this.cells = cells;
return this;
}
public GeolocationSchema addCellsItem(CellSchema cellsItem) {
if (this.cells == null) {
this.cells = new ArrayList<CellSchema>();
}
this.cells.add(cellsItem);
return this;
}
/**
* An array of cell ID objects
* @return cells
**/
@ApiModelProperty(value = "An array of cell ID objects")
public List<CellSchema> getCells() {
return cells;
}
public void setCells(List<CellSchema> cells) {
this.cells = cells;
}
public GeolocationSchema wifi(List<WifiSchema> wifi) {
this.wifi = wifi;
return this;
}
public GeolocationSchema addWifiItem(WifiSchema wifiItem) {
if (this.wifi == null) {
this.wifi = new ArrayList<WifiSchema>();
}
this.wifi.add(wifiItem);
return this;
}
/**
* An array of WiFi objects visible to the device.
* @return wifi
**/
@ApiModelProperty(value = "An array of WiFi objects visible to the device.")
public List<WifiSchema> getWifi() {
return wifi;
}
public void setWifi(List<WifiSchema> wifi) {
this.wifi = wifi;
}
public GeolocationSchema fallbacks(FallbackSchema fallbacks) {
this.fallbacks = fallbacks;
return this;
}
/**
* Get fallbacks
* @return fallbacks
**/
@ApiModelProperty(value = "")
public FallbackSchema getFallbacks() {
return fallbacks;
}
public void setFallbacks(FallbackSchema fallbacks) {
this.fallbacks = fallbacks;
}
public GeolocationSchema address(GeolocationAddressSchema address) {
this.address = address;
return this;
}
/**
* Get address
* @return address
**/
@ApiModelProperty(value = "")
public GeolocationAddressSchema getAddress() {
return address;
}
public void setAddress(GeolocationAddressSchema address) {
this.address = address;
}
public GeolocationSchema ip(String ip) {
this.ip = ip;
return this;
}
/**
* IP address of device.
* @return ip
**/
@ApiModelProperty(example = "49.204.218.106", value = "IP address of device.")
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public GeolocationSchema bt(BtSchema bt) {
this.bt = bt;
return this;
}
/**
* Get bt
* @return bt
**/
@ApiModelProperty(value = "")
public BtSchema getBt() {
return bt;
}
public void setBt(BtSchema bt) {
this.bt = bt;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GeolocationSchema geolocationSchema = (GeolocationSchema) o;
return Objects.equals(this.token, geolocationSchema.token) &&
Objects.equals(this.id, geolocationSchema.id) &&
Objects.equals(this.radio, geolocationSchema.radio) &&
Objects.equals(this.mcc, geolocationSchema.mcc) &&
Objects.equals(this.mnc, geolocationSchema.mnc) &&
Objects.equals(this.cells, geolocationSchema.cells) &&
Objects.equals(this.wifi, geolocationSchema.wifi) &&
Objects.equals(this.fallbacks, geolocationSchema.fallbacks) &&
Objects.equals(this.address, geolocationSchema.address) &&
Objects.equals(this.ip, geolocationSchema.ip) &&
Objects.equals(this.bt, geolocationSchema.bt);
}
@Override
public int hashCode() {
return Objects.hash(token, id, radio, mcc, mnc, cells, wifi, fallbacks, address, ip, bt);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class GeolocationSchema {\n");
sb.append(" token: ").append(toIndentedString(token)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" radio: ").append(toIndentedString(radio)).append("\n");
sb.append(" mcc: ").append(toIndentedString(mcc)).append("\n");
sb.append(" mnc: ").append(toIndentedString(mnc)).append("\n");
sb.append(" cells: ").append(toIndentedString(cells)).append("\n");
sb.append(" wifi: ").append(toIndentedString(wifi)).append("\n");
sb.append(" fallbacks: ").append(toIndentedString(fallbacks)).append("\n");
sb.append(" address: ").append(toIndentedString(address)).append("\n");
sb.append(" ip: ").append(toIndentedString(ip)).append("\n");
sb.append(" bt: ").append(toIndentedString(bt)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"akhil@unwiredlabs.com"
] | akhil@unwiredlabs.com |
1a896959fd09eff74306a1895f361afb638adc62 | a5c07cf214bf0b05f79530af4065175fea523233 | /src/main/java/com/zoupeng/community/dao/LoginTicketMapper.java | 24d897dc1a344c50ca9973078d704b129747506b | [] | no_license | zoupeng007007/community | 647eac22be281edda495651ef9a27ddd464056ff | 114920c72b41b3456544879757aac4d1082d76c2 | refs/heads/main | 2023-05-14T05:22:27.031002 | 2021-06-03T15:36:39 | 2021-06-03T15:36:39 | 367,666,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,097 | java | package com.zoupeng.community.dao;
import com.zoupeng.community.entity.LoginTicket;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
@Mapper
@Component
@Deprecated
/**
* 已将Ticket转移到Redis,不推荐使用
*/
public interface LoginTicketMapper {
@Insert({
"insert into login_ticket(user_id,ticket,status,expired) ",
"values(#{userId},#{ticket},#{status},#{expired})"
})
@Options(useGeneratedKeys = true,keyProperty = "id")//自动生成主键
int insertLoginTicket (LoginTicket loginTicket);
@Select({
"select id,user_id,ticket,status,expired ",
"from login_ticket where ticket=#{ticket}"
})
LoginTicket selectByTicket(String ticket);//查询Session
//在mapper中写sql
@Update({
"<script> ",
"update login_ticket set status=#{status} where ticket=#{ticket} ",
"<if test=\"ticket!=null\"> ",
"and 1=1",
"</if> ",
"</script> "
})
int updateStatus(String ticket,int status);
}
| [
"zoupeng007@126.com"
] | zoupeng007@126.com |
54f7f101da45bdc081b6480692b081088fcfa03f | 00aad001c091351a11f3086092d2b2a8dace2185 | /src/main/java/com/qianfeng/mybatis/dto/IUser.java | 674835c8cfb86513ccfffe419fe20815484e6ad5 | [] | no_license | jaydddd/jaywei | c6ef2dc86343d852d1a6da131ad6a318814badc0 | c126431bce60caed0f64af887f3e0fb2902a5aa2 | refs/heads/master | 2021-04-12T03:56:47.167304 | 2018-03-20T03:17:57 | 2018-03-20T03:17:57 | 125,948,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.qianfeng.mybatis.dto;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* Created by admin on 2018/3/19.
*/
public interface IUser {
/*不需要配置映射文件,实体类和数据库名称一样*/
@Select("SELECT * FROM users")
List<UserDto2> getUser();
}
| [
"1240029870@qq.com"
] | 1240029870@qq.com |
b2af1f6dcef94e76574cb1a1e4048c3a31e46c44 | 20b147a40fb922a977614620f56cc2b22b4cd454 | /src/com/sda/kolekcje/Main.java | a2fad2ffea04701a19f6cb06027d5bc190671e1c | [] | no_license | javascn5/LinkedListImpl_TL | 9c4050c92da39b510878aeb5baf36aa68e16bbce | c2c5e21658938b0ef16baac19f695d70c7180c6d | refs/heads/master | 2020-04-02T04:05:19.400132 | 2018-10-21T12:33:48 | 2018-10-21T12:33:48 | 153,999,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package com.sda.kolekcje;
import java.util.LinkedList;
import java.util.List;
public class Main {
public static void main(String[] args) {
// Arraylist - implementacja tablicową
// linkedlist - implementacja wiązaną
CustomList<String> customList = new CustomLinkedList<>();
customList.add("Jeden");
customList.add("dwa");
customList.add("trzy");
customList.add("cztery");
List<String> list = new LinkedList<>();
list.add("Jan");
list.add("Marcin");
list.add("Karol");
for(String l: list){
System.out.println(l);
}
}
}
| [
"tlachawczak@gmail.com"
] | tlachawczak@gmail.com |
8c7fce829358aa94317b0c479b9b89d8a1ac67a8 | bc8ffe63f1973db31c19d61337c431e64a391c17 | /app/src/main/java/com/parash/hostelmanagementapp/ui/share/ShareFragment.java | 540c48ceb1457d3de083eed654a2dc354978fd0c | [] | no_license | parashghale/HostelManagementApp | 975a272040d29905927556de7aefad30b5e72d9d | 572d31d411ccd87198839779343c1b700eff05aa | refs/heads/master | 2021-01-04T23:28:08.056010 | 2020-02-23T08:53:02 | 2020-02-23T08:53:02 | 240,795,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,577 | java | package com.parash.hostelmanagementapp.ui.share;
import android.Manifest;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.MimeTypeMap;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.StorageTask;
import com.google.firebase.storage.UploadTask;
import com.parash.hostelmanagementapp.MainActivity;
import com.parash.hostelmanagementapp.ProfileActivity;
import com.parash.hostelmanagementapp.R;
import java.util.HashMap;
import static android.app.Activity.RESULT_OK;
public class ShareFragment extends Fragment {
private ShareViewModel shareViewModel;
// ImageView imageView;
// TextView textView;
// Button deleteButton;
// TextView username, email;
// Button btnSignOut,btnLocation,btnExit,btnDeleteUser;
// Intent intent;
// DatabaseReference reference;
// FirebaseUser firebaseUser;
// int count =0;
// String fuId="";
// ProgressBar progressBar;
// StorageReference storageReference;
// private Uri imageURl;
// private StorageTask uploadsTask;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
shareViewModel =
ViewModelProviders.of(this).get(ShareViewModel.class);
View root = inflater.inflate(R.layout.fragment_share, container, false);
Intent intent = new Intent(getContext(), ProfileActivity.class);
startActivity(intent);
return root;
// imageView=root.findViewById(R.id.ProfileImage);
// firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
// storageReference = FirebaseStorage.getInstance().getReference("Uploads");
//
// textView=root.findViewById(R.id.profileEmail);
// textView.setText(firebaseUser.getEmail());
// deleteButton=root.findViewById(R.id.btnDeleteAccount);
// deleteButton.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
// dialog.setTitle("Are you sure?");
// dialog.setMessage("This will deactivate your account");
// dialog.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// firebaseUser.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
// @Override
// public void onComplete(@NonNull Task<Void> task) {
// if(task.isSuccessful())
// {
// Toast.makeText(getContext(), "Account has been deleted", Toast.LENGTH_SHORT).show();
// Intent intent = new Intent(getContext(), MainActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
// startActivity(intent);
//
//
// }
// else
// {
// Toast.makeText(getContext(), task.getException().getMessage(), Toast.LENGTH_SHORT).show();
//
// }
// }
// });
// }
// });
// dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// dialog.cancel();
// }
// });
// AlertDialog alertDialog = dialog.create();
// alertDialog.show();
// }
// });
//
// imageView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// openImage();
// }
// });
}
// private void openImage() {
// Intent intent = new Intent();
// intent.setType("image/*");
// intent.setAction(Intent.ACTION_GET_CONTENT);
// startActivityForResult(intent,1);
// }
// private String getFileExtension(Uri uri)
// {
// Context applicationContext = getActivity().getApplicationContext();
// applicationContext.getContentResolver();
// MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
// return mimeTypeMap.getExtensionFromMimeType(applicationContext.getContentResolver().getType(uri));
// }
//
// @Override
// public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
// if( resultCode == RESULT_OK && data != null )
// {
// imageURl =data.getData();
// uploadImage();
// }
//
//
// }
//
// private void CheckPermission() {
// if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(),
// Manifest.permission.READ_EXTERNAL_STORAGE)) {
//
// new AlertDialog.Builder(getContext())
// .setTitle("Permission needed")
// .setMessage("This permission is needed because of this and that")
// .setPositiveButton("ok", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// ActivityCompat.requestPermissions(getActivity(),
// new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
// }
// })
// .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// dialog.dismiss();
// }
// })
// .create().show();
// }
// }
// private void uploadImage()
// {
//
// if(imageURl !=null)
// {
// final StorageReference fileReference = storageReference.child(System.currentTimeMillis()
// +"."+getFileExtension(imageURl));
// uploadsTask =fileReference.putFile(imageURl);
// uploadsTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot,Task<Uri>>(){
// @Override
// public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
// if(!task.isSuccessful())
// {
// throw task.getException();
// }
// return fileReference.getDownloadUrl();
// }
// }).addOnCompleteListener(new OnCompleteListener<Uri>() {
// @Override
// public void onComplete(@NonNull Task<Uri> task) {
// if(task.isSuccessful())
// {
// Uri downloadUri = task.getResult();
// String mUri = downloadUri.toString();
//
// reference = FirebaseDatabase.getInstance().getReference("Users").child(firebaseUser.getUid());
// HashMap<String,Object> map = new HashMap<>();
// map.put("image",mUri);
// reference.updateChildren(map);
// }
// else
// {
// Toast.makeText(getContext(), "Failed", Toast.LENGTH_SHORT).show();
// }
// }
// }).addOnFailureListener(new OnFailureListener() {
// @Override
// public void onFailure(@NonNull Exception e) {
// Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
// }
// });
// }
// else {
// Toast.makeText(getContext(), "No image selected", Toast.LENGTH_SHORT).show();
// }
// }
} | [
"parash.ghale20@gmail.com"
] | parash.ghale20@gmail.com |
42a274cc4807e6ee767e06f9d73463bcc739af62 | f4a51c90f8731b66c9dd2469b1a6fb361ee27c12 | /HttpException.java | d62a1384c387bbcaa17cee728b63b0eee394367e | [] | no_license | luyifan/JavaServerHttp | bf078efb485eb380f584e7205a0a49e4eed6c7c6 | 2bdb83ff1a5b017283906c160da2fabc17f31a1d | refs/heads/master | 2020-03-30T00:15:34.044190 | 2014-06-03T17:42:44 | 2014-06-03T17:42:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | public class HttpException extends Exception
{
public HttpException()
{
super();
}
public HttpException( String message )
{
super ( message );
}
public HttpException ( String message , Exception e )
{
super( message , e ) ;
}
}
| [
"maxluyifan@gmail.com"
] | maxluyifan@gmail.com |
ec3443dd85da6970147591b225e001828c33c3aa | b993731bbb498bccb473da6417a2b78805df6d80 | /GUITest2/src/com/guitest2/ProjectPanel.java | f568843fa37ceb4fe64268998e93ecbf15fd7520 | [] | no_license | Aimintao/Oracle | d2f39c74dacd929d4d1b5e4121a292ea83fc1049 | e0b207ed1f420b42bee7f5ba89b520b8bbe9e20e | refs/heads/master | 2020-03-28T08:15:22.498643 | 2018-04-22T08:42:29 | 2018-04-22T08:42:29 | 147,954,511 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,323 | java | package com.guitest2;
import com.projectfunction.ProjectFunction;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
public class ProjectPanel extends JPanel implements ActionListener {
protected JPanel mainPanel;
protected JFrame frame;
protected JButton wnum_btn;
protected JButton enum_btn;
ProjectPanel(JFrame F) {
this.frame=F;
this.setLayout(new BorderLayout());
this.mainPanel=new JPanel();
JPanel panel_btn=new JPanel();
//添加控件
this.wnum_btn=new JButton();
this.enum_btn=new JButton();
wnum_btn.setText("查询完成情况");
wnum_btn.addActionListener(this);
enum_btn.setText("查询设备采购");
enum_btn.addActionListener(this);
panel_btn.add(wnum_btn);
panel_btn.add(enum_btn);
this.mainPanel.setLayout(new BorderLayout());
panel_btn.setBorder(BorderFactory.createTitledBorder("查询"));
this.add(mainPanel,"Center");
this.add(panel_btn,"South");
mainPanel.setBorder(BorderFactory.createTitledBorder("结果"));
}
@Override
public void actionPerformed(ActionEvent e) {
if("查询完成情况".equals(e.getActionCommand())){
mainPanel.removeAll();
String mName=JOptionPane.showInputDialog(null,"请输入项目经理姓名","查询完成情况",JOptionPane.INFORMATION_MESSAGE);
System.out.println(mName);
if(! mName.equals("") && mName != null) {
Vector<String> result = ProjectFunction.queryComplete(mName);
//-------------------------------------------------
Vector<String> colHeader = new Vector<String>();
colHeader.add("经理姓名");
colHeader.add("项目名称");
colHeader.add("签订时间");
colHeader.add("应完成时间");
colHeader.add("完成情况");
Vector<Vector<String>> dataVec = new Vector<Vector<String>>();
Vector<String> row1 = new Vector<String>();
row1.add(mName);
row1.add(result.get(0));
row1.add(result.get(1));
row1.add(result.get(2));
row1.add(result.get(3));
dataVec.add(row1);
JTable table = new JTable(dataVec, colHeader);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(table);
mainPanel.add(scrollPane);
}
//----------------------------------------------------
mainPanel.updateUI();
mainPanel.repaint();
}
else if("查询设备采购".equals(e.getActionCommand())){
mainPanel.removeAll();
String pName=JOptionPane.showInputDialog(null,"请输入项目名称","查询设备",JOptionPane.INFORMATION_MESSAGE);
System.out.println(pName);
if(! pName.equals("") && pName != null) {
Vector<String> result = ProjectFunction.getEqubyPro(pName);
//-------------------------------------------------
Vector<String> colHeader = new Vector<String>();
colHeader.add("项目名称");
colHeader.add("设备名称");
colHeader.add("费用");
colHeader.add("供货商");
Vector<Vector<String>> dataVec = new Vector<Vector<String>>();
Vector<String> row1 = new Vector<String>();
row1.add(pName);
row1.add(result.get(0));
row1.add(result.get(1));
row1.add(result.get(2));
dataVec.add(row1);
JTable table = new JTable(dataVec, colHeader);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(table);
mainPanel.add(scrollPane);
}
//----------------------------------------------------
mainPanel.updateUI();
mainPanel.repaint();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
24e920eda236064a5bfa91dc3a3997c0068de1db | d073a6b2c8c46c701d3b8ffecfceca131023d8ec | /app/src/test/java/xyz/yakdmt/navremote/ExampleUnitTest.java | 4f76369873bc3a9539debc129be502f725944455 | [] | no_license | yakdmt/navremote | 96300e21acb1fa3bbdfed9ca625b0c8fa7bb6694 | 815c0462f15e00675756e79f3a937de7c62a2d56 | refs/heads/master | 2021-01-10T01:20:27.460935 | 2016-01-03T19:25:45 | 2016-01-03T19:25:45 | 45,787,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package xyz.yakdmt.navremote;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"dmitry.yakovlev23@gmail.com"
] | dmitry.yakovlev23@gmail.com |
cbcfb74b60a50d532391f07d961fbe931c5b53dd | aa876d8e6144edfd46e6b8284acd3e03fed2813e | /src/main/java/com/tangenta/data/pojo/QuestionType.java | 2988bc111b582da41efb252f8e090e5f5d30fd01 | [] | no_license | tangenta/platform-backend | 57cee4c58573bd779459ad104ff3d5094e921e66 | 09b8d2324fa15d6f07649e4e28e7ec637798818e | refs/heads/master | 2020-04-25T21:11:41.760160 | 2019-03-31T03:41:31 | 2019-03-31T03:41:31 | 173,073,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | package com.tangenta.data.pojo;
public enum QuestionType {
SingleChoice,
MultipleChoice,
TrueOrFalse,
BlanksFilling,
}
| [
"tangenta@126.com"
] | tangenta@126.com |
e9ae5ace8cf13d482c318b13a83e5bf069821d0a | 7aa5e1c88d14e6de9fcc7c4854899d4c34b939ff | /4 sem/laba 7/src/sample/Main.java | b799504da6db7685d9f2047e9736ced79c512692 | [] | no_license | Kat-ies/Java_BSU | 519beb43237a6809e52eca33f314c76d34c812a4 | 4dbc4e66055cff6cf3ca41fb26f6c50ebec256bf | refs/heads/main | 2023-01-28T21:27:58.874369 | 2020-12-05T20:03:56 | 2020-12-05T20:03:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,211 | java | package sample;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import javax.swing.*;
import java.util.Observable;
public class Main extends Application{
private Observable observable;
private LabelObserver labelObserver;
private TextObserver textObserver;
private AnchorPane root;
private Scene scene;
private int WIDTH = 800;
private int HEIGHT = 250;
@Override
public void start(Stage primaryStage){
primaryStage.setTitle("Lab7");
root = new AnchorPane();
observable = new Observable(){
@Override
public void notifyObservers(Object arg) {
setChanged();
super.notifyObservers(arg);
}
};
labelObserver = new LabelObserver();
textObserver = new TextObserver();
root.getChildren().addAll(labelObserver, textObserver);
observable.addObserver(labelObserver);
observable.addObserver(textObserver);
scene = new Scene(root, WIDTH, HEIGHT);
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
observable.notifyObservers(event.getCode().toString());
}
});
AnchorPane.setRightAnchor(labelObserver, scene.getWidth()/2);
AnchorPane.setBottomAnchor(labelObserver, 10.0);
AnchorPane.setLeftAnchor(labelObserver, 30.0);
AnchorPane.setTopAnchor(labelObserver, 10.0);
AnchorPane.setRightAnchor(textObserver, 10.0);
AnchorPane.setBottomAnchor(textObserver, 10.0);
AnchorPane.setLeftAnchor(textObserver, scene.getWidth()/2);
AnchorPane.setTopAnchor(textObserver, 10.0);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"eyurkovsk@gmail.com"
] | eyurkovsk@gmail.com |
6fe633a9c6eefdff46b59199d5721c1ed7b14f72 | f55d6a2e0643a126894eee44e1987862e26a8a7a | /src/com/whitebearsolutions/imagine/wbsairback/rs/model/advanced/ReferenceRs.java | bc5f9b7fe4e9811d5e07985ebb7259019d3e3338 | [
"Apache-2.0"
] | permissive | WhiteBearSolutions/WBSAirback | cd4f52d0a01cdff442105098e6679a57264a2b44 | a12483d84cc4603b28f518eda109da908cba4cf3 | refs/heads/master | 2021-01-25T10:06:52.219073 | 2014-01-27T12:23:24 | 2014-01-27T12:23:24 | 14,498,960 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,645 | java | package com.whitebearsolutions.imagine.wbsairback.rs.model.advanced;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.transform.stream.StreamSource;
@XmlRootElement(name = "reference")
public class ReferenceRs {
private String name;
public ReferenceRs() {}
/**
* Obtiene el xml que representa a este objeto
* @return
*/
public String getXML() {
String xml = "";
try {
JAXBContext jc = JAXBContext.newInstance( ReferenceRs.class );
Marshaller m = jc.createMarshaller();
StringWriter stringWriter = new StringWriter();
m.marshal(this, stringWriter);
xml = stringWriter.toString();
} catch (JAXBException ex) {}
return xml;
}
/**
* Obtiene un objeto a partir de su xml
* @param xml
* @return
*/
public static ReferenceRs fromXML(String xml) {
try {
JAXBContext jc = JAXBContext.newInstance( ReferenceRs.class );
Unmarshaller um = jc.createUnmarshaller();
ReferenceRs o = (ReferenceRs) um.unmarshal( new StreamSource( new StringReader( xml.substring(xml.indexOf("<reference>"), xml.indexOf("</reference>")+"</reference>".length()).toString() ) ) );
return o;
} catch (JAXBException ex) {
return null;
}
}
// ####### GETTERS Y SETTERS #################################
@XmlElement(required=true)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"jorge.gea@whitebearsolutions.com"
] | jorge.gea@whitebearsolutions.com |
b13ee8d61c0391643ce9c14382885250d8bfa930 | 440c79a13d5549839f15f654b79f63086eca6201 | /Source Code for Questions/Q9_Three_Color_Buttons_Horizontal/app/src/androidTest/java/com/example/q9_three_color_buttons_horizontal/ExampleInstrumentedTest.java | aef545ac589f85352c1065594d68dfb7ddd7de3a | [] | no_license | MJK618/AndroidProgramming | ea8c85da61a1e8577f788b20c0327ce48cf25293 | c5ec2c4781ffd9a09847eeaeb10e8866fc7f5a29 | refs/heads/main | 2023-04-11T17:22:14.259249 | 2021-04-29T09:01:42 | 2021-04-29T09:01:42 | 362,462,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.example.q9_three_color_buttons_horizontal;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("com.example.q9_three_color_buttons_horizontal", appContext.getPackageName());
}
} | [
"47236394+MJK618@users.noreply.github.com"
] | 47236394+MJK618@users.noreply.github.com |
a6d840ebd390b4cd4b2d094c0d463d3015c3fc2c | 832ae52fe85439fada8685919058e05849fe6d14 | /Fall 2020/9-8/SoftPasswords2.java | d67b1a8a441b950cc47925579d589ea22aa579db | [] | no_license | cschmi14/Villanova-Programming-Team | 615ffe43e0dc376dd659bf8bf92c7c2729644e38 | f40b3bb233aa1259a50afe3f8ed20fc156ec3c0a | refs/heads/master | 2023-09-03T07:10:58.850707 | 2021-09-28T01:53:49 | 2021-09-28T01:53:49 | 334,807,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,210 | java | import java.util.Scanner;
public class SoftPasswords2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String p, s;
boolean t = true;
p = scan.nextLine();
s = scan.nextLine();
s.replace(" ", "_");
p.replace(" ", "_");
if (s.equals(p))
System.out.println("Yes");
else if (p.equals("0" + s))
System.out.println("Yes");
else if (p.equals("1" + s))
System.out.println("Yes");
else if (p.equals("2" + s))
System.out.println("Yes");
else if (p.equals("3" + s))
System.out.println("Yes");
else if (p.equals("4" + s))
System.out.println("Yes");
else if (p.equals("5" + s))
System.out.println("Yes");
else if (p.equals("6" + s))
System.out.println("Yes");
else if (p.equals("7" + s))
System.out.println("Yes");
else if (p.equals("8" + s))
System.out.println("Yes");
else if (p.equals("9" + s))
System.out.println("Yes");
else if (p.equals(s + "0"))
System.out.println("Yes");
else if (p.equals(s + "1"))
System.out.println("Yes");
else if (p.equals(s + "2"))
System.out.println("Yes");
else if (p.equals(s + "3"))
System.out.println("Yes");
else if (p.equals(s + "4"))
System.out.println("Yes");
else if (p.equals(s + "5"))
System.out.println("Yes");
else if (p.equals(s + "6"))
System.out.println("Yes");
else if (p.equals(s + "7"))
System.out.println("Yes");
else if (p.equals(s + "8"))
System.out.println("Yes");
else if (p.equals(s + "9"))
System.out.println("Yes");
else
t = false;
char[] charArray = s.toCharArray();
for (int i = 0; i < charArray.length; i++) {
if (Character.isUpperCase(charArray[i])) {
charArray[i] = Character.toLowerCase(charArray[i]);
}
else if (Character.isLowerCase(charArray[i])) {
charArray[i] = Character.toUpperCase(charArray[i]);
}
}
s = new String(charArray);
if (s.equals(p))
System.out.println("Yes");
else if (!t)
System.out.println("No");
}
} | [
"cschmidt542@gmail.com"
] | cschmidt542@gmail.com |
67e8957cd4f5aaf5724c64fef298fc54301190a8 | dce784d372d76bd34c4f6fa98f193467231cb27a | /tests/org.jboss.tools.quarkus.lsp4e.test/projects/maven/hibernate-orm-resteasy-yaml/src/main/java/org/acme/hibernate/orm/FruitResource.java | 4007e19552bd127ff48d98eb423e29c0635b0692 | [
"Apache-2.0"
] | permissive | jbosstools/jbosstools-quarkus | ce4a111f40609063a01fd31f9c6795a8b96d12eb | b073d1801df135c37656492481cdeab26fb5cb83 | refs/heads/main | 2023-07-09T22:12:40.542380 | 2023-07-03T09:33:29 | 2023-07-03T09:33:29 | 207,259,486 | 16 | 19 | Apache-2.0 | 2023-09-13T16:19:09 | 2019-09-09T08:18:39 | Java | UTF-8 | Java | false | false | 3,082 | java | package org.acme.hibernate.orm;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.json.Json;
import javax.persistence.EntityManager;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import org.jboss.resteasy.annotations.jaxrs.PathParam;
@Path("fruits")
@ApplicationScoped
@Produces("application/json")
@Consumes("application/json")
public class FruitResource {
@Inject
EntityManager entityManager;
@GET
public Fruit[] get() {
return entityManager.createNamedQuery("Fruits.findAll", Fruit.class)
.getResultList().toArray(new Fruit[0]);
}
@GET
@Path("{id}")
public Fruit getSingle(@PathParam Integer id) {
Fruit entity = entityManager.find(Fruit.class, id);
if (entity == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
return entity;
}
@POST
@Transactional
public Response create(Fruit fruit) {
if (fruit.getId() != null) {
throw new WebApplicationException("Id was invalidly set on request.", 422);
}
entityManager.persist(fruit);
return Response.ok(fruit).status(201).build();
}
@PUT
@Path("{id}")
@Transactional
public Fruit update(@PathParam Integer id, Fruit fruit) {
if (fruit.getName() == null) {
throw new WebApplicationException("Fruit Name was not set on request.", 422);
}
Fruit entity = entityManager.find(Fruit.class, id);
if (entity == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
entity.setName(fruit.getName());
return entity;
}
@DELETE
@Transactional
@Path(
"{id}"
)
public
Response
delete(@PathParam Integer id) {
Fruit entity = entityManager.getReference(Fruit.class, id);
if (entity == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
entityManager.remove(entity);
return Response.status(204).build();
}
@Provider
public static class ErrorMapper implements ExceptionMapper<Exception> {
@Override
public Response toResponse(Exception exception) {
int code = 500;
if (exception instanceof WebApplicationException) {
code = ((WebApplicationException) exception).getResponse().getStatus();
}
return Response.status(code)
.entity(Json.createObjectBuilder().add("error", exception.getMessage()).add("code", code).build())
.build();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
d23af6c34fb55e326f89e1a63a1560a788dabccc | 0e0d4db7f601f7aa118df81fb38b687d2f2edc3e | /src/de/philipp/advancedevolution/lib/xseries/SkullCacheListener.java | 45881d4e2dd072890c6eb7bdd72cecface4d279a | [] | no_license | NikeSchuh/AdvancedEvolution | 8804929d1f57015672c7e44a2e62b2df5a744953 | 44b56615bbcad8a9c57989f71a67831a739ee9ad | refs/heads/master | 2023-01-16T02:07:01.241159 | 2022-10-24T15:11:51 | 2022-10-24T15:11:51 | 316,614,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,927 | java | package de.philipp.advancedevolution.lib.xseries;
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Crypto Morin
*
* 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.
*/
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mojang.authlib.GameProfile;
import org.apache.commons.lang.Validate;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
/**
* This class is currently unused until I find a solution.
*/
@SuppressWarnings("unused")
final class SkullCacheListener {
protected static final Map<UUID, String> CACHE = new HashMap<>();
private static final String SESSION = "https://sessionserver.mojang.com/session/minecraft/profile/";
/**
* https://api.mojang.com/users/profiles/minecraft/Username gives the ID
* https://api.mojang.com/user/profiles/ID without dashes/names gives the names used for the unique ID.
* https://sessionserver.mojang.com/session/minecraft/profile/ID example data:
* <p>
* <pre>
* {
* "id": "Without dashes -",
* "name": "",
* "properties": [
* {
* "name": "textures",
* "value": ""
* }
* ]
* }
* </pre>
*/
@Nullable
public static String getSkinValue(@Nonnull String id) {
Objects.requireNonNull(id, "Player UUID cannot be null");
try {
JsonParser parser = new JsonParser();
URL properties = new URL(SESSION + id); // + "?unsigned=false"
try (InputStreamReader readProperties = new InputStreamReader(properties.openStream())) {
JsonObject jObjectP = parser.parse(readProperties).getAsJsonObject();
if (mojangError(jObjectP)) return null;
JsonObject textureProperty = jObjectP.get("properties").getAsJsonArray().get(0).getAsJsonObject();
//String signature = textureProperty.get("signature").getAsString();
return textureProperty.get("value").getAsString();
}
} catch (IOException | IllegalStateException e) {
System.err.println("Could not get skin data from session servers! " + e.getMessage());
e.printStackTrace();
return null;
}
}
@Nullable
public static String getIdFromUsername(@Nonnull String username) {
Validate.notEmpty(username, "Cannot get UUID of a null or empty username");
int len = username.length();
if (len < 3 || len > 16) throw new IllegalArgumentException("Username cannot be less than 3 and longer than 16 characters: " + username);
try {
URL convertName = new URL("https://api.mojang.com/users/profiles/minecraft/" + username);
JsonParser parser = new JsonParser();
try (InputStreamReader idReader = new InputStreamReader(convertName.openStream())) {
JsonElement jElement = parser.parse(idReader);
if (!jElement.isJsonObject()) return null;
JsonObject jObject = jElement.getAsJsonObject();
if (mojangError(jObject)) return null;
return jObject.get("id").getAsString();
}
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
private static boolean mojangError(@Nonnull JsonObject jsonObject) {
if (!jsonObject.has("error")) return false;
String err = jsonObject.get("error").getAsString();
String msg = jsonObject.get("errorMessage").getAsString();
System.err.println("Mojang Error " + err + ": " + msg);
return true;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
GameProfile profile = new GameProfile(player.getUniqueId(), player.getName());
ItemStack head = XMaterial.PLAYER_HEAD.parseItem();
SkullMeta meta = (SkullMeta) head.getItemMeta();
try {
SkullUtils.GAME_PROFILE.invoke(meta, profile);
} catch (Throwable ex) {
ex.printStackTrace();
}
head.setItemMeta(meta);
// If you don't add it to the players inventory, it won't be cached. That's the problem.
// Or is the inventory cached? I tested this with multiple inventories and other inventories load immediately after an inventory with
// the skull in it is opened once.
player.getInventory().addItem(head);
}
}
| [
"47360415+NikeSchuh@users.noreply.github.com"
] | 47360415+NikeSchuh@users.noreply.github.com |
6bac015e9eab62810b7caee122f746185053494d | d72af4b635f9fb1e446f744cdc55596b4d9287b5 | /src/main/java/com/paulhoang/data/CompanyData.java | f87aebd93f85570ba964b4b883be7819b3c10d77 | [] | no_license | General-Meow/mySharesGenerator | a8a075ba2b1224259983654f9a8a15ae50d7f599 | f8756e2bfbb204906f59c145e18b7149886cc846 | refs/heads/master | 2021-05-03T22:39:04.962695 | 2018-05-05T00:21:26 | 2018-05-05T00:21:26 | 69,394,872 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,380 | java | package com.paulhoang.data;
import java.math.BigDecimal;
/**
* Created by paul on 08/12/2016.
*/
public class CompanyData {
private String name;
private BigDecimal startingPrice;
private Trend trend;
private float trendFlipChance;
public CompanyData(String name, Trend trend, float trendFlipChance) {
this.name = name;
this.trend = trend;
this.trendFlipChance = trendFlipChance;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getStartingPrice() {
return startingPrice;
}
public void setStartingPrice(BigDecimal startingPrice) {
this.startingPrice = startingPrice;
}
public Trend getTrend() {
return trend;
}
public void setTrend(Trend trend) {
this.trend = trend;
}
public float getTrendFlipChance() {
return trendFlipChance;
}
public void setTrendFlipChance(float trendFlipChance) {
this.trendFlipChance = trendFlipChance;
}
@Override
public String toString() {
return "CompanyData{" +
"name='" + name + '\'' +
", startingPrice=" + startingPrice +
", trend=" + trend +
", trendFlipChance=" + trendFlipChance +
'}';
}
}
| [
"spl.ivalis@gmail.com"
] | spl.ivalis@gmail.com |
04255cdd4a9017e1fb76847631b2f52369c17b95 | cf0a3a9a353d3b22db446b2edb0a62b9053f4cae | /Backjoon/Flood Fill/Main_7562_나이트의_이동.java | aead2c785530f1860a0aa2297938c28d1b5e7f77 | [] | no_license | thinkp0907/Algorithm | 512d122aff3d0b15133515a0bcbdfca4afa4f927 | 826da3cb856879b1500be113a962afd3be916a25 | refs/heads/main | 2023-09-06T01:19:48.545733 | 2021-11-09T11:44:52 | 2021-11-09T11:44:52 | 413,831,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,308 | java | package Backjoon.floodFill;
import java.io.*;
import java.util.*;
public class Main_7562_나이트의_이동 {
static int[] dr = {-2, -2, -1, 1, 2, 2, 1, -1};
static int[] dc = {-1, 1, 2, 2, 1, -1, -2, -2};
static int T, N;
static int[][] map;
static int targetX;
static int targetY;
static int totCnt;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
T = sc.nextInt();
for (int t = 0; t < T; t++) {
N = sc.nextInt();
map = new int[N][N];
int x = sc.nextInt();
int y = sc.nextInt();
targetX = sc.nextInt();
targetY = sc.nextInt();
totCnt = 0;
bfs(x, y);
sb.append(totCnt).append("\n");
}
System.out.println(sb.toString());
}
private static void bfs(int x, int y) {
Queue<int[]> que = new LinkedList<int[]>();
que.add(new int[] {x, y, 0});
while(!que.isEmpty()) {
int[] cur = que.poll();
if(cur[0] == targetX && cur[1] == targetY) {
totCnt = cur[2];
return;
}
for(int d=0; d<8; d++) {
int nr = cur[0] + dr[d];
int nc = cur[1] + dc[d];
if(nr < 0 || nc < 0 || nr >= N || nc >= N) continue;
if(map[nr][nc] == 0) {
que.add(new int[] {nr, nc, cur[2]+1});
map[nr][nc] = 1;
}
}
}
}
}
| [
"thinkp0907@gmail.com"
] | thinkp0907@gmail.com |
87627e38113a168fb1c346d578be911d085bf501 | 40fbf821d261100420e1dcd67b90d32e4bb7141f | /src/main/java/citiipay/models/UserLogin.java | 614940474fdee3ec89a89d7e6632a099d207f267 | [] | no_license | csys-fresher-batch-2019/wallet-karthick | 2295f481fc08fe0177b4585a585277d8d6c10371 | 9db7e4dfbe7a68c6f3c93af314af87fd600e5da7 | refs/heads/master | 2020-12-21T15:04:37.558952 | 2020-02-18T04:47:52 | 2020-02-18T04:47:52 | 236,468,850 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package citiipay.models;
public class UserLogin {
private long mobileNumber;
private int pinNumber;
private int status;
public long getMobileNumber() {
return mobileNumber;
}
public void setMobileNumber(long mobileNumber) {
this.mobileNumber = mobileNumber;
}
public int getPinNumber() {
return pinNumber;
}
public void setPinNumber(int pinNumber) {
this.pinNumber = pinNumber;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
@Override
public String toString() {
return "UserLogin [mobileNumber=" + mobileNumber + ", pinNumber=" + pinNumber + ", status=" + status + "]";
}
}
| [
"karrthicks10@gmail.com"
] | karrthicks10@gmail.com |
e3aba93d79aa2254919ab1f21de8903de4df5308 | 0a7f9ec9d445a806ffec6419f2c666fb9710059e | /app/src/main/java/com/raisesail/andoid/androidupload/ResponseData.java | 19399b5fe20c2b16fa0d8045a14c47484efb3494 | [] | no_license | wangchao1994/AndroidUpload | 55f19e4fea8a8a5ddc9b3a33a72c7396fd69ca01 | 3631d16ea833ccdb81c76e5a819931ada43e7fc6 | refs/heads/master | 2020-05-19T19:34:14.213461 | 2019-06-27T08:16:58 | 2019-06-27T08:16:58 | 185,183,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | package com.raisesail.andoid.androidupload;
public class ResponseData {
/**
* status : OK
* id :
* link :
* meta : {}
*/
private String status;
private String id;
private String link;
private MetaBean meta;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public MetaBean getMeta() {
return meta;
}
public void setMeta(MetaBean meta) {
this.meta = meta;
}
public static class MetaBean {
}
}
| [
"wchao0829@163.com"
] | wchao0829@163.com |
ef5f94fa1fb453031061c305344f0088c4b3321c | 9d59afc3395993c14a3f272e10992fc558c62412 | /src/main/java/com/wx/dao/goodsDao/Goodsimpl.java | 9343ad802f3911c5a0843f6ad9d5548a2eb62587 | [] | no_license | wangxiangx86/shopsystem | c993d53d2668bbbc36eba8ad74f725cd22a24168 | 4025596a9d7a7222db96a8a0f83d832a0e2d9c12 | refs/heads/master | 2020-03-21T02:29:59.631209 | 2018-06-20T08:41:11 | 2018-06-20T08:41:11 | 138,001,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,038 | java | package com.wx.dao.goodsDao;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import com.wx.dao.GoodsDao;
import com.wx.entity.Goods;
public class Goodsimpl extends MybatisDao implements GoodsDao{
@Override
public List<Goods> selectAll(SqlSession session) {
List<Goods> goodslist = super.selectList(session, "GoodsMapper.selectAll");
return goodslist;
}
@Override
public int insertGoods(SqlSession session, Goods goods) {
int result = super.insert(session, "GoodsMapper.insertGoods", goods);
return result;
}
@Override
public int deleteGoods(SqlSession session, int id) {
int result = super.delete(session, "GoodsMapper.DeleteGoods", id);
return result;
}
@Override
public int updateGoods(SqlSession session, Goods goods) {
int result = super.update(session, "GoodsMapper.UpdateGoods", goods);
return 0;
}
@Override
public Goods selectOne(SqlSession session, String name) {
Goods goods = (Goods)super.selectOne(session, "GoodsMapper.SelectOne", name);
return goods;
}
}
| [
"979686321@qq.com"
] | 979686321@qq.com |
7cbaf24da4e297f7727bb499e1869231b11a1209 | 263fa4929a6261d18656f8fbe898667d6bd5bbfa | /springboot-security/springboot-security-demo/src/main/java/com/hxd/security/demo/aspect/package-info.java | 38f2de404a7d88ef6ae2404028353600df6f45ef | [] | no_license | xdhua/springcloud-eedu | e650e96fb3913b01a00cde0919d688a217db2225 | d5f198cecc327c0cb3760b0e5b5b7d5139d89472 | refs/heads/master | 2020-07-18T23:16:06.410687 | 2020-01-19T03:04:50 | 2020-01-19T03:04:50 | 206,332,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 102 | java | /**
*
*/
/**
* @author hxd
* 切片
* 2019年11月4日
*/
package com.hxd.security.demo.aspect; | [
"445353584@qq.com"
] | 445353584@qq.com |
eed127dadfd577958f69fcb6ce1350bb33a4bf40 | c75092b767c09022e30eb9329d9a368ecbd223fc | /src/com/snowgears/shop/ShopObject.java | da2c72cc0f0880c8c91874a9051d26a89d6c3ed7 | [] | no_license | GooseMonkey/Shop | d27e1162d8dbcd7b024cfcf91ed27f2c5264248b | 735e2605f430c6e487be5635490162d54e2df709 | refs/heads/master | 2021-01-22T00:45:32.001895 | 2013-12-18T09:36:24 | 2013-12-18T09:36:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,882 | java | package com.snowgears.shop;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.block.Chest;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class ShopObject{
private Location location;
private Location signLocation;
private String owner;
private DisplayItem displayItem;
private Double price;
private Integer amount;
private Integer timesUsed;
private boolean isAdminShop;
private ShopType type;
public ShopObject(Location loc,
Location signLoc,
String player,
ItemStack is,
double pri,
Integer amt,
Boolean admin,
ShopType t,
int amtUsed){
location = loc;
signLocation = signLoc;
owner = player;
price = pri;
amount = amt;
isAdminShop = admin;
type = t;
timesUsed = amtUsed;
displayItem = new DisplayItem(is, this);
}
public Location getLocation(){
return location;
}
public Inventory getInventory(){
return ((Chest)location.getBlock().getState()).getInventory();
}
public Location getSignLocation(){
return signLocation;
}
public String getOwner(){
return owner;
}
public DisplayItem getDisplayItem(){
return displayItem;
}
public double getPrice(){
return price;
}
public int getAmount(){
return amount;
}
public boolean isAdminShop(){
return isAdminShop;
}
public ShopType getType(){
return type;
}
public int getTimesUsed(){
return timesUsed;
}
public void addUse(){
timesUsed++;
}
public void setOwner(String s){
owner = s;
updateSign();
}
public void setPrice(double d){
price = d;
updateSign();
}
public void setAmount(int a){
amount = a;
updateSign();
}
public void setType(ShopType t){
type = t;
updateSign();
}
public void setAdmin(boolean b){
isAdminShop = b;
updateSign();
}
public boolean canAcceptAnotherTransaction(){
if(this.isAdminShop)
return true;
if(type == ShopType.SELLING){
int validItemsShopHas = Shop.plugin.miscListener.getAmount(getInventory(), this.getDisplayItem().getItemStack());
//shop does not have enough items to make another sale
if(validItemsShopHas < this.getAmount())
return false;
//using item economy
if(Shop.plugin.econ == null){
return inventoryHasRoom(new ItemStack(Shop.plugin.economyMaterial, (int)this.getPrice()));
}
}
else if(type == ShopType.BUYING){
//using item economy
if(Shop.plugin.econ == null){
int currencyShopHas = Shop.plugin.miscListener.getAmount(getInventory(), new ItemStack(Shop.plugin.economyMaterial));
//shop does not have enough item currency in stock to make another sale
if(currencyShopHas < this.getPrice())
return false;
}
//using vault economy
else{
double currencyShopHas = Shop.plugin.econ.getBalance(this.getOwner());
//owner of shop does not have enough money for the shop to make a sale
if(currencyShopHas < this.getPrice())
return false;
}
ItemStack stackToGoInShop = this.getDisplayItem().getItemStack().clone();
stackToGoInShop.setAmount(this.getAmount());
return inventoryHasRoom(stackToGoInShop);
}
return true;
}
public void updateSign(){
Sign signBlock = (Sign)signLocation.getBlock().getState();
signBlock.setLine(0, ChatColor.BOLD+"[shop]");
if(type == ShopType.SELLING)
signBlock.setLine(1, "Selling: "+ChatColor.BOLD+ amount);
else if(type == ShopType.BUYING)
signBlock.setLine(1, "Buying: "+ChatColor.BOLD+ amount);
else
signBlock.setLine(1, "Bartering: "); //TODO, "Bartering: Dirt for Stone, etc...
if((price % 1) == 0){
signBlock.setLine(2, ChatColor.GREEN+""+ price.intValue() +" "+ Shop.plugin.economyDisplayName);
}
else{
signBlock.setLine(2, ChatColor.GREEN+""+ price +" "+ Shop.plugin.economyDisplayName);
}
if(isAdminShop){
signBlock.setLine(3, "admin");
}
else{
signBlock.setLine(3, this.owner);
}
signBlock.update(true);
}
public void delete(){
// Shop.plugin.shopHandler.removeShop(this);
this.getDisplayItem().remove();
Block b = this.getSignLocation().getBlock();
if(b.getType() == Material.WALL_SIGN){
Sign signBlock = (Sign)b.getState();
signBlock.setLine(0, "");
signBlock.setLine(1, "");
signBlock.setLine(2, "");
signBlock.setLine(3, "");
signBlock.update(true);
}
}
@Override
public String toString(){
return owner + "." + displayItem.getItemStack().getType().toString();
}
private boolean inventoryHasRoom(ItemStack itemToAdd){
int freeSpace = 0;
for (ItemStack i : getInventory()) {
if(i == null)
freeSpace += itemToAdd.getType().getMaxStackSize();
else if (i.getData().equals(itemToAdd.getData()))
freeSpace += i.getType().getMaxStackSize() - i.getAmount();
}
return (itemToAdd.getAmount() <= freeSpace);
}
}
| [
"awesomete@gmail.com"
] | awesomete@gmail.com |
5edac8b034e6c8eb1f6bba80241de3e83a899d8c | 1d10f731c0a5bac589e94b1d0f6698237c26955c | /src/main/java/com/ruiec/web/controller/home/UserController.java | 12ac11c3cd63360ba2c4e9c5464eb8aa0639ac26 | [] | no_license | longyi97/abbsp | 21b78835d59968ef1e1dec78ebb1a03948767d36 | 23a2aeeaab53352858057989f1e98ac8135bcc6b | refs/heads/master | 2021-05-13T12:35:00.755090 | 2018-01-10T06:19:07 | 2018-01-10T06:19:07 | 116,675,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,823 | java | package com.ruiec.web.controller.home;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruiec.framework.server.support.query.Page;
import com.ruiec.framework.web.support.controller.BaseAdminController;
import com.ruiec.web.common.CommonParam;
import com.ruiec.web.model.Article;
import com.ruiec.web.model.Config;
import com.ruiec.web.model.SignRule;
import com.ruiec.web.model.User;
import com.ruiec.web.model.UserPointsDetail;
import com.ruiec.web.model.UserSign;
import com.ruiec.web.model.UserSignDetail;
import com.ruiec.web.service.ArticleReplyService;
import com.ruiec.web.service.ArticleService;
import com.ruiec.web.service.ConfigService;
import com.ruiec.web.service.ModuleService;
import com.ruiec.web.service.SignRuleService;
import com.ruiec.web.service.UserPointsDetailService;
import com.ruiec.web.service.UserPointsService;
import com.ruiec.web.service.UserService;
import com.ruiec.web.service.UserSignDetailService;
import com.ruiec.web.service.UserSignService;
import com.ruiec.web.util.RuiecDateUtils;
import com.ruiec.web.util.RuiecGetImage;
import com.ruiec.web.util.RuiecRemoveHTML;
/**
* 用户操作页面控制器
*
* @date 2017年10月17日 下午2:11:01
*/
@Controller
@RequestMapping("/user")
public class UserController extends BaseAdminController {
@Autowired
UserService userService;
@Autowired
ArticleService articleService;
@Autowired
private ArticleReplyService articleReplyService;
@Resource
private SignRuleService signRuleService;
@Resource
private UserSignService userSignService;
@Resource
private ConfigService configService;
@Resource
private UserPointsDetailService userPointsDetailService;
@Resource
private UserSignDetailService userSignDetailService;
@Resource
private UserPointsService userPointsService;
@Autowired
private ModuleService moduleService;
/**
* 跳转个人中心首页
*
* @date 2017年10月17日 下午2:11:01
*/
@RequestMapping("index")
public String index(Model model, Page page, User user, HttpSession session) {
Integer sessionId = ((User) session.getAttribute(CommonParam.SESSION_USER)).getId();
userInformation(model, sessionId, user, session);
if (null != sessionId) {
PageHelper.startPage(page.getPageNumber(), page.getPageSize());
List<Article> articleList = articleService.selectByUserAllArticle(sessionId);
if (articleList.size() != 0) {
// 创建数组存放帖子图片的路径
String[] img = new String[articleList.size()];
// 创建数组存放纯文本帖子内容
String[] content = new String[articleList.size()];
for (int i = 0; i < articleList.size(); i++) {
String context = articleList.get(i).getContent();
content[i] = articleList.get(i).getContent();
// 去除内容中的所有标签
// content[i] = content[i].replaceAll("</?[a-zA-Z]+[^><]*>",
// ""); 第一版去除,暂时保留
content[i] = RuiecRemoveHTML.delHTMLTag(content[i]);
if (!RuiecGetImage.getImageSrc(context).equals("")) {
// 后期优化
// 将图片路径从context中取出来
/*
* img[i] = context.substring(context.indexOf("src=\"")
* + 5, context.indexOf("\"", context.indexOf("src=\"")
* + 5));
*/
String image = RuiecGetImage.getImageSrc(context);
if (image.indexOf(",") != -1) {
image = image.substring(0, image.indexOf(","));
}
img[i] = image;
}
}
PageInfo<Article> pageInfo = new PageInfo<Article>(articleList);
page.setTotalCount(pageInfo.getTotal());
page.setList(articleList);
model.addAttribute("page", page);
model.addAttribute("img", img);
model.addAttribute("content", content);
// 帖子的评论数
List<Integer> ArticleReplyCount = new ArrayList<>();
for (Article article2 : articleList) {
ArticleReplyCount.add(articleReplyService.selecctArticleIdCount(article2.getId()));
}
model.addAttribute("ArticleReplyCount", ArticleReplyCount);
} else {
model.addAttribute("isNull", "0");
}
}
model.addAttribute("controlColor", "1");
return "/home/user/userIndex";
}
/**
* 用户基本信息
*
* @date 2017年12月6日 下午4:24:43
*/
public void userInformation(Model model, Integer sessionId, User user, HttpSession session) {
if (null != sessionId) {
user = userService.selectByPrimaryKey(sessionId);
// 用户积分
if (userPointsService.selectByUserId(sessionId) != null) {
model.addAttribute("userPoints", userPointsService.selectByUserId(sessionId).getPoints());
}
// 用户部门
model.addAttribute("departmentName", userService.selectdepartment(sessionId));
// 用户发帖数
model.addAttribute("articleCount", articleService.selectByUserAllArticleCount(sessionId));
// 用户精华数
model.addAttribute("articleHitCount", articleService.selectByUserAllArticleHitCount(sessionId));
}
// 导航栏一级版块
session.setAttribute("modules", moduleService.getSubList(null));
model.addAttribute("user", user);
model.addAttribute("id", sessionId);
}
/**
* 跳转设置个人资料页面
*
* @date 2017年10月17日 下午2:11:01
*/
@RequestMapping("userData")
public String userData(Model model, Page page, HttpSession session, User user) {
Integer sessionId = ((User) session.getAttribute(CommonParam.SESSION_USER)).getId();
userInformation(model, sessionId, user, session);
model.addAttribute("controlColor", "2");
return "/home/user/userSetting";
}
/**
* 修改用户资料
*
* @date 2017年10月17日 下午2:11:01
*/
@ResponseBody
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(User user, HttpServletRequest req, HttpSession session, Model model, Page page) {
// 导航栏一级版块
session.setAttribute("modules", moduleService.getSubList(null));
if (user.getSign() != null) {
if (user.getSign().length() > 50) {
return "0";
}
} else {
user.setSign("");
}
userService.updateByPrimaryKeySelective(user);
((User) session.getAttribute(CommonParam.SESSION_USER)).setHeadImage(user.getHeadImage());
((User) session.getAttribute(CommonParam.SESSION_USER)).setSign(user.getSign());
((User) session.getAttribute(CommonParam.SESSION_USER)).setBirthday(user.getBirthday());
((User) session.getAttribute(CommonParam.SESSION_USER)).setSex(user.getSex());
return "1";
}
/**
* 跳转修改密码
*
* @date 2017年10月17日 下午2:11:01
*/
/*
* @RequestMapping("updatePwd") public String updatePwd(Model model, Page
* page, HttpSession session, User user) { Integer sessionId = ((User)
* session.getAttribute(CommonParam.SESSION_USER)).getId();
* userInformation(model, sessionId, user); return "/home/user/userSetting";
* }
*/
/**
* 修改密码
*
* @date 2017年10月17日 下午2:11:01
*/
@ResponseBody
@RequestMapping("savaPwd")
public String savaPwd(HttpServletRequest request, String pwd, String newpwd, HttpSession session) {
User user = (User) session.getAttribute(CommonParam.SESSION_USER);
// 导航栏一级版块
session.setAttribute("modules", moduleService.getSubList(null));
if (user.getPassword().equals(DigestUtils.md5Hex(pwd))) {
if (user.getUsername().equals(newpwd)) {
return "3";
}
if (newpwd.matches("^\\s|\\s$|^(.)\\1*$")) {
return "2";
}
if (newpwd.equals(pwd)) {
return "4";
}
user.setPassword(DigestUtils.md5Hex(newpwd));
userService.updateByPrimaryKeySelective(user);
session.removeAttribute(CommonParam.SESSION_USER);
return "1";
} else {
return "0";
}
}
// 后期优化
/*
* public static boolean isOrderNumeric(String numOrStr) { boolean flag =
* true;// 如果全是连续数字返回true boolean isNumeric = true;// 如果全是数字返回true for (int
* i = 0; i < numOrStr.length(); i++) { if
* (!Character.isDigit(numOrStr.charAt(i))) { isNumeric = false; break; } }
* if (isNumeric) {// 如果全是数字则执行是否连续数字判断 for (int i = 0; i <
* numOrStr.length(); i++) { if (i > 0) {// 判断如123456 int num =
* Integer.parseInt(numOrStr.charAt(i) + ""); int num_ =
* Integer.parseInt(numOrStr.charAt(i - 1) + "") + 1; if (num != num_) {
* flag = false; break; } } } } else { flag = false; } return flag; }
*
* //保留
*//**
* 不能是连续的数字--递减(如:987654、876543)
*
* @param numOrStr
* @return 连续数字返回true
*//*
* public static boolean isOrderNumeric_(String numOrStr) { boolean flag
* = true;// 如果全是连续数字返回true boolean isNumeric = true;// 如果全是数字返回true for
* (int i = 0; i < numOrStr.length(); i++) { if
* (!Character.isDigit(numOrStr.charAt(i))) { isNumeric = false; break;
* } } if (isNumeric) {// 如果全是数字则执行是否连续数字判断 for (int i = 0; i <
* numOrStr.length(); i++) { if (i > 0) {// 判断如654321 int num =
* Integer.parseInt(numOrStr.charAt(i) + ""); int num_ =
* Integer.parseInt(numOrStr.charAt(i - 1) + "") - 1; if (num != num_) {
* flag = false; break; } } } } else { flag = false; } return flag; }
*/
/**
* 跳转积分列表页面
*
* @date 2017年10月17日 下午2:11:01
*/
@RequestMapping("signList")
public String signList(Model model, HttpSession session, Page page, User user) {
user = (User) session.getAttribute(CommonParam.SESSION_USER);
userInformation(model, user.getId(), user, session);
PageHelper.startPage(page.getPageNumber(), page.getPageSize());
List<UserPointsDetail> userPointsDetail = userPointsDetailService.selectByUserId(user.getId());
if (userPointsDetail.size() == 0) {
model.addAttribute("nolist", "0");
}
PageInfo<UserPointsDetail> pageInfo = new PageInfo<UserPointsDetail>(userPointsDetail);
page.setTotalCount(pageInfo.getTotal());
page.setList(userPointsDetail);
// 控制点击的颜色
model.addAttribute("controlColor", "3");
// 每次签到得到的正常积分
Float oneSign = Float.valueOf(configService.selectByKey("points_sign").getValue());
Map<String, String> map = new HashMap<String, String>();
for (Config config : configService.selectAll()) {
map.put(config.getKey(), config.getValue());
}
model.addAttribute("configs", map);
model.addAttribute("oneSign", oneSign);
// 查出所有签到规则
model.addAttribute("signRule", signRuleService.selectAll());
return "/home/user/userIntegration";
}
/**
* 跳转签到页面
*
* @date 2017年11月30日 上午10:42:41
*/
@RequestMapping("sign")
public String sign(Model model, HttpSession session) {
// 导航栏一级版块
session.setAttribute("modules", moduleService.getSubList(null));
User user = (User) session.getAttribute(CommonParam.SESSION_USER);
// 用戶通过签到获取的总积分
Float aFloat = userPointsDetailService.selectByAllSignPoints(user.getId());
if (aFloat != null && aFloat.intValue() == aFloat) {
model.addAttribute("userRulePoints", aFloat.intValue());
} else {
model.addAttribute("userRulePoints", aFloat);
}
// 用戶签到的总天数
if (userSignService.selectByUserName(user.getId()) != null) {
model.addAttribute("userSignCount", userSignService.selectByUserName(user.getId()).getSignCount());
}
// 查出所有签到规则
List<SignRule> list = signRuleService.selectAll();
if (list.size() > 0) {
// 存放分值的数组
String rewardPoints[] = new String[list.size()];
for (int i = 0; i < list.size(); i++) {
// 强转为int
Integer a = list.get(i).getRewardPoints().intValue();
if (list.get(i).getRewardPoints() - a == 0) {
rewardPoints[i] = a.toString();
} else {
rewardPoints[i] = list.get(i).getRewardPoints().toString();
}
}
model.addAttribute("rewardPoints", rewardPoints);
}
model.addAttribute("signRule", signRuleService.selectAll());
model.addAttribute("signRuleSize", signRuleService.selectAll().size());
// 查出所有按总签到次倒序排序
UserSign uSign = new UserSign();
uSign.setConditionsSort(7);
List<UserSign> uSignList = userSignService.selectByUserSign(uSign);
model.addAttribute("uSign", uSignList);
// 查出所有按连续签到次数倒序排序
UserSign sSign = new UserSign();
sSign.setConditionsSort(8);
List<UserSign> sSignList = userSignService.selectByUserSign(sSign);
model.addAttribute("sSign", sSignList);
// 每次签到得到的正常积分
Float oneSign = Float.valueOf(configService.selectByKey("points_sign").getValue());
if (oneSign.intValue() == oneSign) {
model.addAttribute("oneSign", oneSign.intValue());
} else {
model.addAttribute("oneSign", oneSign);
}
return "/home/user/sign/sign";
}
/**
* 完成签到
*
* @throws ParseException
* @date 2017年11月30日 上午11:18:58
*/
@RequestMapping("succeedSign")
@ResponseBody
public Map<String, Object> succeedSign(HttpSession session) throws ParseException {
User user = (User) session.getAttribute(CommonParam.SESSION_USER);
// 签到是否成功的标识 false:失败,true:成功
Boolean noSucceed = false;
if (user.getId() != null) {
noSucceed = userSignService.isSign(user.getId());
}
// 成功签到,返回历史签到
if (noSucceed) {
return userSignDate(session);
// 签到失败,返回失败标识
} else {
Map<String, Object> jsonmap = new HashMap<String, Object>();
jsonmap.put("noSucceed", noSucceed);
return jsonmap;
}
}
/**
* 获取用户的所有签到日期
*
* @date 2017年12月5日 上午11:25:32
*/
@RequestMapping("userSignDate")
@ResponseBody
public Map<String, Object> userSignDate(HttpSession session) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> jsonmap = new HashMap<String, Object>();
// 获取session
User user = (User) session.getAttribute(CommonParam.SESSION_USER);
Date today = new Date();
// 判断今天是否签到标识,false:未签到,true:签到
Boolean TodayIsSignIn = false;
// 判断今天是否已签到
if (userSignService.selectByUserName(user.getId()) != null) {
Date lastSignTime = userSignService.selectByUserName(user.getId()).getLastSignTime();
Integer signMinus = (int) RuiecDateUtils.getTimePositiveDifference(today, lastSignTime, 3);
if (signMinus == 1) {
TodayIsSignIn = true;
}
}
// 返回签到标识
jsonmap.put("TodayIsSignIn", TodayIsSignIn);
// 判断是否签到成功标识 false:失败,true:成功
Boolean noSucceed = false;
if (user.getId() != null) {
List<UserSignDetail> userSignDetailList = userSignDetailService.selectByUserId(user.getId());
// 获取历史签到记录
if (userSignDetailList != null) {
String signDate[] = new String[userSignDetailList.size()];
for (int i = 0; i < signDate.length; i++) {
signDate[i] = RuiecDateUtils.format_dd(userSignDetailList.get(i).getLastSignTime());
}
noSucceed = true;
// 返回历史签到
jsonmap.put("signDate", signDate);
jsonmap.put("noSucceed", noSucceed);
} else {
jsonmap.put("noSucceed", noSucceed);
}
}
// 进度条
UserSign userSign = userSignService.selectByUserName(user.getId());
List<SignRule> signRuleList = signRuleService.selectAll();
// 初始进度条
String progress = "0%";
if (signRuleList != null) {
if (userSign != null) {
Float aFloat = ((float) userSign.getSignContinuousCount()
/ (float) signRuleList.get(signRuleList.size() - 1).getContinuousDays());
// 若用户连续签到天数大于所定规则最多连续天数,则进度为100%
if (aFloat > 1) {
aFloat = (float) 1;
}
// 返回当前缺省语言环境的百分比格式
progress = NumberFormat.getPercentInstance().format(aFloat);
}
// 各规则所占百分比
String[] rules = new String[signRuleList.size()];
for (int i = 0; i < signRuleList.size(); i++) {
Float aFloat = ((float) signRuleList.get(i).getContinuousDays()
/ (float) signRuleList.get(signRuleList.size() - 1).getContinuousDays());
// 应前端需要,计算出各规则所在比例后减百分4
aFloat = (float) (aFloat - 0.04);
rules[i] = NumberFormat.getPercentInstance().format(aFloat);
}
for (int i = 0; i < rules.length; i++) {
Map<String, Object> jsonmap1 = new HashMap<String, Object>();
jsonmap1.put("left", rules[i]);
jsonmap1.put("Day", signRuleList.get(i).getContinuousDays());
jsonmap1.put("Number", signRuleList.get(i).getRewardPoints());
list.add(jsonmap1);
}
}
jsonmap.put("list", list);
// 返回进度条
jsonmap.put("progress", progress);
return jsonmap;
}
/**
* 签到后按周签到展示
*
* @date 2017年12月19日 下午10:42:41
*/
@RequestMapping("/weekDignIn")
@ResponseBody
public Map<String, Object> WeekDignIn(HttpSession session, Model model, Integer sessionId) {
// 导航栏一级版块
session.setAttribute("modules", moduleService.getSubList(null));
Map<String, Object> jsonmap = new HashMap<String, Object>();
// 获取到登录的用户
User user = (User) session.getAttribute(CommonParam.SESSION_USER);
userInformation(model, sessionId, user, session);// ?
// 判断用户是否存在签到记录
List<Integer> weeks = new ArrayList<Integer>();
if (userSignService.selectByUserName(user.getId()) != null) {
// 获取到用户最后的签到时间
Date lastSignTime = userSignService.selectByUserName(user.getId()).getLastSignTime();
// 获取到最后一次签到的时间中周一的的日期
String st = RuiecDateUtils.getWeekDateOne(lastSignTime);
// 传入st 这个时间,去数据库中判断2017-12-18后面有3条数据
List<UserSignDetail> userSignDetailList = userSignDetailService.selectByUserIdOne(user.getId(), st);
for (UserSignDetail ul : userSignDetailList) {
// 已经获取到周一后面的三条数据
String str = RuiecDateUtils.getWeekOfDate(ul.getLastSignTime());
weeks.add(Integer.valueOf(str));
}
jsonmap.put("weeks", weeks);
}
return jsonmap;
}
}
| [
"1350140784@qq.com"
] | 1350140784@qq.com |
4807bb4a09b70a5f07237c9f0e1493ea59afeee6 | d1a42d706abfe9ebcc06cc27b30539549c75d9a7 | /webframework/smart-framework/src/main/java/org/smart4j/framework/annotation/Trancation.java | 29278c5e368fd9eea1d3990eb08510ed0f67266b | [] | no_license | lugaoyu/webframework | 0bd53cacb1a2d94df7a81913bbe677916366c673 | 9ad1af2fab5de8b50486a363c59ee2a6b48a89ae | refs/heads/master | 2021-09-18T01:26:40.123456 | 2018-07-08T14:14:37 | 2018-07-08T14:14:37 | 103,811,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package org.smart4j.framework.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 定义需要事务控制的方法
*
* @author lugaoyu
* @since 1.0.0
* @date 2017-08-13
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Trancation {
}
| [
"lugaoyu1988@163.com"
] | lugaoyu1988@163.com |
f7949a8401012304d078d88b1a5251aed8720f66 | 62ab1eee884ef7bdbfe15eb5c7538f781f42976a | /test/SearchView/app/src/androidTest/java/com/example/latitude/searchview/ApplicationTest.java | d3006752b6881e0c2a56ab26e4fd7853e0678625 | [] | no_license | nguyenkhanhblaze/baitap | 18be34e45ea9b0b2e808ee01fb2048aa1fe5c92e | 4f61637850b5c682a49a0cee09903fc959f02007 | refs/heads/master | 2021-01-17T12:56:51.376761 | 2016-07-15T09:08:04 | 2016-07-15T09:08:04 | 55,963,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.example.latitude.searchview;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"nguyenkhanhblaze@gmail.com"
] | nguyenkhanhblaze@gmail.com |
aa4c01342b384f5a49c4dab97adf24ca9c02f065 | 4c03af53e4bf38961923b167bcc3fd5fb4d4a789 | /core/tego.runtime/src/main/java/mb/tego/strategies/FunctionStrategy2.java | f108c0b01a86c27f50e60ee350f9068bcc5c6aaa | [
"Apache-2.0"
] | permissive | metaborg/spoofax-pie | a367b679bd21d7f89841f4ef3e984e5c1653d5af | 98f49ef75fcd4d957a65c9220e4dc4c01d354b01 | refs/heads/develop | 2023-07-27T06:08:28.446264 | 2023-07-16T14:46:02 | 2023-07-16T14:46:02 | 102,472,170 | 10 | 16 | Apache-2.0 | 2023-02-06T17:30:58 | 2017-09-05T11:19:03 | Java | UTF-8 | Java | false | false | 832 | java | package mb.tego.strategies;
import mb.tego.sequences.Seq;
import mb.tego.strategies.runtime.TegoEngine;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* A function strategy that can be used to adapt a function call with three arguments as a strategy.
*
* Use {@link StrategyExt#fun}.
*
* @param <A1> the type of the first argument (contravariant)
* @param <A2> the type of the second argument (contravariant)
* @param <T> the type of input (contravariant)
* @param <R> the type of output (covariant)
*/
@FunctionalInterface
public interface FunctionStrategy2<A1, A2, T, R> extends Strategy2<A1, A2, T, R> {
@Override
default @Nullable R evalInternal(TegoEngine engine, A1 arg1, A2 arg2, T input) {
return call(input, arg1, arg2);
}
@Nullable R call(T input, A1 arg1, A2 arg2);
}
| [
"noreply@github.com"
] | noreply@github.com |
49bfb534bdf88510769269f0d9722c2be86a9e59 | fb427a22e4cb9f1c1c65af44fde5230dae905586 | /src/main/java/com/lks/core/MRVConstants.java | 8d7b29d1a5cdd4da094ec3978f4966a5c82e99bd | [] | no_license | shreyaslokkur/PeriodPampering | 91262c73714ae8e453c280543280970c2aa85736 | 3b500a47dde4385fce71a4ceef438c130ac3185c | refs/heads/master | 2021-09-02T15:11:26.146269 | 2017-07-14T12:26:39 | 2017-07-14T12:26:39 | 116,127,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.lks.core;
/**
* Created with IntelliJ IDEA.
* User: shreyaslokkur
*/
public class MRVConstants {
public static final String BASICBUYERADDRESSLIST = "BASICBUYERADDRESS.LIST";
public static final String BASICBUYERADDRESS = "BASICBUYERADDRESS";
public static final String UUID = "UUID";
}
| [
"lokkur@adobe.com"
] | lokkur@adobe.com |
0ee46029cf5ed2d3e44e5e4bcf78d5e41276debe | 956706ca16693bc0f55ad5e7a99334997024716d | /app/src/androidTest/java/com/example/lizzi/gakki/ExampleInstrumentedTest.java | 8d020a24acfe3715a830b64ef87068df8cce2eda | [] | no_license | BinGuoLA/first | 4b490d562f480ea7ebabbd3c265d1ab09de86507 | e3843147d19eec05d85a66f3c35e743166d8ca4d | refs/heads/master | 2020-03-22T09:02:19.496971 | 2018-07-05T07:21:27 | 2018-07-05T07:21:27 | 139,809,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package com.example.lizzi.gakki;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.lizzi.gakki", appContext.getPackageName());
}
}
| [
"13397716393@163.com"
] | 13397716393@163.com |
db0a28a44b62ccaf34bd44954941af31df3b1c94 | e22ec7e53aa216ac276823fef6bae954e6026239 | /2.JavaCore/src/com/javarush/task/task14/task1413/CompItem.java | 1ded11e813857b62504f1277bad42501e50932b8 | [] | no_license | niwza/JavaRush | 9167fd692c47f0f29b2cf1d6832ff184a0aa448d | 97f8a5c6c3dc4e5cd3964c4c5531d113f14ca871 | refs/heads/master | 2021-01-23T05:14:35.312502 | 2017-07-20T21:03:02 | 2017-07-20T21:03:02 | 92,961,230 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package com.javarush.task.task14.task1413;
/**
* Created by niwza on 09.07.2017.
*/
public interface CompItem {
String getName();
}
| [
"niwza@svitonline.com"
] | niwza@svitonline.com |
ad5630a8a7915baf37287ed4a0590a2bad8f14fc | 62d7386c4963400e8ecedbd290fbd0fb2c0cf7dc | /instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java | 7c2d3027cc8ca35dd4d4296a79ba58baba6f1122 | [
"Apache-2.0"
] | permissive | bluemarble/opentelemetry-java-instrumentation | eb644e8144a0323e95398af1a0f84570acda2ec8 | 50fb35a61f66ffe0ee37cf45bad884e5897c5106 | refs/heads/main | 2023-05-27T15:20:14.718517 | 2021-06-10T16:52:05 | 2021-06-10T16:52:05 | 354,686,801 | 0 | 0 | Apache-2.0 | 2021-04-05T01:39:59 | 2021-04-05T01:39:59 | null | UTF-8 | Java | false | false | 7,369 | java | /*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.extannotations;
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.javaagent.instrumentation.extannotations.ExternalAnnotationTracer.tracer;
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
import static net.bytebuddy.matcher.ElementMatchers.isDeclaredBy;
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
import static net.bytebuddy.matcher.ElementMatchers.none;
import static net.bytebuddy.matcher.ElementMatchers.not;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.api.config.Config;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.tooling.config.MethodsConfigurationParser;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.ByteCodeElement;
import net.bytebuddy.description.NamedElement;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
import net.bytebuddy.matcher.ElementMatchers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExternalAnnotationInstrumentation implements TypeInstrumentation {
private static final Logger log =
LoggerFactory.getLogger(ExternalAnnotationInstrumentationModule.class);
private static final String PACKAGE_CLASS_NAME_REGEX = "[\\w.$]+";
static final String CONFIG_FORMAT =
"(?:\\s*"
+ PACKAGE_CLASS_NAME_REGEX
+ "\\s*;)*\\s*"
+ PACKAGE_CLASS_NAME_REGEX
+ "\\s*;?\\s*";
private static final List<String> DEFAULT_ANNOTATIONS =
Arrays.asList(
"com.appoptics.api.ext.LogMethod",
"com.newrelic.api.agent.Trace",
"com.signalfx.tracing.api.Trace",
"com.tracelytics.api.ext.LogMethod",
"datadog.trace.api.Trace",
"io.opentracing.contrib.dropwizard.Trace",
"kamon.annotation.Trace",
"kamon.annotation.api.Trace",
"org.springframework.cloud.sleuth.annotation.NewSpan");
private static final String TRACE_ANNOTATIONS_CONFIG =
"otel.instrumentation.external-annotations.include";
private static final String TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG =
"otel.instrumentation.external-annotations.exclude-methods";
private final ElementMatcher.Junction<ClassLoader> classLoaderOptimization;
private final ElementMatcher.Junction<NamedElement> traceAnnotationMatcher;
/** This matcher matches all methods that should be excluded from transformation. */
private final ElementMatcher.Junction<MethodDescription> excludedMethodsMatcher;
public ExternalAnnotationInstrumentation() {
Set<String> additionalTraceAnnotations = configureAdditionalTraceAnnotations(Config.get());
if (additionalTraceAnnotations.isEmpty()) {
classLoaderOptimization = none();
traceAnnotationMatcher = none();
} else {
ElementMatcher.Junction<ClassLoader> classLoaderMatcher = none();
for (String annotationName : additionalTraceAnnotations) {
classLoaderMatcher = classLoaderMatcher.or(hasClassesNamed(annotationName));
}
this.classLoaderOptimization = classLoaderMatcher;
this.traceAnnotationMatcher = namedOneOf(additionalTraceAnnotations.toArray(new String[0]));
}
excludedMethodsMatcher = configureExcludedMethods();
}
@Override
public ElementMatcher<ClassLoader> classLoaderOptimization() {
return classLoaderOptimization;
}
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return safeHasSuperType(declaresMethod(isAnnotatedWith(traceAnnotationMatcher)));
}
@Override
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
isAnnotatedWith(traceAnnotationMatcher).and(not(excludedMethodsMatcher)),
ExternalAnnotationInstrumentation.class.getName() + "$ExternalAnnotationAdvice");
}
private static Set<String> configureAdditionalTraceAnnotations(Config config) {
String configString = config.getProperty(TRACE_ANNOTATIONS_CONFIG);
if (configString == null) {
return Collections.unmodifiableSet(new HashSet<>(DEFAULT_ANNOTATIONS));
} else if (configString.isEmpty()) {
return Collections.emptySet();
} else if (!configString.matches(CONFIG_FORMAT)) {
log.warn(
"Invalid trace annotations config '{}'. Must match 'package.Annotation$Name;*'.",
configString);
return Collections.emptySet();
} else {
Set<String> annotations = new HashSet<>();
String[] annotationClasses = configString.split(";", -1);
for (String annotationClass : annotationClasses) {
if (!annotationClass.trim().isEmpty()) {
annotations.add(annotationClass.trim());
}
}
return Collections.unmodifiableSet(annotations);
}
}
/**
* Returns a matcher for all methods that should be excluded from auto-instrumentation by
* annotation-based advices.
*/
private static ElementMatcher.Junction<MethodDescription> configureExcludedMethods() {
ElementMatcher.Junction<MethodDescription> result = none();
Map<String, Set<String>> excludedMethods =
MethodsConfigurationParser.parse(
Config.get().getProperty(TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG));
for (Map.Entry<String, Set<String>> entry : excludedMethods.entrySet()) {
String className = entry.getKey();
ElementMatcher.Junction<ByteCodeElement> classMather =
isDeclaredBy(ElementMatchers.named(className));
ElementMatcher.Junction<MethodDescription> excludedMethodsMatcher = none();
for (String methodName : entry.getValue()) {
excludedMethodsMatcher = excludedMethodsMatcher.or(ElementMatchers.named(methodName));
}
result = result.or(classMather.and(excludedMethodsMatcher));
}
return result;
}
public static class ExternalAnnotationAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(
@Advice.Origin Method method,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {
context = tracer().startSpan(method);
scope = context.makeCurrent();
}
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void stopSpan(
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope,
@Advice.Thrown Throwable throwable) {
scope.close();
if (throwable != null) {
tracer().endExceptionally(context, throwable);
} else {
tracer().end(context);
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
172047d6db14554261dba5977110096f539b3fe3 | f5425ef915d45dc7a9f7874b6df47b339b319bce | /app/src/main/java/com/app/manajemenorganisasi/OrmawaActivity.java | 0b04b6f74e2cf3d41d2bfcc07f54bd73de8253de | [] | no_license | ahmadfathan/ManajemenOrganisasi | 880a153ff85b930e0f0daacc050a3411fe8b3f3c | 02c0a6fff08fcedcbdf8adcf65d2c54d66248381 | refs/heads/master | 2023-05-14T14:34:18.999864 | 2021-06-07T16:02:32 | 2021-06-07T16:02:32 | 374,713,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,092 | java | package com.app.manajemenorganisasi;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.app.manajemenorganisasi.models.Organisasi;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.facebook.shimmer.ShimmerFrameLayout;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import static com.app.manajemenorganisasi.utils.DateUtil.dow_name;
import static com.app.manajemenorganisasi.utils.DateUtil.month_name;
public class OrmawaActivity extends AppCompatActivity {
private TextView tv_pengertian, tv_tanggal, tv_deskripsi;
private ImageView iv_gambar;
private FirebaseDatabase mDatabase;
private DatabaseReference mRef;
private FirebaseStorage firebaseStorage;
private StorageReference storageReference;
private ShimmerFrameLayout shimmerFrameLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_omawa);
tv_pengertian = findViewById(R.id.tv_organisasi_pengertian);
tv_tanggal = findViewById(R.id.tv_organisasi_tanggal);
tv_deskripsi = findViewById(R.id.tv_organisasi_deskripsi);
iv_gambar = findViewById(R.id.iv_organisasi_gambar);
shimmerFrameLayout = findViewById(R.id.shimmer_layout_organisasi);
mDatabase = FirebaseDatabase.getInstance();
firebaseStorage = FirebaseStorage.getInstance();
storageReference = firebaseStorage.getReference();
if(getIntent().hasExtra("pratinjau")){
hideLoading();
String pengertian, tanggal, deskripsi;
Uri filePathOrg = getIntent().getParcelableExtra("gambar");
pengertian = getIntent().getStringExtra("pengertian");
tanggal = getIntent().getStringExtra("tanggal");
deskripsi = getIntent().getStringExtra("deskripsi");
tv_pengertian.setText(pengertian);
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss dd-MM-yyyy");
try {
Date date = sdf.parse(tanggal);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
String dow = dow_name[calendar.get(Calendar.DAY_OF_WEEK) - 1];
int dom = calendar.get(Calendar.DAY_OF_MONTH);
String month = month_name[calendar.get(Calendar.MONTH) - 1];
int year = calendar.get(Calendar.YEAR);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
tv_tanggal.setText(String.format("%s, %02d %s %04d %02d:%02d", dow, dom, month, year, hour, minute));
} catch (ParseException e) {
e.printStackTrace();
}
tv_deskripsi.setText(deskripsi);
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePathOrg);
} catch (IOException e) {
e.printStackTrace();
}
iv_gambar.setImageBitmap(bitmap);
iv_gambar.setBackgroundColor(Color.WHITE);
findViewById(R.id.tv_data_tidak_tersedia).setVisibility(View.GONE);
}else{
if(getIntent().hasExtra("group")){
String group = getIntent().getStringExtra("group");
mRef = mDatabase.getReference(group + "/organisasi");
}else{
startActivity(new Intent(OrmawaActivity.this, MainActivity.class));
finish();
}
showLoading();
mRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
Organisasi organisasi = snapshot.getValue(Organisasi.class);
if(organisasi != null){
findViewById(R.id.tv_data_tidak_tersedia).setVisibility(View.GONE);
tv_pengertian.setText(organisasi.getPengertian());
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss dd-MM-yyyy");
try {
Date date = sdf.parse(organisasi.getTanggal());
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
String dow = dow_name[calendar.get(Calendar.DAY_OF_WEEK) - 1];
int dom = calendar.get(Calendar.DAY_OF_MONTH);
String month = month_name[calendar.get(Calendar.MONTH) - 1];
int year = calendar.get(Calendar.YEAR);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
tv_tanggal.setText(String.format("%s, %02d %s %04d %02d:%02d", dow, dom, month, year, hour, minute));
} catch (ParseException e) {
e.printStackTrace();
}
tv_deskripsi.setText(organisasi.getDeskripsi());
storageReference.child("images/" + organisasi.getLokasi_gambar()).getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Glide.with(OrmawaActivity.this)
.load(uri)
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
hideLoading();
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
hideLoading();
return false;
}
})
.into(iv_gambar);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
hideLoading();
}
});
}else{
hideLoading();
findViewById(R.id.tv_data_tidak_tersedia).setVisibility(View.VISIBLE);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
hideLoading();
}
});
}
}
private void showLoading(){
shimmerFrameLayout.startShimmerAnimation();
findViewById(R.id.view1).setVisibility(View.VISIBLE);
findViewById(R.id.view2).setVisibility(View.VISIBLE);
findViewById(R.id.view3).setVisibility(View.VISIBLE);
findViewById(R.id.view4).setVisibility(View.VISIBLE);
}
private void hideLoading(){
findViewById(R.id.view1).setVisibility(View.GONE);
findViewById(R.id.view2).setVisibility(View.GONE);
findViewById(R.id.view3).setVisibility(View.GONE);
findViewById(R.id.view4).setVisibility(View.GONE);
shimmerFrameLayout.stopShimmerAnimation();
}
} | [
"ahmadfathan1021@gmail.com"
] | ahmadfathan1021@gmail.com |
dd5b8104cdcb245fc31a7c073ca3ca1132fe8d9f | 9c507fd783fbc1fa811842389fcfb08270b063f0 | /app/src/main/java/com/example01/myapplicationtest01/activity/BaseActivity.java | cf523ccbdd1af3f09e4e86cb64d10de84c95ba9e | [] | no_license | RevolutionGo/F.A.A | 07cbeded8ff2fdd4e72b9dcda91e70f5f639df56 | 143a8b8d43edb2196e0552d6014bf7795e35e125 | refs/heads/master | 2022-06-17T19:13:16.067341 | 2020-05-07T11:22:18 | 2020-05-07T11:22:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.example01.myapplicationtest01.activity;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example01.myapplicationtest01.util.SharedPreferencesUtil;
public class BaseActivity extends AppCompatActivity {
protected SharedPreferencesUtil sp;
//重写了setContentView方法,在子类调用了setContentView设置布局
public void setContentView(int layoutResID) {
super.setContentView(layoutResID);
//配置文件
sp = SharedPreferencesUtil.getInstance(getApplicationContext());
}
}
| [
"807318819@qq.com"
] | 807318819@qq.com |
8883f24307988149344bc8ba95b77c79725867bf | fb3abcc6009b1cb581fc78ced484a15d0c3aa296 | /selenium/src/training/wrapper_method.java | 98205b6093d6dde4bb6db4ac135008a906c02be9 | [] | no_license | Malar0625/githubdemo | e7d54b0daefec1949e7337f9e10ab25090a4eda4 | 7750d2a4036bcb7627a2c7e2a5f697062b3cd7b7 | refs/heads/master | 2021-01-07T20:08:39.734268 | 2020-03-17T12:38:31 | 2020-03-17T12:38:31 | 241,807,271 | 0 | 0 | null | 2020-10-13T20:24:09 | 2020-02-20T06:07:50 | HTML | UTF-8 | Java | false | false | 1,042 | java | package training;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class wrapper_method
{
WebDriver driver;
public void lauchapp(String url)
{
System.setProperty("webdriver.chrome.driver", "C:\\selenium\\drive\\chromedriver.exe");
driver=new ChromeDriver();
driver.get(url);
}
public void clickbyxpath(String path)
{
driver.findElement(By.xpath(path)).click();
}
public void enterbyid(String loc, String value)
{
driver.findElement(By.id(loc)).sendKeys(value);;
}
public void screenshot(String path1) throws IOException
{
TakesScreenshot ts = (TakesScreenshot)driver;
File Source = ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(Source, new File(path1));
}
public void closeapp()
{
driver.close();
}
}
| [
"BLTuser@BLT215"
] | BLTuser@BLT215 |
f9bb5341c9c5ed8dd5a219c1baf233c5e6e353b9 | 9d2d6de01edde628275674a47a5ae3781d2c59ff | /src/main/java/com/esrichina/demo2/config/audit/package-info.java | 4649a5a2123806a5b42c6f145069d479bcea5b54 | [] | no_license | gischen/jhipsterdemo | 8717d92bad89a22533f94d4f0442b453762c4e8b | c88a4c6d86d73ed0e6359a29e824e597c5fac09d | refs/heads/master | 2021-08-12T03:58:49.678536 | 2017-11-14T11:56:42 | 2017-11-14T11:56:43 | 109,928,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | /**
* Audit specific code.
*/
package com.esrichina.demo2.config.audit;
| [
"eweek2@126.com"
] | eweek2@126.com |
74e52c806503a2e106bed0fbaf9ac37171b6ce0d | 22cd38be8bf986427361079a2f995f7f0c1edeab | /src/main/java/core/erp/fam/service/impl/FAMB0030Dao.java | 34ee939b87f9d1bbf87fe405c7b4dcece4703b7d | [] | no_license | shaorin62/MIS | 97f51df344ab303c85acb2e7f90bb69944f85e0f | a188b02a73f668948246c133cd202fe091aa29c7 | refs/heads/master | 2021-04-05T23:46:52.422434 | 2018-03-09T06:41:04 | 2018-03-09T06:41:04 | 124,497,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,069 | java | /**
* core.erp.tmm.service.impl.FAMB0030Dao.java - <Created by Code Template generator>
*/
package core.erp.fam.service.impl;
import java.util.Map;
import org.springframework.stereotype.Repository;
import core.ifw.cmm.dataaccess.CmmBaseDAO;
/**
* <pre>
* FAMB0030Dao - 메시지 관리 프로그램 데이터처리 DAO 클래스
* </pre>
*
* @author ㅋㅋㅋ
* @since 2016.06.24
* @version 1.0
*
* <pre>
* == Modification Information ==
* Date Modifier Comment
* ====================================================
* 2016.06.24 ㅋㅋㅋ Initial Created.
* ====================================================
* </pre>
*
* Copyright INBUS.(C) All right reserved.
*/
@Repository("FAMB0030Dao")
public class FAMB0030Dao extends CmmBaseDAO {
/**
* <pre>
* 전표마스터
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표마스터
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH00(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH00", searchVo);
}
/**
* <pre>
* 전표라인
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH01(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH01", searchVo);
}
/**
* <pre>
* 전표라인 관리항목
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH02(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH02", searchVo);
}
/**
* <pre>
* 전표라인 부가세
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 부가세
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH03(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH03", searchVo);
}
/**
* <pre>
* 계정과목
* </pre>
* @param paramMap - 조회 파라미터
* @return 계정과목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH10(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH10", searchVo);
}
/**
* <pre>
* 계정과목별 관리항목 조회
* </pre>
* @param paramMap - 조회 파라미터
* @return 계정과목별 관리항목 조회
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH11(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH11", searchVo);
}
/**
* <pre>
* 발생전표라인 관리항목
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH13(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH13", searchVo);
}
/**
* <pre>
* 기준환율
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH14(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH14", searchVo);
}
/**
* <pre>
* 예산잔액
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH15(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH15", searchVo);
}
/**
* <pre>
* 전표일자별 마감정보
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public void processSEARCH16(Map searchVo) throws Exception {
list("FAMB0030.SEARCH16", searchVo);
}
/**
* <pre>
* 귀속부서별, 계정별 코스트센터 조회
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public String processSEARCH17(Map searchVo) throws Exception {
return (String)selectByPk("FAMB0030.SEARCH17", searchVo);
}
/**
* <pre>
* 전표인쇄 - 마스터 조회
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processPRINT00(Map searchVo) throws Exception {
return list("FAMB0030.PRINT00", searchVo);
}
/**
* <pre>
* 전표인쇄 - 분개정보 조회
* </pre>
* @param paramMap - 조회 파라미터
* @return 전표라인 관리항목
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processPRINT01(Map searchVo) throws Exception {
return list("FAMB0030.PRINT01", searchVo);
}
/**
* <pre>
* 전표 인쇄용 순번 재산출
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public int processUPDATE00(Map dataVo) throws Exception {
return update("FAMB0030.UPDATE00", dataVo);
}
/**
* <pre>
* 전표마스터 삭제
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public int processDELETE00(Map dataVo) throws Exception {
return delete("FAMB0030.DELETE00", dataVo);
}
/**
* <pre>
* 전표라인 삭제
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public int processDELETE01(Map dataVo) throws Exception {
return delete("FAMB0030.DELETE01", dataVo);
}
/**
* <pre>
* 전표라인 관리항목 삭제
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public int processDELETE02(Map dataVo) throws Exception {
return delete("FAMB0030.DELETE02", dataVo);
}
/**
* <pre>
* 전표라인 부가세 삭제
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public int processDELETE03(Map dataVo) throws Exception {
return delete("FAMB0030.DELETE03", dataVo);
}
/**
* <pre>
* 전표마스터 저장
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSAVE00(Map dataVo) throws Exception {
return insert("FAMB0030.SAVE00", dataVo);
}
/**
* <pre>
* 전표라인 저장
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSAVE01(Map dataVo) throws Exception {
return insert("FAMB0030.SAVE01", dataVo);
}
/**
* <pre>
* 전표라인 관리항목 저장
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSAVE02(Map dataVo) throws Exception {
return insert("FAMB0030.SAVE02", dataVo);
}
/**
* <pre>
* 전표라인 부가세 저장
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSAVE03(Map dataVo) throws Exception {
return insert("FAMB0030.SAVE03", dataVo);
}
/**
* <pre>
* 전표작성종료
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processFINISH(Map dataVo) throws Exception {
return insert("FAMB0030.FINISH", dataVo);
}
/**
* <pre>
* 전자결재 연동 자료 삭제
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public int processDELETE99(Map dataVo) throws Exception {
return delete("FAMB0030.DELETE99", dataVo);
}
/**
* <pre>
* 결재일련번호 채번 반환
* </pre>
* @param paramMap - 조회 파라미터
* @return 결재 SEQ 조회
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSEARCH99(Map searchVo) throws Exception {
return list("FAMB0030.SEARCH99", searchVo);
}
/**
* <pre>
* 전자결재 연동자료 저장
* </pre>
* @param paramMap - 저장할 데이터
* @return 저장 결과(저장 시 selectKey 사용 시 해당 키 값 전달)
* @throws Exception - 처리시 발생한 예외
*/
@SuppressWarnings("rawtypes")
public Object processSAVE99(Map dataVo) throws Exception {
return insert("FAMB0030.SAVE99", dataVo);
}
}
| [
"imosh@nate.com"
] | imosh@nate.com |
335a72ce7e706228931f0b6348ee6a93bd1311d6 | 2c9521e5393f1f763676b0b713689386be1a7acc | /src/main/java/com/achords/utils/converters/SongConverter.java | fbebe913b89b5299b2bffe59a2a572a0c0dc7ae7 | [] | no_license | Evgenikaall/achords | 69c7b1db8614ca99f7857256084636163ac2d1f6 | 1e23ec1088a4f723fc3cdd7751d59609d88925a6 | refs/heads/master | 2023-03-05T06:22:28.621294 | 2021-02-13T23:19:45 | 2021-02-13T23:19:45 | 326,974,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,676 | java | package com.achords.utils.converters;
import com.achords.model.dto.song.*;
import com.achords.model.entity.song.*;
import com.achords.service.song.*;
import com.achords.utils.exceptions.ChordNotFoundException;
import com.achords.utils.exceptions.GenreNotFoundException;
import com.achords.utils.exceptions.LanguageNotFoundException;
import com.achords.utils.exceptions.StrummingPatterNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
public class SongConverter {
private final AuthorService authorService;
private final ChordsService chordsService;
private final DifficultLevelService difficultLevelService;
private final GenresService genresService;
private final LanguageService languageService;
private final SectionTypeService sectionTypeService;
private final StrummingPatternService strummingPatternService;
private final TuningService tuningService;
public Song mapToEntity(SongDTO songDTO) throws Exception {
Author author = authorService.mapToEntity(songDTO.getAuthor());
DifficultLevel difficultLevel = difficultLevelService.findByName(songDTO.getDifficultLevel().getName());
SectionType sectionType = sectionTypeService.findByName(songDTO.getSectionType().getName());
Tuning tuning = tuningService.findByName(songDTO.getTuning().getName());
Set<Chords> chords = songDTO.getChords().stream()
.map(chordsDTO -> {
Chords chordsTemp = null;
try{
chordsTemp = chordsService.mapToEntity(chordsDTO);
} catch (ChordNotFoundException e) {
// log
}
return chordsTemp;
})
.collect(Collectors.toSet());
Set<Genre> genre = songDTO.getGenres().stream()
.map(genreDTO -> {
Genre genreTemp = null;
try {
genreTemp = genresService.findByName(genreDTO.getName());
} catch (GenreNotFoundException e) {
//log
}
return genreTemp;
})
.collect(Collectors.toSet());
Set<Language> languages = songDTO.getLanguages().stream()
.map(languageDTO -> {
Language languageTemp = null;
try {
languageTemp = languageService.findByName(languageDTO.getName());
} catch (LanguageNotFoundException e) {
e.printStackTrace();
}
return languageTemp;
})
.collect(Collectors.toSet());
Set<StrummingPattern> strummingPatterns = songDTO.getStrummingPatterns().stream()
.map(strummingPatternDTO -> {
StrummingPattern strummingPatternTemp = null;
try {
strummingPatternTemp = strummingPatternService.findByName(strummingPatternDTO.getName());
} catch (StrummingPatterNotFoundException e) {
e.printStackTrace();
}
return strummingPatternTemp;
})
.collect(Collectors.toSet());
return Song.builder()
.author(author)
.name(songDTO.getName())
.postDate(new Timestamp(System.currentTimeMillis()))
.difficultLevel(difficultLevel)
.tuning(tuning)
.chordsSet(chords)
.genreSet(genre)
.languagesSet(languages)
.sectionType(sectionType)
.strummingPatternSet(strummingPatterns)
.lyrics(songDTO.getLyrics())
.comments(songDTO.getComments())
.build();
}
public SongDTO mapToDTO(Song song){
AuthorDTO authorDTO = authorService.mapToDTO(song.getAuthor());
DifficultLevelDTO difficultLevelDTO = difficultLevelService.mapToDTO(song.getDifficultLevel());
SectionTypeDTO sectionTypeDTO = sectionTypeService.mapToDTO(song.getSectionType());
TuningDTO tuningDTO = tuningService.mapToDTO(song.getTuning());
Set<GenreDTO> genreDTO = song.getGenreSet().stream()
.map(genresService::mapToDTO)
.collect(Collectors.toSet());
Set<LanguageDTO> languageDTO = song.getLanguagesSet().stream()
.map(languageService::mapToDTO)
.collect(Collectors.toSet());
Set<StrummingPatternDTO> strummingPatternDTO = song.getStrummingPatternSet()
.stream().map(strummingPatternService::mapToDTO)
.collect(Collectors.toSet());
Set<ChordsDTO> chordsDTO = song.getChordsSet()
.stream().map(chordsService::mapToDTO)
.collect(Collectors.toSet());
return SongDTO.builder()
.name(song.getName())
.author(authorDTO)
.lyrics(song.getLyrics())
.comments(song.getComments())
.difficultLevel(difficultLevelDTO)
.sectionType(sectionTypeDTO)
.tuning(tuningDTO)
.genres(genreDTO)
.languages(languageDTO)
.strummingPatterns(strummingPatternDTO)
.chords(chordsDTO)
.build();
}
}
| [
"evgenikaall@gmail.com"
] | evgenikaall@gmail.com |
b553228c9edb711d3f5629e214c329636bbda384 | de149f97cbc85594dfa3927c240d5c06211eb50b | /src/main/java/main/service/AddingPostService.java | 0fc89cbd1653f345aba87be68097b5cb8ff81a7f | [] | no_license | bagofQQ/DiplomSkillbox | 91e2a5a9893ad3e02532e8dfc69e16588323cea9 | 1ff310f9089704552c3da65ca08299e00c2f9d1a | refs/heads/master | 2023-02-17T04:13:40.901588 | 2021-01-18T18:05:58 | 2021-01-18T18:05:58 | 314,522,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,109 | java | package main.service;
import main.PostsException;
import main.api.request.addingpost.AddingPostRequest;
import main.api.response.addingpost.AddingPostResponse;
import main.api.response.addingpost.ErrorsAddingPostResponse;
import main.model.*;
import org.jsoup.Jsoup;
import org.jsoup.safety.Whitelist;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpSession;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
@Service
public class AddingPostService {
@Value("${blog.constants.valueYes}")
private String VALUE_YES;
@Value("${blog.constants.errorTitle}")
private String ERROR_TITLE;
@Value("${blog.constants.errorText}")
private String ERROR_TEXT;
private final GlobalSettingsRepository globalSettingsRepository;
private final PostRepository postRepository;
private final TagRepository tagRepository;
private final TagToPostRepository tagToPostRepository;
private final UserRepository userRepository;
private final HttpSession httpSession;
private final UserLoginService userLoginService;
@Autowired
public AddingPostService(GlobalSettingsRepository globalSettingsRepository,
PostRepository postRepository,
TagRepository tagRepository,
TagToPostRepository tagToPostRepository,
UserRepository userRepository,
HttpSession httpSession,
UserLoginService userLoginService) {
this.globalSettingsRepository = globalSettingsRepository;
this.postRepository = postRepository;
this.tagRepository = tagRepository;
this.tagToPostRepository = tagToPostRepository;
this.userRepository = userRepository;
this.httpSession = httpSession;
this.userLoginService = userLoginService;
}
public ResponseEntity<AddingPostResponse> addPost(AddingPostRequest addingPostRequest) {
User user = userRepository.findById(userLoginService.getIdentifierMap().get(httpSession.getId())).orElseThrow(PostsException::new);
if (!globalSettingsRepository.findValuePostPremoderation().equals(VALUE_YES) & addingPostRequest.getActive() == 1) {
return new ResponseEntity(recordingOrSetErrors(addingPostRequest, user, ModerationStatus.ACCEPTED), HttpStatus.OK);
}
return new ResponseEntity(recordingOrSetErrors(addingPostRequest, user, ModerationStatus.NEW), HttpStatus.OK);
}
private AddingPostResponse recordingOrSetErrors(AddingPostRequest addingPostRequest, User user, ModerationStatus status) {
HashMap<String, String> errors = checkAddErrors(addingPostRequest);
if (!errors.isEmpty()) {
return setErrors(errors);
}
return postRecording(addingPostRequest, user, status);
}
private HashMap<String, String> checkAddErrors(AddingPostRequest addingPostRequest) {
HashMap<String, String> errors = new HashMap<>();
String cleanText = Jsoup.clean(addingPostRequest.getText(), Whitelist.none());
if (addingPostRequest.getTitle().length() < 1) {
errors.put("title", ERROR_TITLE);
}
if (cleanText.length() < 50) {
errors.put("text", ERROR_TEXT);
}
return errors;
}
private AddingPostResponse setErrors(HashMap<String, String> errors) {
AddingPostResponse addingPostResponse = new AddingPostResponse();
ErrorsAddingPostResponse errorsAddingPostResponse = new ErrorsAddingPostResponse();
errorsAddingPostResponse.setTitle(errors.get("title"));
errorsAddingPostResponse.setText(errors.get("text"));
addingPostResponse.setResult(false);
addingPostResponse.setErrors(errorsAddingPostResponse);
return addingPostResponse;
}
private AddingPostResponse postRecording(
AddingPostRequest addingPostRequest,
User user, ModerationStatus status) {
AddingPostResponse addingPostResponse = new AddingPostResponse();
Post post = new Post();
post.setModerationStatus(status);
post.setIsActive(addingPostRequest.getActive());
post.setModeratorId(0);
post.setUser(user);
post.setTime(checkDate(addingPostRequest.getTimestamp()));
post.setTitle(addingPostRequest.getTitle());
post.setText(addingPostRequest.getText());
post.setViewCount(0);
postRepository.save(post);
tagRecording(addingPostRequest, post);
addingPostResponse.setResult(true);
return addingPostResponse;
}
private Date checkDate(long timestamp) {
Date date = Calendar.getInstance().getTime();
Date datePost = new Date(timestamp * 1000);
if (datePost.before(date)) {
return date;
}
return datePost;
}
private void tagRecording(AddingPostRequest addingPostRequest, Post post) {
for (String tagFromArray : addingPostRequest.getTags()) {
Tag tagBase = new Tag();
String tagLowerCase = tagFromArray.toLowerCase();
if (tagRepository.countCheck(tagLowerCase) > 0) {
int idTag = tagRepository.idTag(tagLowerCase);
tagToPostRecording(idTag, post);
} else {
tagBase.setName(tagLowerCase);
tagRepository.save(tagBase);
tagToPostRecording(tagBase.getId(), post);
}
}
}
private void tagToPostRecording(int idTag, Post post) {
TagToPost tagToPostBase = new TagToPost();
if (tagToPostRepository.countCheckTagToPost(idTag, post.getId()) < 1) {
tagToPostBase.setTagId(idTag);
tagToPostBase.setPostId(post.getId());
tagToPostRepository.save(tagToPostBase);
}
}
}
| [
"hamster88@mail.ru"
] | hamster88@mail.ru |
ed70c7b8c11aa93ac51ace643eb028eed2c8c886 | e73d1209a7a5b1af88594083686fa5354d0ff942 | /app/src/main/java/example/tutorial/mvp/ui/ui/main/MainMvpPresenter.java | 413aeb639f37fa0314ec92d9607a74cb3fd9f781 | [] | no_license | aquavirgo/MVP | cf8a4cb8b754b43dbf2f82e4754faf908ebc556a | 48c92a294c6d2bd9e09f748140209bc56f1a6b66 | refs/heads/master | 2021-05-12T09:30:26.791329 | 2018-01-13T06:44:08 | 2018-01-13T06:44:08 | 117,320,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package example.tutorial.mvp.ui.ui.main;
import example.tutorial.mvp.ui.ui.base.MvpPresenter;
/**
* Created by Jakub on 2018-01-13.
*/
public interface MainMvpPresenter<V extends MainMvpView> extends MvpPresenter<V> {
String getEmailId();
void setUserLoggedOut();
} | [
"jakubguzikowski@o2.pl"
] | jakubguzikowski@o2.pl |
28f327fa55bb6deefbdd6fe58923fb0c4ac0b64b | e2a97f336e545c89dbba886889416ee99c3d89a0 | /ch18_01/src/dao/CartDao.java | 4b4e7f5ca70c1e22bd0417df8a7b0e0d8c26e3e8 | [] | no_license | jongtix/JSP_jongtix | f580d82beaa3a53c9876961af45389527d3832af | ef5aac22eefa6611bdce6647fba645e55d626192 | refs/heads/master | 2021-05-06T00:38:00.250849 | 2018-03-18T07:06:06 | 2018-03-18T07:06:06 | 114,311,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,091 | java | package dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import model.Cart;
public class CartDao {
private static CartDao instance;
public CartDao() {
}
public static CartDao getInstance() {
if (instance == null) {
instance = new CartDao();
}
return instance;
}
public Connection getConnection() throws Exception {
Connection conn = null;
Context init = new InitialContext();
DataSource ds = (DataSource) init.lookup("java:comp/env/jdbc/OracleDB");
conn = ds.getConnection();
return conn;
}
public int insertCart(Cart cart, String buyer) {
int result = 0;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql1 = "select count(*) from cart where buyer = ? and book_id = ?";
String sql2 = "update cart set buy_count = buy_count+? where buyer = ? and book_id = ?";
String sql3 = "insert into cart values(cart_seq.nextval, ?, ?, ?, ?, ?, ?)";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1, buyer);
pstmt.setInt(2, cart.getBook_id());
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.getInt(1) > 0) {
pstmt = conn.prepareStatement(sql2);
int i = 0;
pstmt.setInt(++i, cart.getBuy_count());
pstmt.setString(++i, cart.getBuyer());
pstmt.setInt(++i, cart.getBook_id());
result = pstmt.executeUpdate();
} else {
pstmt = conn.prepareStatement(sql3);
int i = 0;
pstmt.setString(++i, cart.getBuyer());
pstmt.setInt(++i, cart.getBook_id());
pstmt.setString(++i, cart.getBook_title());
pstmt.setInt(++i, cart.getBuy_price());
pstmt.setInt(++i, cart.getBuy_count());
pstmt.setString(++i, cart.getBook_image());
result = pstmt.executeUpdate();
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
if (rs != null)
rs.close();
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
return result;
}
public int getListCount(String buyer) {
int count = 0;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "select count(*) from cart where buyer = ?";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, buyer);
rs = pstmt.executeQuery();
if (rs.next()) {
count = rs.getInt(1);
}
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
if (rs != null)
rs.close();
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
return count;
}
public ArrayList<Cart> getCartList(String buyer) {
ArrayList<Cart> list = new ArrayList<>();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "select * from cart where buyer = ?";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, buyer);
rs = pstmt.executeQuery();
while (rs.next()) {
Cart cart = new Cart();
int i = 0;
cart.setCart_id(rs.getInt(++i));
cart.setBuyer(rs.getString(++i));
cart.setBook_id(rs.getInt(++i));
cart.setBook_title(rs.getString(++i));
cart.setBuy_price(rs.getInt(++i));
cart.setBuy_count(rs.getInt(++i));
cart.setBook_image(rs.getString(++i));
list.add(cart);
}
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
if (rs != null)
rs.close();
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
return list;
}
public int updateCount(int cart_id, int buy_count) {
int result = 0;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql1 = "select book.book_count from book, cart where book.book_id = cart.book_id and cart.cart_id = ?";
String sql2 = "update cart set buy_count = ? where cart_id = ?";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql1);
pstmt.setInt(1, cart_id);
rs = pstmt.executeQuery();
if (rs.next()) {
if (buy_count > rs.getInt(1)) {
result = -1;
} else {
pstmt = conn.prepareStatement(sql2);
pstmt.setInt(1, buy_count);
pstmt.setInt(2, cart_id);
result = pstmt.executeUpdate();
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
return result;
}
public int deleteAll(String buyer) {
int result = 0;
Connection conn = null;
PreparedStatement pstmt = null;
String sql = "delete cart where buyer = ?";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, buyer);
result = pstmt.executeUpdate();
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
return result;
}
public int deleteCart(int list) {
int result = 0;
Connection conn = null;
PreparedStatement pstmt = null;
String sql = "delete from cart where cart_id = ?";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, list);
result = pstmt.executeUpdate();
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
return result;
}
}
| [
"jong1145@naver.com"
] | jong1145@naver.com |
8812f5e4a53dfa842ae4b366d1f0d188538c70e5 | 5dfadf842bdf166c604cdeecae309f45fe3f1a79 | /src/com/msbinfo/expresslync/rct/valuation/HomeStyle.java | e1729f25018a7e77131d9cb1e337dcf7c08b9d0b | [] | no_license | JB2001216/MSBValuationClient | a9d86260ffbf16bd82216b60498704bb42259083 | e2cf9299a8482ffdcc807c84fc3bd0ce6a83b0c8 | refs/heads/master | 2023-02-23T22:11:50.951025 | 2021-01-27T13:48:39 | 2021-01-27T13:48:39 | 333,434,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,599 | java | /*
* XML Type: HomeStyle
* Namespace: http://msbinfo.com/expresslync/rct/valuation
* Java type: com.msbinfo.expresslync.rct.valuation.HomeStyle
*
* Automatically generated - do not modify.
*/
package com.msbinfo.expresslync.rct.valuation;
/**
* An XML HomeStyle(@http://msbinfo.com/expresslync/rct/valuation).
*
* This is an atomic type that is a restriction of com.msbinfo.expresslync.rct.valuation.HomeStyle.
*/
public interface HomeStyle extends org.apache.xmlbeans.XmlString
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(HomeStyle.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s1768D09471800D65E1818E928883FB9D").resolveHandle("homestyle600btype");
org.apache.xmlbeans.StringEnumAbstractBase enumValue();
void set(org.apache.xmlbeans.StringEnumAbstractBase e);
static final Enum STORY_1 = Enum.forString("Story_1");
static final Enum STORY_1_POINT_5 = Enum.forString("Story_1point5");
static final Enum STORY_1_POINT_75 = Enum.forString("Story_1point75");
static final Enum STORY_2 = Enum.forString("Story_2");
static final Enum STORY_2_POINT_5 = Enum.forString("Story_2point5");
static final Enum STORY_2_POINT_75 = Enum.forString("Story_2point75");
static final Enum STORY_3 = Enum.forString("Story_3");
static final Enum STORY_3_POINT_5 = Enum.forString("Story_3point5");
static final Enum STORY_3_POINT_75 = Enum.forString("Story_3point75");
static final Enum STORY_4 = Enum.forString("Story_4");
static final Enum STORY_4_POINT_5 = Enum.forString("Story_4point5");
static final Enum STORY_4_POINT_75 = Enum.forString("Story_4point75");
static final Enum STORY_5 = Enum.forString("Story_5");
static final Enum BACK_SPLIT = Enum.forString("Back_Split");
static final Enum BI_LEVEL = Enum.forString("BiLevel");
static final Enum BILEVEL_ROW_CENTER = Enum.forString("Bilevel_Row_Center");
static final Enum BILEVEL_ROW_END = Enum.forString("Bilevel_Row_End");
static final Enum BUNGALOW = Enum.forString("Bungalow");
static final Enum CAPE_COD = Enum.forString("Cape_Cod");
static final Enum COLONIAL = Enum.forString("Colonial");
static final Enum CONDO = Enum.forString("Condo");
static final Enum CONTEMPORARY = Enum.forString("Contemporary");
static final Enum COTTAGE = Enum.forString("Cottage");
static final Enum FEDERAL_COLONIAL = Enum.forString("Federal_Colonial");
static final Enum MEDITERRANEAN = Enum.forString("Mediterranean");
static final Enum MULTI_WIDE = Enum.forString("MultiWide");
static final Enum MULTI_WIDE_STARTER_HOME = Enum.forString("MultiWide_StarterHome");
static final Enum ORNATE_VICTORIAN = Enum.forString("Ornate_Victorian");
static final Enum QUEEN_ANNE = Enum.forString("Queen_Anne");
static final Enum RAISED_RANCH = Enum.forString("Raised_Ranch");
static final Enum RAMBLER = Enum.forString("Rambler");
static final Enum RANCH = Enum.forString("Ranch");
static final Enum ROW_HOUSE_CENTER = Enum.forString("Row_House_Center");
static final Enum ROW_HOUSE_END = Enum.forString("Row_House_End");
static final Enum SINGLE_WIDE = Enum.forString("SingleWide");
static final Enum SINGLE_WIDE_STARTER_HOME = Enum.forString("SingleWide_StarterHome");
static final Enum SOUTHWEST_ADOBE = Enum.forString("Southwest_Adobe");
static final Enum SPLIT_FOYER = Enum.forString("Split_Foyer");
static final Enum SPLIT_LEVEL = Enum.forString("Split_Level");
static final Enum SUBSTANDARD = Enum.forString("Substandard");
static final Enum TOWNHOUSE_CENTER = Enum.forString("Townhouse_Center");
static final Enum TOWNHOUSE_END = Enum.forString("Townhouse_End");
static final Enum TRILEVEL = Enum.forString("Trilevel");
static final Enum TRILEVEL_ROW_CENTER = Enum.forString("Trilevel_Row_Center");
static final Enum TRILEVEL_ROW_END = Enum.forString("Trilevel_Row_End");
static final Enum VICTORIAN = Enum.forString("Victorian");
static final int INT_STORY_1 = Enum.INT_STORY_1;
static final int INT_STORY_1_POINT_5 = Enum.INT_STORY_1_POINT_5;
static final int INT_STORY_1_POINT_75 = Enum.INT_STORY_1_POINT_75;
static final int INT_STORY_2 = Enum.INT_STORY_2;
static final int INT_STORY_2_POINT_5 = Enum.INT_STORY_2_POINT_5;
static final int INT_STORY_2_POINT_75 = Enum.INT_STORY_2_POINT_75;
static final int INT_STORY_3 = Enum.INT_STORY_3;
static final int INT_STORY_3_POINT_5 = Enum.INT_STORY_3_POINT_5;
static final int INT_STORY_3_POINT_75 = Enum.INT_STORY_3_POINT_75;
static final int INT_STORY_4 = Enum.INT_STORY_4;
static final int INT_STORY_4_POINT_5 = Enum.INT_STORY_4_POINT_5;
static final int INT_STORY_4_POINT_75 = Enum.INT_STORY_4_POINT_75;
static final int INT_STORY_5 = Enum.INT_STORY_5;
static final int INT_BACK_SPLIT = Enum.INT_BACK_SPLIT;
static final int INT_BI_LEVEL = Enum.INT_BI_LEVEL;
static final int INT_BILEVEL_ROW_CENTER = Enum.INT_BILEVEL_ROW_CENTER;
static final int INT_BILEVEL_ROW_END = Enum.INT_BILEVEL_ROW_END;
static final int INT_BUNGALOW = Enum.INT_BUNGALOW;
static final int INT_CAPE_COD = Enum.INT_CAPE_COD;
static final int INT_COLONIAL = Enum.INT_COLONIAL;
static final int INT_CONDO = Enum.INT_CONDO;
static final int INT_CONTEMPORARY = Enum.INT_CONTEMPORARY;
static final int INT_COTTAGE = Enum.INT_COTTAGE;
static final int INT_FEDERAL_COLONIAL = Enum.INT_FEDERAL_COLONIAL;
static final int INT_MEDITERRANEAN = Enum.INT_MEDITERRANEAN;
static final int INT_MULTI_WIDE = Enum.INT_MULTI_WIDE;
static final int INT_MULTI_WIDE_STARTER_HOME = Enum.INT_MULTI_WIDE_STARTER_HOME;
static final int INT_ORNATE_VICTORIAN = Enum.INT_ORNATE_VICTORIAN;
static final int INT_QUEEN_ANNE = Enum.INT_QUEEN_ANNE;
static final int INT_RAISED_RANCH = Enum.INT_RAISED_RANCH;
static final int INT_RAMBLER = Enum.INT_RAMBLER;
static final int INT_RANCH = Enum.INT_RANCH;
static final int INT_ROW_HOUSE_CENTER = Enum.INT_ROW_HOUSE_CENTER;
static final int INT_ROW_HOUSE_END = Enum.INT_ROW_HOUSE_END;
static final int INT_SINGLE_WIDE = Enum.INT_SINGLE_WIDE;
static final int INT_SINGLE_WIDE_STARTER_HOME = Enum.INT_SINGLE_WIDE_STARTER_HOME;
static final int INT_SOUTHWEST_ADOBE = Enum.INT_SOUTHWEST_ADOBE;
static final int INT_SPLIT_FOYER = Enum.INT_SPLIT_FOYER;
static final int INT_SPLIT_LEVEL = Enum.INT_SPLIT_LEVEL;
static final int INT_SUBSTANDARD = Enum.INT_SUBSTANDARD;
static final int INT_TOWNHOUSE_CENTER = Enum.INT_TOWNHOUSE_CENTER;
static final int INT_TOWNHOUSE_END = Enum.INT_TOWNHOUSE_END;
static final int INT_TRILEVEL = Enum.INT_TRILEVEL;
static final int INT_TRILEVEL_ROW_CENTER = Enum.INT_TRILEVEL_ROW_CENTER;
static final int INT_TRILEVEL_ROW_END = Enum.INT_TRILEVEL_ROW_END;
static final int INT_VICTORIAN = Enum.INT_VICTORIAN;
/**
* Enumeration value class for com.msbinfo.expresslync.rct.valuation.HomeStyle.
* These enum values can be used as follows:
* <pre>
* enum.toString(); // returns the string value of the enum
* enum.intValue(); // returns an int value, useful for switches
* // e.g., case Enum.INT_STORY_1
* Enum.forString(s); // returns the enum value for a string
* Enum.forInt(i); // returns the enum value for an int
* </pre>
* Enumeration objects are immutable singleton objects that
* can be compared using == object equality. They have no
* public constructor. See the constants defined within this
* class for all the valid values.
*/
static final class Enum extends org.apache.xmlbeans.StringEnumAbstractBase
{
/**
* Returns the enum value for a string, or null if none.
*/
public static Enum forString(java.lang.String s)
{ return (Enum)table.forString(s); }
/**
* Returns the enum value corresponding to an int, or null if none.
*/
public static Enum forInt(int i)
{ return (Enum)table.forInt(i); }
private Enum(java.lang.String s, int i)
{ super(s, i); }
static final int INT_STORY_1 = 1;
static final int INT_STORY_1_POINT_5 = 2;
static final int INT_STORY_1_POINT_75 = 3;
static final int INT_STORY_2 = 4;
static final int INT_STORY_2_POINT_5 = 5;
static final int INT_STORY_2_POINT_75 = 6;
static final int INT_STORY_3 = 7;
static final int INT_STORY_3_POINT_5 = 8;
static final int INT_STORY_3_POINT_75 = 9;
static final int INT_STORY_4 = 10;
static final int INT_STORY_4_POINT_5 = 11;
static final int INT_STORY_4_POINT_75 = 12;
static final int INT_STORY_5 = 13;
static final int INT_BACK_SPLIT = 14;
static final int INT_BI_LEVEL = 15;
static final int INT_BILEVEL_ROW_CENTER = 16;
static final int INT_BILEVEL_ROW_END = 17;
static final int INT_BUNGALOW = 18;
static final int INT_CAPE_COD = 19;
static final int INT_COLONIAL = 20;
static final int INT_CONDO = 21;
static final int INT_CONTEMPORARY = 22;
static final int INT_COTTAGE = 23;
static final int INT_FEDERAL_COLONIAL = 24;
static final int INT_MEDITERRANEAN = 25;
static final int INT_MULTI_WIDE = 26;
static final int INT_MULTI_WIDE_STARTER_HOME = 27;
static final int INT_ORNATE_VICTORIAN = 28;
static final int INT_QUEEN_ANNE = 29;
static final int INT_RAISED_RANCH = 30;
static final int INT_RAMBLER = 31;
static final int INT_RANCH = 32;
static final int INT_ROW_HOUSE_CENTER = 33;
static final int INT_ROW_HOUSE_END = 34;
static final int INT_SINGLE_WIDE = 35;
static final int INT_SINGLE_WIDE_STARTER_HOME = 36;
static final int INT_SOUTHWEST_ADOBE = 37;
static final int INT_SPLIT_FOYER = 38;
static final int INT_SPLIT_LEVEL = 39;
static final int INT_SUBSTANDARD = 40;
static final int INT_TOWNHOUSE_CENTER = 41;
static final int INT_TOWNHOUSE_END = 42;
static final int INT_TRILEVEL = 43;
static final int INT_TRILEVEL_ROW_CENTER = 44;
static final int INT_TRILEVEL_ROW_END = 45;
static final int INT_VICTORIAN = 46;
public static final org.apache.xmlbeans.StringEnumAbstractBase.Table table =
new org.apache.xmlbeans.StringEnumAbstractBase.Table
(
new Enum[]
{
new Enum("Story_1", INT_STORY_1),
new Enum("Story_1point5", INT_STORY_1_POINT_5),
new Enum("Story_1point75", INT_STORY_1_POINT_75),
new Enum("Story_2", INT_STORY_2),
new Enum("Story_2point5", INT_STORY_2_POINT_5),
new Enum("Story_2point75", INT_STORY_2_POINT_75),
new Enum("Story_3", INT_STORY_3),
new Enum("Story_3point5", INT_STORY_3_POINT_5),
new Enum("Story_3point75", INT_STORY_3_POINT_75),
new Enum("Story_4", INT_STORY_4),
new Enum("Story_4point5", INT_STORY_4_POINT_5),
new Enum("Story_4point75", INT_STORY_4_POINT_75),
new Enum("Story_5", INT_STORY_5),
new Enum("Back_Split", INT_BACK_SPLIT),
new Enum("BiLevel", INT_BI_LEVEL),
new Enum("Bilevel_Row_Center", INT_BILEVEL_ROW_CENTER),
new Enum("Bilevel_Row_End", INT_BILEVEL_ROW_END),
new Enum("Bungalow", INT_BUNGALOW),
new Enum("Cape_Cod", INT_CAPE_COD),
new Enum("Colonial", INT_COLONIAL),
new Enum("Condo", INT_CONDO),
new Enum("Contemporary", INT_CONTEMPORARY),
new Enum("Cottage", INT_COTTAGE),
new Enum("Federal_Colonial", INT_FEDERAL_COLONIAL),
new Enum("Mediterranean", INT_MEDITERRANEAN),
new Enum("MultiWide", INT_MULTI_WIDE),
new Enum("MultiWide_StarterHome", INT_MULTI_WIDE_STARTER_HOME),
new Enum("Ornate_Victorian", INT_ORNATE_VICTORIAN),
new Enum("Queen_Anne", INT_QUEEN_ANNE),
new Enum("Raised_Ranch", INT_RAISED_RANCH),
new Enum("Rambler", INT_RAMBLER),
new Enum("Ranch", INT_RANCH),
new Enum("Row_House_Center", INT_ROW_HOUSE_CENTER),
new Enum("Row_House_End", INT_ROW_HOUSE_END),
new Enum("SingleWide", INT_SINGLE_WIDE),
new Enum("SingleWide_StarterHome", INT_SINGLE_WIDE_STARTER_HOME),
new Enum("Southwest_Adobe", INT_SOUTHWEST_ADOBE),
new Enum("Split_Foyer", INT_SPLIT_FOYER),
new Enum("Split_Level", INT_SPLIT_LEVEL),
new Enum("Substandard", INT_SUBSTANDARD),
new Enum("Townhouse_Center", INT_TOWNHOUSE_CENTER),
new Enum("Townhouse_End", INT_TOWNHOUSE_END),
new Enum("Trilevel", INT_TRILEVEL),
new Enum("Trilevel_Row_Center", INT_TRILEVEL_ROW_CENTER),
new Enum("Trilevel_Row_End", INT_TRILEVEL_ROW_END),
new Enum("Victorian", INT_VICTORIAN),
}
);
private static final long serialVersionUID = 1L;
private java.lang.Object readResolve() { return forInt(intValue()); }
}
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static com.msbinfo.expresslync.rct.valuation.HomeStyle newValue(java.lang.Object obj) {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) type.newValue( obj ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle newInstance() {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle newInstance(org.apache.xmlbeans.XmlOptions options) {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static com.msbinfo.expresslync.rct.valuation.HomeStyle parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (com.msbinfo.expresslync.rct.valuation.HomeStyle) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
| [
"amymadden@fulldiscourse.com"
] | amymadden@fulldiscourse.com |
6b5d96b5b0ec5c41817a136366ed35516eca81fc | a4850d731fa749b866b621d2b13c79e065344135 | /source/pixelmed/src/main/java/com/pixelmed/web/WadoRequest.java | 5cc25b7e64cc4a719b1f884bc154a856d0e2bb66 | [
"BSD-3-Clause"
] | permissive | mksgroup/pixelmed | 1575e87a3e881450d47588be25d4693f35efafc5 | d0ddfdd42757c22c63eed1892a8759db1721ab1e | refs/heads/master | 2022-12-05T12:21:37.127424 | 2020-08-19T08:32:43 | 2020-08-19T08:32:43 | 288,082,031 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,068 | java | /* Copyright (c) 2001-2020, David A. Clunie DBA Pixelmed Publishing. All rights reserved. */
package com.pixelmed.web;
//import java.net.URI;
//import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import com.pixelmed.utils.StringUtilities;
/**
* <p>The {@link WadoRequest WadoRequest} class parses a DICOM PS 3.18 (ISO 17432),
* WADO URL into its constituent query parameters.</p>
*
* @author dclunie
*/
public class WadoRequest extends WebRequest {
private static final String identString = "@(#) $Header: /userland/cvs/pixelmed/imgbook/com/pixelmed/web/WadoRequest.java,v 1.15 2020/01/01 15:48:27 dclunie Exp $";
private String studyUID; // value must be single UID
private String seriesUID; // value must be single UID
private String objectUID; // value must be single UID
// optional
private String [][] contentTypes; // comma separated list of MIME types, potentially associated with relative degree of preference, as specified in IETF RFC2616
private String [] charsets; // comma separated list from RFC2616
private String anonymize; // value must be yes
// optional and only if image and not application/dicom
private String [] annotations; // comma separated list of patient, technique
private int rows; // one integer string (we set to -1 if absent)
private int columns; // one integer string (we set to -1 if absent)
private double region[]; // four comma separated decimal strings
private double windowCenter; // one decimal string, required if windowWidth present (we set to 0 if absent)
private double windowWidth; // one decimal string, required if windowCenter present (we set to 0 if absent, which is legitimate value, so use absence of windowWidth as flag)
private int frameNumber; // one integer string (we set to -1 if absent)
private int imageQuality; // one integer string from 1 to 100 (best) (we set to -1 if absent)
private String presentationUID; // value must be single UID
private String presentationSeriesUID; // value must be single UID, required if presentationUID present
// optional and only if application/dicom
private String transferSyntax; // value must be single UID
/*
* @return the value of the studyID parameter, or null if absent
*/
public String getStudyUID() { return studyUID; }
/*
* @return the value of the seriesUID parameter, or null if absent
*/
public String getSeriesUID() { return seriesUID; }
/*
* @return the value of the objectUID parameter, or null if absent
*/
public String getObjectUID() { return objectUID; }
/*
* <p>Get the values of the contentType parameter</p>
*
* <p>if more than one, the order implies decreasing order of preference.</p>
*
* @return the values of the contentType parameter, as an array of arrays of String,
* one String array for each content type, each containing the content type
* and parameters, or null if absent
*/
public String[][] getContentType() { return contentTypes; }
/*
* <p>Is the contentType parameter a single application/dicom value ?</p>
*
* @return true if there is one contentType parameter value that is application/dicom
*/
public boolean isContentTypeDicom() {
return contentTypes != null
&& contentTypes.length == 1
&& contentTypes[0] != null
&& contentTypes[0].length >= 1
&& contentTypes[0][0] != null
&& contentTypes[0][0].toLowerCase(java.util.Locale.US).equals("application/dicom");
}
/*
* @return the values of the charset parameter, as an array of String, or null if absent
*/
public String[] getCharset() { return charsets; }
/*
* @return the value of the anonymize parameter, which will always be yes, or null if absent
*/
public String getAnonymize() { return anonymize; }
/*
* @return the values of the annotation parameter, as an array of String, containing "patient" and/or "technique", or null if absent
*/
public String [] getAnnotation() { return annotations; }
/*
* @return the value of the rows parameter, or -1 if absent
*/
public int getRows() { return rows; }
/*
* @return the value of the columns parameter, or -1 if absent
*/
public int getColumns() { return columns; }
/*
* @return the values of the region parameter, as an array of four double values, or null if absent
*/
public double[] getRegion() { return region; }
/*
* @return the value of the windowCenter parameter, or 0 if absent
*/
public double getWindowCenter() { return windowCenter; }
/*
* @return the value of the windowWidth parameter, or 0 if absent
*/
public double getWindowWidth() { return windowWidth; }
/*
* @return the value of the frameNumber parameter, or -1 if absent
*/
public int getFrameNumber() { return frameNumber; }
/*
* @return the value of the imageQuality parameter from 1 to 100 (best), or -1 if absent
*/
public int getImageQuality() { return imageQuality; }
/*
* @return the value of the presentationUID parameter, or null if absent
*/
public String getPresentationUID() { return presentationUID; }
/*
* @return the value of the presentationSeriesUID parameter, or null if absent
*/
public String getPresentationSeriesUID() { return presentationSeriesUID; }
/*
* @return the value of the transferSyntax parameter (a UID), or null if absent
*/
public String getTransferSyntax() { return transferSyntax; }
/*
* <p>Validate that a string is a valid DICOM UID.</p>
*
* @param uid a DICOM UID of up to 64 characters in length
* @return true if valid
*/
public static boolean validateUID(String uid) {
return uid != null && uid.length() > 0 && uid.length() <= 64 && uid.matches("[0-9.]*");
}
/*
* <p>Split a string into substrings separated by the specified delimiter.</p>
*
* @param string to split
* @param delimiter the delimiter between substrings
* @return an array of substrings
*/
public static String[] getSeparatedValues(String string,String delimiter) {
//System.out.println("getSeparatedValues() "+string+" by "+delimiter);
String[] values = null;
StringTokenizer st = new StringTokenizer(string,delimiter);
int count = st.countTokens();
if (count > 0) {
values = new String[count];
for (int i=0; i<count; ++i) {
// assert hasMoreElements();
values[i]=st.nextToken();
}
}
//System.out.println("getSeparatedValues() "+values);
return values;
}
/*
* <p>Split a string into substrings separated by commas.</p>
*
* @param string to split
* @return an array of substrings
*/
public static String[] getCommaSeparatedValues(String string) {
return getSeparatedValues(string,",");
}
/*
* <p>Split a string into substrings separated by semicolons.</p>
*
* @param string to split
* @return an array of substrings
*/
public static String[] getSemicolonSeparatedValues(String string) {
return getSeparatedValues(string,";");
}
/*
* <p>Split a string first into substrings separated by commas, then split each of those into substrings separated by semicolons.</p>
*
* <p>Used to split a list of parameters and sub-parameters.</p>
*
* @param string to split
* @return an array of arrays substrings
*/
public static String[][] getCommaThenSemicolonSeparatedValues(String string) {
String[][] values = null;
String[] commaSeparatedValues = getCommaSeparatedValues(string);
if (commaSeparatedValues != null) {
int count = commaSeparatedValues.length;
if (count > 0) {
values = new String[count][];
for (int i=0; i<count; ++i) {
String testValue = commaSeparatedValues[i];
values[i] = testValue == null ? null : getSemicolonSeparatedValues(testValue);
}
}
}
return values;
}
/*
* <p>Dump an array as a human-readable string.</p>
*
* @param doubleArray to dump
* @return a string representation
*/
public static String toString(double[] doubleArray) {
return StringUtilities.toString(doubleArray);
}
/*
* <p>Dump an array as a human-readable string.</p>
*
* @param stringArray to dump
* @return a string representation
*/
public static String toString(String[] stringArray) {
return StringUtilities.toString(stringArray);
}
/*
* <p>Dump an array of arrays as a human-readable string.</p>
*
* @param stringArrays to dump
* @return a string representation
*/
public static String toString(String[][] stringArrays) {
return StringUtilities.toString(stringArrays);
}
/*
* <p>Get the named parameter that is an integer from a map of string values.</p>
*
* @param parameters the map of parameter name-value pairs
* @param key the name of the parameter to retrieve
* @return the integer value, or -1 if not present in the map
* @throws if not an integer string
*/
public static int getSingleIntegerValueFromParameters(Map parameters,String key) throws Exception {
String s = (String)(parameters.get(key));
if (s != null) {
try {
return Integer.parseInt(s);
}
catch (NumberFormatException e) {
throw new Exception(key+" must be an integer string \""+s+"\"");
}
}
return -1;
}
/*
* <p>Get the named parameter that is a double from a map of string values.</p>
*
* @param parameters the map of parameter name-value pairs
* @param key the name of the parameter to retrieve
* @return the double value, or 0 if not present in the map
* @throws if not a decimal string
*/
public static double getSingleDoubleValueFromParameters(Map parameters,String key) throws Exception {
String s = (String)(parameters.get(key));
if (s != null) {
try {
return Double.parseDouble(s);
}
catch (NumberFormatException e) {
throw new Exception(key+" must be a decimal string \""+s+"\"");
}
}
return 0;
}
/*
* <p>Create a representation of a WADO request from an existing WebRequest of requestType=WADO.</p>
*
* @param request an existing WebRequest with parameters
* @throws if not a valid request
*/
public WadoRequest(WebRequest request) throws Exception {
scheme = request.getScheme();
userInfo = request.getUserInfo();
host = request.getHost();
port = request.getPort();
path = request.getPath();
requestType = request.getRequestType();
parameters = request.getParameters();
parseWadoParameters();
}
/*
* <p>Create a representation of a WADO request by parsing a WADO URI.</p>
*
* @param uriString the entire WADO URI string
* @throws if not a valid request
*/
public WadoRequest(String uriString) throws Exception {
super(uriString); // sets requestType
parseWadoParameters();
}
private void parseWadoParameters() throws Exception {
// Mandatory
if (requestType == null || !requestType.equals("WADO")) {
throw new Exception("requestType missing or not WADO \""+requestType+"\"");
}
studyUID = (String)(parameters.get("studyUID"));
if (!validateUID(studyUID)) {
throw new Exception("studyUID missing or not valid \""+studyUID+"\"");
}
seriesUID = (String)(parameters.get("seriesUID"));
if (!validateUID(seriesUID)) {
throw new Exception("seriesUID missing or not valid \""+seriesUID+"\"");
}
objectUID = (String)(parameters.get("objectUID"));
if (!validateUID(objectUID)) {
throw new Exception("objectUID missing or not valid \""+objectUID+"\"");
}
// Optional
String allContentTypes = (String)(parameters.get("contentType"));
if (allContentTypes != null) {
contentTypes = getCommaThenSemicolonSeparatedValues(allContentTypes);
}
String allCharsets = (String)(parameters.get("charset"));
if (allCharsets != null) {
charsets = getCommaSeparatedValues(allCharsets);
}
anonymize = (String)(parameters.get("anonymize"));
if (anonymize != null && !anonymize.equals("yes")) {
throw new Exception("anonymize must be absent or yes \""+anonymize+"\"");
}
String allAnnotations = (String)(parameters.get("annotation"));
if (allAnnotations != null) {
annotations = getCommaSeparatedValues(allAnnotations);
}
rows = getSingleIntegerValueFromParameters(parameters,"rows");
columns = getSingleIntegerValueFromParameters(parameters,"columns");
String sRegion = (String)(parameters.get("region"));
if (sRegion != null) {
String[] regionValues = getCommaSeparatedValues(sRegion);
if (regionValues == null || regionValues.length != 4) {
throw new Exception("region must be four comma delimited decimal strings \""+sRegion+"\"");
}
else {
region = new double[4];
for (int i=0; i<4; ++i) {
try {
region[i] = Double.parseDouble(regionValues[i]);
}
catch (NumberFormatException e) {
throw new Exception("region value must be a decimal string \""+regionValues[i]+"\"");
}
}
}
}
windowCenter = getSingleDoubleValueFromParameters(parameters,"windowCenter");
windowWidth = getSingleDoubleValueFromParameters(parameters,"windowWidth");
if (parameters.get("windowCenter") == null && parameters.get("windowWidth") != null) {
throw new Exception("windowCenter missing but require since windowWidth is present");
}
else if (parameters.get("windowCenter") != null && parameters.get("windowWidth") == null) {
throw new Exception("windowWidth missing but require since windowCenter is present");
}
frameNumber = getSingleIntegerValueFromParameters(parameters,"frameNumber");
imageQuality = getSingleIntegerValueFromParameters(parameters,"imageQuality");
if (imageQuality != -1 && (imageQuality < 1 || imageQuality > 100)) {
throw new Exception("imageQuality must be between 1 and 100 \""+imageQuality+"\"");
}
presentationUID = (String)(parameters.get("presentationUID"));
if (presentationUID != null && !validateUID(presentationUID)) {
throw new Exception("presentationUID not valid \""+presentationUID+"\"");
}
presentationSeriesUID = (String)(parameters.get("presentationSeriesUID"));
if (presentationSeriesUID != null && !validateUID(presentationSeriesUID)) {
throw new Exception("presentationSeriesUID not valid \""+presentationSeriesUID+"\"");
}
if (presentationUID != null && presentationSeriesUID == null) {
throw new Exception("presentationSeriesUID missing but require since presentationUID is present");
}
else if (presentationUID == null && presentationSeriesUID != null) {
throw new Exception("presentationUID missing but require since presentationSeriesUID is present");
}
transferSyntax = (String)(parameters.get("transferSyntax"));
if (transferSyntax != null && !validateUID(transferSyntax)) {
throw new Exception("transferSyntax not valid \""+transferSyntax+"\"");
}
if (!isContentTypeDicom() && transferSyntax != null) {
throw new Exception("transferSyntax is present but contentType is not application/dicom (only)");
}
}
/*
* <p>Dump as a human-readable string.</p>
*
* @return a string representation
*/
public String toString() {
StringBuffer strbuf = new StringBuffer();
strbuf.append("scheme = "); strbuf.append(scheme); strbuf.append("\n");
strbuf.append("userInfo = "); strbuf.append(userInfo); strbuf.append("\n");
strbuf.append("host = "); strbuf.append(host); strbuf.append("\n");
strbuf.append("port = "); strbuf.append(port); strbuf.append("\n");
strbuf.append("path = "); strbuf.append(path); strbuf.append("\n");
strbuf.append("studyUID = "); strbuf.append(studyUID); strbuf.append("\n");
strbuf.append("seriesUID = "); strbuf.append(seriesUID); strbuf.append("\n");
strbuf.append("objectUID = "); strbuf.append(objectUID); strbuf.append("\n");
strbuf.append("contentTypes = "); strbuf.append(toString(contentTypes)); strbuf.append("\n");
strbuf.append("charsets = "); strbuf.append(toString(charsets)); strbuf.append("\n");
strbuf.append("anonymize = "); strbuf.append(anonymize); strbuf.append("\n");
strbuf.append("annotations = "); strbuf.append(toString(annotations)); strbuf.append("\n");
strbuf.append("rows = "); strbuf.append(rows); strbuf.append("\n");
strbuf.append("columns = "); strbuf.append(columns); strbuf.append("\n");
strbuf.append("region = "); strbuf.append(toString(region)); strbuf.append("\n");
strbuf.append("windowCenter = "); strbuf.append(windowCenter); strbuf.append("\n");
strbuf.append("windowWidth = "); strbuf.append(windowWidth); strbuf.append("\n");
strbuf.append("frameNumber = "); strbuf.append(frameNumber); strbuf.append("\n");
strbuf.append("imageQuality = "); strbuf.append(imageQuality); strbuf.append("\n");
strbuf.append("presentationUID = "); strbuf.append(presentationUID); strbuf.append("\n");
strbuf.append("presentationSeriesUID = "); strbuf.append(presentationSeriesUID); strbuf.append("\n");
strbuf.append("transferSyntax = "); strbuf.append(transferSyntax); strbuf.append("\n");
return strbuf.toString();
}
/*
* <pTest parsing the examples in DICOM PS 3.18 Annex B.</p>
*
*/
public static void main(String arg[]) {
String testB1 = "http://www.hospital-stmarco/radiology/wado.php?requestType=WADO&studyUID=1.2.250.1.59.40211.12345678.678910&seriesUID=1.2.250.1.59.40211.789001276.14556172.67789&objectUID=1.2.250.1.59.40211.2678810.87991027.899772.2";
String testB2 = "http://server234/script678.asp?requestType=WADO&studyUID=1.2.250.1.59.40211.12345678.678910&seriesUID=1.2.250.1.59.40211.789001276.14556172.67789&objectUID=1.2.250.1.59.40211.2678810.87991027.899772.2&charset=UTF-8";
//String testB3 = "https://aspradio/imageaccess.js?requestType=WADO&studyUID=1.2.250.1.59.40211.12345678.678910&seriesUID=1.2.250.1.59.40211.789001276.14556172.67789&objectUID=1.2.250.1.59.40211.2678810.87991027.899772.2&contentType=image%2Fjp2;level=1,image%2Fjpeg;q=0.5&annotation=patient,technique&columns=400&rows=300®ion=0.3,0.4,0.5,0.5&windowCenter=-1000&windowWidth=2500";
String testB3 = "https://aspradio/imageaccess.js?requestType=WADO&studyUID=1.2.250.1.59.40211.12345678.678910&seriesUID=1.2.250.1.59.40211.789001276.14556172.67789&objectUID=1.2.250.1.59.40211.2678810.87991027.899772.2&contentType=image%2Fjp2%3Blevel%3D1%2Cimage%2Fjpeg%3Bq%3D0.5&annotation=patient%2Ctechnique&columns=400&rows=300®ion=0.3%2C0.4%2C0.5%2C0.5&windowCenter=-1000&windowWidth=2500";
String testB4 = "http://www.medical-webservice.st/RetrieveDocument?requestType=WADO&studyUID=1.2.250.1.59.40211.12345678.678910&seriesUID=1.2.250.1.59.40211.789001276.14556172.67789&objectUID=1.2.250.1.59.40211.2678810.87991027.899772.2&contentType=application%2Fdicom&anonymize=yes&transferSyntax=1.2.840.10008.1.2.4.50";
try {
System.out.println("B1: \""+testB1+"\"\n"+new WadoRequest(testB1).toString());
System.out.println("B2: \""+testB2+"\"\n"+new WadoRequest(testB2).toString());
System.out.println("B3: \""+testB3+"\"\n"+new WadoRequest(testB3).toString());
System.out.println("B4: \""+testB4+"\"\n"+new WadoRequest(testB4).toString());
}
catch (Exception e) {
System.err.println("B3: threw exception");
e.printStackTrace(System.err); // no need to use SLF4J since command line utility/test
}
}
} | [
"ThachLN@gmail.com"
] | ThachLN@gmail.com |
d90b3a19349901366e48f548ffdc1ebbd3ae437b | 0aabd164442e2206028cc34da59582915d91cf84 | /kingshuk_core_springs/ATMAppSpringStaticFactoryMethodDemo/src/com/spi/date/MainApp.java | d8ecaa6412b1716a062911c3cd86e20839cb67da | [] | no_license | kingshuknandy2016/TBT-Workspace | 0d7339518b32fc5c6e01179b3768808e441ec606 | fef1c5229d0e1d56d97b41b44fb066e7560c208c | refs/heads/master | 2021-01-24T11:06:13.774604 | 2018-02-27T04:50:44 | 2018-02-27T04:50:44 | 123,073,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package com.spi.date;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.spi.atm.ATM;
public class MainApp {
public static void main(String[] args) {
System.out.println("BEGINNING PROGRAM **************");
ApplicationContext context = new ClassPathXmlApplicationContext(
"appContext.xml");
Implementor impl = (Implementor)context.getBean("obj");
System.out.println(impl);
System.out.println("************** ENDING PROGRAM **************");
}
}
| [
"kingshuknandy2016@gmail.com"
] | kingshuknandy2016@gmail.com |
2dc3173eb9bf6c390649a18e24a6cf8cd8c33582 | 57868f603891739f0f4af79c1239bafaf40461c5 | /src/test/java/com/epam/library/user/db/WithDbUserSecurityContextFactory.java | 5c0a154269802d4308f9b8edc7f79b30cf7b3c09 | [] | no_license | maciej-kizlich/interview | d0aaa95db8d33aa1466224078483204fa1907f03 | 1d86f28ef4e16cd2b871b0c41293b485536c5eca | refs/heads/master | 2016-09-06T06:13:34.442211 | 2014-09-11T13:46:34 | 2014-09-11T13:46:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package com.epam.library.user.db;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.test.context.support.WithSecurityContextFactory;
import org.springframework.util.StringUtils;
public class WithDbUserSecurityContextFactory implements WithSecurityContextFactory<WithDbUser> {
@Autowired
private UserDetailsService userDetailsService;
@Override
public SecurityContext createSecurityContext(WithDbUser customUser) {
String username = StringUtils.hasLength(customUser.username()) ? customUser.username() : customUser.value();
if (username == null) {
throw new IllegalArgumentException(customUser + " cannot have null username on both username and value properites");
}
UserDetails principal = userDetailsService.loadUserByUsername(username);
Authentication authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(), principal.getAuthorities());
SecurityContext context = SecurityContextHolder.createEmptyContext();
context.setAuthentication(authentication);
return context;
}
} | [
"Maciej_Kizlich@EPPLKRAW0048.budapest.epam.com"
] | Maciej_Kizlich@EPPLKRAW0048.budapest.epam.com |
1d8fd88dcd8c94520eba99aeabd80e65999e6fc0 | 9fe53ab6dad8834efa2c499534622a0c672c61bd | /starchProject-JPA/src/test/java/sopra/formation/EvenementRepositorySpringTest.java | 93fa90ff8e504608646ae628ea8cd96587c63811 | [] | no_license | rubenrust/starchProject | e0d1528c4121531829a9c90cfb7b358257ed1454 | d3bed97a605c5d42c7f9319f02ecc698bbb7543c | refs/heads/master | 2022-10-25T15:35:13.877666 | 2019-12-12T14:58:02 | 2019-12-12T14:58:02 | 221,252,058 | 0 | 0 | null | 2022-09-22T18:56:52 | 2019-11-12T15:37:20 | Java | UTF-8 | Java | false | false | 6,959 | java | package sopra.formation;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sopra.formation.repository.IEntreprisesRepository;
import sopra.formation.repository.IEvenementRepository;
import sopra.formation.repository.IEvenementStarchRepository;
import sopra.formation.repository.IGroupeRepository;
import sopra.formation.repository.ILieuxEvenementRepository;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "/application-context.xml")
public class EvenementRepositorySpringTest {
@Autowired
private IEvenementRepository evenementRepo;
@Autowired
private IEvenementStarchRepository evenementStarchRepo;
@Autowired
private ILieuxEvenementRepository lieuxEvenementRepo;
@Autowired
private IEntreprisesRepository entrepriseRepo;
@Autowired
private IGroupeRepository groupeRepo;
@Test
public void testEvenement() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
int startNumber = evenementRepo.findAll().size();
Evenement evenementEscape = new Evenement();
evenementEscape.setNbParticipantMax(25);
evenementEscape.setNomEvenement(NomEvenement.Escape_game);
evenementEscape.setTitre("escape game");
evenementEscape.setDate(sdf.parse("09-06-2018"));
evenementEscape.setDeadline(sdf.parse("07-06-2018"));
evenementEscape.setPrix(15);
evenementEscape.setRecurrence(Recurrence.Monthly);
evenementEscape = evenementRepo.save(evenementEscape);
Evenement evenementEscapeFind = evenementRepo.find(evenementEscape.getId());
Assert.assertEquals((Integer) 25, evenementEscapeFind.getNbParticipantMax());
Assert.assertEquals("escape game", evenementEscapeFind.getTitre());
Assert.assertEquals((Integer) 15, evenementEscapeFind.getPrix());
int middleNumber = evenementRepo.findAll().size();
Assert.assertEquals(1, middleNumber-startNumber);
evenementRepo.delete(evenementEscapeFind);
evenementEscapeFind = evenementRepo.find(evenementEscapeFind.getId());
Assert.assertNull(evenementEscapeFind);
}
@Test
public void testEvenementWithEvenementStarch() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
EvenementStarch laserGame = new EvenementStarch();
laserGame.setTitre("laser game de fou");
laserGame.setNbParticipantMax(20);
laserGame.setPrixStarch(10);
laserGame.setDescription("venez vous amuser");
laserGame.setTypeEvenement(TypeEvenement.Corporate);
laserGame.setNomEvenement(NomEvenement.Laser_game);
Adresse adresseLaserGame = new Adresse();
adresseLaserGame.setRue("25 rue dutertre");
adresseLaserGame.setVille("merignac");
adresseLaserGame.setCodePostal("33400");
laserGame.setAdresse(adresseLaserGame);
laserGame = evenementStarchRepo.save(laserGame);
Evenement evenementEscape = new Evenement();
evenementEscape.setNbParticipantMax(25);
evenementEscape.setNomEvenement(NomEvenement.Escape_game);
evenementEscape.setTitre("escape game");
evenementEscape.setDate(sdf.parse("09-06-2018"));
evenementEscape.setDeadline(sdf.parse("07-06-2018"));
evenementEscape.setPrix(15);
evenementEscape.setRecurrence(Recurrence.Monthly);
evenementEscape.setEvenementStarch(laserGame);
evenementEscape = evenementRepo.save(evenementEscape);
Evenement evenementEscapeFind = evenementRepo.find(evenementEscape.getId());
Assert.assertEquals("laser game de fou", evenementEscapeFind.getEvenementStarch().getTitre());
}
@Test
public void testEvenementWithLieuxEvenement() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Adresse adresseEscapeGame = new Adresse();
adresseEscapeGame.setRue("28 rue dupuis");
adresseEscapeGame.setVille("Bordeaux");
adresseEscapeGame.setCodePostal("33000");
LieuxEvenement escapeGame = new LieuxEvenement();
escapeGame.setAdresse(adresseEscapeGame);
escapeGame.setDescription("foot en salle à bordeaux");
escapeGame = lieuxEvenementRepo.save(escapeGame);
Evenement evenementEscape = new Evenement();
evenementEscape.setNbParticipantMax(25);
evenementEscape.setNomEvenement(NomEvenement.Escape_game);
evenementEscape.setTitre("escape game");
evenementEscape.setDate(sdf.parse("09-06-2018"));
evenementEscape.setDeadline(sdf.parse("07-06-2018"));
evenementEscape.setPrix(15);
evenementEscape.setRecurrence(Recurrence.Monthly);
evenementEscape.setLieuxEvenement(escapeGame);
evenementEscape = evenementRepo.save(evenementEscape);
Evenement evenementEscapeFind = evenementRepo.find(evenementEscape.getId());
Assert.assertEquals("foot en salle à bordeaux", evenementEscapeFind.getLieuxEvenement().getDescription());
}
@Test
public void testEvenementWithEntreprise() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Entreprise sopra = new Entreprise();
sopra.setNom("sopra steria");
sopra.setCodeEntreprise("241547");
sopra.setSiret("4715564558855");
sopra.setTva("4552662555");
Adresse adresseSopra = new Adresse();
adresseSopra.setRue("24 rue dure");
adresseSopra.setVille("Merignac");
adresseSopra.setCodePostal("33700");
sopra.setAdresse(adresseSopra);
sopra = entrepriseRepo.save(sopra);
Evenement evenementEscape = new Evenement();
evenementEscape.setNbParticipantMax(25);
evenementEscape.setNomEvenement(NomEvenement.Escape_game);
evenementEscape.setTitre("escape game");
evenementEscape.setDate(sdf.parse("09-06-2018"));
evenementEscape.setDeadline(sdf.parse("07-06-2018"));
evenementEscape.setPrix(15);
evenementEscape.setRecurrence(Recurrence.Monthly);
evenementEscape.setEntreprise(sopra);
evenementEscape = evenementRepo.save(evenementEscape);
Evenement evenementEscapeFind = evenementRepo.find(evenementEscape.getId());
Assert.assertEquals("sopra steria", evenementEscapeFind.getEntreprise().getNom());
}
@Test
public void testEvenementWithGroupe(){
Groupe groupeToto = new Groupe();
groupeToto.setCodeGroupe("254785");
groupeToto.setNom("Toto");
groupeToto = groupeRepo.save(groupeToto);
Evenement evenementEscape = new Evenement();
evenementEscape.setNbParticipantMax(25);
evenementEscape.setNomEvenement(NomEvenement.Escape_game);
evenementEscape.setTitre("escape game");
evenementEscape.setPrix(15);
evenementEscape.setRecurrence(Recurrence.Monthly);
evenementEscape.setGroupe(groupeToto);
evenementEscape = evenementRepo.save(evenementEscape);
Evenement evenementEscapeFind = evenementRepo.find(evenementEscape.getId());
Assert.assertEquals("Toto", evenementEscapeFind.getGroupe().getNom());
}
}
| [
"rust.ruben@gmail.com"
] | rust.ruben@gmail.com |
a7443b3a53396e0a38760dce6ab34e0f41a4e76c | 4fb39608ee08ef19aa151b5c3ce443a51401bc3e | /Astar/src/Main.java | a9752cdc314af08c3ea0c51e04e588d13babd327 | [] | no_license | jjieun07/Java | bac66c9e94c9d82842f79e20b198228bade6d669 | 8127997fb3a59e0c37d17a1a7b448179f82ccba7 | refs/heads/master | 2020-06-18T15:47:48.983854 | 2019-11-27T05:09:48 | 2019-11-27T05:09:48 | 196,353,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java | import java.util.LinkedList;
public class Main {
public static void main(String args[]) {
Astar astar = new Astar();
astar.setWall(4, 6, true);
astar.setWall(1, 1, true);
astar.setWall(1, 2, true);
astar.setWall(1, 3, true);
astar.setWall(1, 4, true);
astar.setWall(1, 5, true);
astar.setWall(1, 6, true);
astar.setWall(1, 7, true);
astar.setWall(1, 8, true);
astar.setWall(1, 9, true);
astar.setWall(3, 0, true);
astar.setWall(3, 1, true);
astar.setWall(3, 2, true);
astar.setWall(3, 3, true);
astar.setWall(3, 4, true);
astar.setWall(3, 5, true);
astar.setWall(4, 5, true);
astar.setWall(5, 5, true);
astar.setWall(5, 3, true);
astar.setWall(6, 3, true);
astar.setWall(6, 5, true);
astar.setWall(4, 7, true);
astar.setWall(4, 8, true);
astar.setWall(4, 9, true);
astar.setWall(5, 7, true);
astar.setWall(6, 7, true);
astar.setWall(8, 2, true);
astar.setWall(8, 3, true);
astar.setWall(8, 4, true);
astar.setWall(8, 5, true);
astar.setWall(8, 6, true);
astar.setWall(8, 7, true);
astar.setWall(8, 8, true);
astar.setWall(8, 9, true);
AstarGUI gui = new AstarGUI(astar);
}
}
| [
"pinkie07@naver.com"
] | pinkie07@naver.com |
c93c45bc3897ba2b74a8cf72a61a3b73de0b7106 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module855/src/main/java/module855packageJava0/Foo14.java | 71de7816c07191cbd761ac210ab329b37a6eb874 | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 446 | java | package module855packageJava0;
import java.lang.Integer;
public class Foo14 {
Integer int0;
Integer int1;
Integer int2;
public void foo0() {
new module855packageJava0.Foo13().foo6();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
f35fd10406a3ea28228b0aac340463ef3e0cb709 | 9aadb0678e182300f43438729bac4e512ea911f2 | /JAVA_Workspace/chapter15/SAXHandler.java | 96829e9791c322f60ea406a6c30578f2f3da441a | [] | no_license | SeungsoonLeee/ssafy | ef0d6aee50a23764a0dc403bce6a7a8c651cf4c2 | 4a7e9c8b14b590f562f5ba68703afd86aa5dfb06 | refs/heads/master | 2023-01-21T00:11:57.330642 | 2019-11-28T08:40:58 | 2019-11-28T08:40:58 | 194,757,133 | 1 | 1 | null | 2023-01-05T11:14:08 | 2019-07-01T23:47:52 | Java | UTF-8 | Java | false | false | 2,082 | java | package chapter15;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class SAXHandler extends DefaultHandler {
// XML을 parsing하기 시작할 때 한번 호출되는 메서드
public void startDocument() throws SAXException {
System.out.println("----------------------- start Document -----------------------");
}
// start tag를 parsing할 때마다 호출되는 메서드
// uri 네임스페이스로 설정된 uri parser 종류에 따라 전달X
// localName 태그 이름만 parser 종류에 따라 전달X
// qName prefix를 포함한 태그 이름
// attributes 시작태그에 선언된 속성 정보들
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
System.out.printf("----------------------- %s 시작 -----------------------\n", qName);
for (int i = 0, len = attributes.getLength(); i < len; i++) {
System.out.println(attributes.getLocalName(i) + " : " + attributes.getValue(i));
}
}
// 태그 바디 중 문자 데이터를 parsing할 때마다 호출되는 메서드
// ch 태그 바디의 모든 문자열
// start 현재 바디의 위치
// length 현재 문자열의 길이
public void characters(char ch[], int start, int length) throws SAXException {
System.out.println(new String(ch, start, length));
}
// end tag를 parsing할 때마다 호출되는 메서드
// uri 네임스페이스로 설정된 uri parser 종류에 따라 전달X
// localName 태그 이름만 parser 종류에 따라 전달X
// qName prefix를 포함한 태그 이름
public void endElement(String uri, String localName, String qName) throws SAXException {
System.out.println("------------------------- end Element -------------------------");
}
// XML parsing이 끝나면 호출되는 메서드
public void endDocument() throws SAXException {
System.out.println("------------------------- end Document -------------------------");
}
}
| [
"cjswosuny01@naver.com"
] | cjswosuny01@naver.com |
63eb9f1d2332cd682be22b354b89347742218767 | 5238fe199ca3c9c50020f7a48a981afa25f03b2a | /src/test/java/com/example/demo/SpringBootWildApplicationTests.java | c732ae774572b01098977bd122497f3c635402fc | [] | no_license | canxuewuhua/springbootPro | 428a768bc8095376cdaf48ab0602995b61ca8a28 | f112bc7626283bd8da8ff242427233404bda2fdd | refs/heads/master | 2022-12-10T09:56:44.747889 | 2022-06-10T03:04:36 | 2022-06-10T03:04:36 | 134,948,742 | 1 | 0 | null | 2022-12-06T00:42:36 | 2018-05-26T09:44:34 | Java | UTF-8 | Java | false | false | 341 | java | package com.example.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringBootWildApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"zhuyongqiang@kingsoft.com"
] | zhuyongqiang@kingsoft.com |
5cb640a314752a6ff7d2bc5f211f77e4ff9b9b06 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/digits/d2b889e1ac42bc85f9df5c45c10708f46784be93d69acd1415cfd4d028cb50b19f50c374a9498c8e8b909173053a100e20c279ddb06c6359a06a920ead3e8080/000/mutations/155/digits_d2b889e1_000.java | 252cd9e7e0827bff62203630abef698a129de2a7 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,707 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class digits_d2b889e1_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
digits_d2b889e1_000 mainClass = new digits_d2b889e1_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj x = new IntObj (), a = new IntObj (), b = new IntObj (), c =
new IntObj (), y = new IntObj ();
output += (String.format ("Enter an integer > "));
b.value = scanner.nextInt ();
a.value = b.value / 10;
c.value = b.value % 10;
if (c.value > 0) {
output += (String.format ("%d\n", c.value));
} else if (c.value < 0) {
y.value = c.value * (-1);
output += (String.format ("%d\n", y.value));
}
if (a.value > 0) {
while (a.value > 0) {
x.value = a.value % 10;
a.value = a.value / 10;
output += (String.format ("%d\n", x.value));
if (a.value < 10) {
output +=
(String.format ("%d\nThat's all, have a nice day!\n", a.value));
if (true)
return;;
}
}
} else if (a.value < 0) {
a.value = a.value * (-1);
while (a.value > 0) {
x.value = 10;
a.value = a.value / 10;
output += (String.format ("%d\n", x.value));
if (a.value < 10) {
a.value = a.value * (-1);
output +=
(String.format ("%d\nTHat's all, have a nice day~\n", a.value));
}
}
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
5e2ec27784a7ebb1ebe765c2cabca90cf79d702d | 490c7ad3961bd54684c3a3fce12bae1dae9b2ba6 | /src/main/java/smvcday1/Person.java | 20e8fd777af6ad123d9ddd055ebf9f9bb8e3dbc0 | [] | no_license | hhe1/smvcday1 | 4d06586680293b5800cf716dc6f31131d8ed3c14 | b9b142365b2ee3bb52f247594117d8c9366d3683 | refs/heads/master | 2021-01-25T00:23:12.560823 | 2018-02-28T14:17:34 | 2018-02-28T14:17:34 | 123,294,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package smvcday1;
public class Person {
private String username;
private String password;
private int age;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public void say() {
System.out.println("people say ");
}
}
| [
"hehong_0603@163.com"
] | hehong_0603@163.com |
5f04191c3006a94368b3804e6904a41b99a60d00 | 58d7cbc844956e4b00ddac16aafcd10cfe6e976c | /java基础1/12.标准类库/3.时间处理相关类/1.Date/Demo.java | 149d7cac3b88e101709e45f8dea398515e9bc0ad | [] | no_license | PaulMing/javastudy | 85ba302021057a0a4f08c1780caf9736a88d4d2f | 3579f7e79d73486ae49a53edbc5c27f066859ee1 | refs/heads/master | 2023-09-04T06:00:57.584162 | 2021-10-29T12:03:07 | 2021-10-29T12:03:07 | 407,141,514 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | import java.util.Date;
public class Demo {
public static void main(String[] args) {
// 开发中使用long类型定义变量,其数据范围可表示基准时间往前几亿年、往后几亿年
long range = Long.MAX_VALUE/(1000L*3600*24*365);
System.out.println(range);//292471208 -> 2.9亿年
long now = System.currentTimeMillis();//时间戳
System.out.println(now);//1625824819229
/*
Date类:
new Date();//返回当前时间对象
new Date(long date);//返回date对应的时间对象
long getTime();//返回时间戳
String toString();//转换为String格式 -> dow mon dd hh:mm:ss zzz yyyy dow就是周中某天[Sun、Mon、Tue、Wed、Thu、Fri、Sat]
-> JDK1.1之前的Date类提供了很多方法:日期操作、字符串转换成时间对象等,目前都废弃了,JDK1.1之后提供了日期操作类Calendar,字符串转化使用DateFormat类
*/
Date d = new Date();
Date d1 = new Date(1000L * 3600 * 24 * 365 * 150);
System.out.println(d);//Sat Jul 10 10:39:58 CST 2021
System.out.println(d.getTime());//1625884798100
System.out.println(d.toString());//Sat Jul 10 10:39:58 CST 202
}
} | [
"zhiming@xiaomi.com"
] | zhiming@xiaomi.com |
66337a4c55eddaf33b302fafa1a43868011e02e0 | 9dc77914b243c8d51af7a49703cd332af886c836 | /techstack-storm/src/main/java/wang/wincent/techstack/storm/example/logMonitor/bolt/SaveMessage2MySql.java | 4b6bec106755ab8ba18a27e9dafcf8860cc4b9bd | [] | no_license | wincentwang/techstack | f9c919ef783e23864bc6b4bf276e90463ce4e0b7 | b1bdd947c96147b17fa6680b62189500358e7569 | refs/heads/master | 2021-06-23T09:26:58.732755 | 2017-09-05T08:17:36 | 2017-09-05T08:17:36 | 96,181,828 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package wang.wincent.techstack.storm.example.logMonitor.bolt;
import backtype.storm.topology.BasicOutputCollector;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseBasicBolt;
import backtype.storm.tuple.Tuple;
import org.apache.log4j.Logger;
import wang.wincent.techstack.storm.example.logMonitor.domain.Record;
import wang.wincent.techstack.storm.example.logMonitor.utils.MonitorHandler;
/**
* Describe: 请补充类描述
* Data: 2015/11/11.
*/
public class SaveMessage2MySql extends BaseBasicBolt {
private static Logger logger = Logger.getLogger(SaveMessage2MySql.class);
public void execute(Tuple input, BasicOutputCollector collector) {
Record record = (Record) input.getValueByField("record");
MonitorHandler.save(record);
}
public void declareOutputFields(OutputFieldsDeclarer declarer) {
}
}
| [
"cunix24@sina.com"
] | cunix24@sina.com |
38887d719cb916854af6d885c9b307af8c927951 | 8a883dab213c8c6aa92dcba5b64012afbc87148b | /HW09-0036453293/src/test/java/hr/fer/zemris/java/sorters/QSortParallelTest.java | 0e26e7654d192cbe42cd112f77d58ba9f825c513 | [] | no_license | mborovac/javaProject | a34e23fefade7d596b2822ede04e593a85b73b1f | 178effbcc27ab9aa2e6ce4b1fbdcfa95a58e9a56 | refs/heads/master | 2021-01-10T07:32:39.270239 | 2015-12-10T18:07:01 | 2015-12-10T18:07:01 | 47,714,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 902 | java | package hr.fer.zemris.java.sorters;
import static org.junit.Assert.*;
import org.junit.Test;
public class QSortParallelTest {
@Test
public void QSortTest1() {
int[] data = new int[] {5, 21, 943, 8, 34, 12 ,83, 36, 2, 4, 31, 4};
QSortParallel.sort(data);
assertEquals("true", true, QSortParallel.isSorted(data));
}
@Test
public void QSortTest2() {
int[] data = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
QSortParallel.sort(data);
assertEquals("true", true, QSortParallel.isSorted(data));
}
@Test
public void QSortTest3() {
int[] data = new int[] {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
QSortParallel.sort(data);
assertEquals("true", true, QSortParallel.isSorted(data));
}
@Test
public void QSortTest4() {
int[] data = new int[] {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5};
QSortParallel.sort(data);
assertEquals("true", true, QSortParallel.isSorted(data));
}
}
| [
"marko.borovac@fer.hr"
] | marko.borovac@fer.hr |
f609089e075e1674ce3e2bfad0d4c7f61fe87fa7 | 5af9def9987c001798f85d6a90f555559d0b9be5 | /task-03-telegram-random-coffee/src/main/java/ru/hse/cs/java2020/task03/dao/ITrackerIssueDao.java | f043256453d1d3fcff940baaa9772b2b42e58b26 | [] | no_license | g-arslan/HSE-CS-Java2020-Tasks | ee7bc9e1c1eff07afc790d64345dfb342c86a4ec | 11fc8e5f1e00522bf358b60d1b70d039f34ba849 | refs/heads/master | 2022-10-04T09:10:50.531959 | 2020-06-11T14:50:38 | 2020-06-11T14:50:38 | 243,804,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package ru.hse.cs.java2020.task03.dao;
import ru.hse.cs.java2020.task03.models.TrackerIssue;
public interface ITrackerIssueDao {
TrackerIssue getTrackerIssue(Integer telegramId);
void saveTrackerIssue(TrackerIssue trackerIssue);
void updateTrackerIssue(TrackerIssue trackerIssue);
}
| [
"garsthe1st@gmail.com"
] | garsthe1st@gmail.com |
eb629300f3a95621c291d51d3847859bc7733c57 | 4423872701a02ad205ddbe1cdc491dc5a1c0c68d | /app/src/main/java/expansion/neto/com/mx/gerenteapp/fragment/fragmentTerminar/FragmentCardTerminar.java | 0685d8ae1be6d2a56ad4e5b8a0aec83bc6c1ec33 | [] | no_license | AntonioMontoyaaA/appgerenteexpansion | 5718935aebc91511b4753484620d233a62d27764 | 0aba3ffd49a1fcf92b35e9451c56410dd1a5bc1a | refs/heads/master | 2023-04-12T07:35:19.620494 | 2021-02-17T19:21:03 | 2021-02-17T19:21:03 | 365,313,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 838 | java | /*
* Copyright 2014 Niek Haarman
*
* 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 expansion.neto.com.mx.gerenteapp.fragment.fragmentTerminar;
import android.support.v4.app.Fragment;
import expansion.neto.com.mx.gerenteapp.sorted.autoriza.AutorizaHolder;
public class FragmentCardTerminar {
}
| [
"70233278+AntonioMontoyaaA@users.noreply.github.com"
] | 70233278+AntonioMontoyaaA@users.noreply.github.com |
14afedb688de026fb4d6a249af9be6a12ef6636b | 499f4189dcda4561df1a3ed3a39165bb78cffcb5 | /IK_project/src/Obj/DrawbleObject.java | 6fc3ff6aa63b5ad4030f906e9ac1951b1498b0a8 | [] | no_license | ilYYYa/IK-project | 0f730c5abd923b839291871bc7773b9c42a7f98c | 87a7c8811e3bd3019ca4ce3ef1f4af239eceb921 | refs/heads/master | 2021-01-18T23:07:08.797108 | 2017-04-05T17:29:34 | 2017-04-05T17:29:34 | 87,090,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package Obj;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
public abstract class DrawbleObject
{
public double posX = 0;
public double posY = 0;
public double localPosX = 0;
public double localPosY = 0;
public double width = 0;
public double height = 0;
public abstract void draw(Graphics g);
public void onMouseClick(MouseEvent event){}
public void onMousePress(MouseEvent event){}
public void onMouseRelease(MouseEvent event){}
public void onMouseMove(MouseEvent event){}
public void onKeyPress(KeyEvent event){}
public void onKeyRelease(KeyEvent event){}
}
| [
"ilyyya.777@gmail.com"
] | ilyyya.777@gmail.com |
685064f04e9c6768b984b936df98c62c1f96387a | efcc6ede8c1b063b8c5325fb9de1e3d05502ad6e | /app/src/main/java/com/arthurbatista/register/activity/MainActivity.java | 98096c599f341fb3f7b1dfc4f6d77143c563b2b4 | [] | no_license | ArthurMorsoleto/Register | 4c160bbe477a1b2702228e415fb52280bf2931b3 | 559c148b1a631f73e854bc198460d67a8dfebb03 | refs/heads/master | 2020-06-18T08:46:50.129359 | 2019-07-10T16:29:21 | 2019-07-10T16:29:21 | 196,239,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,066 | java | package com.arthurbatista.register.activity;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.arthurbatista.register.R;
import com.arthurbatista.register.adapter.ClienteAdapter;
import com.arthurbatista.register.helper.ClienteDAO;
import com.arthurbatista.register.helper.DBHelper;
import com.arthurbatista.register.helper.RecyclerItemClickListener;
import com.arthurbatista.register.model.Cliente;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private RecyclerView recyclerListaClientes;
private ClienteAdapter clienteAdapter;
private List<Cliente> listaClientes = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//configurar o recyclerView
recyclerListaClientes = findViewById(R.id.recyclerListaClientes);
//evento de clique para os itens do recyclerView
recyclerListaClientes.addOnItemTouchListener(
new RecyclerItemClickListener(
getApplicationContext(),
recyclerListaClientes,
new RecyclerItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
//Atualizar o cliente atual
//Recuperar o cliente para edição
Cliente clienteSelecionado = listaClientes.get(position);
Intent intent = new Intent(MainActivity.this, AddClientActivity.class);
intent.putExtra("clienteSelecionado", clienteSelecionado);
startActivity(intent);
}
@Override
public void onLongItemClick(View view, int position) {
//Remover a tarefa
final Cliente clienteSelecionado = listaClientes.get(position);
//alerta para confirmação
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
dialog.setTitle("Confirmar exclusão");
dialog.setMessage("Deseja excluir o Cliente: " + clienteSelecionado.getNome() + "?");
dialog.setPositiveButton("Sim", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//excluir
ClienteDAO clienteDAO = new ClienteDAO(getApplicationContext());
if(clienteDAO.deletar(clienteSelecionado)){
carregarClientes();
Toast.makeText(
getApplicationContext(),
"Cliente " + clienteSelecionado.getNome() + " Removido",
Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(
getApplicationContext(),
"Erro ao remover o Cliente: " + clienteSelecionado.getNome(),
Toast.LENGTH_SHORT).show();
}
}
});
dialog.setNegativeButton("Não", null);
dialog.create();
dialog.show();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
}
)
);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Abrir tela de Cadastro
Intent intent = new Intent(getApplicationContext(), AddClientActivity.class);
startActivity(intent);
}
});
}
@Override
protected void onStart() {
carregarClientes();
super.onStart();
}
public void carregarClientes(){
//Listar clientes
ClienteDAO clienteDAO = new ClienteDAO(getApplicationContext());
listaClientes = clienteDAO.listar();
//configurar um adapter
clienteAdapter = new ClienteAdapter( listaClientes );
//configurar o recycler view
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
recyclerListaClientes.setLayoutManager(layoutManager);
recyclerListaClientes.setHasFixedSize(true);
recyclerListaClientes.addItemDecoration(new DividerItemDecoration(getApplicationContext(), LinearLayout.VERTICAL));
recyclerListaClientes.setAdapter(clienteAdapter);
}
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.menu_main, menu);
// return true;
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// // Handle action bar item clicks here. The action bar will
// // automatically handle clicks on the Home/Up button, so long
// // as you specify a parent activity in AndroidManifest.xml.
// int id = item.getItemId();
//
// //noinspection SimplifiableIfStatement
// if (id == R.id.action_settings) {
// return true;
// }
//
// return super.onOptionsItemSelected(item);
// }
}
| [
"arthur.morsoleto@gmail.com"
] | arthur.morsoleto@gmail.com |
9f2221b59331085a031e1a1feac3ac0761d71f94 | 6775412013350bceefa00a8197a31a74b7ff5b46 | /demos/portal/jsf2-registration-portlet/src/main/java/com/liferay/faces/demos/bean/RegistrantModelBean.java | 0034f4e950f56bd003030be783078082e94bd120 | [] | no_license | ceidion/liferay-faces | 757cd9694d189e017a7568bbca0c98b2deb39c5b | e4a96ca8a01e82d648cc183b4ccc87f215e2772c | refs/heads/master | 2023-04-15T22:02:12.121241 | 2019-11-02T17:40:52 | 2019-11-02T17:40:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,416 | java | /**
* Copyright (c) 2000-2015 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.faces.demos.bean;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import com.liferay.faces.demos.model.Registrant;
import com.liferay.faces.portal.context.LiferayFacesContext;
/**
* This is a model managed bean that represents a user that is registering for an account.
*
* @author "Neil Griffin"
*/
@ManagedBean(name = "registrantModelBean")
@ViewScoped
public class RegistrantModelBean implements Serializable {
// serialVersionUID
private static final long serialVersionUID = 7459438254337818761L;
// Private Data Members
private Registrant registrant;
public RegistrantModelBean() {
registrant = new Registrant(LiferayFacesContext.getInstance().getCompanyId());
}
public Registrant getRegistrant() {
return registrant;
}
}
| [
"neil.griffin.scm@gmail.com"
] | neil.griffin.scm@gmail.com |
d49754c71f693a722ca115ffed24e3dc3b6c7936 | 44036d343380c67be2394666209b87e7151c45c7 | /src/main/java/com/bakery/service/OrderGenerator.java | f19872a42e62301d327bdf829d72747877957c5c | [] | no_license | SanMateo222/BakeryChallenge | b2b41b698f0638cf59b35679b4e97bb17b23c734 | 2ab2ce8d89dac8f58313261ba308f0a0b9f42347 | refs/heads/master | 2020-05-06T13:26:24.750444 | 2019-04-08T12:15:45 | 2019-04-08T12:15:45 | 180,136,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package com.bakery.service;
import com.bakery.app.BakeryOrderRequest;
import com.bakery.model.BakeryOrder;
import java.util.List;
public interface OrderGenerator {
List<BakeryOrder> generateOrderList(List<BakeryOrderRequest> bakeryOrderRequestList);
}
| [
"wlodi222@gmail.com"
] | wlodi222@gmail.com |
1acb723884d5512cfd4536d8903035e1124ac7aa | a58acd3c5646754fbbcf41386efc8791b7fb6ed8 | /xm-store/src/main/java/com/xm/xmstore/service/ex/ServiceException.java | 87920927d990d7240c29bba0895bc515688a61c4 | [] | no_license | Abner0217/xm_store | 2b49370c3fed3e0310d4940b027f1a3830523fcb | 8bc9ed3f92700db748f5db4af9a1a5e85c90c0e8 | refs/heads/master | 2022-06-13T23:20:37.572011 | 2019-07-13T15:46:24 | 2019-07-13T15:46:24 | 196,741,665 | 0 | 0 | null | 2022-05-20T21:02:46 | 2019-07-13T16:14:52 | HTML | UTF-8 | Java | false | false | 727 | java | package com.xm.xmstore.service.ex;
/**
* 业务逻辑异常的基类
* @author jamie
*
*/
public class ServiceException extends RuntimeException {
private static final long serialVersionUID = 1L;
public ServiceException() {
super();
}
public ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public ServiceException(String message) {
super(message);
}
public ServiceException(Throwable cause) {
super(cause);
}
}
| [
"zhaokangwei@163.com"
] | zhaokangwei@163.com |
a7d1ad815eced63195b371753e40952ae299aade | 275069d3262ba52c5599b8a4b655bf5951818650 | /ProxyPattern/src/main/java/com/mycompany/facadepattern/access/ArrayRepository.java | 05e523f398526428bef74a1c1813e94ee185298e | [] | no_license | jorgeisolano/ProxyPattern | 0d7069c59188a05e0eb3645a0b55c179490b019e | 06bdb11f60156b9e61167262b2b20725d590b1f5 | refs/heads/main | 2023-01-08T04:16:45.945915 | 2020-11-05T22:03:56 | 2020-11-05T22:03:56 | 310,418,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.mycompany.facadepattern.access;
import com.mycompany.facadepattern.domain.Order;
/**
* Implementacion de repositorio por array
* (sin implmentar, objetivo principal del ejercicio Proxy)
*
* @author Jorge Ivan, Juan Pablo Solarte
*/
public class ArrayRepository implements IOrderRepository{
public ArrayRepository() {
}
@Override
public void createOrder(Order order) {
}
}
| [
"noreply@github.com"
] | noreply@github.com |
3bf462c4809313b3a7f8f9e8886248e1277e3151 | b3633e3ec170e10ffaf07f7125d1bc17ff2b462f | /Benchmarks/ph-commons-ph-commons-parent-pom-9.3.9-patched/ph-commons/src/main/java/com/helger/commons/ws/HostnameVerifierVerifyAll.java | 30af8b4603fa40564fe4f6bcaefc8e982b105869 | [
"Apache-2.0"
] | permissive | dliang2000/hierarchy_analysis | 23c30460050a2451606adf28cc1e09fc101e7457 | 4083b4c9e0daaf519cd1c3f37c4379bf97da9329 | refs/heads/master | 2022-05-31T02:01:24.776781 | 2021-03-30T20:39:58 | 2021-03-30T20:39:58 | 231,459,166 | 1 | 0 | null | 2022-05-20T21:58:23 | 2020-01-02T21:03:00 | Java | UTF-8 | Java | false | false | 1,938 | java | /**
* Copyright (C) 2014-2019 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.commons.ws;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.helger.commons.debug.GlobalDebug;
import com.helger.commons.string.ToStringGenerator;
/**
* Implementation of HostnameVerifier always returning <code>true</code>.
*
* @author Philip Helger
*/
public class HostnameVerifierVerifyAll implements HostnameVerifier
{
private static final Logger LOGGER = LoggerFactory.getLogger (HostnameVerifierVerifyAll.class);
private final boolean m_bDebug;
public HostnameVerifierVerifyAll ()
{
this (GlobalDebug.isDebugMode ());
}
public HostnameVerifierVerifyAll (final boolean bDebug)
{
m_bDebug = bDebug;
}
/**
* @return The debug flag as passed in the constructor.
*/
public boolean isDebug ()
{
return m_bDebug;
}
public boolean verify (final String sURLHostname, final SSLSession aSession)
{
if (m_bDebug)
if (LOGGER.isInfoEnabled ())
LOGGER.info ("Hostname '" + sURLHostname + "' is accepted by default in SSL session " + aSession + "!");
return true;
}
@Override
public String toString ()
{
return new ToStringGenerator (this).append ("debug", m_bDebug).getToString ();
}
}
| [
"q8liang@uwaterloo.ca"
] | q8liang@uwaterloo.ca |
e17fd9b27cc8cd07dd34e2172a139a416c3d36be | 50121932894e36260f1f6416a66bb7710c8782ad | /src/main/java/starwalker/config/auth/LoginUserArgumentResolver.java | 79015631f1ab83ac6e70324bd461ee8d1c0804e9 | [] | no_license | cook2421/Starwalker | a46a68b77f1fd2b7f0377ef82f848342b50ab897 | 1c6af230d477271a576135cbfdf21cf43cd3b2d1 | refs/heads/master | 2023-05-23T19:33:32.692912 | 2021-06-25T05:45:12 | 2021-06-25T05:45:12 | 379,107,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,374 | java | package starwalker.config.auth;
import lombok.RequiredArgsConstructor;
import org.springframework.core.MethodParameter;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import starwalker.config.auth.dto.SessionUser;
import javax.servlet.http.HttpSession;
@RequiredArgsConstructor
@Component
public class LoginUserArgumentResolver implements HandlerMethodArgumentResolver {
private final HttpSession httpSession;
@Override
public boolean supportsParameter(MethodParameter parameter){
boolean isLoginUserAnnotation = parameter.getMethodAnnotation(LoginUser.class) != null;
boolean isUserClass = SessionUser.class.equals(parameter.getParameterType());
return isLoginUserAnnotation && isUserClass;
}
@Override
public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
return httpSession.getAttribute("user");
}
}
| [
"cooksh2421"
] | cooksh2421 |
62fb36a58180e3bad1ccf920bfa8c47162c43063 | 018cd372129dc26fb6e9072da65418ee2bb4f2e1 | /src/main/java/org/megam/mammoth/core/api/APICapability.java | 591a18392e0897421c5bfbedf81038b387c1dda3 | [] | no_license | indykish/mammoth | 6052bfe75d79ac11b6d93ccf35989e6fb4dbde13 | 64b798b9f17a8f00ac91051a59f75d6f750189b4 | refs/heads/master | 2021-05-16T02:18:18.773959 | 2013-10-29T10:41:00 | 2013-10-29T10:41:00 | 5,505,164 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package org.megam.mammoth.core.api;
import java.util.List;
public interface APICapability {
public String title();
public String description();
public String version(String versionid);
public List<APICall> describe(String apicall);
}
| [
"indykish@gmail.com"
] | indykish@gmail.com |
6ff22f07f9fdc1fbda856fbdbffbe64bc0786937 | 8218fdee6ae28432760ca3d5de1c106fc2dd3ebc | /not_yet_commons/not-yet-commons-ssl-0.3.17/src/java/org/apache/commons/ssl/org/bouncycastle/asn1/pkcs/RSAPrivateKey.java | a841c6f044e240785560a48fd17a8591d2bad105 | [
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | rcbj/apigee-jwt-aad-timeapi-proxy | bdfb810bce9666db66fcb12a33aa49d080a416f8 | 9856373070d611aa8759a5bed8baab39fafda83b | refs/heads/master | 2022-02-23T18:35:01.375846 | 2019-12-21T04:58:00 | 2019-12-21T04:58:00 | 78,804,403 | 4 | 3 | Apache-2.0 | 2022-02-11T03:49:54 | 2017-01-13T01:46:58 | Java | UTF-8 | Java | false | false | 5,554 | java | package org.apache.commons.ssl.org.bouncycastle.asn1.pkcs;
import java.math.BigInteger;
import java.util.Enumeration;
import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1EncodableVector;
import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Integer;
import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Object;
import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Primitive;
import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Sequence;
import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1TaggedObject;
import org.apache.commons.ssl.org.bouncycastle.asn1.DERSequence;
public class RSAPrivateKey
extends ASN1Object
{
private BigInteger version;
private BigInteger modulus;
private BigInteger publicExponent;
private BigInteger privateExponent;
private BigInteger prime1;
private BigInteger prime2;
private BigInteger exponent1;
private BigInteger exponent2;
private BigInteger coefficient;
private ASN1Sequence otherPrimeInfos = null;
public static RSAPrivateKey getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
return getInstance(ASN1Sequence.getInstance(obj, explicit));
}
public static RSAPrivateKey getInstance(
Object obj)
{
if (obj instanceof RSAPrivateKey)
{
return (RSAPrivateKey)obj;
}
if (obj != null)
{
return new RSAPrivateKey(ASN1Sequence.getInstance(obj));
}
return null;
}
public RSAPrivateKey(
BigInteger modulus,
BigInteger publicExponent,
BigInteger privateExponent,
BigInteger prime1,
BigInteger prime2,
BigInteger exponent1,
BigInteger exponent2,
BigInteger coefficient)
{
this.version = BigInteger.valueOf(0);
this.modulus = modulus;
this.publicExponent = publicExponent;
this.privateExponent = privateExponent;
this.prime1 = prime1;
this.prime2 = prime2;
this.exponent1 = exponent1;
this.exponent2 = exponent2;
this.coefficient = coefficient;
}
private RSAPrivateKey(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
BigInteger v = ((ASN1Integer)e.nextElement()).getValue();
if (v.intValue() != 0 && v.intValue() != 1)
{
throw new IllegalArgumentException("wrong version for RSA private key");
}
version = v;
modulus = ((ASN1Integer)e.nextElement()).getValue();
publicExponent = ((ASN1Integer)e.nextElement()).getValue();
privateExponent = ((ASN1Integer)e.nextElement()).getValue();
prime1 = ((ASN1Integer)e.nextElement()).getValue();
prime2 = ((ASN1Integer)e.nextElement()).getValue();
exponent1 = ((ASN1Integer)e.nextElement()).getValue();
exponent2 = ((ASN1Integer)e.nextElement()).getValue();
coefficient = ((ASN1Integer)e.nextElement()).getValue();
if (e.hasMoreElements())
{
otherPrimeInfos = (ASN1Sequence)e.nextElement();
}
}
public BigInteger getVersion()
{
return version;
}
public BigInteger getModulus()
{
return modulus;
}
public BigInteger getPublicExponent()
{
return publicExponent;
}
public BigInteger getPrivateExponent()
{
return privateExponent;
}
public BigInteger getPrime1()
{
return prime1;
}
public BigInteger getPrime2()
{
return prime2;
}
public BigInteger getExponent1()
{
return exponent1;
}
public BigInteger getExponent2()
{
return exponent2;
}
public BigInteger getCoefficient()
{
return coefficient;
}
/**
* This outputs the key in PKCS1v2 format.
* <pre>
* RSAPrivateKey ::= SEQUENCE {
* version Version,
* modulus INTEGER, -- n
* publicExponent INTEGER, -- e
* privateExponent INTEGER, -- d
* prime1 INTEGER, -- p
* prime2 INTEGER, -- q
* exponent1 INTEGER, -- d mod (p-1)
* exponent2 INTEGER, -- d mod (q-1)
* coefficient INTEGER, -- (inverse of q) mod p
* otherPrimeInfos OtherPrimeInfos OPTIONAL
* }
*
* Version ::= INTEGER { two-prime(0), multi(1) }
* (CONSTRAINED BY {-- version must be multi if otherPrimeInfos present --})
* </pre>
* <p>
* This routine is written to output PKCS1 version 2.1, private keys.
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new ASN1Integer(version)); // version
v.add(new ASN1Integer(getModulus()));
v.add(new ASN1Integer(getPublicExponent()));
v.add(new ASN1Integer(getPrivateExponent()));
v.add(new ASN1Integer(getPrime1()));
v.add(new ASN1Integer(getPrime2()));
v.add(new ASN1Integer(getExponent1()));
v.add(new ASN1Integer(getExponent2()));
v.add(new ASN1Integer(getCoefficient()));
if (otherPrimeInfos != null)
{
v.add(otherPrimeInfos);
}
return new DERSequence(v);
}
}
| [
"robert.broeckelmann@levvel.io"
] | robert.broeckelmann@levvel.io |
d1cf210281d6fc076268f742689e4b43633895da | a1a3ee63527437178c96dc230fa16d201bf477a7 | /src/Test/SignupTest.java | 600e7dc4cdfdd96d1f0f9b34a2b79cb75895288c | [] | no_license | Niv-Behar/Software-engineering | 051d30d5f4e9c570ce2f6893dd4ea2ab1aa34f99 | 497a80a7646f848598520f0463cbe34269750bfa | refs/heads/master | 2023-01-08T14:46:25.508621 | 2020-11-10T13:10:14 | 2020-11-10T13:10:14 | 267,287,792 | 2 | 1 | null | 2020-05-27T11:08:56 | 2020-05-27T10:20:44 | Java | UTF-8 | Java | false | false | 1,337 | java | package Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import Model.UserService;
class SignupTest {
@Test
public void SignupFailsWhenEmailIsEmpty() {
UserService userService = UserService.getInstance();
boolean result = userService.signup("", "test");
if(result) Assertions.fail("Signup success but should have failed!");
Assertions.assertEquals(false, result);
}
@Test
public void SignupFailsWhenPasswordIsEmpty() {
UserService userService = UserService.getInstance();
boolean result = userService.signup("test@test", "");
if(result) Assertions.fail("Signup success but should have failed!");
Assertions.assertEquals(false, result);
}
@Test
public void SignupFailsWhenEmailAlreadyRegistered() {
UserService userService = UserService.getInstance();
boolean result = userService.signup("test@test", "test");
if(result) Assertions.fail("Signup success but should have failed!");
Assertions.assertEquals(false, result);
}
@Test
public void SignupFailsWhenEmailNotValidEmail() {
UserService userService = UserService.getInstance();
boolean result = userService.signup("testtest", "test");
if(result) Assertions.fail("Signup success but should have failed!");
Assertions.assertEquals(false, result);
}
}
| [
"vekyoni@icloud.com"
] | vekyoni@icloud.com |
6bc30f8a40984d277dc212ddf2891b11bf388e70 | 61ff5b7dc76564d39c83c46f9fba43475d0745c4 | /src/test/java/com/capgemini/lpu/Loan/TestViewRequests.java | 957efbc50ceb670257a17e706b45390300113ea3 | [] | no_license | BadiSaineel/Bank-Loan | 37b6f03fb5c2815f3a3b5478e63908113399d9de | e6af3f4f2cab4bc55015debe476285e9ed5d9ec0 | refs/heads/master | 2021-01-06T15:05:45.665166 | 2020-03-21T04:31:06 | 2020-03-21T04:31:06 | 241,372,387 | 0 | 0 | null | 2020-10-13T19:38:12 | 2020-02-18T13:47:42 | Java | UTF-8 | Java | false | false | 1,702 | java | package com.capgemini.lpu.Loan;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.capgemini.lpu.loan.exceptions.LoanRequestObjectException;
import com.capgemini.lpu.loan.exceptions.RequestIdException;
import com.capgemini.lpu.loan.exceptions.RequestIdFormateException;
import com.capgemini.lpu.loan.service.LoanService;
import com.capgemini.lpu.loan.service.LoanServiceImpl;
public class TestViewRequests {
LoanService ser= new LoanServiceImpl();
@Test
@DisplayName("Functionality of checking null in view requests")
public void test1() {
assertThrows(LoanRequestObjectException.class,()-> ser.viewRequests(null));
}
@Test
@DisplayName("Functionality of checking RequestIdFormateException in view requests")
public void test2() {
assertThrows(RequestIdFormateException.class,()-> ser.viewRequests("jjeh2832"));
}
@Test
@DisplayName("Functionality of checking RequestIdException in view requests")
public void test3() {
assertThrows(RequestIdException.class,()-> ser.viewRequests("lid654589"));
}
@DisplayName("Functionality of view one request")
@Test
public void test4() throws RequestIdFormateException, RequestIdException, LoanRequestObjectException {
assertNotNull(ser.viewRequests("lid756551"));
}
@Test
@DisplayName("Functionality of view all requests")
public void test5() {
assertTrue(ser.viewRequests().size()>1);
}
}
| [
"bsaineel@gmail.com"
] | bsaineel@gmail.com |
942085a54f0f3e66bb07f7fbbc06d3e5eb166c1a | f6a03e73f2da505d84cdcc4f60c3aa1b3f4adea4 | /app/src/main/java/kr/co/tjeit/beautisalon/utils/DBManager.java | 4bd6c3ddbe919a9c453f980f516408f94a3ff03e | [] | no_license | HanSangYeol/BeautiSalon | 277b516384a042ab63115339c538870bca783684 | 6e66508d33cb3360a6be3f5e972f822c9f9babf5 | refs/heads/master | 2021-05-16T05:40:49.565650 | 2017-09-12T03:13:25 | 2017-09-12T03:13:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,004 | java | package kr.co.tjeit.beautisalon.utils;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
/**
* Created by user on 2017-09-12.
*/
public class DBManager {
// 1. DB 파일명
static final String DATABASE_NAME = "dbfile.db";
// ※ 반드시 확장자는 .db => SQLite에서 인식가능하게.
// 2. 테이블 이름
static final String TABLE_USER = "Users";
static final String TABLE_DESIGNER = "Designers";
// 3. 데이터베이스 버젼
// 앱 : 업데이트가 가능.
// => 사용자가 다운로드 하지 않으면 적용되지 않음.
// => DB구조가 변경될 경우, 업데이트시 반드시 명시해야함.
static final int DB_VERSION = 1;
// DB관련 기본정보 마무리.
// 필요 변수 작성
// 1. DB => 파일. 안드로이드에서 파일 저장 : Context 객체 의존
Context mContext;
// 2. DBManager 자신을 변수로.
// DB는 하나의 파일. => 여러개의 프로세스가 동시에 작업하면 매우 곤란.
// DBManager 클래스는 단 하나의 객체만 생성되도록 강제. => Singletone (디자인패턴)
private static DBManager mDBManager = null;
// 3. 실제로 데이터가 저장되는 데이터베이스 변수.
// DBMS 객체 생성. (SQLite)
private SQLiteDatabase mDatabase = null;
// 필요변수 작성 마무리
// DB객체를 하나만 존재하도록 : SingleTone -> 구현
// 생성자는 private, 대신 getInstance 메쏘드를 public
// getInstance가 하는일?
// => 만약 mDBManager가 null이라면 새로 생성
// => 이미 생성되어있다면, 생성되어있는 객체를 활용하도록 리턴.
// mDBmanager는 static. => 프로그램 시작시 단 한번 메모리에 올라감. 종료시까지 상주.
public static DBManager getInstance(Context context) {
if (mDBManager == null) {
mDBManager = new DBManager(context);
}
return mDBManager;
}
// 싱글톤 패턴이 완성되려면, 생성자를 아무도 콜 하지 못하게 막아야함.
// 그래야 하나의 객체로 유지.
// 생성자를 막는다 : 접근 권한을 막는다 => 아무도 접근 못하게 하려면? private
private DBManager(Context context) {
// 생성자에서 하는일?
// 1. mContext 초기화
mContext = context;
// 2. 데이터베이스 열거나 없으면 만들기.
mDatabase = mContext.openOrCreateDatabase(DATABASE_NAME, Context.MODE_PRIVATE, null);
// 3. 만약, DB를 열었는데 필요한 테이블이 없다면 만들어야함.
// => mDatabase를 이용해, CREATE TABLE 구문 (SQL)을 실행.
// => DDL들을 모두 작성.
// Users 테이블 작성 쿼리
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS " + TABLE_USER +
"(" +
"id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"name TEXT, " +
"gender INTEGER, " +
"profileURL TEXT" +
");"
);
// Designer 테이블 생성
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS " + TABLE_DESIGNER +
"(" +
"id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"name TEXT, " +
"gender INTEGER, " +
"nickName TEXT, " +
"majorAge INTEGER" +
");"
);
}
public long insertUser(ContentValues addRowValues) {
// 사용자 테이블에 데이터를 추가하기 위한 기능.
// ContentValues : DB에 데이터를 넣기 위한 HashMap
// HashMap : "키" - "값" 묶음.
return mDatabase.insert(TABLE_USER, null, addRowValues);
}
public long insertDesigner(ContentValues addRowValues) {
return mDatabase.insert(TABLE_DESIGNER, null, addRowValues);
}
// public void insertUserBySQL(String name, int gender, String URL) {
//
// mDatabase.execSQL(
//
// "INSERT INTO " + TABLE_USER +
// "VALUES (" +
// "null," +
// "'" + name + "', " +
// "" + gender +", " +
// "'" + URL + "');"
//
// );
//
// }
// 데이터 조회 기능
// 모든 디자이너 목록 가져오기
public Cursor getAllDesignersCursor() {
// 일반적인 CREATE TABLE, INSERT INTO 등등의 쿼리는 execSQL 로 실행.
//
// SELECT 문 => 조회 결과를 표 형식으로 돌려받아야 함.
// execSQL은 리턴타입이 void. (아무것도 돌려주지 않음.)
// Cursor를 리턴해주는 rawQuery메쏘드를 이용
return mDatabase.rawQuery("SELECT * FROM " + TABLE_DESIGNER, null);
}
}
| [
"cho881020@gmail.com"
] | cho881020@gmail.com |
7fb87c9330e33b86cb1d4d83c28e4c95ef514269 | 71dd94e891cf599ce781d68fdbfa4f05fa775376 | /spider-base/spider-base-utils/src/test/java/event_listener/EventProducer.java | 73d9cfeeb2355085761642a55fab60fc8bb21eb0 | [] | no_license | sijunx/myDic | 4367a0c7f9d7850956ee803e6b025e3531a16849 | aecf98238722058e782d86d0396028d3965b78ea | refs/heads/master | 2022-12-25T09:33:09.038421 | 2020-08-15T12:27:44 | 2020-08-15T12:27:44 | 220,731,622 | 1 | 0 | null | 2022-12-16T04:49:34 | 2019-11-10T02:34:50 | Java | UTF-8 | Java | false | false | 520 | java | package event_listener;
public class EventProducer {
ListenerRegister register = new ListenerRegister();
private int value;
public int getValue() {
return value;
}
public void setValue(int newValue) {
if (value != newValue) {
value = newValue;
ValueChangeEvent event = new ValueChangeEvent(this, value);
register.fireAEvent(event);
}
}
public void addListener(ValueChangeListener a) {
register.addListener(a);
}
}
| [
"sijunx@163.com"
] | sijunx@163.com |
68ab61958a782ec45a668ee86af1ab3a526ae949 | 8bc11f39a716bfe8761a2c54bf8c3ea5504e97b9 | /xdclass-order-service/src/main/java/net/ec_shop/mq/ProductOrderMQListener.java | bc4de347b59b2eb7442878ec01baac0fdbc6c39f | [] | no_license | Extreme-S/ec-shop | cde9134dc14aaad7c5680961d2ac91925dcf0233 | 4e10b7c9d94a51dc05dbfaa5742957fd7e52d292 | refs/heads/main | 2023-07-14T08:51:32.331730 | 2021-07-27T15:55:01 | 2021-07-27T15:55:01 | 378,961,148 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package net.ec_shop.mq;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import net.ec_shop.model.OrderMessage;
import net.ec_shop.service.ProductOrderService;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Slf4j
@Component
@RabbitListener(queues = "${mqconfig.order_close_queue}")
public class ProductOrderMQListener {
@Autowired
private ProductOrderService productOrderService;
/**
* 消费重复消息,幂等性保证
* 并发情况下如何保证安全
*
* @param orderMessage
* @param message
* @param channel
* @throws IOException
*/
@RabbitHandler
public void closeProductOrder(OrderMessage orderMessage, Message message, Channel channel) throws IOException {
log.info("监听到消息:closeProductOrder:{}", orderMessage);
long msgTag = message.getMessageProperties().getDeliveryTag();
try {
boolean flag = productOrderService.closeProductOrder(orderMessage);
if (flag) {
channel.basicAck(msgTag, false);
} else {
channel.basicReject(msgTag, true);
}
} catch (IOException e) {
log.error("定时关单失败:", orderMessage);
channel.basicReject(msgTag, true);
}
}
}
| [
"1716224950@qq.com"
] | 1716224950@qq.com |
d3c18ca6be447ddf6b39b66d18d080abcef9236a | c2d12b2b782ae291437c360ba1a929840c8a7ad7 | /aozora/app/src/main/java/com/summer/asozora/livedoor/base/swipe/Utils.java | a719bd289e508cc7e5a40ef33d5e7b10bcb75ad1 | [] | no_license | xiastars/CoffeeAndroid-Aozora | b040dd8037339d2200d8dd8a844befa90f2eea02 | 2c307d719f131ffb7cdb480e88f0f73ee345c801 | refs/heads/master | 2020-05-29T14:02:50.936828 | 2020-05-09T10:16:52 | 2020-05-09T10:16:52 | 189,181,236 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,879 | java |
package com.summer.asozora.livedoor.base.swipe;
import android.app.Activity;
import android.app.ActivityOptions;
import android.os.Build;
import java.lang.reflect.Method;
/**
*
* Created by Chaojun Wang on 6/9/14.
*/
public class Utils {
private Utils() {
}
/**
* Convert a translucent themed Activity
* {@link android.R.attr#windowIsTranslucent} to a fullscreen opaque
* Activity.
* <p>
* Call this whenever the background of a translucent Activity has changed
* to become opaque. Doing so will allow the {@link android.view.Surface} of
* the Activity behind to be released.
* <p>
* This call has no effect on non-translucent activities or on activities
* with the {@link android.R.attr#windowIsFloating} attribute.
*/
static void convertActivityFromTranslucent(Activity activity) {
try {
Method method = Activity.class.getDeclaredMethod("convertFromTranslucent");
method.setAccessible(true);
method.invoke(activity);
} catch (Throwable t) {
}
}
/**
* Convert a translucent themed Activity
* {@link android.R.attr#windowIsTranslucent} back from opaque to
* translucent following a call to
* {@link #convertActivityFromTranslucent(Activity)} .
* <p>
* Calling this allows the Activity behind this one to be seen again. Once
* all such Activities have been redrawn
* <p>
* This call has no effect on non-translucent activities or on activities
* with the {@link android.R.attr#windowIsFloating} attribute.
*/
public static void convertActivityToTranslucent(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
convertActivityToTranslucentAfterL(activity);
} else {
convertActivityToTranslucentBeforeL(activity);
}
}
/**
* Calling the convertToTranslucent method on platforms before Android 5.0
*/
static void convertActivityToTranslucentBeforeL(Activity activity) {
try {
Class<?>[] classes = Activity.class.getDeclaredClasses();
Class<?> translucentConversionListenerClazz = null;
for (Class clazz : classes) {
if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
translucentConversionListenerClazz = clazz;
}
}
Method method = Activity.class.getDeclaredMethod("convertToTranslucent",
translucentConversionListenerClazz);
method.setAccessible(true);
method.invoke(activity, new Object[] {
null
});
} catch (Throwable t) {
}
}
/**
* Calling the convertToTranslucent method on platforms after Android 5.0
*/
private static void convertActivityToTranslucentAfterL(Activity activity) {
try {
Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
getActivityOptions.setAccessible(true);
Object options = getActivityOptions.invoke(activity);
Class<?>[] classes = Activity.class.getDeclaredClasses();
Class<?> translucentConversionListenerClazz = null;
for (Class clazz : classes) {
if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
translucentConversionListenerClazz = clazz;
}
}
Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
translucentConversionListenerClazz, ActivityOptions.class);
convertToTranslucent.setAccessible(true);
convertToTranslucent.invoke(activity, null, options);
} catch (Throwable t) {
}
}
}
| [
"xiastars@vip.qq.com"
] | xiastars@vip.qq.com |
b4c96a58d26925b877f71e219c02ecdd4188ad4d | a232c5071ad741b6e3bb1c9efbfa4508a8e6a517 | /Lab05_gradle_spring_jpa_rest/gunshop-rest/catalog-web/src/main/java/ro/ubb/catalog/web/dto/RentalDto.java | 7be0b6faf43e03fbcd9d26cfa861521d0dae1c3c | [] | no_license | VaruTudor/Systems-for-Design-and-Implementation | 02ed729113103b1336b35e78ae96fea5edd42443 | 91d57e899ca46aa9be8e83cf36377cbea1eeea4b | refs/heads/master | 2023-08-15T05:18:34.372341 | 2021-10-09T09:01:26 | 2021-10-09T09:01:26 | 375,748,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package ro.ubb.catalog.web.dto;
import lombok.*;
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString(callSuper = true)
public class RentalDto extends BaseDto{
private int price;
private long clientId;
private long gunTypeId;
}
| [
"varutudor@gmail.com"
] | varutudor@gmail.com |
7012ef6ca850c83422856071f481496881f070ce | fe649522fee950e51cd22e5e6fa8e0629906f627 | /GeeksForGeeks/src/main/java/edu/iu/sagar/sorting/ShellSort.java | 7b755bca77d443ab524543e2dbf607af2b8ada0a | [] | no_license | bhandaresagar/Practise-Samples | 701d7a054b863dae6db8b2cbb2badad4ac9626d8 | 8b38c73d6a159935b17c88d197d246116a47232f | refs/heads/master | 2021-01-10T14:08:41.901656 | 2016-02-05T09:51:09 | 2016-02-05T09:51:09 | 51,138,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package edu.iu.sagar.sorting;
public class ShellSort extends SorterBase
{
public void sort(int[] numbers)
{
int increment = numbers.length / 2, total = numbers.length - 1, j;
while (increment > 0)
{
for (int i = increment; i < total; i++)
{
int temp = numbers[i];
for (j = i; j >= increment; j -= increment)
{
if (temp < numbers[j - increment])
{
numbers[j] = numbers[j - increment];
} else
{
break;
}
}
numbers[j] = temp;
}
increment /= 2;
}
}
}
| [
"sagabhan@indiana.edu"
] | sagabhan@indiana.edu |
6f458e01d77f59ba03dd05dbaf50c6715903cf75 | 46e536413ca9d92c924ec84f2cddc5cf33cbcbae | /src/test/java/com/nz/supplieritem/SupplieritemApplicationTests.java | 26edcaa171fc2471b7f7f4cc456f1923ce3cccb1 | [] | no_license | hmchuoxintong/newDemo | 9a21b03f78836fa73cd755f7883128701ddc2ef2 | fb0050754a14888d5d11a82adea28e5767a4305f | refs/heads/master | 2020-06-20T19:35:31.811312 | 2019-07-18T15:54:06 | 2019-07-18T15:54:06 | 197,224,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,941 | java | package com.nz.supplieritem;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SupplieritemApplicationTests {
@Autowired
private WebApplicationContext wac;
private MockMvc mvc;
@Before
public void setup(){
mvc = MockMvcBuilders.webAppContextSetup(wac).build();
}
@Test
public void contextLoads() {
}
@Test
public void whenQuerySuccess(){
try {
String example= "{'userId':1, 'userName':'kqzu'}";
String kqzhu = mvc.perform(get("/user/query")
.param("userId","1")
.param("userName","李雷")
.contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(1)).andReturn().getResponse().getContentAsString();
System.out.println(kqzhu);
} catch (Exception e) {
e.printStackTrace();
}
}
public void test1(){
String example= "{'id':1, 'name':'kqzu'}";
try {
ResultActions kqzhu = mvc.perform(post("/user") // 路径
.contentType(MediaType.APPLICATION_JSON) //用contentType表示具体请求中的媒体类型信息,MediaType.APPLICATION_JSON表示互联网媒体类型的json数据格式(见备注)
.content(example)
.accept(MediaType.APPLICATION_JSON)) //accept指定客户端能够接收的内容类型
.andExpect(content().contentType("application/json;charset=UTF-8")) //验证响应contentType == application/json;charset=UTF-8
.andExpect(jsonPath("$.id").value(1)) //验证id是否为1,jsonPath的使用
.andExpect(jsonPath("$.name").value("kqzhu"));
// 验证name是否等于Zhukeqian
} catch (Exception e) {
e.printStackTrace();
}
String errorExample = "{'id':1, 'name':'kqzhu'}";
try {
MvcResult result = mvc.perform(post("/user")
.contentType(MediaType.APPLICATION_JSON)
.content(errorExample)
.accept(MediaType.APPLICATION_JSON)) //执行请求
.andExpect(status().isBadRequest()) //400错误请求, status().isOk() 正确 status().isNotFound() 验证控制器不存在
.andReturn(); //返回MvcResult
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void whenUploadSuccess(){
try {
String file = mvc.perform(fileUpload("/file")
.file(new MockMultipartFile("file", "test.txt", "multipart/form-data", "hello world upload".getBytes())
)
).andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
System.out.println(file.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"865124492@qq.com"
] | 865124492@qq.com |
ed936fd0d9db971334024d8626793975bea5e69d | bcfe864807d84cdb000f95ecc1601a2487eb4ddf | /src/main/java/com/aspectexample/codder/GoogleCoder.java | 8b5ab7754a25d7ca23bde5f0091d12dfa97f894c | [] | no_license | slavikgav/AspectJ | f7a2044a0b5f599d67cb36066d2e84c0fafebe79 | a4fe8ed4416a1841033401d54aa37a76428fd1c0 | refs/heads/master | 2021-01-24T02:47:41.823097 | 2018-02-25T20:24:44 | 2018-02-25T20:24:44 | 122,862,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package com.aspectexample.codder;
public class GoogleCoder implements Codder {
String currentRepository;
public void createRepository(String repositoryName){
currentRepository = repositoryName;
System.out.println("Creating repository: " + currentRepository);
}
public String getLastRepository(){
System.out.println(currentRepository + " is current repository");
return currentRepository;
}
public void throwRepositoryExist() throws Exception {
System.out.println("throwPlaylistExist() is running");
throw new Exception("Sorry, this repository is already exists");
}
public void createRepositoryAround(String repositoryName){
currentRepository = repositoryName;
System.out.println("Creating repository around: " + currentRepository);
}
} | [
"gavryshko.sl@gmail.com"
] | gavryshko.sl@gmail.com |
fead0c631a02f0def78a935aa1d193d827fcc3ee | 7eddd52ac703370ed05afdca72880d838542e4f6 | /other-service/src/main/java/com/mint/other/filter/CorsFilter.java | b78a56c114bd983a8656d9a293066fb138721e23 | [] | no_license | jonycw/spring-cloud-demo | 5ffabec1bdbd0c6dbe79df4be612e8d02234a8ee | bb6bc57e06d61dc128fd9eefb488e909ca98e715 | refs/heads/main | 2023-03-22T11:38:16.022099 | 2021-03-12T03:35:56 | 2021-03-12T03:35:56 | 323,855,389 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | package com.mint.other.filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author :cw
* @date :Created in 2020/8/14 下午3:37
* @description:
* @modified By:
* @version: $
*/
@Component
public class CorsFilter implements Filter {
private final static Logger logger = LoggerFactory.getLogger(CorsFilter.class);
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest reqs = (HttpServletRequest) req;
response.setHeader("Access-Control-Allow-Origin",reqs.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
chain.doFilter(req, res);
}
public void init(FilterConfig filterConfig) {}
public void destroy() {}
}
| [
"chenwei26@100tal.com"
] | chenwei26@100tal.com |
f38f4059d155104d5801062d9e5cf8d53411984a | 0ee9399c69ce2038ed5a946009355cd26586e0da | /applicationlesson/src/model/SiteEV.java | b13bb25c255ffde5cb6d880ea8b12ef1bb13d76b | [] | no_license | sakuma17/WebTraining | c6a2ed9686f17fe406cbfaa8067a697f99d0a1fc | 7bd057d8eb39aec2aa42d1bb1f284ebb565f9024 | refs/heads/master | 2023-02-22T11:04:29.800254 | 2021-01-23T05:45:57 | 2021-01-23T05:45:57 | 324,029,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | package model;
import java.io.Serializable;
public class SiteEV implements Serializable{
private int like;
private int dislike;
public SiteEV() {
like=0;
dislike=0;
}
public int getLike() {
return like;
}
public void setLike(int like) {
this.like = like;
}
public int getDislike() {
return dislike;
}
public void setDislike(int dislike) {
this.dislike = dislike;
}
}
| [
"ids08663@gmail.com"
] | ids08663@gmail.com |
106d03727642e60faea51d897f2ac40fd2fa263d | bb5eb9a99dd93288c61ed2ef8b38bc718c4fe4e3 | /src/camera/mobile/android/app/src/main/java/com/meowlmobile/MainActivity.java | 0a0e1ca78467219f5548e89d46d1efb970ee0dcc | [] | no_license | meowl-surveillance-system/meowl | cf0b6455cd4f463e26bf8c1153d635b71a51ce03 | 5201f67b3c3dd35283a649e7b47c26a68105f7ee | refs/heads/master | 2023-01-11T17:23:05.291265 | 2020-05-14T01:47:29 | 2020-05-14T01:47:29 | 225,935,106 | 1 | 1 | null | 2023-01-05T19:39:30 | 2019-12-04T18:49:06 | TypeScript | UTF-8 | Java | false | false | 349 | java | package com.meowlmobile;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "MeowlMobile";
}
}
| [
"noreply@github.com"
] | noreply@github.com |
19e13c2ee8a8b392d41f4493735978c35ae89107 | 9e80055f94e5f5a01e5bd2277941893d1ad9f8c5 | /QuickStart/app/src/main/java/com/fernandocs/firebase/quickstart/CircleTransform.java | 4f38666019223c2b8a6b14e3a4221a760260d62f | [
"Apache-2.0"
] | permissive | fernandocs/firebase-quickstart-android | 2cba13b5d4450d7b48380a9278b3150c6aaf0e7c | 0a2c48dea2a1027c16949c0385fae7ecc607f94c | refs/heads/master | 2021-01-19T03:56:41.381770 | 2016-08-10T17:49:40 | 2016-08-10T17:49:40 | 65,388,734 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | package com.fernandocs.firebase.quickstart;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
@Override
public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
int x = (source.getWidth() - size) / 2;
int y = (source.getHeight() - size) / 2;
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
if (squaredBitmap != source) {
source.recycle();
}
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
BitmapShader shader = new BitmapShader(squaredBitmap,
BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
paint.setShader(shader);
paint.setAntiAlias(true);
float r = size / 2f;
canvas.drawCircle(r, r, r, paint);
squaredBitmap.recycle();
return bitmap;
}
@Override
public String key() {
return "circle";
}
}
| [
"fernandocs@ciandt.com"
] | fernandocs@ciandt.com |
764ed3614c1c4f2bc6e7a4c10fd9a1423a9b3473 | 5fa2e8ac23f9a2279c76772672406aa57803a22d | /src/main/java/com/academy/project/demo/dto/request/OrderRequest.java | c226aefa9b254145f5095531410cc2f303df918d | [] | no_license | Bodia1999/main-project-java | 4fbe64ab5b091fc17772a321a0b2b8be4a11c9fa | 523d954a1879f01655147c92dbe7570f7836309c | refs/heads/master | 2022-06-24T07:14:39.442227 | 2019-08-18T12:24:32 | 2019-08-18T12:24:32 | 200,051,119 | 0 | 0 | null | 2022-05-20T21:05:04 | 2019-08-01T12:58:27 | Java | UTF-8 | Java | false | false | 577 | java | package com.academy.project.demo.dto.request;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class OrderRequest {
private Long userId;
private String stripeChargeId;
private String ticketEvolutionId;
private Boolean ifRefunded;
private String amount;
private String typeOfEvents;
private String row;
private String section;
private String occursAt;
private Integer quantity;
private String nameOfEvent;
}
| [
"92782560bodia"
] | 92782560bodia |
0295e35d3f5c902cbfdbc4f876e2e6fbc920ae31 | c3305d6393e6780dbacfd1713833c50db9d5d56c | /prjImobiliaria/src/qi/edu/br/mb/FuncionarioMB.java | 82b31cfe05b263ec4b4f2be5ed9e7fa421a886d1 | [] | no_license | LuisEduardoER/proj-imobiliaria | c706f9b3187cec9d916ecfda1ff1aaa05ff416ae | b301c9005e1af61698211492322f37da90af871f | refs/heads/master | 2021-01-10T16:57:57.052747 | 2013-07-10T21:09:15 | 2013-07-10T21:09:15 | 46,505,505 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 4,699 | java | package qi.edu.br.mb;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
import qi.edu.br.bean.FuncionarioBean;
import qi.edu.br.model.Funcionario;
@ManagedBean
@ViewScoped
public class FuncionarioMB {
@EJB
FuncionarioBean funcionarioBean;
String id;
String nome;
String foto;
String usuario;
String senha;
String ativo;
String msgAviso;
String alterar;
String val;
String status;
public FuncionarioMB() {
FacesContext context = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) context.getExternalContext().getSession(false);
if(session.getAttribute("verificaFunc")!= null){
Funcionario fun;
fun = new Funcionario();
fun = (Funcionario) session.getAttribute("funcionarioAlt");
this.setNome(fun.getNome());
this.setFoto(fun.getFoto());
this.setUsuario(fun.getUsuario());
this.setSenha(fun.getSenha());
this.setId(String.valueOf(fun.getId()));
this.setAlterar("1");
this.setStatus(String.valueOf(fun.getAtivo()));
session.removeAttribute("verificaFunc");
}
//this.setMsgAviso("id ->!"+fun.getNome());
}
public void save() {
Funcionario obj;
try {
validation();
obj = new Funcionario();
obj.setFoto(foto);
obj.setNome(nome);
obj.setSenha(senha);
obj.setUsuario(usuario);
obj.setAtivo(Integer.parseInt(status));
if(alterar != null){
obj.setId(Integer.parseInt(id));
funcionarioBean.update(obj);
FacesContext ctx = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) ctx.getExternalContext().getSession(false);
if(session.getAttribute("tipoUsuario") == "1"){
String url = ctx.getExternalContext().encodeResourceURL("http://localhost:8080/prjImobiliaria/view/menuFunc.jsp?msg=alterar");
ctx.getExternalContext().redirect(url);
}else{
String url = ctx.getExternalContext().encodeResourceURL("http://localhost:8080/prjImobiliaria/view/menuCli.jsp?msg=alterar");
ctx.getExternalContext().redirect(url);
}
}else{
funcionarioBean.save(obj);
FacesContext ctx = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) ctx.getExternalContext().getSession(false);
if(session.getAttribute("tipoUsuario") == "1"){
String url = ctx.getExternalContext().encodeResourceURL("http://localhost:8080/prjImobiliaria/view/menuFunc.jsp?msg=cadastrar");
ctx.getExternalContext().redirect(url);
}else{
String url = ctx.getExternalContext().encodeResourceURL("http://localhost:8080/prjImobiliaria/view/menuCli.jsp?msg=cadastrar");
ctx.getExternalContext().redirect(url);
}
}
} catch (Exception e) {
setMessage("msgErro", e.getMessage());
}
}
private void setMessage(String objMsg, String message){
FacesMessage msg = new FacesMessage(message);
/* Obtém a instancia atual do FacesContext e adiciona a mensagem de erro nele. */
FacesContext.getCurrentInstance().addMessage(objMsg, msg);
}
private void validation() throws Exception {
if (this.getNome() == ""){
throw new Exception("Informe o Nome");
}
if (this.getFoto() == ""){
throw new Exception("Informe o caminho da foto");
}
if (this.getSenha() == ""){
throw new Exception("Informe a Senha");
}
if (this.getUsuario() == ""){
throw new Exception("Informe o Usuário");
}
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getFoto() {
return foto;
}
public void setFoto(String foto) {
this.foto = foto;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public String getAtivo() {
return ativo;
}
public void setAtivo(String ativo) {
this.ativo = ativo;
}
public String getMsgAviso() {
return msgAviso;
}
public void setMsgAviso(String msgAviso) {
this.msgAviso = msgAviso;
}
public String getAlterar() {
return alterar;
}
public void setAlterar(String alterar) {
this.alterar = alterar;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
| [
"sergiobmaciel@6e33543b-9521-6815-75a3-cb29ecc2e0d4"
] | sergiobmaciel@6e33543b-9521-6815-75a3-cb29ecc2e0d4 |
92a5634103a7a3504ab3b9a5e588294c7a7f2904 | 6bcb70513d24cecf9792e6048196ce545c7a91cb | /src/main/java/Demo3.java | 8b1d0f93547f50ea9125ed09f5d3d34b0e3159bf | [] | no_license | syk0604/myworld | 0bc57d21b6625179a0badea442d4dab9af8e4b6d | 1a6bc2eb7d926f3ca8cc6f7c1c8ae9c3d830dc3d | refs/heads/master | 2023-05-14T02:15:06.738462 | 2021-06-05T09:49:43 | 2021-06-05T09:49:43 | 374,073,201 | 0 | 0 | null | 2021-06-05T09:52:59 | 2021-06-05T09:29:27 | Java | UTF-8 | Java | false | false | 453 | java | import org.w3c.dom.ls.LSOutput;
/**
* Administrator
* 2021/5/26
*/
public class Demo3 implements Runnable{
int a = 0;
@Override
public void run() {
for (int i = 0; i < 100; i++) {
a++;
System.out.println(a);
Thread.currentThread().interrupt();
System.out.println(Thread.currentThread().isInterrupted());
System.out.println("interrupt后的值"+a);
}
}
}
| [
"346351676@qq.com"
] | 346351676@qq.com |
19ac99c2ee4d73ea52c7f233638fec4e671897d8 | 1aa8a93cf69e63c4f31f82d3149240c72df5a9e9 | /Dia3/Calculadora.java | beec0b47bb713c739f39d6b9def0611b670e4342 | [] | no_license | gamarzaid/cursojava | 7a6894a947d3b5bcc2f3aa4597666ad64eb5392a | f70d77d216a00ef677aa80617180db5168fdfa40 | refs/heads/master | 2020-04-09T06:57:41.985364 | 2018-12-07T13:54:53 | 2018-12-07T13:54:53 | 160,134,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,119 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Equipo_xx
*/
public class Calculadora extends javax.swing.JFrame {
/**
* Creates new form Calculadora
*/
public Calculadora() {
initComponents();
}
Operaciones op = new Operaciones();
double n1, n2, resultado;
public void leeDatos(){
n1 = Double.parseDouble(this.num1.getText());
n2 = Double.parseDouble(this.num2.getText());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
num1 = new javax.swing.JTextField();
num2 = new javax.swing.JTextField();
result = new javax.swing.JLabel();
suma = new javax.swing.JButton();
resta = new javax.swing.JButton();
multi = new javax.swing.JButton();
div = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
result.setFont(new java.awt.Font("Tw Cen MT", 1, 18)); // NOI18N
suma.setText("+");
suma.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sumaActionPerformed(evt);
}
});
resta.setText("-");
multi.setText("x");
div.setText("/");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(68, 68, 68)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(num1, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)
.addComponent(num2))
.addGap(51, 51, 51)
.addComponent(result, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(77, 77, 77)
.addComponent(suma)
.addGap(18, 18, 18)
.addComponent(resta)
.addGap(18, 18, 18)
.addComponent(multi)
.addGap(18, 18, 18)
.addComponent(div)))
.addContainerGap(53, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(num1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(15, 15, 15)
.addComponent(num2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(result, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(suma)
.addComponent(resta)
.addComponent(multi)
.addComponent(div))
.addContainerGap(37, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void sumaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sumaActionPerformed
// TODO add your handling code here:
leeDatos();
resultado = op.Suma(n1, n2);
this.result.setText(""+resultado);
}//GEN-LAST:event_sumaActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Calculadora.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Calculadora.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Calculadora.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Calculadora.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Calculadora().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton div;
private javax.swing.JPanel jPanel1;
private javax.swing.JButton multi;
private javax.swing.JTextField num1;
private javax.swing.JTextField num2;
private javax.swing.JButton resta;
private javax.swing.JLabel result;
private javax.swing.JButton suma;
// End of variables declaration//GEN-END:variables
}
| [
"noreply@github.com"
] | noreply@github.com |
b4d5cf8a493fed82eac99f3e9f44e3501934fed7 | acc3e8bf8c49c8f577d03d836e725c669194677e | /javase-test/src/main/java/com/figer/techstack/IDependencyParser.java | 503266dc952fc064b37044e879d0aa4d89903e78 | [] | no_license | codefiger/javaTest | 3bc83671d0c26922aef0542ae9e9b162cc4510a9 | 4bcc6990037398ab2cf2fe6666dd31b7387be56d | refs/heads/master | 2020-04-07T06:24:38.211368 | 2017-08-10T13:51:06 | 2017-08-10T13:51:06 | 48,683,105 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package com.figer.techstack;
import java.util.List;
/**
* Created by figer on 03/05/2017.
*/
public interface IDependencyParser {
List<String> getDeclaringDependencies();
}
| [
"figerzpeng@gmail.com"
] | figerzpeng@gmail.com |
3ebbaeaf09a998bf5e22a772e21f86760137042b | e654d119272eabf84d3ac9cdc0d8806b1c1d2e99 | /src/uit/tkorg/cspublicationtool/entities/RankPaperSubdomain.java | 4ab2019ee7973440a4ff64e2faeef104fe87912c | [] | no_license | duc2802/cspublicationtool | 1d4b4cb875a6af188dcb03361fbb45e63cf5eca1 | 474547bd90de4ec27fda0aad8bada22b3bd71f21 | refs/heads/master | 2021-01-15T13:48:21.902074 | 2014-03-26T15:40:21 | 2014-03-26T15:40:21 | 32,434,050 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package uit.tkorg.cspublicationtool.entities;
// Generated Dec 4, 2011 5:00:43 PM by Hibernate Tools 3.2.1.GA
/**
* RankPaperSubdomain generated by hbm2java
*/
public class RankPaperSubdomain implements java.io.Serializable {
private RankPaperSubdomainId id;
private Integer citationCount;
private int rank;
public RankPaperSubdomain() {
}
public RankPaperSubdomain(RankPaperSubdomainId id, int rank) {
this.id = id;
this.rank = rank;
}
public RankPaperSubdomain(RankPaperSubdomainId id, Integer citationCount, int rank) {
this.id = id;
this.citationCount = citationCount;
this.rank = rank;
}
public RankPaperSubdomainId getId() {
return this.id;
}
public void setId(RankPaperSubdomainId id) {
this.id = id;
}
public Integer getCitationCount() {
return this.citationCount;
}
public void setCitationCount(Integer citationCount) {
this.citationCount = citationCount;
}
public int getRank() {
return this.rank;
}
public void setRank(int rank) {
this.rank = rank;
}
}
| [
"tiendo.vn@e7245cfb-2c84-49a3-6c70-a5728351e23f"
] | tiendo.vn@e7245cfb-2c84-49a3-6c70-a5728351e23f |
d7a81d8e386af6c15e6b9e4f2545290d3ce4d06f | 9aea280c73f583238bbcf6cec6b58af98857eb9d | /android/exponentview/src/main/java/versioned/host/exp/exponent/modules/api/ImagePickerModule.java | 5ac1ee6a7b554ba847ba49587b79bc8c191e3cdd | [
"BSD-3-Clause",
"MIT",
"CC-BY-4.0",
"Apache-2.0"
] | permissive | tiensonqin/exponent | 5f721a055e740e648ebf8b857950f42f7c7d1969 | 6a33769323962e383dfbb1e3639361af6fcb3fa0 | refs/heads/master | 2021-01-11T04:16:05.938594 | 2016-12-06T22:42:43 | 2016-12-07T01:02:54 | 71,194,549 | 2 | 2 | null | 2016-10-18T01:01:13 | 2016-10-18T01:01:13 | null | UTF-8 | Java | false | false | 9,898 | java | package versioned.host.exp.exponent.modules.api;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Environment;
import android.provider.MediaStore;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.UUID;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.bridge.WritableMap;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.theartofdev.edmodo.cropper.CropImage;
import host.exp.exponent.ActivityResultListener;
import host.exp.exponentview.Exponent;
public class ImagePickerModule extends ReactContextBaseJavaModule implements ActivityResultListener {
static final int REQUEST_LAUNCH_CAMERA = 1;
static final int REQUEST_LAUNCH_IMAGE_LIBRARY = 2;
private final ReactApplicationContext mReactContext;
private Uri mCameraCaptureURI;
private Promise mPromise;
private Boolean mLaunchedCropper = false;
final String OPTION_QUALITY = "quality";
final String OPTION_ALLOWS_EDITING = "allowsEditing";
final String OPTION_ASPECT = "aspect";
private int quality = 100;
private Boolean allowsEditing = false;
private ReadableArray forceAspect = null;
public ImagePickerModule(ReactApplicationContext reactContext) {
super(reactContext);
mReactContext = reactContext;
Exponent.getInstance().addActivityResultListener(this);
}
@Override
public String getName() {
return "ExponentImagePicker";
}
private boolean readOptions(final ReadableMap options, final Promise promise) {
if (options.hasKey(OPTION_QUALITY)) {
quality = (int) (options.getDouble(OPTION_QUALITY) * 100);
}
if (options.hasKey(OPTION_ALLOWS_EDITING)) {
allowsEditing = options.getBoolean(OPTION_ALLOWS_EDITING);
}
if (options.hasKey(OPTION_ASPECT)) {
forceAspect = options.getArray(OPTION_ASPECT);
if (forceAspect.size() != 2 || forceAspect.getType(0) != ReadableType.Number ||
forceAspect.getType(1) != ReadableType.Number) {
promise.reject(new IllegalArgumentException("'aspect option must be of form [Number, Number]"));
return false;
}
}
return true;
}
// NOTE: Currently not reentrant / doesn't support concurrent requests
@ReactMethod
public void launchCameraAsync(final ReadableMap options, final Promise promise) {
if (!readOptions(options, promise)) {
return;
}
final Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (cameraIntent.resolveActivity(Exponent.getInstance().getApplication().getPackageManager()) == null) {
promise.reject(new IllegalStateException("Error resolving activity"));
return;
}
Exponent.getInstance().getPermissions(new Exponent.PermissionsListener() {
@Override
public void permissionsGranted() {
launchCameraWithPermissionsGranted(promise, cameraIntent);
}
@Override
public void permissionsDenied() {
promise.reject(new SecurityException("User rejected permissions"));
}
}, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA});
}
private void launchCameraWithPermissionsGranted(Promise promise, Intent cameraIntent) {
File imageFile;
try {
imageFile = File.createTempFile("exponent_capture_", ".jpg",
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES));
} catch (IOException e) {
e.printStackTrace();
return;
}
if (imageFile == null) {
promise.reject(new IOException("Could not create temporary image file."));
return;
}
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
mCameraCaptureURI = Uri.fromFile(imageFile);
mPromise = promise;
Exponent.getInstance().getCurrentActivity().startActivityForResult(cameraIntent, REQUEST_LAUNCH_CAMERA);
}
// NOTE: Currently not reentrant / doesn't support concurrent requests
@ReactMethod
public void launchImageLibraryAsync(final ReadableMap options, final Promise promise) {
if (!readOptions(options, promise)) {
return;
}
Exponent.getInstance().getPermissions(new Exponent.PermissionsListener() {
@Override
public void permissionsGranted() {
launchImageLibraryWithPermissionsGranted(promise);
}
@Override
public void permissionsDenied() {
promise.reject(new SecurityException("User rejected permissions."));
}
}, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE});
}
private void launchImageLibraryWithPermissionsGranted(Promise promise) {
Intent libraryIntent = new Intent();
libraryIntent.setType("image/*");
libraryIntent.setAction(Intent.ACTION_GET_CONTENT);
mPromise = promise;
Exponent.getInstance().getCurrentActivity().startActivityForResult(libraryIntent, REQUEST_LAUNCH_IMAGE_LIBRARY);
}
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
if (mLaunchedCropper) {
mLaunchedCropper = false;
final Promise promise = mPromise;
mPromise = null;
if (promise == null) {
return;
}
if (resultCode != Activity.RESULT_OK) {
WritableMap response = Arguments.createMap();
response.putBoolean("cancelled", true);
promise.resolve(response);
return;
}
CropImage.ActivityResult result = CropImage.getActivityResult(intent);
Uri uri = result.getUri();
WritableMap response = Arguments.createMap();
response.putString("uri", uri.toString());
int rot = result.getRotation() % 360;
if (rot < 0) {
rot += 360;
}
if (rot == 0 || rot == 180) { // Rotation is right-angled only
response.putInt("width", result.getCropRect().width());
response.putInt("height", result.getCropRect().height());
} else {
response.putInt("width", result.getCropRect().height());
response.putInt("height", result.getCropRect().width());
}
response.putBoolean("cancelled", false);
promise.resolve(response);
}
return;
}
if (mPromise == null || (mCameraCaptureURI == null && requestCode == REQUEST_LAUNCH_CAMERA)
|| (requestCode != REQUEST_LAUNCH_CAMERA && requestCode != REQUEST_LAUNCH_IMAGE_LIBRARY)) {
return;
}
final Promise promise = mPromise;
mPromise = null;
// User cancel
if (resultCode != Activity.RESULT_OK) {
WritableMap response = Arguments.createMap();
response.putBoolean("cancelled", true);
promise.resolve(response);
return;
}
AsyncTask.execute(new Runnable() {
@Override
public void run() {
Uri uri = requestCode == REQUEST_LAUNCH_CAMERA ? mCameraCaptureURI : intent.getData();
if (allowsEditing) {
mLaunchedCropper = true;
mPromise = promise; // Need promise again later
CropImage.ActivityBuilder cropImage = CropImage.activity(uri);
if (forceAspect != null) {
cropImage.
setAspectRatio(forceAspect.getInt(0), forceAspect.getInt(1)).
setFixAspectRatio(true).
setInitialCropWindowPaddingRatio(0);
}
cropImage.start(Exponent.getInstance().getCurrentActivity());
} else {
String beforeDecode = uri.toString();
String afterDecode = Uri.decode(beforeDecode);
Bitmap bmp = null;
try {
bmp = ImageLoader.getInstance().loadImageSync(afterDecode,
new DisplayImageOptions.Builder()
.considerExifParams(true)
.build());
} catch (Throwable e) {}
if (bmp == null) {
try {
bmp = ImageLoader.getInstance().loadImageSync(beforeDecode,
new DisplayImageOptions.Builder()
.considerExifParams(true)
.build());
} catch (Throwable e) {}
}
if (bmp == null) {
promise.reject(new IllegalStateException("Image decoding failed."));
return;
}
String path = writeImage(bmp);
WritableMap response = Arguments.createMap();
response.putString("uri", Uri.fromFile(new File(path)).toString());
response.putInt("width", bmp.getWidth());
response.putInt("height", bmp.getHeight());
response.putBoolean("cancelled", false);
promise.resolve(response);
}
}
});
}
private String writeImage(Bitmap image) {
FileOutputStream out = null;
String filename = UUID.randomUUID().toString();
String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + filename + ".jpg";
try {
out = new FileOutputStream(path);
image.compress(Bitmap.CompressFormat.JPEG, quality, out);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return path;
}
}
| [
"aurora@exp.host"
] | aurora@exp.host |
f8e5eeb5b4a9d23a70c4579e42b9b36cb83c9150 | ef52b9b5ea8509f9a3b47e059dc73f57fb0740a9 | /src/main/java/com/app/sl/tabbedapplication/AlbumAdapter.java | 7fbe158d34946b84434bf5d94e30322591829992 | [] | no_license | SimosLeei/ClimeTune | 2f5639f93ce1928c5af2d08d0a5c7f7dd2db4795 | 5010418f70b481a88c0b8e2e61379958f08e345b | refs/heads/master | 2021-06-28T09:28:01.747636 | 2021-02-16T20:54:36 | 2021-02-16T20:54:36 | 197,369,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,259 | java | package com.app.sl.tabbedapplication;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.media.Image;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import org.w3c.dom.Text;
import java.util.ArrayList;
public class AlbumAdapter extends BaseAdapter {
private ArrayList<Albums> albumList;
private LayoutInflater albuminf;
Typeface tf ;
public AlbumAdapter(ArrayList<Albums> theAlbums, Context context) {
albumList = theAlbums;
albuminf = LayoutInflater.from(context);
}
@Override
public int getCount() {
return albumList.size();
}
@Override
public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int arg0) {
return 0;
}
static class ViewHolder{
ImageView coverView;
TextView albumTitle;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder albumDisplayHolder;
View AlbumLay = convertView;
Log.d("ViewPos", String.valueOf(position)+convertView);
if(AlbumLay==null) {
AlbumLay = (RelativeLayout) albuminf.inflate
(R.layout.album, parent, false);
albumDisplayHolder = new ViewHolder();
albumDisplayHolder.coverView = (ImageView) AlbumLay.findViewById(R.id.image);
albumDisplayHolder.albumTitle = (TextView) AlbumLay.findViewById(R.id.Album_Name);
AlbumLay.setTag(albumDisplayHolder);
}
else{
albumDisplayHolder = (ViewHolder) AlbumLay.getTag();
}
Albums currAlbum = albumList.get(position);
final String AlbumArt = currAlbum.getAlbumArt();
albumDisplayHolder.albumTitle.setText(currAlbum.getAlbumName());
tf=ResourcesCompat.getFont((albumDisplayHolder.albumTitle).getContext(), R.font.liquidrom);
albumDisplayHolder.albumTitle.setTypeface(tf);
new Thread(new Runnable() {
@Override
public void run() {
Log.d("AlumbArtCreation","albumart Create");
albumDisplayHolder.coverView.post(new Runnable() {
@Override
public void run() {
if(AlbumArt!=null) {
Log.d("AlumbArtCreation","albumart Created");
Bitmap bm = BitmapFactory.decodeFile(AlbumArt);
albumDisplayHolder.coverView.setImageBitmap(bm);
}else {
albumDisplayHolder.coverView.setImageResource(R.drawable.generic);
}
}
});
}
}).start();
return AlbumLay;
}
}
| [
"34507287+SimosLeei@users.noreply.github.com"
] | 34507287+SimosLeei@users.noreply.github.com |
39f0a79acabce647aee38fec9fd79fd0f4589af3 | 2f196a164f55ac1f32b7ef07ed1ba94b41341a3d | /listeners/facebook/facebook-process/src/test/java/io/beancounter/listener/facebook/FacebookRouteTest.java | d5ade9d7b31c46dfad00381a7deb0b019e54095f | [] | no_license | Trink0/NoTube-Beancounter-2.0 | fcea8eefb588cc01ae5730fbf7b3ec020f1582e7 | 9d2c58a47bef5b28768ccfa250984c4515631318 | refs/heads/master | 2021-01-21T00:24:55.788968 | 2012-11-20T19:41:47 | 2012-11-20T19:41:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,199 | java | package io.beancounter.listener.facebook;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.testng.CamelTestSupport;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import io.beancounter.commons.model.activity.Activity;
import io.beancounter.commons.model.randomisers.VerbRandomizer;
import io.beancounter.commons.tests.TestsBuilder;
import io.beancounter.commons.tests.TestsException;
import io.beancounter.listener.commons.ActivityConverter;
import io.beancounter.listener.facebook.core.model.FacebookNotification;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class FacebookRouteTest extends CamelTestSupport {
private Injector injector;
private List<Activity> activities;
private ActivityConverter activityConverter;
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return injector.getInstance(FacebookRoute.class);
}
@BeforeMethod
public void setUp() throws Exception {
injector = Guice.createInjector(new Module() {
@Override
public void configure(Binder binder) {
activityConverter = mock(ActivityConverter.class);
binder.bind(ActivityConverter.class).toInstance(activityConverter);
binder.bind(FacebookRoute.class).toInstance(new FacebookRoute() {
@Override
protected String toKestrelQueue() {
return "mock:result";
}
@Override
protected String fromFacebookEndpoint() {
return "direct:start";
}
@Override
public String errorEndpoint() {
return "mock:error";
}
});
}
});
activities = new ArrayList<Activity>();
activities.add(anActivity());
activities.add(anActivity());
super.setUp();
}
@Test
public void challengeParamReturnedOnSuccessfulVerification() throws Exception {
String challenge = "success";
final HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getParameter("hub.mode")).thenReturn("subscribe");
when(request.getParameter("hub.verify_token")).thenReturn("TEST-BEANCOUNTER-FACEBOOK");
when(request.getParameter("hub.challenge")).thenReturn(challenge);
Exchange exchange = template.request("direct:start", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(Exchange.HTTP_METHOD, "GET");
exchange.getIn().setHeader(Exchange.HTTP_SERVLET_REQUEST, request);
}
});
assertThat(challenge, is(equalTo(exchange.getOut().getBody())));
}
@Test
public void challengeNotReturnedWhenHubParamsAreMissing() throws Exception {
final HttpServletRequest request = mock(HttpServletRequest.class);
Exchange exchange = template.request("direct:start", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(Exchange.HTTP_METHOD, "GET");
exchange.getIn().setHeader(Exchange.HTTP_SERVLET_REQUEST, request);
}
});
assertThat(exchange.getOut().getBody(), is(nullValue()));
}
@Test
public void processFacebookNotification() throws Exception {
when(activityConverter.getActivities(any(FacebookNotification.class))).thenReturn(activities);
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(2);
template.send("direct:start", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST");
exchange.getIn().setBody(facebookRequest());
}
});
result.assertIsSatisfied();
}
@Test
public void handlesNotificationsWithError() throws Exception {
when(activityConverter.getActivities(any(FacebookNotification.class)))
.thenThrow(new RuntimeException("Wrong format"));
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(0);
MockEndpoint error = getMockEndpoint("mock:error");
error.expectedMessageCount(1);
template.send("direct:start", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST");
exchange.getIn().setBody(facebookRequest());
}
});
result.assertIsSatisfied();
error.assertIsSatisfied();
}
private String facebookRequest() {
return "{\"object\":\"user\",\"entry\":[{\"uid\":1335845740,\"changed_fields\":[\"name\",\"picture\"],\"time\":232323},{\"uid\":1234,\"changed_fields\":[\"friends\"],\"time\":232325}]}";
}
private Activity anActivity() {
try {
TestsBuilder testsBuilder = TestsBuilder.getInstance();
testsBuilder.register(new VerbRandomizer("verb-randomizer"));
return testsBuilder.build().build(Activity.class).getObject();
} catch (TestsException e) {
throw new RuntimeException(e);
}
}
} | [
"bibryam@gmail.com"
] | bibryam@gmail.com |
c9523670d0cf1428cee4afc55741ac4e8c52d500 | fd263bde844e9b10a8fd7be0b877bbb408808733 | /test/com/company/jdbc/dao/DeptDaoTest.java | 1205fff4b5c5f6911662e87ba4e50ed5eb98f0d8 | [] | no_license | GitHubXuMing/MSServer | a1f993dc0bbe6929aecb58f000f8b8f19d373a62 | f6312fe51c75f0ba69aef801cbc97201a988b110 | refs/heads/master | 2022-11-13T13:07:06.551852 | 2020-07-06T09:26:21 | 2020-07-06T09:26:21 | 277,565,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,532 | java | package com.company.jdbc.dao;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import com.company.jdbc.dao.idao.IDeptDao;
import com.company.jdbc.dao.impl.DeptDao;
import com.company.jdbc.entity.Dept;
import junit.framework.TestCase;
public class DeptDaoTest {
private IDeptDao deptDao = new DeptDao();
@Test
public void testFindAll() throws Exception {
deptDao.findAll().stream().forEach(System.out::println);
}
@Test
public void testFindByPage() throws Exception {
deptDao.findByPage(2,3).stream().forEach(System.out::println);
}
@Test
public void testFindByName() throws Exception {
deptDao.findByName("a").stream().forEach(System.out::println);
}
@Test
public void testFindById() throws Exception {
System.out.println(deptDao.findById(3));
System.out.println(deptDao.findById(99));
}
@Test
public void testInsert() throws Exception {
Dept dept = new Dept("test-AA","test-aa");
TestCase.assertEquals(1, deptDao.insert(dept));
}
@Test
public void testDelete() throws Exception {
Dept dept = new Dept();
dept.setDeptno(3);
System.out.println(deptDao.delete(dept));
}
@Test
public void testUpdate() throws Exception {
Dept dept = deptDao.findById(1003);
dept.setDname("test_UPDATE");
deptDao.update(dept);
}
@Test
public void testInsertBatch()throws Exception{
List<Dept> depts = new ArrayList<Dept>();
for(int i=50000;i<60000;i++) {
Dept dept = new Dept(i,"dname"+i,"loc"+i);
depts.add(dept);
}
deptDao.insertBatch(depts);
}
}
| [
"1457570681@qq.com"
] | 1457570681@qq.com |
28f9fd90c73bebda03bbe204e1c74d3f5e28f5e0 | b7a7ff0a5c322eae30656676890140bcd2a491dd | /iptvlibrary/src/main/java/com/droidlogic/android/media/tv/companionlibrary/model/InternalProviderData.java | f48109708162c05ee7835e580a22757520ab9540 | [
"Apache-2.0"
] | permissive | yanzhiwei1990/customed-iptv-source | c4e4ca42f3cb3f467c4f4d0574ab6e5f0f7675ec | 0cbce08b241bb978acd699f5619f503f0b08c57a | refs/heads/master | 2020-04-23T19:57:35.750181 | 2019-02-19T07:50:10 | 2019-02-19T07:51:04 | 171,423,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,160 | java | /*
* Copyright 2016 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.droidlogic.android.media.tv.companionlibrary.model;
import android.support.annotation.NonNull;
import com.droidlogic.android.media.tv.companionlibrary.utils.TvContractUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* This is a serialized class used for storing and retrieving serialized data from {@link
* android.media.tv.TvContract.Channels#COLUMN_INTERNAL_PROVIDER_DATA}, {@link
* android.media.tv.TvContract.Programs#COLUMN_INTERNAL_PROVIDER_DATA}, and {@link
* android.media.tv.TvContract.RecordedPrograms#COLUMN_INTERNAL_PROVIDER_DATA}.
*
* <p>In addition to developers being able to add custom attributes to this data type, there are
* pre-defined values.
*/
public class InternalProviderData {
private static final String TAG = "InternalProviderData";
private static final boolean DEBUG = true;
private static final String KEY_VIDEO_TYPE = "type";
private static final String KEY_VIDEO_URL = "url";
private static final String KEY_REPEATABLE = "repeatable";
private static final String KEY_CUSTOM_DATA = "custom";
private static final String KEY_ADVERTISEMENTS = "advertisements";
private static final String KEY_ADVERTISEMENT_START = "start";
private static final String KEY_ADVERTISEMENT_STOP = "stop";
private static final String KEY_ADVERTISEMENT_TYPE = "type";
private static final String KEY_ADVERTISEMENT_REQUEST_URL = "requestUrl";
private static final String KEY_RECORDING_START_TIME = "recordingStartTime";
private JSONObject mJsonObject;
/** Creates a new empty object */
public InternalProviderData() {
mJsonObject = new JSONObject();
}
/**
* Creates a new object and attempts to populate from the provided String
*
* @param data Correctly formatted InternalProviderData
* @throws ParseException If data is not formatted correctly
*/
public InternalProviderData(@NonNull String data) throws ParseException {
try {
mJsonObject = new JSONObject(data);
} catch (JSONException e) {
throw new ParseException(e.getMessage());
}
}
/**
* Creates a new object and attempts to populate by obtaining the String representation of the
* provided byte array
*
* @param bytes Byte array corresponding to a correctly formatted String representation of
* InternalProviderData
* @throws ParseException If data is not formatted correctly
*/
public InternalProviderData(@NonNull byte[] bytes) throws ParseException {
try {
mJsonObject = new JSONObject(new String(bytes));
} catch (JSONException e) {
throw new ParseException(e.getMessage());
}
}
private int jsonHash(JSONObject jsonObject) {
int hashSum = 0;
Iterator<String> keys = jsonObject.keys();
while (keys.hasNext()) {
String key = keys.next();
try {
if (jsonObject.get(key) instanceof JSONObject) {
// This is a branch, get hash of this object recursively
JSONObject branch = jsonObject.getJSONObject(key);
hashSum += jsonHash(branch);
} else {
// If this key does not link to a JSONObject, get hash of leaf
hashSum += key.hashCode() + jsonObject.get(key).hashCode();
}
} catch (JSONException ignored) {
}
}
return hashSum;
}
@Override
public int hashCode() {
// Recursively get the hashcode from all internal JSON keys and values
return jsonHash(mJsonObject);
}
private boolean jsonEquals(JSONObject json1, JSONObject json2) {
Iterator<String> keys = json1.keys();
while (keys.hasNext()) {
String key = keys.next();
try {
if (json1.get(key) instanceof JSONObject) {
// This is a branch, check equality of this object recursively
JSONObject thisBranch = json1.getJSONObject(key);
JSONObject otherBranch = json2.getJSONObject(key);
return jsonEquals(thisBranch, otherBranch);
} else {
// If this key does not link to a JSONObject, check equality of leaf
if (!json1.get(key).equals(json2.get(key))) {
// The VALUE of the KEY does not match
return false;
}
}
} catch (JSONException e) {
return false;
}
}
// Confirm that no key has been missed in the check
return json1.length() == json2.length();
}
/**
* Tests that the value of each key is equal. Order does not matter.
*
* @param obj The object you are comparing to.
* @return Whether the value of each key between both objects is equal.
*/
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof InternalProviderData)) {
return false;
}
JSONObject otherJsonObject = ((InternalProviderData) obj).mJsonObject;
return jsonEquals(mJsonObject, otherJsonObject);
}
@Override
public String toString() {
return mJsonObject.toString();
}
/**
* Gets the video type of the program.
*
* @return The video type of the program, -1 if no value has been given.
*/
public int getVideoType() {
if (mJsonObject.has(KEY_VIDEO_TYPE)) {
try {
return mJsonObject.getInt(KEY_VIDEO_TYPE);
} catch (JSONException ignored) {
}
}
return TvContractUtils.SOURCE_TYPE_INVALID;
}
/**
* Sets the video type of the program.
*
* @param videoType The video source type. Could be {@link TvContractUtils#SOURCE_TYPE_HLS},
* {@link TvContractUtils#SOURCE_TYPE_HTTP_PROGRESSIVE}, or {@link
* TvContractUtils#SOURCE_TYPE_MPEG_DASH}.
*/
public void setVideoType(int videoType) {
try {
mJsonObject.put(KEY_VIDEO_TYPE, videoType);
} catch (JSONException ignored) {
}
}
/**
* Gets the video url of the program if valid.
*
* @return The video url of the program if valid, null if no value has been given.
*/
public String getVideoUrl() {
if (mJsonObject.has(KEY_VIDEO_URL)) {
try {
return mJsonObject.getString(KEY_VIDEO_URL);
} catch (JSONException ignored) {
}
}
return null;
}
/**
* Gets a list of all advertisements. If no ads have been assigned, the list will be empty.
*
* @return A list of all advertisements for this channel or program.
*/
public List<Advertisement> getAds() {
List<Advertisement> ads = new ArrayList<>();
try {
if (mJsonObject.has(KEY_ADVERTISEMENTS)) {
JSONArray adsJsonArray =
new JSONArray(mJsonObject.get(KEY_ADVERTISEMENTS).toString());
for (int i = 0; i < adsJsonArray.length(); i++) {
JSONObject ad = adsJsonArray.getJSONObject(i);
long start = ad.getLong(KEY_ADVERTISEMENT_START);
long stop = ad.getLong(KEY_ADVERTISEMENT_STOP);
int type = ad.getInt(KEY_ADVERTISEMENT_TYPE);
String requestUrl = ad.getString(KEY_ADVERTISEMENT_REQUEST_URL);
ads.add(
new Advertisement.Builder()
.setStartTimeUtcMillis(start)
.setStopTimeUtcMillis(stop)
.setType(type)
.setRequestUrl(requestUrl)
.build());
}
}
} catch (JSONException ignored) {
}
return ads;
}
/**
* Gets recording start time of program for recorded program. For a non-recorded program, this
* value will not be set.
*
* @return Recording start of program in UTC milliseconds, 0 if no value is given.
*/
public long getRecordedProgramStartTime() {
try {
return mJsonObject.getLong(KEY_RECORDING_START_TIME);
} catch (JSONException ignored) {
}
return 0;
}
/**
* Sets the video url of the program.
*
* @param videoUrl A valid url pointing to the video to be played.
*/
public void setVideoUrl(String videoUrl) {
try {
mJsonObject.put(KEY_VIDEO_URL, videoUrl);
} catch (JSONException ignored) {
}
}
/**
* Checks whether the programs on this channel should be repeated periodically in order.
*
* @return Whether to repeat programs. Returns false if no value has been set.
*/
public boolean isRepeatable() {
if (mJsonObject.has(KEY_REPEATABLE)) {
try {
return mJsonObject.getBoolean(KEY_REPEATABLE);
} catch (JSONException ignored) {
}
}
return false;
}
/**
* Sets whether programs assigned to this channel should be repeated periodically. This field is
* relevant to channels.
*
* @param repeatable Whether to repeat programs.
*/
public void setRepeatable(boolean repeatable) {
try {
mJsonObject.put(KEY_REPEATABLE, repeatable);
} catch (JSONException ignored) {
}
}
/**
* Sets a list of advertisements for this channel or program. If setting for a channel, list
* size should be <= 1. Channels cannot have more than one advertisement.
*
* @param ads A list of advertisements that should be shown.
*/
public void setAds(List<Advertisement> ads) {
try {
if (ads != null && !ads.isEmpty()) {
JSONArray adsJsonArray = new JSONArray();
for (Advertisement ad : ads) {
JSONObject adJson = new JSONObject();
adJson.put(KEY_ADVERTISEMENT_START, ad.getStartTimeUtcMillis());
adJson.put(KEY_ADVERTISEMENT_STOP, ad.getStopTimeUtcMillis());
adJson.put(KEY_ADVERTISEMENT_TYPE, ad.getType());
adJson.put(KEY_ADVERTISEMENT_REQUEST_URL, ad.getRequestUrl());
adsJsonArray.put(adJson);
}
mJsonObject.put(KEY_ADVERTISEMENTS, adsJsonArray);
}
} catch (JSONException ignored) {
}
}
/**
* Sets the recording program start time for a recorded program.
*
* @param startTime Recording start time in UTC milliseconds of recorded program.
*/
public void setRecordingStartTime(long startTime) {
try {
mJsonObject.put(KEY_RECORDING_START_TIME, startTime);
} catch (JSONException ignored) {
}
}
/**
* Adds some custom data to the InternalProviderData.
*
* @param key The key for this data
* @param value The value this data should take
* @return This InternalProviderData object to allow for chaining of calls
* @throws ParseException If there is a problem adding custom data
*/
public InternalProviderData put(String key, Object value) throws ParseException {
try {
if (!mJsonObject.has(KEY_CUSTOM_DATA)) {
mJsonObject.put(KEY_CUSTOM_DATA, new JSONObject());
}
mJsonObject.getJSONObject(KEY_CUSTOM_DATA).put(key, String.valueOf(value));
} catch (JSONException e) {
throw new ParseException(e.getMessage());
}
return this;
}
/**
* Gets some previously added custom data stored in InternalProviderData.
*
* @param key The key assigned to this data
* @return The value of this key if it has been defined. Returns null if the key is not found.
* @throws ParseException If there is a problem getting custom data
*/
public Object get(String key) throws ParseException {
if (!mJsonObject.has(KEY_CUSTOM_DATA)) {
return null;
}
try {
return mJsonObject.getJSONObject(KEY_CUSTOM_DATA).opt(key);
} catch (JSONException e) {
throw new ParseException(e.getMessage());
}
}
/**
* Checks whether a custom key is found in InternalProviderData.
*
* @param key The key assigned to this data
* @return Whether this key is found.
* @throws ParseException If there is a problem checking custom data
*/
public boolean has(String key) throws ParseException {
if (!mJsonObject.has(KEY_CUSTOM_DATA)) {
return false;
}
try {
return mJsonObject.getJSONObject(KEY_CUSTOM_DATA).has(key);
} catch (JSONException e) {
throw new ParseException(e.getMessage());
}
}
/**
* This exception is thrown when an error occurs in getting or setting data for the
* InternalProviderData.
*/
public class ParseException extends JSONException {
public ParseException(String s) {
super(s);
}
}
}
| [
"651967795@qq.com"
] | 651967795@qq.com |
0b29781b353f739605220956b4b608e1186d5e5f | 69e336d4c9c58fff7c93395339cc0f840e31601c | /src/main/com/idamobile/vpb/courier/network/core/LoaderCallback.java | 17ddde62216f40b63143ddaab0e4b3bbd3e6ed56 | [] | no_license | idamobile/vpb-courier-app | d8ee1f4cad11a05c4e82b492defcee37c3affb43 | 760b5a271e6de21b4ea140d68f4e1b29f9de151a | refs/heads/master | 2021-01-11T02:08:55.045189 | 2014-02-20T08:07:30 | 2014-02-20T08:07:30 | 8,136,215 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | package com.idamobile.vpb.courier.network.core;
import com.idamobile.vpb.courier.ApplicationMediator;
import java.io.Serializable;
/**
* Callback called by NetworkManager when data ready from network. Used to update model or store data in database.
*
* @author Sergey Royz
* @since 05/23/2012
*/
public interface LoaderCallback<Q> extends Serializable {
void onStartLoading(Request<Q> request, ApplicationMediator mediator);
void onDataReady(Request<Q> request, ResponseDTO<Q> response, ApplicationMediator mediator);
} | [
"shaubert.alexander@gmail.com"
] | shaubert.alexander@gmail.com |
0f58eaa863fc93f6038157ecc07745f7666d6f4c | 31c527850641bd6d048697c8e1cab767c463224d | /java.project/MyPractice/src/assignment/cl/Boy.java | 5ea24f13187cb8cb544febef3c5ed137e7d1b4a4 | [] | no_license | ju9501/iot-kite | 49ed975eb44076ab21348a9b6d4f4a134ad8e4c6 | 809375588bf8a6ff08baa0a85457bdbe3b560e12 | refs/heads/master | 2022-04-09T21:47:04.178222 | 2020-03-23T09:32:25 | 2020-03-23T09:32:25 | 240,656,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,224 | java | package assignment.cl;
public class Boy {
// 어린아이 = 객체
// 변수 = 구슬의 개수
// 메서드 = 데이터의 증감
// 구슬의 개수
int numOfMarble;
// 생성자 : 아이가 가지는 구슬의 개수를 초기화
public Boy(int num) {
numOfMarble = num;
}
// 게임에서 이기면 구슬의 개수를 증가
void win(int num){
numOfMarble += num;
}
// 게임에서 지면 구슬의 개수를 감소
void lose(int num){
numOfMarble -= num;
}
// 게임의 승리
void gameWin(Boy boy, int num) {
win(num);
boy.lose(num);
}
void showData() {
System.out.println("구슬의 개수 : " + numOfMarble);
}
public static void main(String[] args) {
// 어린이1 생성 : 구슬 15개 보유
Boy boy1 = new Boy(15);
// 어린이2 생성 : 구슬 9개 보유
Boy boy2 = new Boy(9);
System.out.println("현재 보유 현황");
System.out.println("어린이1");
boy1.showData();
System.out.println("어린이2");
boy2.showData();
System.out.println("=============================");
// 첫번째 게임 : 어린이1이 승리, 구슬 2개 획득
boy1.gameWin(boy2, 2);
System.out.println("첫번째 게임 : 어린이1이 승리, 구슬 2개 획득 ");
System.out.println("현재 보유 현황");
System.out.println("어린이1");
boy1.showData();
System.out.println("어린이2");
boy2.showData();
System.out.println("=================================");
// 두번째 게임 : 어린이2가 승리, 구슬 7개 획득
boy2.gameWin(boy1, 7);
System.out.println("두번째 게임 : 어린이2가 승리, 구슬 7개 획득 ");
System.out.println("현재 보유 현황");
System.out.println("어린이1");
boy1.showData();
System.out.println("어린이2");
boy2.showData();
System.out.println("=================================");
// // 보유현황 출력
// show(boy1, boy2);
//
// public static show(boy1, 1, boy2, 2);
// System.out.println("현재 보유 현황");
// System.out.println("어린이1");
// boy1.showData();
// System.out.println("어린이2");
// boy2.showData();
// System.out.println("=================================");
//
//
}
}
| [
"luvyou33@naver.com"
] | luvyou33@naver.com |
1b6a97db38239150193e94fbc5e8c9ca8f0c7eeb | 9c465ecc835792bb2ee246f4b6f4c9d89e0b5b07 | /TestSuite/Scanner/Comment/QustComment.pt | 7505dec4f420a97417cebec18d451ca68e86bba8 | [] | no_license | ruffoa/Compilers-PT_Pascal | 668979e5476211bd3a5f44a216c9f1e209e105fd | 87861f68845dbf10fd912dfad8b3fe6a7605a8ed | refs/heads/master | 2023-02-12T11:17:13.130122 | 2020-04-19T21:14:00 | 2020-04-19T21:14:00 | 234,433,624 | 1 | 0 | null | 2021-01-14T02:32:32 | 2020-01-16T23:46:24 | C | UTF-8 | Java | false | false | 26 | pt | // this is a test comment
| [
"noreply@github.com"
] | noreply@github.com |
af9877945f50b4ce81dc60052efb77759a6ff2a1 | dffff7f398562c4e94f0f3d4785b9674ba707f7e | /FreeCol/src/net/sf/freecol/common/debug/DebugUtils.java | edb86a828ef2b0c8d19cfd0da1c12f2227a7daed | [] | no_license | AQiu454/COSC442-Final-Project | c345dc4fbff3f63a21d8c9f598bdca5706129736 | df06483d42d1ea73580d3ff3922f66a9d06aa294 | refs/heads/master | 2020-03-06T18:25:29.440424 | 2018-05-17T01:26:28 | 2018-05-17T01:26:28 | 127,006,624 | 1 | 0 | null | 2018-05-16T20:55:19 | 2018-03-27T15:19:34 | Java | UTF-8 | Java | false | false | 40,976 | java | /**
* Copyright (C) 2002-2015 The FreeCol Team
*
* This file is part of FreeCol.
*
* FreeCol is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* FreeCol is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FreeCol. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.freecol.common.debug;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.event.ChangeEvent;
import net.sf.freecol.client.FreeColClient;
import net.sf.freecol.client.gui.GUI;
import net.sf.freecol.client.gui.ChoiceItem;
import net.sf.freecol.common.i18n.Messages;
import net.sf.freecol.common.io.FreeColXMLWriter.WriteScope;
import net.sf.freecol.common.model.Building;
import net.sf.freecol.common.model.BuildingType;
import net.sf.freecol.common.model.Colony;
import net.sf.freecol.common.model.Disaster;
import net.sf.freecol.common.model.Europe;
import net.sf.freecol.common.model.FoundingFather;
import net.sf.freecol.common.model.Game;
import net.sf.freecol.common.model.GameOptions;
import net.sf.freecol.common.model.Goods;
import net.sf.freecol.common.model.GoodsContainer;
import net.sf.freecol.common.model.GoodsType;
import net.sf.freecol.common.model.IndianSettlement;
import net.sf.freecol.common.model.Location;
import net.sf.freecol.common.model.LostCityRumour.RumourType;
import net.sf.freecol.common.model.Map;
import net.sf.freecol.common.model.Monarch.MonarchAction;
import net.sf.freecol.common.model.Player;
import net.sf.freecol.common.model.Role;
import net.sf.freecol.common.model.Settlement;
import net.sf.freecol.common.model.Specification;
import net.sf.freecol.common.model.StringTemplate;
import net.sf.freecol.common.model.Tension;
import net.sf.freecol.common.model.Tile;
import net.sf.freecol.common.model.Unit;
import net.sf.freecol.common.model.UnitType;
import net.sf.freecol.common.option.BooleanOption;
import net.sf.freecol.common.util.LogBuilder;
import static net.sf.freecol.common.util.CollectionUtils.*;
import net.sf.freecol.common.util.RandomChoice;
import static net.sf.freecol.common.util.StringUtils.*;
import net.sf.freecol.server.FreeColServer;
import net.sf.freecol.server.ai.AIColony;
import net.sf.freecol.server.ai.AIMain;
import net.sf.freecol.server.ai.AIPlayer;
import net.sf.freecol.server.ai.AIUnit;
import net.sf.freecol.server.ai.mission.Mission;
import net.sf.freecol.server.ai.mission.TransportMission;
import net.sf.freecol.server.model.ServerBuilding;
import net.sf.freecol.server.model.ServerColony;
import net.sf.freecol.server.model.ServerPlayer;
import net.sf.freecol.server.model.ServerUnit;
/**
* Utilities for in game debug support.
*
* Several client GUI features have optional debug routines. These routines are
* typically quite special in that they need to intrusive things with the
* server, and do not have much in common with the client code while still
* sometimes needing user interaction. They also have considerable similarity
* amongst themselves. So they have been collected here.
*
* The client GUI features that are the source of these routines are: - The
* colony panel - The debug menu - The tile popup menu
*/
public class DebugUtils {
private static final Logger logger = Logger.getLogger(DebugUtils.class.getName());
/**
* Debug action to add buildings to the user colonies.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param buildingTitle
* A label for the choice dialog.
*/
public static void addBuildings(final FreeColClient freeColClient, String buildingTitle) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game game = freeColClient.getGame();
final GUI gui = freeColClient.getGUI();
final Player player = freeColClient.getMyPlayer();
BuildingType buildingType = gui.getChoice(null, buildingTitle, "cancel",
game.getSpecification().getBuildingTypeList().stream().map(bt -> {
String msg = Messages.getName(bt);
return new ChoiceItem<BuildingType>(msg, bt);
}).sorted().collect(Collectors.toList()));
if (buildingType == null)
return;
final Game sGame = server.getGame();
final BuildingType sBuildingType = server.getSpecification().getBuildingType(buildingType.getId());
final Player sPlayer = sGame.getFreeColGameObject(player.getId(), Player.class);
List<String> results = new ArrayList<>();
int fails = 0;
for (Colony sColony : sPlayer.getColonies()) {
Colony.NoBuildReason reason = sColony.getNoBuildReason(sBuildingType, null);
results.add(sColony.getName() + ": " + reason);
if (reason == Colony.NoBuildReason.NONE) {
if (sBuildingType.isDefenceType()) {
sColony.getTile().cacheUnseen();// +til
}
Building sBuilding = new ServerBuilding(sGame, sColony, sBuildingType);
sColony.addBuilding(sBuilding);// -til
} else {
fails++;
}
}
gui.showInformationMessage(join(", ", results));
if (fails < sPlayer.getNumberOfSettlements()) {
// Brutally resynchronize
freeColClient.getConnectController().reconnect();
}
}
/**
* Debug action to add a founding father.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param fatherTitle
* A label for the choice dialog.
*/
public static void addFathers(final FreeColClient freeColClient, String fatherTitle) {
final FreeColServer server = freeColClient.getFreeColServer();
final GUI gui = freeColClient.getGUI();
final Player player = freeColClient.getMyPlayer();
final Game sGame = server.getGame();
final Specification sSpec = sGame.getSpecification();
final Player sPlayer = sGame.getFreeColGameObject(player.getId(), Player.class);
FoundingFather father = gui.getChoice(null, fatherTitle, "cancel",
sSpec.getFoundingFathers().stream().filter(f -> !sPlayer.hasFather(f)).map(f -> {
String msg = Messages.getName(f);
return new ChoiceItem<FoundingFather>(msg, f);
}).sorted().collect(Collectors.toList()));
if (father != null) {
server.getInGameController().addFoundingFather((ServerPlayer) sPlayer, father);
}
}
/**
* Debug action to add gold.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void addGold(final FreeColClient freeColClient) {
final FreeColServer server = freeColClient.getFreeColServer();
final GUI gui = freeColClient.getGUI();
final Player player = freeColClient.getMyPlayer();
final Game sGame = server.getGame();
final Player sPlayer = sGame.getFreeColGameObject(player.getId(), Player.class);
String response = gui.getInput(null, StringTemplate.template("prompt.selectGold"), Integer.toString(1000), "ok",
"cancel");
if (response == null || response.isEmpty())
return;
int gold;
try {
gold = Integer.parseInt(response);
} catch (NumberFormatException x) {
return;
}
player.modifyGold(gold);
sPlayer.modifyGold(gold);
}
/**
* Debug action to add immigration.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void addImmigration(final FreeColClient freeColClient) {
final FreeColServer server = freeColClient.getFreeColServer();
final GUI gui = freeColClient.getGUI();
final Player player = freeColClient.getMyPlayer();
final Game sGame = server.getGame();
final Player sPlayer = sGame.getFreeColGameObject(player.getId(), Player.class);
String response = gui.getInput(null, StringTemplate.template("prompt.selectImmigration"), Integer.toString(100),
"ok", "cancel");
if (response == null || response.isEmpty())
return;
int crosses;
try {
crosses = Integer.parseInt(response);
} catch (NumberFormatException x) {
return;
}
player.modifyImmigration(crosses);
sPlayer.modifyImmigration(crosses);
}
/**
* Debug action to add liberty to the player colonies.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void addLiberty(final FreeColClient freeColClient) {
final FreeColServer server = freeColClient.getFreeColServer();
final GUI gui = freeColClient.getGUI();
final Player player = freeColClient.getMyPlayer();
final Game sGame = server.getGame();
String response = gui.getInput(null, StringTemplate.template("prompt.selectLiberty"), Integer.toString(100),
"ok", "cancel");
if (response == null || response.isEmpty())
return;
int liberty;
try {
liberty = Integer.parseInt(response);
} catch (NumberFormatException x) {
return;
}
for (Colony c : player.getColonies()) {
c.addLiberty(liberty);
sGame.getFreeColGameObject(c.getId(), Colony.class).addLiberty(liberty);
}
}
/**
* Adds a change listener to a menu (the debug menu in fact), that changes the
* label on a menu item when the skip status changes.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param menu
* The menu to add the change listener to.
* @param item
* The menu item whose label should change.
*/
public static void addSkipChangeListener(final FreeColClient freeColClient, JMenu menu, final JMenuItem item) {
final FreeColServer server = freeColClient.getFreeColServer();
if (server == null)
return;
menu.addChangeListener((ChangeEvent e) -> {
boolean skipping = server.getInGameController().getSkippedTurns() > 0;
item.setText(Messages.message((skipping) ? "menuBar.debug.stopSkippingTurns" : "menuBar.debug.skipTurns"));
});
}
/**
* Debug action to add a new unit to a tile.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param tile
* The <code>Tile</code> to add to.
*/
public static void addNewUnitToTile(final FreeColClient freeColClient, Tile tile) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final Specification sSpec = sGame.getSpecification();
final Player player = freeColClient.getMyPlayer();
final Player sPlayer = sGame.getFreeColGameObject(player.getId(), Player.class);
final Tile sTile = sGame.getFreeColGameObject(tile.getId(), Tile.class);
final GUI gui = freeColClient.getGUI();
UnitType unitChoice = gui.getChoice(null, StringTemplate.template("prompt.selectUnitType"), "cancel",
sSpec.getUnitTypeList().stream().map(ut -> {
String msg = Messages.getName(ut);
return new ChoiceItem<UnitType>(msg, ut);
}).sorted().collect(Collectors.toList()));
if (unitChoice == null)
return;
Unit carrier = null, sCarrier = null;
if (!sTile.isLand() && !unitChoice.isNaval()) {
sCarrier = find(sTile.getUnitList(), u -> u.isNaval() && u.getSpaceLeft() >= unitChoice.getSpaceTaken());
}
Location loc = (sCarrier != null) ? sCarrier : sTile;
ServerUnit sUnit = new ServerUnit(sGame, loc, sPlayer, unitChoice);// -vis(sPlayer)
((ServerPlayer) sPlayer).exploreForUnit(sUnit);
sUnit.setMovesLeft(sUnit.getInitialMovesLeft());
sPlayer.invalidateCanSeeTiles();// +vis(sPlayer)
freeColClient.getConnectController().reconnect();
// Note "game" is no longer valid after reconnect.
Unit unit = freeColClient.getGame().getFreeColGameObject(sUnit.getId(), Unit.class);
if (unit != null) {
gui.setActiveUnit(unit);
gui.refresh();
gui.resetMenuBar();
}
}
/**
* Debug action to add goods to a unit.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param unit
* The <code>Unit</code> to add to.
*/
public static void addUnitGoods(final FreeColClient freeColClient, final Unit unit) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final Specification sSpec = sGame.getSpecification();
final GUI gui = freeColClient.getGUI();
List<ChoiceItem<GoodsType>> gtl = new ArrayList<>();
for (GoodsType t : sSpec.getGoodsTypeList()) {
if (t.isFoodType() && t != sSpec.getPrimaryFoodType())
continue;
String msg = Messages.getName(t);
gtl.add(new ChoiceItem<>(msg, t));
}
Collections.sort(gtl);
GoodsType goodsType = gui.getChoice(null, StringTemplate.template("prompt.selectGoodsType"), "cancel",
sSpec.getGoodsTypeList().stream().filter(gt -> !gt.isFoodType() || gt == sSpec.getPrimaryFoodType())
.map(gt -> {
String msg = Messages.getName(gt);
return new ChoiceItem<GoodsType>(msg, gt);
}).sorted().collect(Collectors.toList()));
if (goodsType == null)
return;
String amount = gui.getInput(null, StringTemplate.template("prompt.selectGoodsAmount"), "20", "ok", "cancel");
if (amount == null)
return;
int a;
try {
a = Integer.parseInt(amount);
} catch (NumberFormatException nfe) {
return;
}
GoodsType sGoodsType = sSpec.getGoodsType(goodsType.getId());
GoodsContainer ugc = unit.getGoodsContainer();
GoodsContainer sgc = sGame.getFreeColGameObject(ugc.getId(), GoodsContainer.class);
ugc.setAmount(goodsType, a);
sgc.setAmount(sGoodsType, a);
}
/**
* Debug action to apply a disaster to a colony.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param colony
* The <code>Colony</code> to apply a disaster to.
*/
public static void applyDisaster(final FreeColClient freeColClient, final Colony colony) {
final GUI gui = freeColClient.getGUI();
List<RandomChoice<Disaster>> disasters = colony.getDisasters();
if (disasters.isEmpty()) {
gui.showErrorMessage(
StringTemplate.template("error.disasterNotAvailable").addName("%colony%", colony.getName()));
return;
}
Disaster disaster = gui.getChoice(null, StringTemplate.template("prompt.selectDisaster"), "cancel",
disasters.stream().map(rc -> {
String label = Messages.getName(rc.getObject()) + " " + Integer.toString(rc.getProbability());
return new ChoiceItem<Disaster>(label, rc.getObject());
}).sorted().collect(Collectors.toList()));
if (disaster == null)
return;
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final ServerColony sColony = sGame.getFreeColGameObject(colony.getId(), ServerColony.class);
final Disaster sDisaster = sGame.getSpecification().getDisaster(disaster.getId());
if (server.getInGameController().debugApplyDisaster(sColony, sDisaster) <= 0) {
gui.showErrorMessage(StringTemplate.template("error.disasterAvoided").addName("%colony%", colony.getName())
.addNamed("%disaster%", disaster));
}
freeColClient.getInGameController().nextModelMessage();
}
/**
* Debug action to change ownership of a colony.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param colony
* The <code>Colony</code> to take ownership of.
*/
public static void changeOwnership(final FreeColClient freeColClient, final Colony colony) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final ServerColony sColony = sGame.getFreeColGameObject(colony.getId(), ServerColony.class);
final GUI gui = freeColClient.getGUI();
final Game game = freeColClient.getGame();
Player player = gui.getChoice(null, StringTemplate.template("prompt.selectOwner"), "cancel",
game.getLiveEuropeanPlayers(colony.getOwner()).stream().map(p -> {
String msg = Messages.message(p.getCountryLabel());
return new ChoiceItem<Player>(msg, p);
}).sorted().collect(Collectors.toList()));
if (player == null)
return;
ServerPlayer sPlayer = sGame.getFreeColGameObject(player.getId(), ServerPlayer.class);
server.getInGameController().debugChangeOwner(sColony, sPlayer);
Player myPlayer = freeColClient.getMyPlayer();
if (gui.getActiveUnit() != null && gui.getActiveUnit().getOwner() != myPlayer) {
freeColClient.getInGameController().nextActiveUnit();
}
gui.refresh();
gui.resetMenuBar();
}
/**
* Debug action to change ownership of a unit.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param unit
* The <code>Unit</code> to take ownership of.
*/
public static void changeOwnership(final FreeColClient freeColClient, final Unit unit) {
final FreeColServer server = freeColClient.getFreeColServer();
final GUI gui = freeColClient.getGUI();
final Game game = unit.getGame();
Player player = gui.getChoice(null, StringTemplate.template("prompt.selectOwner"), "cancel",
game.getLivePlayers(null).stream().filter(p -> unit.getType().isAvailableTo(p)).map(p -> {
String msg = Messages.message(p.getCountryLabel());
return new ChoiceItem<Player>(msg, p);
}).sorted().collect(Collectors.toList()));
if (player == null || unit.getOwner() == player)
return;
final Game sGame = server.getGame();
ServerUnit sUnit = sGame.getFreeColGameObject(unit.getId(), ServerUnit.class);
ServerPlayer sPlayer = sGame.getFreeColGameObject(player.getId(), ServerPlayer.class);
server.getInGameController().debugChangeOwner(sUnit, sPlayer);
Player myPlayer = freeColClient.getMyPlayer();
if (unit.getOwner() == myPlayer) {
gui.setActiveUnit(unit);
} else {
freeColClient.getInGameController().nextActiveUnit();
}
gui.refresh();
gui.resetMenuBar();
}
/**
* Debug action to change the roles of a unit.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param unit
* The <code>Unit</code> to change the role of.
*/
public static void changeRole(final FreeColClient freeColClient, final Unit unit) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final Unit sUnit = sGame.getFreeColGameObject(unit.getId(), Unit.class);
final GUI gui = freeColClient.getGUI();
Role roleChoice = gui.getChoice(null, StringTemplate.template("prompt.selectRole"), "cancel",
sGame.getSpecification().getRoles().stream().map(r -> new ChoiceItem<Role>(r.getId(), r)).sorted()
.collect(Collectors.toList()));
if (roleChoice == null)
return;
sUnit.changeRole(roleChoice, roleChoice.getMaximumCount());
freeColClient.getConnectController().reconnect();
}
/**
* Debug action to check for client-server desynchronization.
*
* Called from the debug menu and client controller. TODO: This is still fairly
* new and messy. Defer i18n for a while.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @return True if desynchronization found.
*/
public static boolean checkDesyncAction(final FreeColClient freeColClient) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game game = freeColClient.getGame();
final Map map = game.getMap();
final Player player = freeColClient.getMyPlayer();
final Game sGame = server.getGame();
final Map sMap = sGame.getMap();
final ServerPlayer sPlayer = sGame.getFreeColGameObject(player.getId(), ServerPlayer.class);
boolean problemDetected = false;
LogBuilder lb = new LogBuilder(256);
lb.add("Desynchronization detected\n");
for (Tile t : sMap.getAllTiles()) {
if (!sPlayer.canSee(t))
continue;
for (Unit u : t.getUnitList()) {
if (!sPlayer.owns(u) && (t.hasSettlement() || u.isOnCarrier()))
continue;
if (game.getFreeColGameObject(u.getId(), Unit.class) == null) {
lb.add("Unit missing on client-side.\n", " Server: ",
u.getDescription(Unit.UnitLabelType.NATIONAL), "(", u.getId(), ") from: ",
u.getLocation().getId(), ".\n");
try {
lb.add(" Client: ", map.getTile(u.getTile().getX(), u.getTile().getY()).getFirstUnit().getId(),
"\n");
} catch (NullPointerException npe) {
}
problemDetected = true;
} else {
Unit cUnit = game.getFreeColGameObject(u.getId(), Unit.class);
if (cUnit.hasTile() && !cUnit.getTile().getId().equals(u.getTile().getId())) {
lb.add("Unit located on different tiles.\n", " Server: ",
u.getDescription(Unit.UnitLabelType.NATIONAL), "(", u.getId(), ") from: ",
u.getLocation().getId(), "\n", " Client: ",
cUnit.getDescription(Unit.UnitLabelType.NATIONAL), "(", cUnit.getId(), ") at: ",
cUnit.getLocation().getId(), "\n");
problemDetected = true;
}
}
}
Tile ct = game.getFreeColGameObject(t.getId(), Tile.class);
Settlement sSettlement = t.getSettlement();
Settlement cSettlement = ct.getSettlement();
if (sSettlement == null) {
if (cSettlement == null) {
;// OK
} else {
lb.add("Settlement still present in client: ", cSettlement);
problemDetected = true;
}
} else {
if (cSettlement == null) {
lb.add("Settlement not present in client: ", sSettlement);
problemDetected = true;
} else if (sSettlement.getId().equals(cSettlement.getId())) {
;// OK
} else {
lb.add("Settlements differ.\n Server: ", sSettlement.toString(), "\n Client: ",
cSettlement.toString(), "\n");
}
}
}
boolean goodsProblemDetected = false;
for (GoodsType sg : sGame.getSpecification().getGoodsTypeList()) {
int sPrice = sPlayer.getMarket().getBidPrice(sg, 1);
GoodsType cg = game.getSpecification().getGoodsType(sg.getId());
int cPrice = player.getMarket().getBidPrice(cg, 1);
if (sPrice != cPrice) {
lb.add("Goods prices for ", sg, " differ.\n");
goodsProblemDetected = true;
}
}
if (goodsProblemDetected) {
lb.add(" Server:\n", sPlayer.getMarket(), "\n", " Client:\n", player.getMarket(), "\n");
problemDetected = true;
}
if (problemDetected) {
lb.shrink("\n");
String err = lb.toString();
freeColClient.getGUI().showInformationMessage(err);
logger.severe(err);
}
return problemDetected;
}
/**
* Debug action to display an AI colony plan.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param colony
* The <code>Colony</code> to summarize.
*/
public static void displayColonyPlan(final FreeColClient freeColClient, final Colony colony) {
final FreeColServer server = freeColClient.getFreeColServer();
final AIMain aiMain = server.getAIMain();
final AIColony aiColony = aiMain.getAIColony(colony);
if (aiColony == null) {
freeColClient.getGUI().showErrorMessage(
StringTemplate.template("error.notAIColony").addName("%colony%", colony.getName()));
} else {
// TODO: Missing i18n
freeColClient.getGUI().showInformationMessage(aiColony.planToString());
}
}
/**
* Debug action to create a string showing the colony value for a given tile and
* player.
*
* Note: passing the freeColClient is redundant for now, but will be needed
* if/when we move getColonyValue into the AI.
*
* @param tile
* The colony <code>Tile</code> to evaluate.
* @return A string describing the colony value of a tile.
*/
public static String getColonyValue(Tile tile) {
Player player = FreeColDebugger.debugDisplayColonyValuePlayer();
if (player == null)
return null;
int value = player.getColonyValue(tile);
if (value < 0) {
return Player.NoValueType.fromValue(value).toString();
}
return Integer.toString(value);
}
/**
* Debug action to display Europe.
*
* Called from the debug popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void displayEurope(final FreeColClient freeColClient) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final AIMain aiMain = server.getAIMain();
LogBuilder lb = new LogBuilder(256);
List<Unit> inEurope = new ArrayList<>();
List<Unit> toEurope = new ArrayList<>();
List<Unit> toAmerica = new ArrayList<>();
HashMap<String, List<Unit>> units = new HashMap<>();
for (Player tp : sGame.getLiveEuropeanPlayers(null)) {
Player p = sGame.getFreeColGameObject(tp.getId(), Player.class);
if (p.getEurope() == null)
continue;
inEurope.clear();
toEurope.clear();
toAmerica.clear();
units.clear();
units.put(Messages.message("sailingToEurope"), toEurope);
units.put(Messages.getName(p.getEurope()), inEurope);
units.put(Messages.message("sailingToAmerica"), toAmerica);
lb.add("\n==", Messages.message(p.getCountryLabel()), "==\n");
for (Unit u : p.getEurope().getUnitList()) {
if (u.getDestination() instanceof Map) {
toAmerica.add(u);
continue;
}
if (u.getDestination() instanceof Europe) {
toEurope.add(u);
continue;
}
inEurope.add(u);
}
for (Entry<String, List<Unit>> entry : units.entrySet()) {
final String label = entry.getKey();
final List<Unit> list = entry.getValue();
if (list.isEmpty())
continue;
lb.add("\n->", label, "\n");
for (Unit u : list) {
lb.add("\n", u.getDescription(Unit.UnitLabelType.NATIONAL));
if (u.isDamaged()) {
lb.add(" (", Messages.message(u.getRepairLabel()), ")");
} else {
lb.add(" ");
AIUnit aiu = aiMain.getAIUnit(u);
if (!aiu.hasMission()) {
lb.add(" (", Messages.message("none"), ")");
} else {
lb.add(aiu.getMission().toString().replaceAll("\n", " \n"));
}
}
}
lb.add("\n");
}
lb.add("\n->", Messages.message("immigrants"), "\n\n");
for (UnitType unitType : p.getEurope().getRecruitables()) {
lb.add(Messages.getName(unitType), "\n");
}
lb.add("\n");
}
freeColClient.getGUI().showInformationMessage(lb.toString());
}
/**
* Debug action to display a mission.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param unit
* The <code>Unit</code> to display.
*/
public static void displayMission(final FreeColClient freeColClient, final Unit unit) {
final FreeColServer server = freeColClient.getFreeColServer();
final AIMain aiMain = server.getAIMain();
final AIUnit aiUnit = aiMain.getAIUnit(unit);
Mission m = aiUnit.getMission();
String msg = (m == null) ? Messages.message("none")
: (m instanceof TransportMission) ? ((TransportMission) m).toFullString() : m.toString();
freeColClient.getGUI().showInformationMessage(msg);
}
/**
* Debug action to dump a players units/iterators to stderr.
*
* Called from the debug menu. TODO: missing i18n
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void displayUnits(final FreeColClient freeColClient) {
final Player player = freeColClient.getMyPlayer();
List<Unit> all = player.getUnits();
LogBuilder lb = new LogBuilder(256);
lb.add("\nActive units:\n");
Unit u, first = player.getNextActiveUnit();
if (first != null) {
lb.add(first.toString(), "\nat ", first.getLocation(), "\n");
all.remove(first);
while (player.hasNextActiveUnit() && (u = player.getNextActiveUnit()) != first) {
lb.add(u, "\nat ", u.getLocation(), "\n");
all.remove(u);
}
}
lb.add("Going-to units:\n");
first = player.getNextGoingToUnit();
if (first != null) {
all.remove(first);
lb.add(first, "\nat ", first.getLocation(), "\n");
while (player.hasNextGoingToUnit() && (u = player.getNextGoingToUnit()) != first) {
lb.add(u, "\nat ", u.getLocation(), "\n");
all.remove(u);
}
}
lb.add("Remaining units:\n");
while (!all.isEmpty()) {
u = all.remove(0);
lb.add(u, "\nat ", u.getLocation(), "\n");
}
freeColClient.getGUI().showInformationMessage(lb.toString());
}
/**
* Debug action to dump a tile to stderr.
*
* Called from tile popup menu. Not concerned with i18n for stderr output.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param tile
* The <code>Tile</code> to dump.
*/
public static void dumpTile(final FreeColClient freeColClient, final Tile tile) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final Player player = freeColClient.getMyPlayer();
System.err.println("\nClient (" + player.getId() + "):");
tile.save(System.err, WriteScope.toClient(player), true);
System.err.println("\n\nServer:");
Tile sTile = sGame.getFreeColGameObject(tile.getId(), Tile.class);
sTile.save(System.err, WriteScope.toServer(), true);
System.err.println("\n\nSave:");
sTile.save(System.err, WriteScope.toSave(), true);
System.err.println("\n");
}
/**
* Debug action to reset the moves left of the units on a tile.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param units
* The <code>Unit</code>s to reactivate.
*/
public static void resetMoves(final FreeColClient freeColClient, List<Unit> units) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final GUI gui = freeColClient.getGUI();
boolean first = true;
for (Unit u : units) {
Unit su = sGame.getFreeColGameObject(u.getId(), Unit.class);
u.setMovesLeft(u.getInitialMovesLeft());
su.setMovesLeft(su.getInitialMovesLeft());
if (first) {
gui.setActiveUnit(u);
first = false;
}
for (Unit u2 : u.getUnitList()) {
Unit su2 = sGame.getFreeColGameObject(u2.getId(), Unit.class);
u2.setMovesLeft(u2.getInitialMovesLeft());
su2.setMovesLeft(su2.getInitialMovesLeft());
}
}
gui.refresh();
gui.resetMenuBar();
}
/**
* Debug action to reveal or hide the map.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param reveal
* If true, reveal the map, else hide the map.
*/
public static void revealMap(final FreeColClient freeColClient, boolean reveal) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game game = freeColClient.getGame();
server.exploreMapForAllPlayers(reveal);
// Removes fog of war when revealing the whole map
// Restores previous setting when hiding it back again
BooleanOption fogOfWarSetting = game.getSpecification().getBooleanOption(GameOptions.FOG_OF_WAR);
if (reveal) {
FreeColDebugger.setNormalGameFogOfWar(fogOfWarSetting.getValue());
fogOfWarSetting.setValue(false);
} else {
fogOfWarSetting.setValue(FreeColDebugger.getNormalGameFogOfWar());
}
}
/**
* Debug action to set the amount of goods in a colony.
*
* Called from the colony panel.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param colony
* The <code>Colony</code> to set goods amounts in.
*/
public static void setColonyGoods(final FreeColClient freeColClient, final Colony colony) {
final Specification spec = colony.getSpecification();
GoodsType goodsType = freeColClient.getGUI().getChoice(null, StringTemplate.template("prompt.selectGoodsType"),
"cancel", spec.getGoodsTypeList().stream()
.filter(gt -> !gt.isFoodType() || gt == spec.getPrimaryFoodType()).map(gt -> {
String msg = Messages.getName(gt);
return new ChoiceItem<GoodsType>(msg, gt);
}).sorted().collect(Collectors.toList()));
if (goodsType == null)
return;
String response = freeColClient.getGUI().getInput(null, StringTemplate.template("prompt.selectGoodsAmount"),
Integer.toString(colony.getGoodsCount(goodsType)), "ok", "cancel");
if (response == null || response.isEmpty())
return;
int a;
try {
a = Integer.parseInt(response);
} catch (NumberFormatException nfe) {
return;
}
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final Specification sSpec = server.getSpecification();
final GoodsType sGoodsType = sSpec.getGoodsType(goodsType.getId());
GoodsContainer cgc = colony.getGoodsContainer();
GoodsContainer sgc = sGame.getFreeColGameObject(cgc.getId(), GoodsContainer.class);
cgc.setAmount(goodsType, a);
sgc.setAmount(sGoodsType, a);
}
/**
* Debug action to set the next monarch action.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param monarchTitle
* A label for the choice dialog.
*/
public static void setMonarchAction(final FreeColClient freeColClient, String monarchTitle) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final Player player = freeColClient.getMyPlayer();
final ServerPlayer sPlayer = sGame.getFreeColGameObject(player.getId(), ServerPlayer.class);
final GUI gui = freeColClient.getGUI();
MonarchAction action = gui.getChoice(null, monarchTitle, "cancel", Arrays.stream(MonarchAction.values())
.map(a -> new ChoiceItem<MonarchAction>(a)).sorted().collect(Collectors.toList()));
if (action == null)
return;
server.getInGameController().setMonarchAction(sPlayer, action);
}
/**
* Debug action to set the lost city rumour type on a tile.
*
* Called from tile popup menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param tile
* The <code>Tile</code> to operate on.
*/
public static void setRumourType(final FreeColClient freeColClient, final Tile tile) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final Tile sTile = sGame.getFreeColGameObject(tile.getId(), Tile.class);
RumourType rumourChoice = freeColClient.getGUI().getChoice(null,
StringTemplate.template("prompt.selectLostCityRumour"), "cancel",
Arrays.stream(RumourType.values()).filter(r -> r != RumourType.NO_SUCH_RUMOUR)
.map(r -> new ChoiceItem<RumourType>(r.toString(), r)).sorted().collect(Collectors.toList()));
if (rumourChoice == null)
return;
tile.getTileItemContainer().getLostCityRumour().setType(rumourChoice);
sTile.getTileItemContainer().getLostCityRumour().setType(rumourChoice);
}
/**
* Debug action to skip turns.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void skipTurns(FreeColClient freeColClient) {
freeColClient.skipTurns(0); // Clear existing skipping
String response = freeColClient.getGUI().getInput(null, StringTemplate.key("prompt.selectTurnsToSkip"),
Integer.toString(10), "ok", "cancel");
if (response == null || response.isEmpty())
return;
int skip;
try {
skip = Integer.parseInt(response);
} catch (NumberFormatException nfe) {
skip = -1;
}
if (skip > 0)
freeColClient.skipTurns(skip);
}
/**
* Debug action to step the random number generator.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void stepRNG(FreeColClient freeColClient) {
final FreeColServer server = freeColClient.getFreeColServer();
final GUI gui = freeColClient.getGUI();
boolean more = true;
while (more) {
int val = server.getInGameController().stepRandom();
more = gui.confirm(null, StringTemplate.template("prompt.stepRNG").addAmount("%value%", val), "more",
"cancel");
}
}
/**
* Debug action to summarize information about a native settlement that is
* normally hidden.
*
* Called from tile popup menu. TODO: missing i18n
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
* @param is
* The <code>IndianSettlement</code> to summarize.
*/
public static void summarizeSettlement(final FreeColClient freeColClient, final IndianSettlement is) {
final FreeColServer server = freeColClient.getFreeColServer();
final Game sGame = server.getGame();
final AIMain aiMain = server.getAIMain();
final Specification sSpec = sGame.getSpecification();
final IndianSettlement sis = sGame.getFreeColGameObject(is.getId(), IndianSettlement.class);
LogBuilder lb = new LogBuilder(256);
lb.add(sis.getName(), "\n\nAlarm\n");
Player mostHated = sis.getMostHated();
for (Player p : sGame.getLiveEuropeanPlayers(null)) {
Tension tension = sis.getAlarm(p);
lb.add(Messages.message(p.getNationLabel()), " ",
((tension == null) ? "(none)" : Integer.toString(tension.getValue())),
((mostHated == p) ? " (most hated)" : ""), " ", Messages.message(sis.getAlarmLevelKey(p)), " ",
sis.getContactLevel(p), "\n");
}
lb.add("\nGoods Present\n");
for (Goods goods : sis.getCompactGoods()) {
lb.add(Messages.message(goods.getLabel(true)), "\n");
}
lb.add("\nGoods Production\n");
for (GoodsType type : sSpec.getGoodsTypeList()) {
int prod = sis.getTotalProductionOf(type);
if (prod > 0) {
lb.add(Messages.getName(type), " ", prod, "\n");
}
}
lb.add("\nPrices (buy 1/100 / sell 1/100)\n");
GoodsType[] wanted = sis.getWantedGoods();
for (GoodsType type : sSpec.getStorableGoodsTypeList()) {
int i;
for (i = wanted.length - 1; i >= 0; i--) {
if (type == wanted[i])
break;
}
lb.add(Messages.getName(type), ": ", sis.getPriceToBuy(type, 1), "/", sis.getPriceToBuy(type, 100), " / ",
sis.getPriceToSell(type, 1), "/", sis.getPriceToSell(type, 100),
((i < 0) ? "" : " wanted[" + Integer.toString(i) + "]"), "\n");
}
lb.add("\nUnits present\n");
for (Unit u : sis.getUnitList()) {
Mission m = aiMain.getAIUnit(u).getMission();
lb.add(u, " at ", u.getLocation());
if (m != null) {
lb.add(" ", m.getClass(), ".");
}
lb.add("\n");
}
lb.add("\nUnits owned\n");
for (Unit u : sis.getOwnedUnits()) {
Mission m = aiMain.getAIUnit(u).getMission();
lb.add(u, " at ", u.getLocation());
if (m != null) {
lb.add(" ", m.getClass(), ".");
}
lb.add("\n");
}
lb.add("\nTiles\n");
for (Tile t : sis.getOwnedTiles())
lb.add(t, "\n");
lb.add("\nConvert Progress = ", sis.getConvertProgress());
lb.add("\nLast Tribute = ", sis.getLastTribute());
freeColClient.getGUI().showInformationMessage(lb.toString());
}
/**
* Debug action to run the AI.
*
* Called from the debug menu.
*
* @param freeColClient
* The <code>FreeColClient</code> for the game.
*/
public static void useAI(final FreeColClient freeColClient) {
final FreeColServer server = freeColClient.getFreeColServer();
final Player player = freeColClient.getMyPlayer();
final AIMain aiMain = server.getAIMain();
final AIPlayer ap = aiMain.getAIPlayer(player);
ap.setDebuggingConnection(freeColClient.askServer().getConnection());
ap.startWorking();
freeColClient.getConnectController().reconnect();
}
}
| [
"kleona3@students.towson.edu"
] | kleona3@students.towson.edu |
305a78b2d97098c7d7f8172bca3742c7757dcfe9 | cfcfee53506f68dec12d9488bf1e013fe7f5606a | /src/test/java/SheetMusicTest.java | 190a362cdab7ef84561871a98fc9d099ed3139d8 | [] | no_license | Metelski123/Java_musicExchange | ac9b3620fd9298422989d30e248111e79e269abb | c311cbca8bded29446a67375f38f07f5a5239a8f | refs/heads/main | 2023-03-31T22:53:16.609907 | 2021-04-04T15:34:33 | 2021-04-04T15:34:33 | 354,579,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | import Miscellaneous.SheetMusic;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class SheetMusicTest {
SheetMusic sheetMusic;
@Before
public void before() {
sheetMusic = new SheetMusic(10, 10.00, 20.00);
}
@Test
public void canGetBuyPrice(){
assertEquals(10, sheetMusic.getBuyPrice(), 0.01);
}
@Test
public void canGetSellPrice(){
assertEquals(20, sheetMusic.getSellPrice(), 0.01);
}
@Test
public void canGetMarkUpAmount(){
assertEquals(10, sheetMusic.calculateMarkup(), 0.01);
}
@Test
public void canGetNumberOfPages(){
assertEquals(10, sheetMusic.getNumberOfPages());
}
} | [
"janekmetelski@hotmail.com"
] | janekmetelski@hotmail.com |
2cce427799c94e1d08078da00c14354101e09446 | 9cb14da9c2cadbc808b39ec88027fdb954582b47 | /Maven/src/main/java/session/JdbcFilmDAO.java | 6b40a5ce0ea96f92335e171d0223b928239ec362 | [] | no_license | dwpsutton/Featurespace | afca9e384e921e6c4d0f17c6c0dae349903b3f1f | 40aabdb9e0daa01f295879cde2fb7b1732d9f3ac | refs/heads/master | 2021-01-20T07:56:14.249165 | 2017-05-01T16:46:53 | 2017-05-01T16:46:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,491 | java | package session;
import entity.Film;
import entity.Genre;
import java.sql.*;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
public class JdbcFilmDAO implements FilmDAO {
private String url = "jdbc:mysql://localhost:3306/filmstore";
private String username = "root";
private String password = "carpond";
@Override
public Long insert(Film film) {
String sql = "insert into Film (title, stock, released, genre, version) values (?,?,?,?,?)";
try (Connection connection = DriverManager.getConnection(url, username, password);
PreparedStatement statement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
statement.setString(1, film.getTitle());
statement.setInt(2, film.getStock());
LocalDate released = film.getReleased();
//setDate takes a java.sql.Date argument
statement.setDate(3, Date.valueOf(released));
statement.setString(4, film.getGenre().toString());
statement.setInt(5, 0);
statement.execute();
ResultSet rs = statement.getGeneratedKeys();
if (rs.next()) {
Long generatedId = rs.getLong(1);
film.setId(generatedId);
return generatedId;
}
throw new FilmException("Primary key was not generated");
} catch (Exception ex) {
throw new FilmException(ex.getMessage());
}
}
@Override
public boolean update(Film film) {
String sql = "update film set title = ?, released = ?, genre = ?, stock = ?, version = version + 1 where id = ? and version = ?";
try (Connection connection = DriverManager.getConnection(url, username, password);
PreparedStatement statement = connection.prepareStatement(sql)) {
connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
statement.setString(1, film.getTitle());
statement.setDate(2, Date.valueOf(film.getReleased()));
statement.setString(3, film.getGenre().toString());
statement.setInt(4, film.getStock());
statement.setLong(5, film.getId());
statement.setInt(6, film.getVersion());
return statement.executeUpdate() == 1;
} catch (Exception ex) {
throw new FilmException(ex.getMessage());
}
}
@Override
public boolean delete(Long filmId) {
String sql = "delete from film where id = ?";
try (Connection connection = DriverManager.getConnection(url, username, password);
PreparedStatement statement = connection.prepareStatement(sql)) {
connection.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);//default
connection.setAutoCommit(false);
statement.setLong(1, filmId);
boolean updated = statement.executeUpdate() == 1;
connection.commit();
return updated;
} catch (Exception ex) {
throw new FilmException(ex.getMessage());
}
}
private Film toFilm(ResultSet rs) throws SQLException {
Film film = new Film();
film.setId(rs.getLong("id"));
film.setStock(rs.getInt("stock"));
//convert a java.sql.Date to a LocalDate
film.setReleased(rs.getDate("released").toLocalDate());
film.setTitle(rs.getString("title"));
film.setGenre(Genre.valueOf(rs.getString("genre")));
return film;
}
@Override
public Collection<Film> selectAll() {
Collection<Film> films = new ArrayList<>();
String sql = "select * from film";
try (Connection connection = DriverManager.getConnection(url, username, password);
PreparedStatement statement = connection.prepareStatement(sql)) {
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
Film film = toFilm(rs);
films.add(film);
}
} catch (Exception ex) {
throw new FilmException(ex.getMessage());
}
return films;
}
@Override
public Collection<Film> selectByTitle(String search) {
Collection<Film> films = new ArrayList<>();
String sql = "select * from film where lcase (title) like ?";
try (Connection connection = DriverManager.getConnection(url, username, password);
PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setString(1, "%" + search.toLowerCase() + "%");
ResultSet rs = statement.executeQuery();
while (rs.next()) {
Film film = toFilm(rs);
films.add(film);
}
} catch (Exception ex) {
throw new FilmException(ex.getMessage());
}
return films;
}
@Override
public Film selectById(Long id) {
String sql = "select * from film where id = ?";
try (Connection connection = DriverManager.getConnection(url, username, password);
PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setLong(1, id);
ResultSet rs = statement.executeQuery();
if (rs.next()) {
return toFilm(rs);
}
} catch (Exception ex) {
throw new FilmException(ex.getMessage());
}
return null;
}
}
| [
"mailbox@javaconsult.co.uk"
] | mailbox@javaconsult.co.uk |
3db996fc6ba63c3b6ce9898887b19c1abd24db67 | dbb5f29cb0094e2d6df61ca019a31c5420dce56e | /app/src/main/java/com/example/oliverabad/countriescatalog/mvp/main/details/CountryDetailsPresenter.java | 73d5c7edbf23ad7eae7374f7369e8e85c13d9604 | [] | no_license | abadoliverco/CountriesCatalog | f69fca350feafd462085ba60997de6a03cbcc782 | 96f3d992cfa703af6f3583b08bd59b92d21acd15 | refs/heads/master | 2020-03-22T12:53:29.312421 | 2018-07-07T10:49:38 | 2018-07-07T10:49:38 | 140,069,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,198 | java | package com.example.oliverabad.countriescatalog.mvp.main.details;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.example.oliverabad.countriescatalog.data.model.CountryModel;
import com.example.oliverabad.countriescatalog.di.component.ApplicationComponent;
import com.example.oliverabad.countriescatalog.mvp.common.base.BasePresenter;
import static com.example.oliverabad.countriescatalog.mvp.main.details.CountryDetailsActivity.BUNDLE_COUNTRY_MODEL;
/**
* Created by oliverabad on 7/7/18.
*/
public class CountryDetailsPresenter extends BasePresenter<CountryDetailsMvpView> {
public CountryDetailsPresenter(Context context) {
super(context);
}
private CountryModel country;
@Override
public void loadData() {
getView().showDetails(country);
}
@Override
public void injectComponent(ApplicationComponent applicationComponent) {
applicationComponent.inject(this);
}
public void setBundle(Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
country = (CountryModel) intent.getParcelableExtra(BUNDLE_COUNTRY_MODEL);
}
}
}
| [
"oliver.abad@viseo.com"
] | oliver.abad@viseo.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.