blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 5
132
| path
stringlengths 2
382
| src_encoding
stringclasses 34
values | length_bytes
int64 9
3.8M
| score
float64 1.5
4.94
| int_score
int64 2
5
| detected_licenses
listlengths 0
142
| license_type
stringclasses 2
values | text
stringlengths 9
3.8M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
96954e9987ceaa5035f3b1210e2e0f64bd7a3a64
|
Java
|
SergiyKlymenko/Spring-MVC-Security-annotations
|
/src/main/java/com/mvc/controller/MainController.java
|
UTF-8
| 1,635
| 2.421875
| 2
|
[] |
no_license
|
package com.mvc.controller;
import java.security.Principal;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class MainController {
@RequestMapping(value = {"/", "/welcome" }, method = RequestMethod.GET)
public String welcomePage(Model model) {
model.addAttribute("title", "Welcome");
model.addAttribute("message", "This is welcome page!");
return "welcomePage";
}
@RequestMapping(value = "/admin", method = RequestMethod.GET)
public String adminPage(Model model) {
return "adminPage";
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage(Model model ) {
return "loginPage";
}
@RequestMapping(value = "/logoutSuccessful", method = RequestMethod.GET)
public String logoutSuccessfulPage(Model model) {
model.addAttribute("title", "Logout");
return "logoutSuccessfulPage";
}
@RequestMapping(value = "/userInfo", method = RequestMethod.GET)
public String userInfo(Model model, Principal principal) {
// After user login successfully.
String userName = principal.getName();
System.out.println("User Name: "+ userName);
model.addAttribute("message", "User name: " + userName);
return "userInfoPage";
}
}
| true
|
dd2974d417d891fcb9581b982f9f4ec0001fac25
|
Java
|
janith-ch/construction-management
|
/Procurement Management System for Construction Industry/application-backend/src/main/java/app/system/application/backend/response/CommonResponse.java
|
UTF-8
| 1,555
| 2.40625
| 2
|
[] |
no_license
|
package app.system.application.backend.response;
public class CommonResponse<T> {
private T dataBundle;
private Boolean isSuccess;
private String errorMessage;
private String successMessage;
public CommonResponse(String errorMessage, T dataBundle) {
this.dataBundle = dataBundle;
this.errorMessage = errorMessage;
}
public CommonResponse(Boolean isSuccess, String errorMessage, T dataBundle) {
this.dataBundle = dataBundle;
this.isSuccess = isSuccess;
this.errorMessage = errorMessage;
}
public CommonResponse(String errorMessage) {
this.errorMessage = errorMessage;
}
public CommonResponse(Boolean isSuccess, String errorMessage) {
this.isSuccess = isSuccess;
this.errorMessage = errorMessage;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public T getDataBundle() {
return dataBundle;
}
public void setDataBundle(T dataBundle) {
this.dataBundle = dataBundle;
}
public Boolean getIsSuccess() {
return isSuccess;
}
public void setIsSuccess(Boolean isSuccess) {
this.isSuccess = isSuccess;
}
public String getSuccessMessage() {
return successMessage;
}
public void setSuccessMessage(String successMessage) {
this.successMessage = successMessage;
}
}
| true
|
231ed29da631ad709af8cac688db5ab0a63a316b
|
Java
|
brunovianarezende/bjsistemas-bjtarefas-app
|
/app/src/main/java/nom/bruno/tasksapp/services/TaskService.java
|
UTF-8
| 1,479
| 1.851563
| 2
|
[] |
no_license
|
package nom.bruno.tasksapp.services;
import android.content.Context;
import android.support.annotation.NonNull;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import nom.bruno.tasksapp.Constants;
import nom.bruno.tasksapp.models.MyVoid;
import nom.bruno.tasksapp.models.Result;
import nom.bruno.tasksapp.models.Task;
import nom.bruno.tasksapp.models.TaskCreation;
import nom.bruno.tasksapp.models.TaskUpdate;
import nom.bruno.tasksapp.models.TasksDelta;
import nom.bruno.tasksapp.services.storage.TasksStorage;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
public interface TaskService {
Observable<List<Task>> getTasks();
Observable<MyVoid> deleteTask(final int id);
Observable<MyVoid> updateTask(final int id, final TaskUpdate taskUpdate);
Observable<Integer> addTask(final TaskCreation taskCreation);
Observable<TasksDelta> getTasksDelta();
List<Task> getPersistedTasks();
}
| true
|
bc7bb4411b5c48f905bf34819a8c938074a1f6e0
|
Java
|
immortalcatz/StuffCraft-Mod
|
/stuffcraft/entity/nautilus/Nautilus.java
|
UTF-8
| 2,424
| 2.4375
| 2
|
[] |
no_license
|
package dr_detonation.stuffcraft.entity.nautilus;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class Nautilus extends ModelBase
{
//fields
ModelRenderer Body;
ModelRenderer ShellBase;
ModelRenderer ShellBack;
ModelRenderer ShellTop;
ModelRenderer ShellFront;
public Nautilus()
{
textureWidth = 64;
textureHeight = 32;
Body = new ModelRenderer(this, 14, 0);
Body.addBox(-1F, -1F, -1F, 2, 2, 2);
Body.setRotationPoint(0F, 23F, 0F);
Body.setTextureSize(64, 32);
Body.mirror = true;
setRotation(Body, 0F, 0F, 0F);
ShellBase = new ModelRenderer(this, 0, 0);
ShellBase.addBox(-1.5F, 0F, -1.5F, 3, 3, 3);
ShellBase.setRotationPoint(0F, 21F, 2F);
ShellBase.setTextureSize(64, 32);
ShellBase.mirror = true;
setRotation(ShellBase, 0F, 0F, 0F);
ShellBack = new ModelRenderer(this, 0, 8);
ShellBack.addBox(-1F, -2.533333F, -1F, 2, 6, 2);
ShellBack.setRotationPoint(0F, 21.4F, 4F);
ShellBack.setTextureSize(64, 32);
ShellBack.mirror = true;
setRotation(ShellBack, 0F, 0F, 0F);
ShellTop = new ModelRenderer(this, 0, 19);
ShellTop.addBox(-1F, -1F, -1.5F, 2, 2, 3);
ShellTop.setRotationPoint(0F, 20F, 2F);
ShellTop.setTextureSize(64, 32);
ShellTop.mirror = true;
setRotation(ShellTop, 0F, 0F, 0F);
ShellFront = new ModelRenderer(this, 24, 0);
ShellFront.addBox(-0.5F, -1F, -0.5F, 1, 2, 1);
ShellFront.setRotationPoint(0F, 20.26667F, 0F);
ShellFront.setTextureSize(64, 32);
ShellFront.mirror = true;
setRotation(ShellFront, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Body.render(f5);
ShellBase.render(f5);
ShellBack.render(f5);
ShellTop.render(f5);
ShellFront.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}
| true
|
c24c5b805beedb0befcd9c4aec5fe24d9a59df60
|
Java
|
skytylon/WansViewPlus
|
/app/src/main/java/net/ajcloud/wansviewplus/entity/CapabilityInfo.java
|
UTF-8
| 6,724
| 2.03125
| 2
|
[] |
no_license
|
package net.ajcloud.wansviewplus.entity;
import android.text.TextUtils;
import net.ajcloud.wansviewplus.support.core.bean.CapabilityBean;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.Unique;
/**
* Created by mamengchao on 2018/07/13.
* Function: ่ฝๅ้
*/
@Entity
public class CapabilityInfo {
@Id(autoincrement = true)
private Long id;
@NotNull
@Unique
private String mode; //ไบงๅ็ฑปๅ
private String vendorCode; //ๅๅไปฃ็
private String fw_version; //ๅบไปถ็ๆฌ
private String streams; //ๆตๆฐ้
private String resolutions; //ๅ่พจ็
private String qualities; //่ง้ข่ดจ้ 1:HD,5:FHD
private String networkConfig; //้
็ฝๆจกๅผ eth, qr..
private int ptz; //ไบๅฐ
private String audioSample; //้ณ้ข้ๆ ท
private int autoTrack; //่ชๅจ่ฟฝ่ธช
private String pirDetect; //็บขๅค็งปๅจ็ๆต
private String voiceDetect; //ๅฃฐ้ณ็ๆง
private int duplexVoice; //ๅฎๆถๅๅ่ฏญ้ณ
private String localStorageTypes; //ๆฌๅฐๅญๅจๆนๅผ
private String battery; //็ตๆฑ ไพ็ต
private String encryptMode; //ๅ ๅฏๆจกๅผ
private int diagnose; //่ฏๆญๆฏๆ
public CapabilityInfo(CapabilityBean bean) {
this.mode = bean.mode;
this.vendorCode = bean.vendorCode;
this.fw_version = bean.fw_version;
this.streams = bean.streams;
this.resolutions = bean.resolutions;
this.qualities = bean.qualities;
this.networkConfig = bean.networkConfig;
this.ptz = bean.ptz;
this.audioSample = bean.audioSample;
this.autoTrack = bean.autoTrack;
this.pirDetect = bean.pirDetect;
this.voiceDetect = bean.voiceDetect;
this.duplexVoice = bean.duplexVoice;
this.localStorageTypes = bean.localStorageTypes;
this.battery = bean.battery;
this.encryptMode = bean.encryptMode;
this.diagnose = bean.diagnose;
}
@Generated(hash = 1927142859)
public CapabilityInfo(Long id, @NotNull String mode, String vendorCode,
String fw_version, String streams, String resolutions, String qualities,
String networkConfig, int ptz, String audioSample, int autoTrack,
String pirDetect, String voiceDetect, int duplexVoice,
String localStorageTypes, String battery, String encryptMode,
int diagnose) {
this.id = id;
this.mode = mode;
this.vendorCode = vendorCode;
this.fw_version = fw_version;
this.streams = streams;
this.resolutions = resolutions;
this.qualities = qualities;
this.networkConfig = networkConfig;
this.ptz = ptz;
this.audioSample = audioSample;
this.autoTrack = autoTrack;
this.pirDetect = pirDetect;
this.voiceDetect = voiceDetect;
this.duplexVoice = duplexVoice;
this.localStorageTypes = localStorageTypes;
this.battery = battery;
this.encryptMode = encryptMode;
this.diagnose = diagnose;
}
@Generated(hash = 621108751)
public CapabilityInfo() {
}
//่ทๅ็ฝ็ป้
็ฝฎ
public String[] getNetworkConfigs() {
if (TextUtils.isEmpty(this.networkConfig)) {
return null;
} else {
return this.networkConfig.split(",");
}
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getMode() {
return this.mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getVendorCode() {
return this.vendorCode;
}
public void setVendorCode(String vendorCode) {
this.vendorCode = vendorCode;
}
public String getFw_version() {
return this.fw_version;
}
public void setFw_version(String fw_version) {
this.fw_version = fw_version;
}
public String getStreams() {
return this.streams;
}
public void setStreams(String streams) {
this.streams = streams;
}
public String getResolutions() {
return this.resolutions;
}
public void setResolutions(String resolutions) {
this.resolutions = resolutions;
}
public String getQualities() {
return this.qualities;
}
public void setQualities(String qualities) {
this.qualities = qualities;
}
public String getNetworkConfig() {
return this.networkConfig;
}
public void setNetworkConfig(String networkConfig) {
this.networkConfig = networkConfig;
}
public int getPtz() {
return this.ptz;
}
public void setPtz(int ptz) {
this.ptz = ptz;
}
public String getAudioSample() {
return this.audioSample;
}
public void setAudioSample(String audioSample) {
this.audioSample = audioSample;
}
public int getAutoTrack() {
return this.autoTrack;
}
public void setAutoTrack(int autoTrack) {
this.autoTrack = autoTrack;
}
public String getPirDetect() {
return this.pirDetect;
}
public void setPirDetect(String pirDetect) {
this.pirDetect = pirDetect;
}
public String getVoiceDetect() {
return this.voiceDetect;
}
public void setVoiceDetect(String voiceDetect) {
this.voiceDetect = voiceDetect;
}
public int getDuplexVoice() {
return this.duplexVoice;
}
public void setDuplexVoice(int duplexVoice) {
this.duplexVoice = duplexVoice;
}
public String getLocalStorageTypes() {
return this.localStorageTypes;
}
public void setLocalStorageTypes(String localStorageTypes) {
this.localStorageTypes = localStorageTypes;
}
public String getBattery() {
return this.battery;
}
public void setBattery(String battery) {
this.battery = battery;
}
public String getEncryptMode() {
return this.encryptMode;
}
public void setEncryptMode(String encryptMode) {
this.encryptMode = encryptMode;
}
public int getDiagnose() {
return this.diagnose;
}
public void setDiagnose(int diagnose) {
this.diagnose = diagnose;
}
}
| true
|
5c4c228d13af8bd9b58870833bbed063fb55dc02
|
Java
|
hyekyung-kim/android-project-01
|
/app/src/main/java/ddwucom/mobile/ma02_20170931/SearchMain.java
|
UTF-8
| 9,591
| 2.171875
| 2
|
[] |
no_license
|
package ddwucom.mobile.ma02_20170931;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import javax.net.ssl.HttpsURLConnection;
public class SearchMain extends AppCompatActivity {
final int SEARCH_INFO_CODE = 100;
public static final String TAG = "SearchMain";
EditText etTarget;
ListView lvList;
String apiAddress;
String query;
SearchAdapter adapter;
ArrayList<NaverBookDTO> resultList;
BookXmlParser parser;
ImageFileManager imgManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
etTarget = findViewById(R.id.etTarget);
lvList = findViewById(R.id.lvList);
resultList = new ArrayList();
adapter = new SearchAdapter(this, R.layout.list_search, resultList);
lvList.setAdapter(adapter);
apiAddress = getResources().getString(R.string.naverBook_api_url);
parser = new BookXmlParser();
imgManager = new ImageFileManager(this);
//lvList.setOnItemLongClickListener(saveImageLongClickListener);
/*
* ๋ฆฌ์คํธ ๋ทฐ ํด๋ฆญ์ ์ฑ
์ ๋ํ ์์ธ ์ ๋ณด ์ ๊ณต
* ์ฝ๊ธฐ/์์ ์ถ๊ฐ ๋ฒํผ
* */
lvList.setOnItemClickListener(showInfoClickListener);
}
AdapterView.OnItemClickListener showInfoClickListener =
new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
/* ๋ฆฌ์คํธ๋ทฐ์ ๋ณด์ฌ์ง๊ณ ํด๋ฆญ๋ ์ด๋ฏธ์ง๋ ๋ด๋ถ์ ์ฅ์์ ์์ ๊ฒ์ */
NaverBookDTO dto = resultList.get(position);
String imgUrl = dto.getImageLink();
String imgName = imgManager.getFileNameFromUrl(imgUrl);
// TODO: ๋ฐ์์จ ์ด๋ฏธ์ง ์ฐพ์์ intent๋ก ๋๊ธฐ๊ธฐ
ImageView imgView = (ImageView)view.findViewById(R.id.ivImage);
Bitmap bitmap = ((BitmapDrawable)imgView.getDrawable()).getBitmap();
Intent intent = new Intent(SearchMain.this, SearchInfoActivity.class);
intent.putExtra("NaverBookDTO", resultList.get(position));
intent.putExtra("url", imgUrl);
intent.putExtra("imgName", imgName);
intent.putExtra("img", bitmap);
startActivityForResult(intent, SEARCH_INFO_CODE);
}
};
/* TODO: ์ด๋ฏธ์ง ์ ์ฅ ๋ง๊ณ ๋ค๋ฅธ ๊ธฐ๋ฅ์ผ๋ก ๋ฐ๊พธ๊ธฐ*/
AdapterView.OnItemLongClickListener saveImageLongClickListener =
new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
/* ์์ฑํ ๋ถ๋ถ */
/*๋กฑํด๋ฆญํ ํญ๋ชฉ์ ์ด๋ฏธ์ง ์ฃผ์๋ฅผ ๊ฐ์ ธ์ ๋ด๋ถ ๋ฉ๋ชจ๋ฆฌ์ ์ง์ ํ ์ด๋ฏธ์ง ํ์ผ์ ์ธ๋ถ์ ์ฅ์๋ก ์ด๋
* ImageFileManager ์ ์ด๋ ๊ธฐ๋ฅ ์ฌ์ฉ
* ์ด๋์ ์ฑ๊ณตํ ๊ฒฝ์ฐ ํ์ผ ๋ช
, ์คํจํ์ ๊ฒฝ์ฐ null ์ ๋ฐํํ๋ฏ๋ก ํด๋น ๊ฐ์ ๋ฐ๋ผ Toast ์ถ๋ ฅ*/
NaverBookDTO dto = resultList.get(position);
if (dto.getImageFileName() != null) { // ์ธ๋ถ์ ์ฅ์์ ์ ์ฅํ ํ์ผ๋ช
์ด ๊ธฐ๋ก๋์ด ์์ ๊ฒฝ์ฐ
Toast.makeText(SearchMain.this, "Already moved!", Toast.LENGTH_SHORT).show();
} else {
String savedName = imgManager.moveStorage(dto.getImageLink());
Log.i(TAG, "Saved file name: " + savedName);
if (savedName != null) {
dto.setImageFileName(savedName); // ์ธ๋ถ์ ์ฅ์์ ์ ์ฅํ ํ์ผ๋ช
์ dto ์ ์ ์ฅ
Toast.makeText(SearchMain.this, savedName + " is saved to Ext.", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(SearchMain.this, "Save failure!", Toast.LENGTH_SHORT).show();
}
}
return true;
}
};
@Override
protected void onDestroy() {
super.onDestroy();
imgManager.clearSaveFilesOnInternal();
}
public void onClick(View v) {
switch(v.getId()) {
case R.id.btnLibSearch:
query = etTarget.getText().toString();
try {
new NaverAsyncTask().execute(apiAddress + URLEncoder.encode(query, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
}
class NaverAsyncTask extends AsyncTask<String, Integer, String> {
ProgressDialog progressDlg;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDlg = ProgressDialog.show(SearchMain.this, "Wait", "Downloading...");
}
@Override
protected String doInBackground(String... strings) {
String address = strings[0];
String result = downloadContents(address);
if (result == null) return "Error!";
return result;
}
@Override
protected void onPostExecute(String result) {
Log.i(TAG, result);
resultList = parser.parse(result); // ํ์ฑ ์ํ
adapter.setList(resultList); // Adapter ์ ํ์ฑ ๊ฒฐ๊ณผ๋ฅผ ๋ด๊ณ ์๋ ArrayList ๋ฅผ ์ค์
adapter.notifyDataSetChanged();
progressDlg.dismiss();
}
/* ๋คํธ์ํฌ ๊ด๋ จ ๋ฉ์๋ */
/* ๋คํธ์ํฌ ํ๊ฒฝ ์กฐ์ฌ */
private boolean isOnline() {
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
return (networkInfo != null && networkInfo.isConnected());
}
/* URLConnection ์ ์ ๋ฌ๋ฐ์ ์ฐ๊ฒฐ์ ๋ณด ์ค์ ํ ์ฐ๊ฒฐ, ์ฐ๊ฒฐ ํ ์์ ํ InputStream ๋ฐํ
* ๋ค์ด๋ฒ์ฉ์ ์์ - ClientID, ClientSeceret ์ถ๊ฐ strings.xml ์์ ์ฝ์ด์ด*/
private InputStream getNetworkConnection(HttpURLConnection conn) throws Exception {
// ํด๋ผ์ด์ธํธ ์์ด๋ ๋ฐ ์ํฌ๋ฆฟ ๊ทธ๋ฆฌ๊ณ ์์ฒญ URL ์ ์ธ
conn.setReadTimeout(3000);
conn.setConnectTimeout(3000);
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.setRequestProperty("X-Naver-Client-Id", getResources().getString(R.string.naverBook_id));
conn.setRequestProperty("X-Naver-Client-Secret", getResources().getString(R.string.naverBook_secret));
if (conn.getResponseCode() != HttpsURLConnection.HTTP_OK) {
throw new IOException("HTTP error code: " + conn.getResponseCode());
}
return conn.getInputStream();
}
/* InputStream์ ์ ๋ฌ๋ฐ์ ๋ฌธ์์ด๋ก ๋ณํ ํ ๋ฐํ */
protected String readStreamToString(InputStream stream){
StringBuilder result = new StringBuilder();
try {
InputStreamReader inputStreamReader = new InputStreamReader(stream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String readLine = bufferedReader.readLine();
while (readLine != null) {
result.append(readLine + "\n");
readLine = bufferedReader.readLine();
}
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
return result.toString();
}
/* ์ฃผ์(address)์ ์ ์ํ์ฌ ๋ฌธ์์ด ๋ฐ์ดํฐ๋ฅผ ์์ ํ ํ ๋ฐํ */
protected String downloadContents(String address) {
HttpURLConnection conn = null;
InputStream stream = null;
String result = null;
try {
URL url = new URL(address);
conn = (HttpURLConnection)url.openConnection();
stream = getNetworkConnection(conn);
result = readStreamToString(stream);
if (stream != null) stream.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (conn != null) conn.disconnect();
}
return result;
}
}
}
| true
|
a4473123250494747b345cc6ae60a5e089272b8c
|
Java
|
josemontenegro/ToBuyP2.2
|
/app/src/main/java/com/example/admin/tobuy/data/Queries.java
|
UTF-8
| 445
| 2.28125
| 2
|
[] |
no_license
|
package com.example.admin.tobuy.data;
import com.example.admin.tobuy.models.ToBuy;
import java.util.ArrayList;
import java.util.List;
public class Queries {
public List<ToBuy> toBuys(){
List<ToBuy> toBuys = new ArrayList<>();
List<ToBuy> toBuyList = ToBuy.find(ToBuy.class,"done = 0");
if (toBuyList != null && toBuyList.size() > 0){
toBuys.addAll(toBuyList);
}
return toBuys;
}
}
| true
|
5870fc52d4458176a5b1df9ea80a506034264fa1
|
Java
|
Vikram-Bollam/Intern-Vikram
|
/OnlineAppointmentBooking/src/full/aw/Servlets/SupportUpdateAppointment.java
|
UTF-8
| 678
| 2.109375
| 2
|
[] |
no_license
|
package full.aw.Servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import full.aw.service.ScheduleBook;
@SuppressWarnings("serial")
public class SupportUpdateAppointment extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ScheduleBook sb=new ScheduleBook();
String userid = (String) req.getSession(false).getAttribute("userSession");
sb.deleteSchedule(userid, req.getParameter("custKey"));
}//method close
}//class close
| true
|
9f6953356d5a1742620ebe3b9f29bc5b26aec68b
|
Java
|
GEMINI1999/AddressBook-Management
|
/src/cn/design/SearchTool.java
|
UTF-8
| 1,725
| 2.765625
| 3
|
[
"Apache-2.0"
] |
permissive
|
package cn.design;
import javax.swing.*;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class SearchTool {
public static boolean hasData(String strData) {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
AddressBook addressBook = new AddressBook();
boolean sign = false;
try {
conn = JDBCUtils.getConnection();
stmt = conn.createStatement();
if (!CharTool.isNumeric(strData)) {
String sql = "select * from address_book where name = '" + strData + "'";
rs = stmt.executeQuery(sql);
while (rs.next()) {
String str = rs.getString("name");
if (str == null) {
break;
} else {
sign = true;
break;
}
}
} else {
String sql = "select * from address_book where phone_number = '" + strData + "'";
rs = stmt.executeQuery(sql);
while (rs.next()) {
String str = rs.getString("name");
if (str == null) {
break;
} else {
sign = true;
break;
}
}
}
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} finally {
JDBCUtils.release(rs, stmt, conn);
return sign;
}
}
}
| true
|
f5d31472fc523981c2c24118134df9d5bb51a504
|
Java
|
divukman/algorithms
|
/AlgorithmsTesting/src/main/java/com/dimitar/algorithms/hackerrank/ExtraLongFactorials.java
|
UTF-8
| 608
| 3.484375
| 3
|
[] |
no_license
|
package com.dimitar.algorithms.hackerrank;
import java.math.BigInteger;
/**
* https://www.hackerrank.com/challenges/extra-long-factorials/problem
*/
public class ExtraLongFactorials {
public static BigInteger factorial(int n) {
if (n == 1) return BigInteger.valueOf(n);
else {
return factorial(n-1).multiply(BigInteger.valueOf(n));
}
}
static void extraLongFactorials(int n) {
final BigInteger result = factorial(n);
System.out.println(result);
}
public static void main(String[] args) {
extraLongFactorials(30);
}
}
| true
|
41cc4a8a13ac8f213c02025b3e9f6add9595288e
|
Java
|
Rizwan-Hasan/GPA-Calculator-Java
|
/src/app/calculator.java
|
UTF-8
| 1,288
| 3
| 3
|
[
"MIT"
] |
permissive
|
package app;
import java.text.DecimalFormat;
import java.util.Map;
class calculator
{
private double CGPA;
private double totalCredit;
private String[] theoryGrades;
private String[] labGrades;
private Map<String, Object> gradeSheet = new gradeList().load();
calculator(String x, String y, boolean xCheck, boolean yCheck)
{
this.theoryGrades = x.toUpperCase().split("\\s*,\\s*");
this.labGrades = y.toUpperCase().split("\\s*,\\s*");
if(xCheck) {
this.totalCredit +=
this.theoryGrades.length * (double) this.gradeSheet.get("Sub");
for (String grade : this.theoryGrades)
this.CGPA +=
(double) this.gradeSheet.get(grade) * (double) this.gradeSheet.get("Sub");
}
if(yCheck) {
this.totalCredit +=
this.labGrades.length * (double) this.gradeSheet.get("Lab");
for (String grade : this.labGrades)
this.CGPA +=
(double) this.gradeSheet.get(grade) * (double) this.gradeSheet.get("Lab");
}
this.CGPA /= this.totalCredit;
}
double getCGPA() {
return Double.parseDouble(new DecimalFormat("#.##").format(this.CGPA));
}
}
| true
|
1aa7cc2dde551abd9152cfc013e7ff815d349256
|
Java
|
ldodds/slug
|
/src/java/com/ldodds/slug/http/URLRetrievalWorker.java
|
UTF-8
| 5,066
| 2.328125
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.ldodds.slug.http;
import java.util.logging.*;
import java.io.*;
import java.net.*;
import com.hp.hpl.jena.rdf.model.*;
import com.ldodds.slug.framework.*;
import com.ldodds.slug.framework.config.Memory;
import com.ldodds.slug.http.throttle.Throttle;
import com.ldodds.slug.vocabulary.SCUTTERVOCAB;
/**
* @author ldodds
*/
public class URLRetrievalWorker extends ProducerWorkerImpl
{
//used to get etags, lastModified, add skips and Reasons
private Memory _memory;
private Throttle throttle;
public URLRetrievalWorker(Memory memory, String name)
{
super(name);
_memory = memory;
}
/**
* @see com.ldodds.slug.framework.ProducerWorkerImpl#doTask(java.lang.Object)
*/
protected Result doTask(Task workItem) {
URLTask urlTask = (URLTask)workItem;
pause(urlTask);
Response response = null;
Resource fetch = null;
try {
Resource rep = _memory.getOrCreateRepresentation( urlTask.getURL() );
if (rep != null && rep.hasProperty(SCUTTERVOCAB.skip)) {
_logger.finer("SKIP " + workItem.getId());
return ResultImpl.noop();
}
fetch = _memory.makeFetch(rep);
HttpURLConnection connection = urlTask.openConnection();
configureConnection(urlTask, rep, connection);
try
{
_logger.finest("Connecting to " + workItem.getId() );
connecting(urlTask);
connection.connect();
connected(urlTask);
_memory.annotateFetch(fetch, connection.getResponseCode(), connection.getHeaderFields());
} catch (UnknownHostException uhe)
{
_memory.makeReasonAndSkip(rep, "UnknownHostException: " + uhe.getMessage());
return ResultImpl.failure("Unknown host");
} catch (IOException ie)
{
_memory.makeReasonAndError(fetch, ie);
return ResultImpl.failure(ie.getMessage());
}
if (connection.getResponseCode()== HttpURLConnection.HTTP_NOT_FOUND)
{
_memory.makeReasonAndSkip(rep, "404, Not Found");
return ResultImpl.failure("404");
}
if (connection.getResponseCode()== HttpURLConnection.HTTP_FORBIDDEN)
{
_memory.makeReasonAndSkip(rep, "403, Not Authorized");
return ResultImpl.failure("403");
}
if (connection.getResponseCode()== HttpURLConnection.HTTP_GONE)
{
_memory.makeReasonAndSkip(rep, "410, Gone");
return ResultImpl.failure("410");
}
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED)
{
return ResultImpl.noop();
}
//success, and not no-op
response = new Response(
urlTask.getURL(),
connection.getHeaderFields(),
readContent(connection) );
} catch (Exception e)
{
String msg = e.getMessage();
if (msg != null && msg.startsWith("Server returned HTTP response code: ") ) {
msg = msg.substring(36, 39);
}
else {
_logger.log(Level.SEVERE, "Unexpected exception processing " + workItem.getId(), e);
}
_memory.makeReasonAndError(fetch, e);
return ResultImpl.failure(msg);
}
return response;
}
private StringBuffer readContent(HttpURLConnection connection)
throws IOException
{
BufferedReader in = new BufferedReader(
new InputStreamReader(connection.getInputStream()), 1024);
StringBuffer content = new StringBuffer();
String line = in.readLine();
while (line != null)
{
content.append(line + "\n");
line = in.readLine();
}
return content;
}
/**
* @param rep
* @param connection
*/
private void configureConnection(URLTask task, Resource rep, HttpURLConnection connection)
{
connection.setInstanceFollowRedirects(true);
//set timeouts
connection.setReadTimeout(30000);
connection.setConnectTimeout(30000);
boolean conditionalGet = false;
if (rep != null && rep.hasProperty(SCUTTERVOCAB.latestFetch))
{
Resource latestFetch = rep.getProperty(SCUTTERVOCAB.latestFetch).getResource();
if (latestFetch.hasProperty(SCUTTERVOCAB.etag))
{
connection.addRequestProperty("If-None-Match",
latestFetch.getProperty(SCUTTERVOCAB.etag).getObject().toString() );
conditionalGet = true;
}
if (latestFetch.hasProperty(SCUTTERVOCAB.lastModified))
{
connection.addRequestProperty("If-Modified-Since",
latestFetch.getProperty(SCUTTERVOCAB.lastModified).getObject().toString() );
conditionalGet = true;
}
}
if (conditionalGet) {
_logger.finest("Performing conditional GET for " + task.getId() );
}
connection.addRequestProperty("Accept", "application/rdf+xml");
}
private void pause(URLTask task) {
if ( throttle != null )
throttle.pause(task);
}
private void connecting(URLTask task) {
if ( throttle != null )
throttle.connecting(task);
}
private void connected(URLTask task) {
if ( throttle != null )
throttle.connected(task);
}
public void setThrottle(Throttle throttle) {
this.throttle = throttle;
}
}
| true
|
549c19dc3744ae7be9c278cc4454cb1f76783d72
|
Java
|
tomjbarry/penstro-public
|
/src/main/java/com/py/py/dto/in/ChangeAppreciationResponseDTO.java
|
UTF-8
| 780
| 2.03125
| 2
|
[
"MIT"
] |
permissive
|
package com.py.py.dto.in;
import com.py.py.dto.DTO;
public class ChangeAppreciationResponseDTO extends DTO {
/**
*
*/
private static final long serialVersionUID = -8608835628416126371L;
private String appreciationResponse;
private boolean appreciationResponseWarning;
public ChangeAppreciationResponseDTO() {
}
public String getAppreciationResponse() {
return appreciationResponse;
}
public void setAppreciationResponse(String appreciationResponse) {
this.appreciationResponse = appreciationResponse;
}
public boolean isAppreciationResponseWarning() {
return appreciationResponseWarning;
}
public void setAppreciationResponseWarning(boolean appreciationResponseWarning) {
this.appreciationResponseWarning = appreciationResponseWarning;
}
}
| true
|
7bdecc47a8a49d8caa9bdc7339af92a8b1dc91fe
|
Java
|
mpabasara11/Library_Management_System
|
/myProject/src/myConnection.java
|
UTF-8
| 346
| 2.53125
| 3
|
[] |
no_license
|
import java.sql.*;
public class myConnection {
public Connection conn;
public Connection getConnection()
{ try{
String dbpath="jdbc:mysql://localhost/library";
conn=DriverManager.getConnection(dbpath,"root","");
}
catch(SQLException e)
{System.out.print(e.getMessage());
}
return conn;
}
}
| true
|
e3646c32fd8141c74af7a5c4ab88bbea4cd0ea2c
|
Java
|
jtravan3/redox-java-data-model
|
/src/main/java/redox/datamodel/clinicalsummary/common/ValueWrapper.java
|
UTF-8
| 327
| 2.078125
| 2
|
[
"CC-BY-3.0",
"MIT"
] |
permissive
|
package redox.datamodel.clinicalsummary.common;
import lombok.Data;
/**
* This is a wrapper class for Observation Value type. It can either be a Value or String
* data type so this class provides the ability for it to be both
*/
@Data
public class ValueWrapper {
private Value value;
private String valueString;
}
| true
|
aa7463b0761d3a2bccd0ca2281ce373ba71b5d73
|
Java
|
charles-marques/dataset-375
|
/projetos/nwcfile/src/main/java/nwcfile/KeySignature.java
|
UTF-8
| 2,905
| 2.703125
| 3
|
[] |
no_license
|
package nwcfile;
public class KeySignature extends Symbol {
public enum Note {
A,B,C,D,E,F,G;
}
private final NwcItem BYTE3 = new NwcItem() {
public NwcItem marshall(NwcFileWriter writer)
throws NwcFileException {
return this;
}
public NwcItem unmarshall(NwcFileReader reader)
throws NwcFileException {
byte flatBits = reader.readByte();
for (Note note : Note.values()) {
setFlat(note, NwcUtils.subByte(flatBits,
note.ordinal(),
note.ordinal() + 1) != 0);
}
return this;
}
};
private final NwcItem BYTE5 = new NwcItem() {
public NwcItem marshall(NwcFileWriter writer)
throws NwcFileException {
return this;
}
public NwcItem unmarshall(NwcFileReader reader)
throws NwcFileException {
byte sharpBits = reader.readByte();
for (Note note : Note.values()) {
setSharp(note, NwcUtils.subByte(sharpBits,
note.ordinal(),
note.ordinal() + 1) != 0);
}
return this;
}
};
private final NwcItem BYTE6TO12 = new NwcItem() {
public NwcItem marshall(NwcFileWriter writer)
throws NwcFileException {
return this;
}
public NwcItem unmarshall(NwcFileReader reader)
throws NwcFileException {
reader.skip(7);
return this;
}
};
private boolean[] m_flats = new boolean[Note.values().length];
private boolean[] m_sharps = new boolean[Note.values().length];
public KeySignature () {
for (Note note : Note.values()) {
m_flats[note.ordinal()] = false;
m_sharps[note.ordinal()] = false;
}
}
public void setFlat(Note note, boolean present) {
m_flats[note.ordinal()] = present;
}
public void setSharp(Note note, boolean present) {
m_sharps[note.ordinal()] = present;
}
@Override
public String toString() {
String endl = System.getProperty("line.separator");
StringBuilder builder = new StringBuilder();
builder.append("***** Key signature *****" + endl);
builder.append("Flats :");
for (Note note : Note.values()) {
if (m_flats[note.ordinal()]) {
builder.append(" ");
builder.append(note);
}
}
builder.append(endl);
builder.append("Sharps :");
for (Note note : Note.values()) {
if (m_sharps[note.ordinal()]) {
builder.append(" ");
builder.append(note);
}
}
builder.append(endl);
builder.append("***** End key signature *****" + endl);
return builder.toString();
}
public KeySignature marshall(NwcFileWriter writer)
throws NwcFileException {
// TODO
return this;
}
public KeySignature unmarshall(NwcFileReader reader)
throws NwcFileException {
BYTE1.unmarshall(reader);
BYTE2.unmarshall(reader);
BYTE3.unmarshall(reader);
BYTE4.unmarshall(reader);
BYTE5.unmarshall(reader);
BYTE6TO12.unmarshall(reader);
return this;
}
}
| true
|
5127e3b75e789a384d29e7a7a1f1bda690fe0348
|
Java
|
yangxiaoxi/EshoManager
|
/EshopManager/src/com/yunhe/service/LunBoService.java
|
GB18030
| 370
| 1.859375
| 2
|
[] |
no_license
|
package com.yunhe.service;
import java.util.List;
import com.yunhe.pojo.Ad;
public interface LunBoService {
/**
* ึฒอผ
* @return
*/
boolean insertPhoto(String ad_img,int book_id);
/**
* ษพึฒอผ
* @param ad_img
*/
void deletePhoto(int ad_id);
/**
* ะตึฒอผ
* @return
*/
List<Ad> selectPhoto();
}
| true
|
ec55e1d69e0b5e506ea654aec437e2e2c50d1628
|
Java
|
RchengANDLengwen/SsmFrame
|
/company/src/main/java/com/codejoys/company/entity/CurrentDeptEmp.java
|
UTF-8
| 4,591
| 2.28125
| 2
|
[] |
no_license
|
package com.codejoys.company.entity;
import java.io.Serializable;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table current_dept_emp
*/
public class CurrentDeptEmp implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column current_dept_emp.emp_no
*
* @mbg.generated
*/
private Integer empNo;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column current_dept_emp.dept_no
*
* @mbg.generated
*/
private String deptNo;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column current_dept_emp.from_date
*
* @mbg.generated
*/
private Date fromDate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column current_dept_emp.to_date
*
* @mbg.generated
*/
private Date toDate;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table current_dept_emp
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column current_dept_emp.emp_no
*
* @return the value of current_dept_emp.emp_no
*
* @mbg.generated
*/
public Integer getEmpNo() {
return empNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column current_dept_emp.emp_no
*
* @param empNo the value for current_dept_emp.emp_no
*
* @mbg.generated
*/
public void setEmpNo(Integer empNo) {
this.empNo = empNo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column current_dept_emp.dept_no
*
* @return the value of current_dept_emp.dept_no
*
* @mbg.generated
*/
public String getDeptNo() {
return deptNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column current_dept_emp.dept_no
*
* @param deptNo the value for current_dept_emp.dept_no
*
* @mbg.generated
*/
public void setDeptNo(String deptNo) {
this.deptNo = deptNo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column current_dept_emp.from_date
*
* @return the value of current_dept_emp.from_date
*
* @mbg.generated
*/
public Date getFromDate() {
return fromDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column current_dept_emp.from_date
*
* @param fromDate the value for current_dept_emp.from_date
*
* @mbg.generated
*/
public void setFromDate(Date fromDate) {
this.fromDate = fromDate;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column current_dept_emp.to_date
*
* @return the value of current_dept_emp.to_date
*
* @mbg.generated
*/
public Date getToDate() {
return toDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column current_dept_emp.to_date
*
* @param toDate the value for current_dept_emp.to_date
*
* @mbg.generated
*/
public void setToDate(Date toDate) {
this.toDate = toDate;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table current_dept_emp
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", empNo=").append(empNo);
sb.append(", deptNo=").append(deptNo);
sb.append(", fromDate=").append(fromDate);
sb.append(", toDate=").append(toDate);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
| true
|
46eac675d78fc25f6980d5832e8ffdf3692d60ff
|
Java
|
dineshkatamneni/MyProjects
|
/Banking_Application/src/main/java/com/wayne/project/console/IConsoleForCards.java
|
UTF-8
| 559
| 1.914063
| 2
|
[] |
no_license
|
package com.wayne.project.console;
import com.wayne.project.cards.ICards;
import com.wayne.project.cards.IRedeemCardPoints;
import java.sql.SQLException;
public interface IConsoleForCards {
public void displayCardsInformation() throws SQLException;
public boolean generateCardPinCode(ICards cards, String typeOfCard) throws SQLException;
public boolean redeemCardPoints(IRedeemCardPoints redeemCardPoints, String typeOfCard) throws SQLException;
public void addPaymentReminder(String customerId) throws SQLException;
}
| true
|
7d78f5742071286039dfcc1814cc4ce5106801de
|
Java
|
leolopez48/ImportadoraPoe
|
/ProyectoPoe/src/com/dao/DaoUnidadMedida.java
|
UTF-8
| 4,984
| 2.296875
| 2
|
[] |
no_license
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.dao;
import com.pojos.UnidadMedida;
import com.utils.HibernateUtil;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
/**
* NombreClase: DaoUnidadMedida
* Fecha: 13/11/2020
* Versiรณn: 1.0
* Copyright:ITCA-FEPADE
* @author Leonel Antonio Lรณpez Valencia - 040119
* Roberto Alejandro Armijo Jรญmenez - 046719
* Sandra Natalia Menjรญvar Romero - 174218
*/
public class DaoUnidadMedida {
public String insertarUnidadMedida(UnidadMedida unidad){
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(unidad);
session.getTransaction().commit();
return "Insertado correctamente";
} catch (HibernateException e) {
session.getTransaction().rollback();
JOptionPane.showMessageDialog(null, e.getMessage());
return "No se ha insertado";
} finally {
session.close();
}
}
public String modificarUnidadMedida(UnidadMedida unidad){
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.update(unidad);
session.getTransaction().commit();
return "Modificado correctamente";
} catch (HibernateException e) {
session.getTransaction().rollback();
JOptionPane.showMessageDialog(null, e.getMessage());
return "No se ha insertado";
} finally {
session.close();
}
}
public String eliminarUnidadMedida(UnidadMedida unidad){
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(unidad);
session.getTransaction().commit();
return "Eliminado correctamente";
} catch (HibernateException e) {
session.getTransaction().rollback();
JOptionPane.showMessageDialog(null, e.getMessage());
return "No se ha insertado";
} finally {
session.close();
}
}
public List<UnidadMedida> mostrarUnidadMedidas(){
List<UnidadMedida> listaUnidadMedidas = new ArrayList();
Session session = null;
session = HibernateUtil.getSessionFactory().openSession();
Transaction t = session.beginTransaction();
String sql = "FROM UnidadMedida";
try {
listaUnidadMedidas = session.createQuery(sql).list();
t.commit();
session.close();
} catch (HibernateException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
t.rollback();
}
return listaUnidadMedidas;
}
public UnidadMedida buscarUnidadMedida(int id){
UnidadMedida unidad = new UnidadMedida();
Session session = null;
session = HibernateUtil.getSessionFactory().openSession();
Transaction t = session.beginTransaction();
try {
unidad = (UnidadMedida) session.load(UnidadMedida.class, id);
t.commit();
session.close();
} catch (HibernateException e) {
unidad = null;
t.rollback();
}
return unidad;
}
public int ultimoId() {
List<UnidadMedida> listaUnidadMedidas = new ArrayList();
Session session = null;
int id = 0;
session = HibernateUtil.getSessionFactory().openSession();
Transaction t = session.beginTransaction();
String sql = "FROM UnidadMedida";
try {
listaUnidadMedidas = session.createQuery(sql).list();
for (UnidadMedida usu : listaUnidadMedidas) {
id = usu.getIdUnidadMedida();
}
t.commit();
session.close();
} catch (HibernateException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
t.rollback();
}
id++;
return id;
}
public List<UnidadMedida> buscarUnidadMedida(String nombre){
List<UnidadMedida> listaUnidadMedidas = new ArrayList();
Session session = null;
int id = 0;
session = HibernateUtil.getSessionFactory().openSession();
Transaction t = session.beginTransaction();
String sql = "FROM UnidadMedida WHERE nombre LIKE :nombre";
try {
listaUnidadMedidas = session.createQuery(sql).setString("nombre", "%"+nombre+"%").list();
t.commit();
session.close();
} catch (HibernateException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
t.rollback();
}
id++;
return listaUnidadMedidas;
}
}
| true
|
df3a9a0a291229c28f118d7c3a7c41840d30efbf
|
Java
|
koppor/synopsys-detect
|
/detectable/src/main/java/com/synopsys/integration/detectable/detectables/cargo/CargoDetectable.java
|
UTF-8
| 3,407
| 1.820313
| 2
|
[
"Apache-2.0"
] |
permissive
|
/**
* detectable
*
* Copyright (c) 2020 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.synopsys.integration.detectable.detectables.cargo;
import java.io.File;
import java.util.Optional;
import com.synopsys.integration.detectable.Detectable;
import com.synopsys.integration.detectable.DetectableEnvironment;
import com.synopsys.integration.detectable.Extraction;
import com.synopsys.integration.detectable.ExtractionEnvironment;
import com.synopsys.integration.detectable.detectable.annotation.DetectableInfo;
import com.synopsys.integration.detectable.detectable.exception.DetectableException;
import com.synopsys.integration.detectable.detectable.file.FileFinder;
import com.synopsys.integration.detectable.detectable.result.CargoGenerateLockfileDetectResult;
import com.synopsys.integration.detectable.detectable.result.DetectableResult;
import com.synopsys.integration.detectable.detectable.result.FilesNotFoundDetectableResult;
import com.synopsys.integration.detectable.detectable.result.PassedDetectableResult;
@DetectableInfo(language = "Rust", forge = "crates", requirementsMarkdown = "File: Cargo.lock")
public class CargoDetectable extends Detectable {
public static final String CARGO_LOCK_FILENAME = "Cargo.lock";
public static final String CARGO_TOML_FILENAME = "Cargo.toml";
private final FileFinder fileFinder;
private final CargoExtractor cargoExtractor;
private File cargoLock;
private File cargoToml;
public CargoDetectable(final DetectableEnvironment environment, final FileFinder fileFinder, final CargoExtractor cargoExtractor) {
super(environment);
this.fileFinder = fileFinder;
this.cargoExtractor = cargoExtractor;
}
@Override
public DetectableResult applicable() {
cargoLock = fileFinder.findFile(environment.getDirectory(), CARGO_LOCK_FILENAME);
cargoToml = fileFinder.findFile(environment.getDirectory(), CARGO_TOML_FILENAME);
if (cargoLock == null && cargoToml == null) {
return new FilesNotFoundDetectableResult(CARGO_LOCK_FILENAME, CARGO_TOML_FILENAME);
}
return new PassedDetectableResult();
}
@Override
public DetectableResult extractable() {
if (cargoLock == null && cargoToml != null) {
return new CargoGenerateLockfileDetectResult(environment.getDirectory().getAbsolutePath());
}
return new PassedDetectableResult();
}
@Override
public Extraction extract(final ExtractionEnvironment extractionEnvironment) {
return cargoExtractor.extract(cargoLock, Optional.ofNullable(cargoToml));
}
}
| true
|
82d8e878fc7c7f326e9e498b7f2dcac6a0904f0a
|
Java
|
rajibad91/Java
|
/Shopping_Cart/src/main/java/com/example/spring/Shopping_Cart/TestDB.java
|
UTF-8
| 446
| 1.742188
| 2
|
[] |
no_license
|
package com.example.spring.Shopping_Cart;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestDB {
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context = new ClassPathXmlApplicationContext("Service.xml");
Service service = (Service) context.getBean("beanService");
}
}
| true
|
77dbf0e041236fc14f3e62385e8f13c462597c6f
|
Java
|
xei/bamilo-android
|
/app/src/main/java/com/bamilo/android/appmodule/bamiloapp/di/components/OrderCancellationComponent.java
|
UTF-8
| 455
| 1.75
| 2
|
[] |
no_license
|
package com.bamilo.android.appmodule.bamiloapp.di.components;
import com.bamilo.android.core.modules.OrderCancellationModule;
import com.bamilo.android.appmodule.bamiloapp.view.fragments.OrderCancellationFragment;
import dagger.Subcomponent;
/**
* Created by mohsen on 1/31/18.
*/
@Subcomponent(modules = {
OrderCancellationModule.class
})
public interface OrderCancellationComponent {
void inject(OrderCancellationFragment fragment);
}
| true
|
68f9cb62a1845da1e1b54e5730a9faaa771533b4
|
Java
|
luciferliusha/dataCenter
|
/src/main/java/com/zjcds/serverResource/controller/ServerResourceController.java
|
UTF-8
| 3,479
| 2.265625
| 2
|
[] |
no_license
|
package com.zjcds.serverResource.controller;
import com.zjcds.serverResource.service.ServerResourceService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description:
* @Author: zhangxy
* @Date: Created in 9:49 2019/9/24
* @Modified By:
*/
@RestController
@RequestMapping("/serverResource")
public class ServerResourceController {
//่ทๅๆฅๅฟ่ฎฐๅฝๅจLogger
private static Logger log = Logger.getLogger(ServerResourceController.class);
@Autowired
private ServerResourceService serverResourceService;
/*
* ๆๅก่ตๆบไฟกๆฏ้กต้ข
* */
@RequestMapping("/serverResourceInfo")
public ModelAndView serverRelease() {
ModelAndView mv = new ModelAndView("serverResource/serverResourceInfo");
log.info("่ฟๅๆๅก่ตๆบไฟกๆฏ้กต้ข");
mv.addObject("flag", "3");
return mv;
}
/**
* ๆฅ่ฏขๆๅก่ตๆบไฟกๆฏๅ่กจๆฐๆฎ
* @return
*/
@RequestMapping(value = "/getServiceResourceList", method = RequestMethod.GET)
public List<Map<String,Object>> getServiceResourceList(HttpServletRequest request,@RequestParam Map<String,Object> param) {
// ๆฅ่ฏขๆๅก่ตๆบไฟกๆฏๅ่กจๆฐๆฎ
List<Map<String,Object>> result = serverResourceService.getServiceResourceList(param);
log.info("ๆฅ่ฏขๆๅก่ตๆบๅ่กจ");
return result;
}
/**
* ่ฟๅๆๅกๆณจๅๅ่กจ้กต้ข
* @return
*/
@RequestMapping("/serverResourceRegister")
public ModelAndView serverResourceRegister() {
ModelAndView mv = new ModelAndView("serverResource/serverResourceRegister");
mv.addObject("flag", "3");
log.info("่ฟๅๆๅก่ฏฆๆ
ๅ่กจ้กต้ข");
return mv;
}
/**
* ๆณจๅๆๅก่ตๆบไฟกๆฏ
* @param request
* @param params
* @return
*/
@RequestMapping(value = "saveServiceResource", method = RequestMethod.POST)
public Map<String, String> saveServiceResource(HttpServletRequest request, @RequestParam Map<String,Object> params) {
int count = serverResourceService.saveServiceResource(params);
Map<String, String> result = new HashMap<String, String>();
if (count > 0) {
result.put("message", "success");
} else {
result.put("message", "fail");
}
return result;
}
/**
* ่ฟๅๆๅก่ตๆบ่ฏฆๆ
้กต้ข
* @return
*/
@RequestMapping("/serverResourceDetail")
public ModelAndView serverResourceDetail() {
ModelAndView mv = new ModelAndView("serverResource/serverResourceDetail");
mv.addObject("flag", "3");
log.info("่ฟๅๆๅก่ตๆบ่ฏฆๆ
้กต้ข");
return mv;
}
/**
* ๆฅ่ฏขๆๅก่ตๆบ่ฏฆๆ
ๆฐๆฎ
* @param id
* @return
*/
@RequestMapping("/getServerResourceById/{id}")
public Map<String,Object> getServerResourceById(@PathVariable String id) {
return serverResourceService.getServerResourceById(id);
}
/**
* ๆฅ่ฏขๆฐๆฎ้กนไฟกๆฏ
* @return
*/
@RequestMapping("/getDataItem")
public List<Map<String,Object>> getDataItem() {
return serverResourceService.getDataItem();
}
}
| true
|
bf327d3a9079cd5572577f4d55d2e4ff10d33ba7
|
Java
|
sethiz/Movie-Ticket-Booking
|
/Code/adminui/AddSeatType.java
|
UTF-8
| 8,515
| 2.375
| 2
|
[] |
no_license
|
package adminui;
import java.beans.PropertyVetoException;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import model.DAO.seattypeDAO;
import model.to.seattypeTO;
import operations.Validations;
/**
*
* @author Shubham Sethi
*/
public class AddSeatType extends javax.swing.JInternalFrame {
int seat;
public AddSeatType() {
initComponents();
getRootPane().setDefaultButton(btnAddSeatType);
}
public AddSeatType(seattypeTO cit) {
this();
if (cit != null) {
seat = cit.getTypeID();
jtfSeatType.setText(cit.getTypename());
jtfCharges.setText(String.valueOf(cit.getCharges()));
setTitle("Update Seat Type Information");
btnAddSeatType.setText("Update");
}
}
/**
* 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() {
btnAddSeatType = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jtfSeatType = new javax.swing.JTextField();
jtfCharges = new javax.swing.JTextField();
setClosable(true);
setIconifiable(true);
setTitle("Add Seat Type");
btnAddSeatType.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
btnAddSeatType.setText("Add New Seat Type");
btnAddSeatType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAddSeatTypeActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel1.setText("Enter Seat Type Name");
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel2.setText("Enter Seat Charges");
jtfSeatType.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
jtfCharges.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
jtfCharges.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
jtfChargesKeyTyped(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(67, 67, 67)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jtfCharges, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(63, 63, 63)
.addComponent(jtfSeatType, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(181, Short.MAX_VALUE)
.addComponent(btnAddSeatType, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(180, 180, 180))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(56, 56, 56)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfSeatType, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jtfCharges, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(68, 68, 68)
.addComponent(btnAddSeatType, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnAddSeatTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddSeatTypeActionPerformed
String seattype = jtfSeatType.getText().trim();
String charges = jtfCharges.getText().trim();
boolean allvalid = true;
String message = "";
if (Validations.isEmpty(seattype)) {
message+= "Please Provide Seat Name\n\n";
allvalid = false;
}
if(Validations.isEmpty(charges))
{
message+="Please Provide Charges";
allvalid = false;
}
if (allvalid) {
int charge = Integer.parseInt(charges);
if (charge > 0) {
seattypeTO stt = new seattypeTO();
stt.setTypename(seattype);
stt.setCharges(charge);
seattypeDAO action = new seattypeDAO();
if (btnAddSeatType.getText().contains("Add")) {
if (action.insertRecord(stt)) {
message = "New Seat Type is Added in system";
jtfCharges.setText("");
jtfSeatType.setText("");
JInternalFrame[] jif = getDesktopPane().getAllFrames();
if (jif != null) {
for (JInternalFrame jf : jif) {
if (jf instanceof ViewSeatType) {
ViewSeatType vci = (ViewSeatType) jf;
vci.bindSeatTable();
break;
}
}
}
} else {
message = action.getErrormessgae();
}
} else if (btnAddSeatType.getText().contains("Update")) {
stt.setTypeID(seat);
if (action.updateRecord(stt)) {
message = "Seat Type is Updated in System";
jtfCharges.setText("");
jtfSeatType.setText("");
} else {
message = action.getErrormessgae();
}
ViewSeatType vci = new ViewSeatType();
vci.setVisible(true);
getDesktopPane().add(vci);
try {
vci.setSelected(true);
} catch (PropertyVetoException ex) {
}
dispose();
}
}
}
JOptionPane.showMessageDialog(this, message);
}//GEN-LAST:event_btnAddSeatTypeActionPerformed
private void jtfChargesKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtfChargesKeyTyped
if (!Character.isDigit(evt.getKeyChar())) {
evt.consume();
}
}//GEN-LAST:event_jtfChargesKeyTyped
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAddSeatType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField jtfCharges;
private javax.swing.JTextField jtfSeatType;
// End of variables declaration//GEN-END:variables
}
| true
|
3ed02afbc545a1a0933ed867d3a202a1d117c02b
|
Java
|
H-O-S/ProgKievModule02
|
/src/Lesson01/MainL01Task01.java
|
UTF-8
| 516
| 3.375
| 3
|
[] |
no_license
|
/**
* Java OOP. Lesson 01.
*
* @author Oleg Khrulov
* @version dated 04.04.2019
*/
package Lesson01;
public class MainL01Task01 {
public static void main(String[] args) {
Car carOne = new Car();
carOne.setColor("Green");
carOne.setWeight(2000);
carOne.setYear(1980);
Car carTwo = new Car();
carTwo.setColor("Red");
carTwo.setWeight(1500);
carTwo.setYear(2010);
System.out.println(carOne);
System.out.println(carTwo);
}
}
| true
|
706a7dfc8766876ce34d8468ce894664b16d0c9e
|
Java
|
sjain30/JavaLectures
|
/src/com/company/Lec3/src/com/company/Butterfly.java
|
UTF-8
| 895
| 3.3125
| 3
|
[] |
no_license
|
package com.company.Lec3;
import java.util.Scanner;
public class Butterfly {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n=s.nextInt();
int vmr=1;
int row=1;
while(vmr<=2*n-1){
int hmir=1;
int col=1;
while(hmir<=2*n-1) {
if (col <= n-row) {
System.out.print(" ");
}
else {
System.out.print(col);
}
if (hmir < n) {
col++;
}
else {
col--;
}
hmir++;
}
System.out.println();
if (vmr < n) {
row++;
}
else {
row--;
}
vmr++;
}
}
}
| true
|
4562a40891b4fe470d577574ad13f0550c3f7437
|
Java
|
Timothy2015/Java
|
/1_ๅป้ชๅณฐjavaๆ็จ็ฌ่ฎฐ/7_้ๅ/7.2_ไฝฟ็จQueue.java
|
UTF-8
| 1,192
| 4.0625
| 4
|
[] |
no_license
|
import java.util.LinkedList;
import java.util.Queue;
/**
# LinkedList็ไผ็น๏ผ
- LinkedListๅณๅฎ็ฐไบListๆฅๅฃ๏ผๅๅฎ็ฐไบQueueๆฅๅฃ
- ๅจไฝฟ็จๆถ๏ผๅฆๆๆๅฎๅฝไฝList๏ผๅฐฑ่ทๅList็ๅผ็จ๏ผๅฆๆๆๅฎๅฝไฝQueue,ๅฐฑ่ทๅQueue็ๅผ็จ
*/
public class Main{
public static void main(String[] args){
Queue<String> q = new LinkedList<>();
//ๆทปๅ 3ไธชๅ
็ด ๅฐ้ๅ - q.offer() or q.add()
q.add("tomato");
q.add("pear");
q.offer("apple");
q.offer("oringe");
q.offer("banana");
//ไป้ๅๅๅบๅ
็ด - q.poll()๏ผ่ทๅ้้ฆๅ
็ด ๅนถๅ ้ค or q.remove()
// q.peek()๏ผๅชๆฏ่ทๅ้้ฆๅ
็ด , ไธๅ ้ค or q.element()
System.out.println(q.peek()); //tomato
System.out.println(q.peek()); //tomato
System.out.println(q.peek()); //tomato๏ผๅชๆฏ่ทๅ้้ฆๅ
็ด ๏ผไฝไธๅ ้ค
System.out.println(q.poll()); //tomato
System.out.println(q.poll()); //pear
System.out.println(q.poll()); //apple
System.out.println(q.poll()); //oringe
System.out.println(q.element());//banana
System.out.println(q.remove());//banana
}
}
| true
|
707a9421be32b05804f4eafc5b9ce572c2d1ac8a
|
Java
|
Lorimax/boi
|
/MyGame/src/game/PickUp.java
|
UTF-8
| 675
| 2.96875
| 3
|
[] |
no_license
|
package game;
import java.util.concurrent.ThreadLocalRandom;
public class PickUp {
protected int posX;
protected int posY;
public PickUp() {
this.posX = ThreadLocalRandom.current().nextInt(0, 750);
this.posY = ThreadLocalRandom.current().nextInt(0, 750);
}
public void reset() {
this.posX = ThreadLocalRandom.current().nextInt(0, 750);
this.posY = ThreadLocalRandom.current().nextInt(0, 750);
}
public int getPosX() {
return posX;
}
public void setPosX(int posX) {
this.posX = posX;
}
public int getPosY() {
return posY;
}
public void setPosY(int posY) {
this.posY = posY;
}
}
| true
|
647162be1b057514f7dca9908ba271564f790200
|
Java
|
utcn-cs-software-design-tudorv-2019/assignment-1-AndreiBercean
|
/StudentManagement/src/dataAccessLayer/Student.java
|
UTF-8
| 352
| 2.8125
| 3
|
[] |
no_license
|
package dataAccessLayer;
public class Student
{
protected int userID;
protected int group;
public Student(int id, int g)
{
userID = id;
group = g;
}
public int getGroup()
{
return group;
}
public void setGroup(int group)
{
this.group = group;
}
public int getUserID()
{
return userID;
}
}
| true
|
1c3aac33cbeed08987a13ebcf6c7a9383e05269d
|
Java
|
AnandMurugan/kth-seds-2011-projects
|
/ID2212/HW1/src/utils/MessageType.java
|
UTF-8
| 374
| 1.867188
| 2
|
[] |
no_license
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package utils;
/**
*
* @author julio
*/
public enum MessageType {
CLIENT_NEW_GAME,
CLIENT_GUESS_LETTER,
CLIENT_GUESS_WORD,
CLIENT_DISCONNECT,
SERVER_NEW_GAME,
SERVER_WRONG_LETTER,
SERVER_CORRECT_LETTER,
SERVER_GAME_OVER,
SERVER_WIN
}
| true
|
ee16c16d5e8ca6cf4b7f64e95b14a549ac678d77
|
Java
|
mtu20181234/leetcode
|
/276. Paint Fence.java
|
UTF-8
| 430
| 2.734375
| 3
|
[] |
no_license
|
public class Solution {
public int numWays(int n, int k) {
int[] dp = {0,k,k*k,0};
if(n<=2){
return dp[n];
}
int diff = k*(k-1);
int same = k;
int cur = -1;
for(int i=2;i<n;i++){
int prevDiff = diff;
cur = diff*k + same*(k-1);
diff = (diff + same)*(k-1);
same = prevDiff;
}
return cur;
}
}
| true
|
6dc98196eb809068b11dc570a38264cf9dd464b5
|
Java
|
Anthony-W/CS101
|
/Lab10/src/Dog.java
|
UTF-8
| 1,308
| 3.734375
| 4
|
[] |
no_license
|
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Dog {
enum Tail {
LONG,
SHORT,
NONE;
}
int age;
String name;
String bark;
boolean hasShortHair;
double weight;
Tail tail;
public Dog() {
this("Wolfy");
}
public Dog(String name) {
if (validName(name))
this.name = name;
else
this.name = "Wolfy";
age = 2;
bark = "Bark!";
hasShortHair = true;
weight = 20.0;
tail = Tail.SHORT;
}
private boolean validName(String name) {
Pattern pattern = Pattern.compile("[a-zA-Z]*");
Matcher matcher = pattern.matcher(name);
if (matcher.matches()) return true;
else return false;
}
int humanAge() {
return age * 7; //convert to human
}
public String speak() {
return bark;
}
public void printInfo() {
System.out.println("This dog's name is " + name);
System.out.println(name + " is " + age + " years old (" + humanAge() + " in human years)");
if (hasShortHair) System.out.println(name + " has short hair");
else System.out.println(name + " does not have short hair");
System.out.println(name + " weighs " + weight + " lbs");
System.out.println(name + "'s tail length is " + tail);
System.out.println(speak());
System.out.println("");
}
}
| true
|
30e9589a8ce722e834353e277eff4c3e7727c782
|
Java
|
Marcin3232/StacjaPogodowa_Mobilna
|
/app/src/main/java/com/example/czujnik5/Adapter/TempDataAdapter.java
|
UTF-8
| 1,286
| 2.375
| 2
|
[
"MIT"
] |
permissive
|
package com.example.czujnik5.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.czujnik5.Model.TempData;
import com.example.czujnik5.R;
import java.util.List;
public class TempDataAdapter extends ArrayAdapter<TempData> {
private List<TempData> tempList;
private Context mContext;
public TempDataAdapter(List<TempData> P, Context ctx) {
super(ctx, R.layout.list_temperature, P);
this.tempList = P;
this.mContext = ctx;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(R.layout.list_temperature, null, true);
TextView name = (TextView) view.findViewById(R.id.tempName);
TextView time = (TextView) view.findViewById(R.id.timeId);
TempData tempData = tempList.get(position);
time.setText(tempData.getTime());
name.setText(tempData.getTemperature());
return view;
}
}
| true
|
e083b56a5335191a2802d039b6015adcafdfeb5e
|
Java
|
lyf10009/JavaTest
|
/src/PatternsDesign/AbstractFactory/AbstractFactory.java
|
UTF-8
| 153
| 2.5
| 2
|
[] |
no_license
|
package PatternsDesign.AbstractFactory;
public interface AbstractFactory {
public ICpu createCpu();
public IMainboard createMainboard();
}
| true
|
d6f3f64df2b670972b8a804f6cdd903443df8048
|
Java
|
svn2github/myfaces-extcdi-parent
|
/alternative-modules/alternative-configuration-modules/core-alternative-configuration-module/src/test/java/org/apache/myfaces/extensions/cdi/core/test/alternative/config/CoreConfigTest.java
|
UTF-8
| 3,823
| 1.867188
| 2
|
[] |
no_license
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.extensions.cdi.core.test.alternative.config;
import org.apache.myfaces.extensions.cdi.core.alternative.config.AlternativeCodiCoreConfig;
import org.apache.myfaces.extensions.cdi.core.alternative.scope.conversation.config.AlternativeConversationConfig;
import org.apache.myfaces.extensions.cdi.core.alternative.scope.conversation.config.AlternativeWindowContextConfig;
import org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig;
import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.ConversationConfig;
import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
public class CoreConfigTest
{
@Test
public void testAlternativeCodiCoreConfig()
{
CodiCoreConfig codiCoreConfig = new AlternativeCodiCoreConfig();
//changed via config see myfaces-extcdi.properties
assertEquals(codiCoreConfig.isAdvancedQualifierRequiredForDependencyInjection(), false);
assertEquals(codiCoreConfig.isConfigurationLoggingEnabled(), true);
assertEquals(codiCoreConfig.isInvalidBeanCreationEventEnabled(), false);
}
@Test
public void testAlternativeConversationConfig()
{
ConversationConfig conversationConfig = new AlternativeConversationConfig();
assertEquals(conversationConfig.isConversationRequiredEnabled(), true);
assertEquals(conversationConfig.getConversationTimeoutInMinutes(), 30);
assertEquals(conversationConfig.isAccessBeanEventEnabled(), false);
assertEquals(conversationConfig.isCloseConversationEventEnabled(), false);
assertEquals(conversationConfig.isStartConversationEventEnabled(), false);
assertEquals(conversationConfig.isRestartConversationEventEnabled(), false);
assertEquals(conversationConfig.isScopeBeanEventEnabled(), false);
assertEquals(conversationConfig.isUnscopeBeanEventEnabled(), false);
}
@Test
public void testAlternativeWindowContextConfig()
{
WindowContextConfig windowContextConfig = new AlternativeWindowContextConfig();
assertEquals(windowContextConfig.getMaxWindowContextCount(), 64);
assertEquals(windowContextConfig.getWindowContextTimeoutInMinutes(), 60);
assertEquals(windowContextConfig.isUrlParameterSupported(), true);
assertEquals(windowContextConfig.isUnknownWindowIdsAllowed(), false);
assertEquals(windowContextConfig.isAddWindowIdToActionUrlsEnabled(), false);
assertEquals(windowContextConfig.isCloseEmptyWindowContextsEnabled(), false);
assertEquals(windowContextConfig.isEagerWindowContextDetectionEnabled(), true);
assertEquals(windowContextConfig.isCreateWindowContextEventEnabled(), false);
assertEquals(windowContextConfig.isCloseWindowContextEventEnabled(), false);
}
}
| true
|
c9520c379f5443ade4ac3b1c573242e7411f4079
|
Java
|
wencl/spark_stream_kafka
|
/src/main/java/org/jrj/wen/spark_stream_kafka/execute/JavaDirectKafkaWordCount.java
|
UTF-8
| 5,722
| 2.078125
| 2
|
[] |
no_license
|
package org.jrj.wen.spark_stream_kafka.execute;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.log4j.Logger;
import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.function.PairFunction;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Encoder;
import org.apache.spark.sql.Encoders;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.streaming.Durations;
import org.apache.spark.streaming.api.java.JavaDStream;
import org.apache.spark.streaming.api.java.JavaInputDStream;
import org.apache.spark.streaming.api.java.JavaPairDStream;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import org.apache.spark.streaming.kafka010.ConsumerStrategies;
import org.apache.spark.streaming.kafka010.KafkaUtils;
import org.apache.spark.streaming.kafka010.LocationStrategies;
import scala.Tuple2;
/**
* Consumes messages from one or more topics in Kafka and does wordcount. Usage:
* JavaDirectKafkaWordCount <brokers> <groupId> <topics> <brokers> is a list of
* one or more Kafka brokers <groupId> is a consumer group name to consume from
* topics <topics> is a list of one or more kafka topics to consume from
*
* Example: $ bin/run-example streaming.JavaDirectKafkaWordCount
* broker1-host:port,broker2-host:port \ consumer-group topic1,topic2
*/
public class JavaDirectKafkaWordCount {
private static Logger logger = Logger.getLogger(JavaDirectKafkaWordCount.class);
private static final Pattern SPACE = Pattern.compile(" ");
public static void aa() {
logger.info("JavaDirectKafkaWordCount start...");
String brokers = "hadoop-1:9092,hadoop-2:9092,hadoop-3:9092,hadoop-4:9092";
String groupId = "spark_stream_kafka";
String topics = "spark_stream_kafka";
// Create context with a 2 seconds batch interval
SparkConf sparkConf = new SparkConf().setAppName("JavaDirectKafkaWordCount");
SparkContext sc = new SparkContext(sparkConf);
// try {
// FileSystem fs = FileSystem.newInstance(sc.hadoopConfiguration());
// Path p = new Path("/spark/spark_stream_kafka-0.0.1-SNAPSHOT.jar");
// fs.deleteOnExit(p);
// fs.copyFromLocalFile(false,
// new
// Path("/usr/local/wen/spark_stream_kafka/target/original-spark_stream_kafka-0.0.1-SNAPSHOT.jar"),
// p);
// logger.info("ไธไผ jarๆๅ");
// } catch (IOException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
JavaStreamingContext jssc = new JavaStreamingContext(sparkConf, Durations.seconds(2));
Set<String> topicsSet = new HashSet<>(Arrays.asList(topics.split(",")));
Map<String, Object> kafkaParams = new HashMap<>();
kafkaParams.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, brokers);
kafkaParams.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
kafkaParams.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
kafkaParams.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
// Create direct kafka stream with brokers and topics
JavaInputDStream<ConsumerRecord<String, String>> messages = KafkaUtils.createDirectStream(jssc,
LocationStrategies.PreferConsistent(), ConsumerStrategies.Subscribe(topicsSet, kafkaParams));
// Get the lines, split them into words, count the words and print
JavaDStream<String> lines = messages.map(ConsumerRecord::value);
JavaDStream<String> words = lines.flatMap(x -> Arrays.asList(SPACE.split(x)).iterator());
JavaPairDStream<String, Integer> wordCounts = words.mapToPair(s -> new Tuple2<>(s, 1))
.reduceByKey((i1, i2) -> i1 + i2);
// wordCounts.print();
// ๏ผ็ชๅฃ้ฟๅบฆ๏ผwindow length โ ็ชๅฃ่ฆ็็ๆถ้ด้ฟๅบฆ๏ผไธๅพไธญไธบ3๏ผ
// ๏ผๆปๅจ่ท็ฆป๏ผsliding interval โ ็ชๅฃๅฏๅจ็ๆถ้ด้ด้๏ผไธๅพไธญไธบ2๏ผ
// ๆณจๆ๏ผ่ฟไธคไธชๅๆฐ้ฝๅฟ
้กปๆฏ DStream ๆนๆฌก้ด้๏ผไธๅพไธญไธบ1๏ผ็ๆดๆฐๅ.
JavaPairDStream<String, Integer> windowedWordCounts = words.mapToPair(s -> new Tuple2<>(s, 1))
.reduceByKeyAndWindow((i1, i2) -> i1 + i2, Durations.seconds(10), Durations.seconds(6));
// windowedWordCounts.print();
SparkSession ss = SparkSession.builder().appName("wordCountSparkSql").config(sparkConf).getOrCreate();
Encoder<String> stringEncoder = Encoders.STRING();
Dataset<String> primitiveDS = ss.createDataset(Arrays.asList("d32321d:100", "1d32:200", "d32d:300"),
stringEncoder);
JavaPairRDD<String, Integer> jr = primitiveDS.javaRDD()
.mapToPair((PairFunction<String, String, Integer>) str -> {
String[] arr = str.split(":");
return new Tuple2<>(arr[0], Integer.valueOf(arr[1]));
});
// JavaPairDStream<String, Integer> windowedStream =
// wordCounts.window(Durations.seconds(20));
JavaPairDStream<String, Integer> joinedStream = windowedWordCounts.transformToPair(rdd -> rdd.join(jr))
.mapToPair(
(PairFunction<Tuple2<String, Tuple2<Integer, Integer>>, String, Integer>) p -> new Tuple2<String, Integer>(
p._1(), p._2()._1() + p._2()._2()));
// Start the computation
joinedStream.print();
jssc.start();
try {
jssc.awaitTermination();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
logger.info("JavaDirectKafkaWordCount end...");
}
}
| true
|
b8414d95e2bcce3e23da513805daae85f1ef177a
|
Java
|
quyixiao/testshell
|
/src/main/java/tsh/util/ParserTokenManager.java
|
UTF-8
| 19,833
| 2.140625
| 2
|
[] |
no_license
|
package tsh.util;
import tsh.Token;
import tsh.constant.ParserConstants;
import tsh.exception.TokenMgrError;
import tsh.t.TSHTuple;
import tsh.t.TTuple2;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ParserTokenManager extends Utils implements ParserConstants {
public static List<char[]> type = new ArrayList<>();
static {
for (String temp : tempType) {
type.add(temp.toCharArray());
}
}
static {
mapChar.put((int) '!', BANG);
mapChar.put((int) '"', DOUBLE_QUOT);
mapChar.put((int) '#', NOTES);
mapChar.put((int) '$', DOLLAR);
mapChar.put((int) '%', MOD);
mapChar.put((int) '&', AND);
mapChar.put((int) '\'', SINGLE_QUOT);
mapChar.put((int) '(', LPAREN);
mapChar.put((int) ')', RPAREN);
mapChar.put((int) '*', STAR);
mapChar.put((int) '+', PLUS);
mapChar.put((int) ',', COMMA);
mapChar.put((int) '-', MINUS);
mapChar.put((int) '.', DOT);
mapChar.put((int) '/', SLASH);
mapChar.put((int) ':', COLON);
mapChar.put((int) ';', SEMICOLON);
mapChar.put((int) '<', LT);
mapChar.put((int) '=', ASSIGN);
mapChar.put((int) '>', GT);
mapChar.put((int) '?', HOOK);
mapChar.put((int) '@', AT);
mapChar.put((int) '[', LBRACKET);
mapChar.put((int) ']', RBRACKET);
mapChar.put((int) '\\', CONTINUE_LINE);
mapChar.put((int) '^', XOR);
mapChar.put((int) '_', UNDERLINE);
mapChar.put((int) '`', DEAD_CHAR);
mapChar.put((int) '{', LBRACE);
mapChar.put((int) '|', OR);
mapChar.put((int) '}', RBRACE);
mapChar.put((int) '~', TILDE);
}
protected JavaCharStream input_stream;
private final int[] jjrounds = new int[74];
private final int[] jjstateSet = new int[148];
protected char curChar;
int curLexState = 0;
int defaultLexState = 0;
int jjnewStateCnt;
int jjround;
int jjmatchedPos;
String jjmatchedKind;
private boolean continueReader = false;
private String curKind = "";
public ParserTokenManager(JavaCharStream stream) {
if (JavaCharStream.staticFlag) {
throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
}
input_stream = stream;
}
public java.io.PrintStream debugStream = System.out;
public void setDebugStream(java.io.PrintStream ds) {
debugStream = ds;
}
public void ReInit(JavaCharStream stream) {
jjmatchedPos = jjnewStateCnt = 0;
curLexState = defaultLexState;
input_stream = stream;
ReInitRounds();
}
private final void ReInitRounds() {
int i;
jjround = 0x80000001;
for (i = 74; i-- > 0; )
jjrounds[i] = 0x80000000;
}
protected Token jjFillToken() {
Token t = new Token();
t.kind = jjmatchedKind;
t.image = input_stream.GetImage().trim();
if (jjmatchedKind.equals(EOF) && TStringUtil.isNotBlank(t.image)) {
if (TRUE.equals(t.image.trim())) {
t.kind = TRUE;
} else if (FALSE.equals(t.image.trim())) {
t.kind = FALSE;
}
}
t.beginLine = input_stream.getBeginLine();
t.beginColumn = input_stream.getBeginColumn();
t.endLine = input_stream.getEndLine();
t.endColumn = input_stream.getEndColumn();
return t;
}
public static Token jjTempFillToken() {
Token t = new Token();
t.kind = default_1;
t.image = "";
t.beginLine = 0;
t.beginColumn = 0;
t.endLine = 0;
t.endColumn = 0;
return t;
}
protected Token jjFillTokenEof() {
Token t = new Token();
t.kind = jjmatchedKind;
t.image = "";
return t;
}
public Token getNextToken() {
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop:
for (; ; ) {
try {
curChar = input_stream.BeginToken();
} catch (java.io.IOException e) {
jjmatchedKind = EOF;
return jjFillTokenEof();
}
jjmatchedKind = default_jjmatchedKind; // 2147483647
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
if (curPos == -1) { // ๅฆ่ฏปๅๅฐ็ปญ่ก็ฌฆ \ ๆถ๏ผ็ปง็ปญๅไธ่ฏปๅ
continue;
}
if (jjmatchedKind != default_jjmatchedKind) {
//ๆไปถ่ฏปๅ็ปๆ
if (eqOR(jjmatchedKind, EOF)) {
return jjFillToken();
}
//ๅฆๆ่ฟๅ็ไฝ็ฝฎๅฐไบๅฝๅ่ฏปๅๅฐ็ไฝ็ฝฎ๏ผๅ้ๅฐๅฝๅ่ฟๅไฝ็ฝฎ
// ๅฆ buffer = [a,b,c,d,e,f,g]
// jjmatchedPos = 3
// curPos = 6,ๅ้่ฆๅ้ 6 - 3 - 1 = 2 ๏ผๅ ๆญคไธๆฌกไป e ๅผๅง่ฏปๅ
if (jjmatchedPos + 1 < curPos) {
input_stream.backup(curPos - jjmatchedPos - 1);
}
// false jjmatchedKind is : [1, 2, 3, 4, 5, 6, 7, 8, 9, 61, 62, 63, 65, 70, 71]
if (!commonJjstrLiteralImages.contains(jjmatchedKind)) {
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
} else {
// false jjmatchedKind is :
if (!jjstrLiteralImages.contains(jjmatchedKind)) {
matchedToken = jjFillToken();
if (specialToken == null)
specialToken = matchedToken;
else {
matchedToken.specialToken = specialToken;
specialToken = (specialToken.next = matchedToken);
}
}
continue EOFLoop;
}
}
//ๅฆๆ่ฏปๅไธๆญฃ็กฎ๏ผ่ฟๅๅบ้็่กๅๅ
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try {
input_stream.readChar();
input_stream.backup(1);
} catch (java.io.IOException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
} else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
}
private final int jjStartNfaWithStates_0(String kind) {
//continueReader ไธป่ฆๆฏ็จไบๅค็ๅญ็ฌฆไธฒ๏ผๅช่ฆ""ๆ''ๅ
่ฃน็ไปปๆๅญ็ฌฆ๏ผ้ฝๅฝๆๅญ็ฌฆไธฒๆฅๅค็
if (!continueReader && eqOR(kind, TAB, SPACE)) { //ๅฆๆ้ๅฐ tab ,็ฉบๆ ผ๏ผ ๅ้ๅท
return getCommon();
} else if (!continueReader && eqOR(kind, ENTER, NEXT_LINE)) { //ๅฝ่ฏปๅๅฐ\rๅ \n
String image = input_stream.GetImage().trim();
if (image.length() > 0) {
input_stream.backup(1);
} else {
jjmatchedPos = input_stream.bufpos;
jjmatchedKind = NEXT_LINE;
return 1;
}
return getCommon();
} else if (!continueReader && eqOR(kind, CONTINUE_LINE)) { //ๅฝ่ฏปๅๅฐ็ปญ่ก็ฌฆ \ ๆถ
char c = readChar();
if (c > 0) {
input_stream.backup(1);
}
String temp = c + "";
if (c == 0 || TStringUtil.isBlank(temp)) {
//ๅฆๆ็ปญ่ก็ฌฆๅ้ข็็ฑปๅไธไธบ็ฉบๆถ๏ผ่ฟๅ็ปญ่ก็ฌฆๅ้ข็ๅ
ๅฎน
String image = input_stream.GetImage().trim();
if (image.length() > 1) {
input_stream.backup(1);
return getCommon();
} else {
TTuple2<Boolean, Integer> line = readUtilChar('\n').getData();
int i = line.getSecond() + input_stream.GetImage().length() - 1;
input_stream.tokenBegin += i;
return -1;
}
}
} else if (!continueReader && eqOR(kind, LPAREN, RPAREN, LBRACE, RBRACE, LBRACKET, RBRACKET, SEMICOLON, COMMA,
COLON, HOOK, AT, TILDE)) { //ๅฆๆ่ฏปๅๅฐ ๏ผ ๏ผ{ } [ ] ๏ผ , : ? @ ~
String image = input_stream.GetImage().trim();
if (eqOR(image, SEMICOLON)) { //ๅฆๆๆฏ; ๏ผ็ฅ่ฟ, ๅจ javaไธญไปฃ็ ๅฟ
้ไปฅ;็ปๅฐพ๏ผไฝๆฏๅจ่ๆฌไธญ๏ผๅไธๅ;้ฝไธๅฝฑๅ
input_stream.tokenBegin += 1;
return -1;
}
if (image.length() > 1) {
input_stream.backup(1);
}
return getCommon();
} else if (!continueReader && eqOR(kind, DOT)) { //. ็ๅค็
String image = input_stream.GetImage().trim();
image = image.substring(0, image.length() - 1);
if (TStringUtil.isNumber(image)) { //ๅฆๆๅ้ขๆฏๆฐๅญ๏ผๅ็ปง็ปญ่ฏปๅ
return 0;
}
if (image.length() > 0) {
input_stream.backup(1);
}
return getCommon();
} else if (!continueReader && eqOR(kind, LT)) { //ๅฆๆๆฏ < ๏ผๅฏ่ฝๆฏ<=๏ผ<<=,<< ไธ็งๆ
ๅต
return getSpecial(new char[]{'<'}, '<', '=');
} else if (!continueReader && eqOR(kind, GT)) {//ๅฏ่ฝไผๅบ็ฐ็ๆ
ๅต>=๏ผ>>๏ผ>>>๏ผ>>=๏ผ>>>=
return getSpecial(new char[]{'>'}, '=', '>');
} else if (!continueReader && eqOR(kind, SLASH)) { // / ๅทๅ้ขๅช่ฝๆฅ = ไฝๆฏ๏ผๅฆๆ //,/**... */ ่กจ็คบๆณจ้,ไธ้ขไธป่ฆๆฏๅฏนๆณจ้ๅค็
char c = readChar();
input_stream.backup(1);
if (c == '/') { //่กจ็คบๆณจ้
TTuple2<Boolean, Integer> line = readUtilChar('\n').getData();
if (line.getFirst()) {
input_stream.backup(1);
}
int i = line.getSecond() + input_stream.GetImage().length() - 1;
input_stream.tokenBegin += i;
return -1; //่ฟๅ-1 ่กจ็คบ็ฅ่ฟ ๆ่งฃๆ็ๅญ็ฌฆ , //่กจ็คบๆณจ้
} else if (c == '*') { // /* .... */ ไน่กจ็คบๆณจ้
readChar(); //่ฏปๅๅฝๅ *
int i = input_stream.GetImage().length() - 1;
while (true) {
TTuple2<Boolean, Integer> line = readUtilChar('*').getData();
i += line.getSecond();
char temp = readChar();
if (temp == '/') {
i = i + 1;
break;
}
}
input_stream.tokenBegin += i;
return -1;
}
return getSpecial(null, '=');
} else if (!continueReader && eqOR(kind, ASSIGN)) { // = ,ๅ้ขๅช่ฝๆฅ =,ๅฆ ==๏ผ<=๏ผ<<=๏ผ>=๏ผ>>=๏ผ>>>=๏ผ!=๏ผ+=๏ผ-=๏ผ*=๏ผ/=๏ผ&=๏ผ|=๏ผ^=๏ผ%=
return getSpecial(new char[]{'=', '<', '>', '!', '+', '-', '*', '/', '&', '|', '^', '%'}, '=');
} else if (!continueReader && eqOR(kind, STAR)) { // ! ,* ,^,% ,ๅ้ขๅช่ฝๆฅ =
return getSpecial(new char[]{'*'}, '*', '=');
} else if (!continueReader && eqOR(kind, BANG, XOR, MOD)) { // ! ,* ,^,% ,ๅ้ขๅช่ฝๆฅ =
return getSpecial(null, '=');
} else if (!continueReader && eqOR(kind, PLUS)) { // + ๅทๅ้ข่ฝๆฅ +,= ๆ ๏ผ++ ๅ+= ไธค็งๆ
ๅต
return getSpecial(new char[]{'+'}, '+', '=');
} else if (!continueReader && eqOR(kind, MINUS)) { // - ๅทๅ้ข ๅช่ฝๆฅ - ๆ = ๏ผ็ปๆ -= ๆ--
return getSpecial(new char[]{'-'}, '-', '=');
} else if (!continueReader && eqOR(kind, AND)) { // & ๅ้ขๅช่ฝๆฅ & ๆ =
return getSpecial(new char[]{'&'}, '&', '=');
} else if (!continueReader && eqOR(kind, OR)) { // | ๅ้ขๅช่ฝๆฅ | ๆ =
return getSpecial(new char[]{'|'}, '|', '=');
} else if (eqOR(kind, DOUBLE_QUOT, SINGLE_QUOT)) { // " ๅๅผๅทๅค็,' ๅๅผๅทๅค็
if (continueReader && eqOR(kind, curKind)) {
input_stream.backup(2);
char c = readChar();
readChar();
if (c == '\\') {//่กจ็คบ็ปง็ปญ
return 0;
}
continueReader = !continueReader;
curKind = "";
int position = getCommon();
jjmatchedKind = STR;
return position;
}
if (!continueReader) {
continueReader = !continueReader;
curKind = kind;
}
} else if (eqOR(kind, EOF)) {
jjmatchedKind = EOF;
return 1;
}
return 0;
}
public int getSpecial(char[] preMatches, char... afterMatches) {
String image = input_stream.GetImage().trim();
image = image.substring(0, image.length() - 1);
boolean preFlag = true;
if (preMatches != null && preMatches.length > 0) {
for (char m : preMatches) {
String temp = image; // ๅฆ <<= ็ๆ
ๅต๏ผ่ฏปๅๅฐๆๅไธไธช็ญไบ็ฌฆๅทๆถ
if (TStringUtil.isNotBlank(temp) && temp.trim().length() > 0) {
temp = temp.substring(temp.length() - 1);
}
if (eq(temp, m + "")) {
preFlag = false;
break;
}
}
}
if (image.length() > 0 && preFlag) {
input_stream.backup(1);
return getCommon();
} else {
char c = readChar();
if (c > 0) {
input_stream.backup(1);
} else {
return getCommon();
}
boolean flag = true;
for (char m : afterMatches) {
if (c == m) {
flag = false;
break;
}
}
if (flag) {
return getCommon();
}
}
return 0;
}
public char readChar() {
try {
return input_stream.readChar();
} catch (IOException e) {
}
return 0;
}
public TSHTuple readUtilChar(char compare) {
int i = 0;
while (true) {
try {
char c = input_stream.readChar();
++i;
if (c == compare) {
return new TSHTuple(true, i);
}
} catch (IOException e) {
return new TSHTuple(false, i);
}
}
}
public int getCommon() {
String image = input_stream.GetImage().trim();
if (TStringUtil.isNotBlank(image)) { //่กจๆๅ้ขๆ้็ฉบๆ ผ๏ผtab๏ผ็ๅญ็ฌฆ
// ๅฆ image = for ,ๅๆไปฌ็ๅ
ณ้ฎๅญ for ๅน้
ไธไบ๏ผๅ match = for
String match = matchs(image.trim().toCharArray());
jjmatchedPos = input_stream.bufpos;
if (TStringUtil.isNotBlank(match)) {
jjmatchedKind = match; //่ฎพ็ฝฎ ๅน้
ๅฐ็็ฑปๅ
} else {
if (TStringUtil.isNumber(image)) { //ๅคๆญๅฝๅๅญ็ฌฆไธฒๆฏไธๆฏๆฐๅญ็ฑปๅ
jjmatchedKind = NUMBER;
} else {
jjmatchedKind = IDENTIFIER; //ๅฆๆๆขไธๆฏๅ
ณ้ฎๅญ็ฑปๅ๏ผไน่ฟๆฏๆฐๅญ็ฑปๅ๏ผๅๅช่ฝๆฏidentifier็ฑปๅไบ
}
}
return 2;
}
return 0;
}
public static String matchs(char[] buffer) {
List<Integer> locations = new ArrayList<>();
for (int i = 0; i < type.size(); i++) {
locations.add(i);
}
int flag = 0;
for (char buf : buffer) {
int a = (int) buf;
if (a == 0) {
break;
}
if (TStringUtil.isBlank(buf + "")) {
continue;
}
List<Integer> tempLocations = new ArrayList<>();
for (int i : locations) {
if (type.get(i).length > flag && type.get(i)[flag] == buf) {
tempLocations.add(i);
}
}
locations = tempLocations;
flag++;
}
int mini = -1;
for (int i : locations) {
if (type.get(i).length == buffer.length) {
mini = i;
}
}
StringBuilder sb = new StringBuilder();
if (mini > -1) {
char a[] = type.get(mini);
for (char b : a) {
sb.append(b);
}
}
return sb.toString();
}
public static void main(String[] args) {
char[] a = {'&'};
String b = matchs(a);
System.out.println(b);
StringBuilder sb = new StringBuilder();
for (char[] t : type) {
sb.append(t).append(" , ");
}
System.out.println(sb);
}
public int jjMoveStringLiteralDfa0_0() {
while (true) {
try {
int flag = 0;
if (curChar == '\t') { //ๅฆๆๆฏ TAB ็ฑปๅ
flag = jjStartNfaWithStates_0(TAB);
} else if (curChar == ' ') { //ๅฆๆๆฏ ็ฉบๆ ผ ็ฑปๅ
flag = jjStartNfaWithStates_0(SPACE);
} else if (curChar == '\r') { //ๅฆๆๆฏ ๅ่ฝฆ ็ฑปๅ
flag = jjStartNfaWithStates_0(ENTER);
} else if (curChar == '\n') { //ๅฆๆๆฏๆข่ก็ฌฆ
flag = jjStartNfaWithStates_0(NEXT_LINE);
} else if ((curChar >= 48 && curChar <= 57)
|| (curChar >= 65 && curChar <= 90)
|| (curChar >= 97 && curChar <= 122)) { //ๅฆๆๆฏ a~z,A~Z,0~9 ไธ็งๆ
ๅต๏ผ่กจ็คบๆฏๅญ้ข้็ฑปๅ
flag = jjStartNfaWithStates_0(IDENTIFIER);
} else {//@,[,\,],^,_,`,!,",#,$,%,&,',(,),*,+,-,.,/,:,;,{,<,|,=,},>,~,? ็ฑปๅ
flag = jjStartNfaWithStates_0(mapChar.get(new Integer(curChar)));
}
if (flag > 0) { //ๅฆๆ flag > 0 ๏ผ่กจ็คบๆฌๆฌก่ฏปๅ็ปๆ ๏ผๅฆ่ฏปๅๅฐ for ไบ
return input_stream.bufpos + 1;
}
if (flag == -1) { // ๅฝ่ฏปๅๅฐ็ปญ่ก็ฌฆ \ ๆถ๏ผ่กจ็คบไธ่ฆ่ฟๅ๏ผ็ปง็ปญ่ฏปๅ
return -1;
}
curChar = input_stream.readChar(); //็ปง็ปญๅๅ่ฏปๅไธไธชๅญ็ฌฆ
} catch (IOException e) {
jjStartNfaWithStates_0(SPACE);
return input_stream.bufpos + 1;
} catch (Exception e) {
e.printStackTrace();
return input_stream.bufpos + 1;
}
}
}
}
| true
|
cc1b7e0c35807514c5737a11126778402f05be9a
|
Java
|
STAMP-project/dspot-experiments
|
/benchmark/training/reactor/core/publisher/FluxSkipWhileTest.java
|
UTF-8
| 4,553
| 2.09375
| 2
|
[] |
no_license
|
/**
* Copyright (c) 2011-2017 Pivotal Software 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 reactor.core.publisher;
import Scannable.Attr.ACTUAL;
import Scannable.Attr.PARENT;
import Scannable.Attr.TERMINATED;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.reactivestreams.Subscription;
import reactor.core.CoreSubscriber;
import reactor.test.StepVerifier;
import reactor.test.publisher.FluxOperatorTest;
import reactor.test.subscriber.AssertSubscriber;
public class FluxSkipWhileTest extends FluxOperatorTest<String, String> {
@Test(expected = NullPointerException.class)
public void sourceNull() {
new FluxSkipWhile(null, ( v) -> true);
}
@Test(expected = NullPointerException.class)
public void predicateNull() {
Flux.never().skipWhile(null);
}
@Test
public void skipNone() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Flux.range(1, 5).skipWhile(( v) -> false).subscribe(ts);
ts.assertValues(1, 2, 3, 4, 5).assertComplete().assertNoError();
}
@Test
public void skipNoneBackpressured() {
AssertSubscriber<Integer> ts = AssertSubscriber.create(0);
Flux.range(1, 5).skipWhile(( v) -> false).subscribe(ts);
ts.assertNoValues().assertNoError().assertNotComplete();
ts.request(2);
ts.assertValues(1, 2).assertNoError().assertNotComplete();
ts.request(10);
ts.assertValues(1, 2, 3, 4, 5).assertComplete().assertNoError();
}
@Test
public void skipSome() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Flux.range(1, 5).skipWhile(( v) -> v < 3).subscribe(ts);
ts.assertValues(3, 4, 5).assertComplete().assertNoError();
}
@Test
public void skipSomeBackpressured() {
AssertSubscriber<Integer> ts = AssertSubscriber.create(0);
Flux.range(1, 5).skipWhile(( v) -> v < 3).subscribe(ts);
ts.assertNoValues().assertNoError().assertNotComplete();
ts.request(2);
ts.assertValues(3, 4).assertNoError().assertNotComplete();
ts.request(10);
ts.assertValues(3, 4, 5).assertComplete().assertNoError();
}
@Test
public void skipAll() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Flux.range(1, 5).skipWhile(( v) -> true).subscribe(ts);
ts.assertNoValues().assertComplete().assertNoError();
}
@Test
public void skipAllBackpressured() {
AssertSubscriber<Integer> ts = AssertSubscriber.create(0);
Flux.range(1, 5).skipWhile(( v) -> true).subscribe(ts);
ts.assertNoValues().assertNoError().assertNotComplete();
ts.request(2);
ts.assertNoValues().assertComplete().assertNoError();
}
@Test
public void predicateThrows() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Flux.range(1, 5).skipWhile(( v) -> {
throw new RuntimeException("forced failure");
}).subscribe(ts);
ts.assertNoValues().assertNotComplete().assertError(RuntimeException.class).assertErrorMessage("forced failure");
}
@Test
public void aFluxCanBeSkippedWhile() {
StepVerifier.create(Flux.just("test", "test2", "test3").skipWhile("test"::equals)).expectNext("test2", "test3").verifyComplete();
}
@Test
public void scanSubscriber() {
CoreSubscriber<Integer> actual = new LambdaSubscriber(null, ( e) -> {
}, null, null);
FluxSkipWhile.SkipWhileSubscriber<Integer> test = new FluxSkipWhile.SkipWhileSubscriber<>(actual, ( i) -> true);
Subscription parent = Operators.emptySubscription();
test.onSubscribe(parent);
Assertions.assertThat(test.scan(PARENT)).isSameAs(parent);
Assertions.assertThat(test.scan(ACTUAL)).isSameAs(actual);
Assertions.assertThat(test.scan(TERMINATED)).isFalse();
test.onComplete();
Assertions.assertThat(test.scan(TERMINATED)).isTrue();
}
}
| true
|
90b7bfd206b014944dda27ea577840e56a8e1208
|
Java
|
AyaYoru/AndroidStudio-RandomNumber-9
|
/android_num9_RandomNumber/app/src/main/java/com/example/android_num9_randomnumber/MainActivity.java
|
UTF-8
| 4,274
| 2.25
| 2
|
[] |
no_license
|
package com.example.android_num9_randomnumber;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn1 = (Button)findViewById(R.id.number1);
btn1.setOnClickListener(clickNum1);
Button btn2 = (Button)findViewById(R.id.number2);
btn2.setOnClickListener(clickNum2);
Button btn3 = (Button)findViewById(R.id.number3);
btn3.setOnClickListener(clickNum3);
Button btn4 = (Button)findViewById(R.id.number4);
btn4.setOnClickListener(clickNum4);
Button btn5 = (Button)findViewById(R.id.number5);
btn5.setOnClickListener(clickNum5);
Button btn6 = (Button)findViewById(R.id.number6);
btn6.setOnClickListener(clickNum6);
Button btn7 = (Button)findViewById(R.id.number7);
btn7.setOnClickListener(clickNum7);
Button btn8 = (Button)findViewById(R.id.number8);
btn8.setOnClickListener(clickNum8);
Button btn9 = (Button)findViewById(R.id.number9);
btn9.setOnClickListener(clickNum9);
Button btn_re = (Button)findViewById(R.id.Restart);
btn_re.setOnClickListener(clickRestart);
}
private View.OnClickListener clickNum1 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("1");
}
};
private View.OnClickListener clickNum2 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("2");
}
};
private View.OnClickListener clickNum3 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("3");
}
};
private View.OnClickListener clickNum4 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("4");
}
};
private View.OnClickListener clickNum5 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("5");
}
};
private View.OnClickListener clickNum6 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("6");
}
};
private View.OnClickListener clickNum7 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("7");
}
};
private View.OnClickListener clickNum8 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("8");
}
};
private View.OnClickListener clickNum9 = new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView number = (TextView)findViewById(R.id.setNumber);
number.setText("9");
}
};
private View.OnClickListener clickRestart = new View.OnClickListener() {
@Override
public void onClick(View v) {
int count = 0;
}
};
public void clickOut(View v){
TextView number = (TextView)findViewById(R.id.setNumber);
Intent intent = new Intent(this, SecondActivity.class);
Bundle bundle = new Bundle();
bundle.putString("NUM", number.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
}
}
| true
|
cfe0631aef3fd81d19d17228701b4792dcad8cd6
|
Java
|
jmad/aloha
|
/src/java/cern/accsoft/steering/aloha/calc/variation/VariationDataImpl.java
|
UTF-8
| 6,194
| 2.453125
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
* $Id: VariationDataImpl.java,v 1.2 2009-03-16 16:38:11 kfuchsbe Exp $
*
* $Date: 2009-03-16 16:38:11 $ $Revision: 1.2 $ $Author: kfuchsbe $
*
* Copyright CERN, All Rights Reserved.
*/
package cern.accsoft.steering.aloha.calc.variation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author kfuchsbe
*/
public class VariationDataImpl implements VariationData {
private final static Logger LOGGER = LoggerFactory.getLogger(VariationDataImpl.class);
/** the additional parameters which will be varied during fitting */
private Map<String, VariationParameter> variationParameters = new LinkedHashMap<>();
/** the variation parameters which are not varied in the current fitting. */
private Map<String, VariationParameter> fixedVariationParameters = new LinkedHashMap<>();
/** the listeners to this data */
private List<VariationDataListener> listeners = new ArrayList<>();
@Override
public void addVariationParameter(VariationParameter parameter) {
variationParameters.put(parameter.getKey(), parameter);
fireChangedVariationParameters();
}
@Override
public VariationParameter getVariationParameter(String key) {
return variationParameters.get(key);
}
@Override
public List<Double> getVariationParameterInitialValues() {
ArrayList<Double> values = new ArrayList<>();
for (VariationParameter param : variationParameters.values()) {
values.add(param.getActiveMeasurementInitialValue());
}
return values;
}
@Override
public List<Double> getVariationParameterValues() {
ArrayList<Double> values = new ArrayList<>();
for (VariationParameter param : variationParameters.values()) {
values.add(param.getActiveMeasurementAbsoluteValue());
}
return values;
}
@Override
public List<Double> getVariationParameterValueErrors() {
ArrayList<Double> errors = new ArrayList<>();
for (VariationParameter param : variationParameters.values()) {
errors.add(param.getError());
}
return errors;
}
@Override
public List<VariationParameter> getVariationParameters() {
return new ArrayList<>(variationParameters.values());
}
@Override
public void removeVariationParameter(String key) {
VariationParameter parameter = getVariationParameter(key);
if (parameter == null) {
return;
}
parameter.reset();
variationParameters.remove(key);
fixedVariationParameters.remove(key);
fireChangedVariationParameters();
}
@Override
public ArrayList<String> getVariationParameterNames() {
ArrayList<String> names = new ArrayList<>();
for (VariationParameter param : variationParameters.values()) {
names.add(param.getName());
}
return names;
}
@Override
public void reset() {
for (VariationParameter parameter : variationParameters.values()) {
parameter.reset();
}
for (VariationParameter parameter : fixedVariationParameters.values()) {
parameter.reset();
}
}
@Override
public int getVariationParametersCount() {
return this.variationParameters.size();
}
/**
* notifies all listeners, that the number of variation parameters have changed.
*/
private void fireChangedVariationParameters() {
for (VariationDataListener listener : listeners) {
listener.changedVariationParameters();
}
}
@Override
public void addListener(VariationDataListener listener) {
this.listeners.add(listener);
}
@Override
public void removeListener(VariationDataListener listener) {
this.listeners.remove(listener);
}
@Override
public void fixVariationParameter(String key) {
moveParameter(key, this.variationParameters, this.fixedVariationParameters);
}
@Override
public void unfixVariationParameter(String key) {
moveParameter(key, this.fixedVariationParameters, this.variationParameters);
}
@Override
public List<VariationParameter> getFixedVariationParameters() {
return new ArrayList<>(this.fixedVariationParameters.values());
}
/**
* moves the variation parameter of the given key from one map to the other.
*
* @param key
* @param source
* @param dest
*/
private void moveParameter(String key, Map<String, VariationParameter> source, Map<String, VariationParameter> dest) {
VariationParameter parameter = source.get(key);
if (parameter == null) {
LOGGER.warn("No variation parameter with the key '" + key + "' found.");
return;
}
source.remove(key);
dest.put(key, parameter);
fireChangedVariationParameters();
}
@Override
public List<Double> getVariationParameterChanges() {
ArrayList<Double> changes = new ArrayList<>();
for (VariationParameter param : variationParameters.values()) {
changes.add(param.getOffsetChange());
}
return changes;
}
@Override
public List<Double> getVariationParameterRelativeChanges() {
ArrayList<Double> changes = new ArrayList<>();
for (VariationParameter param : variationParameters.values()) {
changes.add(param.getActiveMeasurementRelativeChange());
}
return changes;
}
@Override
public List<Double> getVariationParameterRelativeErrors() {
ArrayList<Double> errors = new ArrayList<>();
for (VariationParameter param : variationParameters.values()) {
Double initialValue = param.getActiveMeasurementInitialValue();
if ((initialValue != null) && (Math.abs(initialValue) > 1e-8)) {
errors.add(param.getError() / initialValue);
} else {
errors.add(0.0);
}
}
return errors;
}
}
| true
|
ddd9123f6aa63052636a2158afa69353152d1345
|
Java
|
suprajaLara/snistForum
|
/app/src/main/java/jag/chintu/shiva/forum/Cse4sub.java
|
UTF-8
| 4,196
| 2.375
| 2
|
[] |
no_license
|
package jag.chintu.shiva.forum;
//import android.support.v7.app.*;
import java.util.*;
import android.os.*;
//import android.support.v7.widget.*;
import android.view.*;
import android.content.*;
import android.widget.*;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class Cse4sub extends AppCompatActivity
{
private SubjectsAdapter mAdapter;
private List<Subjects> movieList;
private RecyclerView recyclerView;
public Cse4sub() {
this.movieList = new ArrayList<Subjects>();
}
private void prepareMovieData() {
this.movieList.add(new Subjects("SOFTWARE TESING(ST)"));
this.movieList.add(new Subjects("MANAGEMENT SCIENCE(MS)"));
this.movieList.add(new Subjects("MOBILE COMPUTING(MC)"));
this.movieList.add(new Subjects("DATA MINING & DATA WAREHOUSE(DWDM)"));
this.movieList.add(new Subjects("ENVIRONMENTAL STUDIES(ES)"));
this.movieList.add(new Subjects("Culture, Values,Professional Ethics and IPR(CVIPR)"));
this.movieList.add(new Subjects("ADVANCED COMPUTER ARCHITECTURE(ACA)"));
this.movieList.add(new Subjects("SCRIPTING LANGUAGE(SL)"));
this.movieList.add(new Subjects("CLOUD COMPUTING(CC)"));
((RecyclerView.Adapter)this.mAdapter).notifyDataSetChanged();
}
@Override
protected void onCreate(final Bundle bundle) {
super.onCreate(bundle);
this.setContentView(R.layout.activity_cse3sub);
this.recyclerView = (RecyclerView)this.findViewById(R.id.recycler_view);
this.mAdapter = new SubjectsAdapter(this.movieList);
this.recyclerView.setLayoutManager((RecyclerView.LayoutManager)new LinearLayoutManager(this.getApplicationContext()));
this.recyclerView.setItemAnimator((RecyclerView.ItemAnimator)new DefaultItemAnimator());
this.recyclerView.setAdapter((RecyclerView.Adapter)this.mAdapter);
this.recyclerView.addOnItemTouchListener((RecyclerView.OnItemTouchListener)new SubjectsItemClickListener(this.getApplicationContext(), this.recyclerView, (SubjectsItemClickListener.OnItemClickListener)new SubjectsItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(final View view, final int n) {
if (n == 0) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)St.class));
}
else if (n == 1) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Ms.class));
}
else if (n == 2) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Mc.class));
}
else if (n == 3) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Dwdm.class));
}
else if (n == 4) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Es.class));
}
else if (n == 5) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Cvipr.class));
}
else if (n == 6) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Aca.class));
}
else if (n == 7) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Sl.class));
}
else if (n == 8) {
Cse4sub.this.startActivity(new Intent((Context)Cse4sub.this, (Class)Cc.class));
}
else {
Toast.makeText(Cse4sub.this.getApplicationContext(), (CharSequence)"Notes related to this subject will be uploaded soon!", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onLongItemClick(final View view, final int n) {
}
}));
this.prepareMovieData();
}
}
| true
|
b193620e1ecc872d2741d6eb6079df7d82750212
|
Java
|
amitayansh/JavaFundamentals
|
/src/com/amitclive/fundamentals/Example47.java
|
UTF-8
| 784
| 3.171875
| 3
|
[] |
no_license
|
package com.amitclive.fundamentals;
public class Example47 {
public static void main(String[] args) {
char ch1 ='A';
// char ch2 =+ch1; Compilation Error: Type mismatch: cannot convert from int to char
char ch2 =(char) +ch1;
int a =+ch1;
double d1 =1234.567;
double d2 =-d1;
double d3 =+d1;
byte b1 =12;
byte b2 = 23;
int a3 =b1+b2;
// byte b3 =b1+b2; Compilation error:Type mismatch: cannot convert from int to byte
byte b3 =(byte) (b1+b2);
System.out.println(ch1);
System.out.println(ch2);
System.out.println(d1);
System.out.println(d2);
System.out.println(d3);
System.out.println(b1);
System.out.println(b2);
System.out.println(a3);
}
}
| true
|
45e537a0d82ddfb8cbdee3297ce03b385c40adf9
|
Java
|
szkuwamac/hcables
|
/common/szkuwa/hcables/tileentity/renderer/TESRCableHook.java
|
UTF-8
| 10,696
| 2.046875
| 2
|
[
"MIT"
] |
permissive
|
package szkuwa.hcables.tileentity.renderer;
import java.util.Iterator;
import org.lwjgl.opengl.GL11;
import szkuwa.hcables.HCables;
import szkuwa.hcables.item.ItemCable;
import szkuwa.hcables.tileentity.TileEntityGenericCableHook;
import szkuwa.hcables.utils.CableConnectionType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class TESRCableHook extends TileEntitySpecialRenderer{
private IModelCustom model;
private ResourceLocation texture;
private IModelCustom lightbulb;
private ResourceLocation texL1;
private ResourceLocation texL2;
public TESRCableHook(){
model = AdvancedModelLoader.loadModel(new ResourceLocation("hcables", "models/stone_cube.obj"));
texture = new ResourceLocation("hcables", "textures/blocks/stone.png");
lightbulb = AdvancedModelLoader.loadModel(new ResourceLocation("hcables", "models/lightbulb.obj"));
texL1 = new ResourceLocation("hcables", "textures/blocks/bedrock.png");
texL2 = new ResourceLocation("hcables", "textures/blocks/glass_orange.png");
}
private double getSideAdjustmentX(int side){
switch (side){
case 2: return 0.5;
case 3: return 0.5;
case 4: return 0.8;
case 5: return 0.2;
default: return 0;
}
}
private double getSideAdjustmentY(int side){
switch (side){
case 2: return 0.3;
case 3: return 0.3;
case 4: return 0.3;
case 5: return 0.3;
default: return 0;
}
}
private double getSideAdjustmentZ(int side){
switch (side){
case 2: return 0.8;
case 3: return 0.2;
case 4: return 0.5;
case 5: return 0.5;
default: return 0;
}
}
private void drawHookModel(int side, boolean alpha){ this.drawHookModel(side, 0, 0, 0, alpha); }
private void drawHookModel(int side, double x, double y, double z, boolean alpha){
GL11.glTranslated(x, y, z);
GL11.glTranslated(1, 0, 0);
bindTexture(texture);
boolean wasAlpha = GL11.glIsEnabled(GL11.GL_BLEND);
if (alpha){
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(0, 0, 0, 0.5F);
}
// model specific transformation etc
switch (side){
case 2: {
// north side
GL11.glRotatef(-90F, 0F, 1F, 0F);
GL11.glTranslated(1, 0, 0);
model.renderAll();
bindTexture(texL2);
GL11.glTranslated(-0.22, 0.35, 0.5);
lightbulb.renderAll();
GL11.glTranslated(0.22, -0.35, -0.5);
GL11.glTranslated(-1, 0, 0);
GL11.glRotatef(90F, 0F, 1F, 0F);
break;
}
case 3: {
// south side
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glTranslated(0, 0, -1);
model.renderAll();
bindTexture(texL2);
GL11.glTranslated(-0.22, 0.35, 0.5);
lightbulb.renderAll();
GL11.glTranslated(0.22, -0.35, -0.5);
GL11.glTranslated(0, 0, 1);
GL11.glRotatef(-90F, 0F, 1F, 0F);
break;
}
default:
case 4: {
// west side
// nothing to do
model.renderAll();
bindTexture(texL2);
GL11.glTranslated(-0.22, 0.35, 0.5);
lightbulb.renderAll();
GL11.glTranslated(0.22, -0.35, -0.5);
break;
}
case 5: {
// east side
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glTranslated(1, 0, -1);
model.renderAll();
bindTexture(texL2);
GL11.glTranslated(-0.22, 0.35, 0.5);
lightbulb.renderAll();
GL11.glTranslated(0.22, -0.35, -0.5);
GL11.glTranslated(-1, 0, 1);
GL11.glRotatef(-180F, 0F, -1F, 0F);
}
}
if (alpha && !wasAlpha){
GL11.glDisable(GL11.GL_BLEND);
}
GL11.glTranslated(-1, 0, 0);
GL11.glTranslated(-x, -y, -z);
}
private double getBezierPoint(double t, double p0, double p1, double p2, double p3){
double u = 1 - t;
double uu = u*u;
double uuu = uu*u;
double tt = t*t;
double ttt = tt*t;
double result = p0 * uuu;
result += p1 * 3 * uu * t;
result += p2 * 3 * u * tt;
result += p3 * ttt;
return result;
}
private void drawBezierLine(double p0x, double p0y, double p0z, double p3x, double p3y, double p3z, double gravity, double step){
double px, py, pz;
GL11.glVertex3d(p0x, p0y, p0z);
for (int i = 0; i <= step; i++){
double t = i / step;
px = getBezierPoint(t, p0x, p0x, p3x, p3x);
py = getBezierPoint(t, p0y, p0y-gravity, p3y-gravity, p3y);
pz = getBezierPoint(t, p0z, p0z, p3z, p3z);
GL11.glVertex3d(px, py, pz);
}
GL11.glVertex3d(p3x, p3y, p3z);
}
private double getDistance(double p0x, double p0y, double p0z, double p1x, double p1y, double p1z){
double x = p0x - p1x;
double y = p0y - p1y;
double z = p0z - p1z;
return Math.sqrt(x*x + y*y + z*z);
}
private void drawConnection(TileEntity source, TileEntity destination, boolean alpha){ this.drawConnection(source.getBlockMetadata(), source.xCoord, source.yCoord, source.zCoord, destination.getBlockMetadata(), destination.xCoord, destination.yCoord, destination.zCoord, alpha); }
private void drawConnection(int aside, double ax, double ay, double az, int bside, double bx, double by, double bz, boolean alpha){
double startx = getSideAdjustmentX(aside);
double starty = getSideAdjustmentY(aside);
double startz = getSideAdjustmentZ(aside);
double endx = bx - ax + getSideAdjustmentX(bside);
double endy = by - ay + getSideAdjustmentY(bside);
double endz = bz - az + getSideAdjustmentZ(bside);
GL11.glPushMatrix();
boolean isAlphaTest = GL11.glIsEnabled(GL11.GL_ALPHA_TEST);
float lineWidth = GL11.glGetFloat(GL11.GL_LINE_WIDTH);
boolean isTexture2d = GL11.glIsEnabled(GL11.GL_TEXTURE_2D);
if (isAlphaTest) { GL11.glDisable(GL11.GL_ALPHA_TEST); }
if (isTexture2d) { GL11.glDisable(GL11.GL_TEXTURE_2D); }
GL11.glLineWidth(3F);
boolean wasAlpha = GL11.glIsEnabled(GL11.GL_BLEND);
if (alpha){
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(0, 0, 0, 0.5F);
}
GL11.glBegin(GL11.GL_LINE_STRIP);
// if (this.getDistance(startx, starty, startz, endx, endy, endz) < 10){
GL11.glColor4f(0, 0.1F, 0.1F, 0.5F);
// } else {
// GL11.glColor3f(1F, 0.1F, 0.1F);
// }
this.drawBezierLine(startx, starty, startz, endx, endy, endz, 0.5, 30);
GL11.glEnd();
if (isAlphaTest) { GL11.glEnable(GL11.GL_ALPHA_TEST); }
if (isTexture2d) { GL11.glEnable(GL11.GL_TEXTURE_2D); }
GL11.glLineWidth(lineWidth);
if (alpha && !wasAlpha){
GL11.glDisable(GL11.GL_BLEND);
}
GL11.glPopMatrix();
}
private void drawConnections(TileEntity tileEntity){
if (tileEntity instanceof TileEntityGenericCableHook){
TileEntityGenericCableHook source = (TileEntityGenericCableHook)tileEntity;
Iterator<szkuwa.hcables.utils.CableConnection> it = source.manager.connections.iterator();
while (it.hasNext()){
szkuwa.hcables.utils.CableConnection item = it.next();
TileEntity destination = source.getWorldObj().getTileEntity(item.x, item.y, item.z);
if (destination instanceof TileEntityGenericCableHook && item.type == CableConnectionType.OUTBOUND){
this.drawConnection(source, destination, false);
}
}
}
}
private void drawPlayerConnection(TileEntity tileEntity, float partialTick){
// shit load of sanity checks ahead!
if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().thePlayer != null && !Minecraft.getMinecraft().thePlayer.isDead && tileEntity != null){
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
// lets check what our player is holding in his hand
if (player.inventory != null && player.inventory.getCurrentItem() != null){
ItemStack stack = player.inventory.getCurrentItem();
if (stack.getItem() == HCables.itemCable){
// its our cable!
NBTTagCompound tag = stack.stackTagCompound;
if (tag != null && tag.getBoolean("selected")){
int x = tag.getInteger("x");
int y = tag.getInteger("y");
int z = tag.getInteger("z");
// now we know that player exists, we know he's holding our cable and that the cable has some entity stored...
// lets see if this is our current entity
if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z){
// it is... lets roll
// lets check if our player is "watching" something
MovingObjectPosition mop = player.rayTrace(5, partialTick);
if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit >= 2 && mop.sideHit <= 5){
// he is and he's looking at some kind of block on sides that are supported by our hooks
// so lets try and draw a connection and hook model
// but first translate x/y/z depending on side so we will draw on the surface of the block that we are looking at not inside it
double dx = mop.blockX;
double dy = mop.blockY;
double dz = mop.blockZ;
switch (mop.sideHit){
case 2: { dz--; break; }
case 3: { dz++; break; }
case 4: { dx--; break; }
case 5: { dx++; break; }
}
// lets first check if this place is suitable for our block
if (!HCables.blockCableHook.canPlaceBlockAt(player.worldObj, (int)dx, (int)dy, (int)dz)){
// can't place = can't draw.
return;
}
this.drawHookModel(mop.sideHit, dx - tileEntity.xCoord, dy - tileEntity.yCoord, dz - tileEntity.zCoord, true);
this.drawConnection(tileEntity.getBlockMetadata(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, mop.sideHit, dx, dy, dz, true);
}
}
}
}
}
}
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z); // lets set this so all our draw* will use (0,0,0) as starting point
this.drawHookModel(tileEntity.getBlockMetadata(), false);
this.drawConnections(tileEntity);
this.drawPlayerConnection(tileEntity, partialTick);
GL11.glPopMatrix();
}
}
| true
|
b39e4fb8bf67bb166522825df0c69aa011fb72f2
|
Java
|
AartiGoel11/Eclipse_Programs
|
/ServletAndJSP/JavaProject/src/com/wipro/file/FileExample.java
|
UTF-8
| 472
| 3.015625
| 3
|
[] |
no_license
|
package com.wipro.file;
import java.io.File;
import java.io.IOException;
public class FileExample {
public static void main(String[] args) {
File f = new File("file2.txt");
try {
boolean b= f.createNewFile();
System.out.println("file is created "+b);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String path=f.getAbsolutePath();
System.out.println(path);
System.out.println("File exists..."+f.exists());
}
}
| true
|
9d93d1010f74962e83265a96bb604e4630adf68d
|
Java
|
comradekingu/unity
|
/web-common/src/main/java/pl/edu/icm/unity/webui/common/credentials/SingleCredentialPanel.java
|
UTF-8
| 11,116
| 1.601563
| 2
|
[] |
no_license
|
/*
* Copyright (c) 2013 ICM Uniwersytet Warszawski All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package pl.edu.icm.unity.webui.common.credentials;
import java.util.Collection;
import java.util.Map;
import org.apache.logging.log4j.Logger;
import com.vaadin.shared.ui.ContentMode;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import pl.edu.icm.unity.base.utils.Log;
import pl.edu.icm.unity.engine.api.CredentialManagement;
import pl.edu.icm.unity.engine.api.EntityCredentialManagement;
import pl.edu.icm.unity.engine.api.EntityManagement;
import pl.edu.icm.unity.engine.api.msg.UnityMessageSource;
import pl.edu.icm.unity.engine.api.session.AdditionalAuthenticationMisconfiguredException;
import pl.edu.icm.unity.engine.api.session.AdditionalAuthenticationRequiredException;
import pl.edu.icm.unity.exceptions.EngineException;
import pl.edu.icm.unity.exceptions.IllegalCredentialException;
import pl.edu.icm.unity.types.authn.CredentialDefinition;
import pl.edu.icm.unity.types.authn.CredentialPublicInformation;
import pl.edu.icm.unity.types.authn.CredentialType;
import pl.edu.icm.unity.types.authn.LocalCredentialState;
import pl.edu.icm.unity.types.basic.Entity;
import pl.edu.icm.unity.types.basic.EntityParam;
import pl.edu.icm.unity.webui.authn.additional.AdditionalAuthnHandler;
import pl.edu.icm.unity.webui.authn.additional.AdditionalAuthnHandler.AuthnResult;
import pl.edu.icm.unity.webui.common.CompactFormLayout;
import pl.edu.icm.unity.webui.common.ComponentsContainer;
import pl.edu.icm.unity.webui.common.Images;
import pl.edu.icm.unity.webui.common.NotificationPopup;
import pl.edu.icm.unity.webui.common.credentials.CredentialsPanel.Callback;
import pl.edu.icm.unity.webui.common.safehtml.HtmlConfigurableLabel;
/**
* Single credential editor with credential extra info
* @author P.Piernik
*
*/
public class SingleCredentialPanel extends VerticalLayout
{
private static final Logger log = Log.getLogger(Log.U_SERVER_WEB, SingleCredentialPanel.class);
private EntityCredentialManagement ecredMan;
private EntityManagement entityMan;
private CredentialEditorRegistry credEditorReg;
private CredentialManagement credMan;
private UnityMessageSource msg;
private boolean changed = false;
private Entity entity;
private final long entityId;
private final boolean simpleMode;
private final boolean showButtons;
private HtmlConfigurableLabel credentialName;
private VerticalLayout credentialStatus;
private Button update;
private Button clear;
private Button invalidate;
private CredentialEditor credEditor;
private ComponentsContainer credEditorComp;
private CredentialDefinition toEdit;
private LocalCredentialState credentialState;
private Callback callback;
private final AdditionalAuthnHandler additionalAuthnHandler;
public SingleCredentialPanel(AdditionalAuthnHandler additionalAuthnHandler, UnityMessageSource msg, long entityId,
EntityCredentialManagement ecredMan, CredentialManagement credMan,
EntityManagement entityMan, CredentialEditorRegistry credEditorReg,
CredentialDefinition toEdit, boolean simpleMode, boolean showButtons, Callback callback)
throws Exception
{
this.additionalAuthnHandler = additionalAuthnHandler;
this.msg = msg;
this.ecredMan = ecredMan;
this.credMan = credMan;
this.entityId = entityId;
this.entityMan = entityMan;
this.credEditorReg = credEditorReg;
this.simpleMode = simpleMode;
this.showButtons = showButtons;
this.toEdit = toEdit;
this.callback = callback;
loadEntity(new EntityParam(entityId));
init();
}
private void init() throws Exception
{
credentialName = new HtmlConfigurableLabel();
credentialName.setCaption(msg.getMessage("CredentialChangeDialog.credentialName"));
credentialStatus = new VerticalLayout();
credentialStatus.setMargin(false);
credentialStatus.setCaption(
msg.getMessage("CredentialChangeDialog.credentialStateInfo"));
credEditor = credEditorReg.getEditor(toEdit.getTypeId());
credEditorComp = credEditor.getEditor(CredentialEditorContext.builder()
.withConfiguration(toEdit.getConfiguration())
.withRequired(true)
.withEntityId(entityId)
.withAdminMode(!simpleMode)
.build());
clear = new Button(msg.getMessage("CredentialChangeDialog.clear"));
clear.setIcon(Images.undeploy.getResource());
clear.addClickListener(e -> {
changeCredentialStatus(LocalCredentialState.notSet);
if (callback != null)
callback.refresh();
});
invalidate = new Button(msg.getMessage("CredentialChangeDialog.invalidate"));
invalidate.setIcon(Images.warn.getResource());
invalidate.addClickListener(ne -> {
changeCredentialStatus(LocalCredentialState.outdated);
callback.refresh();
});
update = new Button(msg.getMessage("CredentialChangeDialog.update"));
update.setIcon(Images.save.getResource());
update.addClickListener(e -> {
boolean updated = updateCredential(true);
if (updated && callback != null)
callback.refresh();
});
HorizontalLayout buttonsBar = new HorizontalLayout();
buttonsBar.setSpacing(true);
buttonsBar.setMargin(false);
if (showButtons)
{
if (!simpleMode)
{
buttonsBar.addComponent(clear);
if (isSupportInvalidate(toEdit.getTypeId()))
{
buttonsBar.addComponent(invalidate);
}
}
buttonsBar.addComponent(update);
}
FormLayout fl = new CompactFormLayout(credentialName, credentialStatus);
fl.setMargin(true);
addComponent(fl);
if (!isEmptyEditor())
{
fl.addComponent(new Label());
fl.addComponents(credEditorComp.getComponents());
addComponent(buttonsBar);
}
setSpacing(true);
setMargin(false);
updateCredentialStatus();
}
public AbstractField<?> getFocussedComponent()
{
for (Component component: credEditorComp.getComponents())
if (component instanceof AbstractField<?>)
return (AbstractField<?>) component;
return null;
}
public boolean isChanged()
{
return changed;
}
public boolean isEmptyEditor()
{
return credEditorComp.getComponents().length == 0;
}
private String getStatusIcon()
{
if (credentialState.equals(LocalCredentialState.correct))
return Images.ok.getHtml();
else if (credentialState.equals(LocalCredentialState.notSet))
return Images.undeploy.getHtml();
else
return Images.warn.getHtml();
}
public LocalCredentialState getCredentialState()
{
return credentialState;
}
private boolean isSupportInvalidate(String credType)
{
try
{
Collection<CredentialType> credentialTypes = credMan.getCredentialTypes();
for (CredentialType type : credentialTypes)
{
if (type.getName().equals(credType))
{
return type.isSupportingInvalidation();
}
}
} catch (EngineException e)
{
log.debug("Can not get credential type " + credType, e);
}
return false;
}
private void updateCredentialStatus()
{
String desc = toEdit.getDescription().getValue(msg);
if (desc != null && !desc.isEmpty())
{
credentialName.setValue(desc);
} else
{
credentialName.setValue(toEdit.getName());
}
Map<String, CredentialPublicInformation> s = entity.getCredentialInfo()
.getCredentialsState();
CredentialPublicInformation credPublicInfo = s.get(toEdit.getName());
credentialState = credPublicInfo.getState();
credentialStatus.removeAllComponents();
Label status = new Label(getStatusIcon() + " "
+ msg.getMessage("CredentialStatus."
+ credPublicInfo.getState().toString()));
status.setContentMode(ContentMode.HTML);
credentialStatus.addComponent(status);
ComponentsContainer viewer = credEditor
.getViewer(credPublicInfo.getExtraInformation());
if (viewer == null)
{
credentialStatus.setVisible(false);
} else
{
credentialStatus.addComponents(viewer.getComponents());
credentialStatus.setVisible(true);
}
if (credPublicInfo.getState() == LocalCredentialState.notSet)
{
clear.setEnabled(false);
invalidate.setEnabled(false);
} else if (credPublicInfo.getState() == LocalCredentialState.outdated)
{
clear.setEnabled(true);
invalidate.setEnabled(false);
} else
{
clear.setEnabled(true);
invalidate.setEnabled(true);
}
}
public boolean updateCredential(boolean showSuccess)
{
String secrets;
try
{
secrets = credEditor.getValue();
} catch (IllegalCredentialException e)
{
NotificationPopup.showError(msg
.getMessage("CredentialChangeDialog.credentialUpdateError"),
e.getMessage());
return false;
}
EntityParam entityP = new EntityParam(entity.getId());
try
{
ecredMan.setEntityCredential(entityP, toEdit.getName(), secrets);
} catch (IllegalCredentialException e)
{
credEditor.setCredentialError(e);
return false;
} catch (AdditionalAuthenticationRequiredException additionalAuthn)
{
additionalAuthnHandler.handleAdditionalAuthenticationException(additionalAuthn,
msg.getMessage("CredentialChangeDialog.additionalAuthnRequired"),
msg.getMessage("CredentialChangeDialog.additionalAuthnRequiredInfo"),
this::onAdditionalAuthnForUpdateCredential);
return false;
} catch (AdditionalAuthenticationMisconfiguredException misconfigured)
{
NotificationPopup.showError(msg.getMessage("CredentialChangeDialog.credentialUpdateError"),
msg.getMessage("AdditionalAuthenticationMisconfiguredError"));
return false;
} catch (Exception e)
{
NotificationPopup.showError(msg, msg.getMessage(
"CredentialChangeDialog.credentialUpdateError"), e);
return false;
}
credEditor.setCredentialError(null);
if (showSuccess)
NotificationPopup.showSuccess(msg.getMessage("CredentialChangeDialog.credentialUpdated"), "");
changed = true;
loadEntity(entityP);
updateCredentialStatus();
return true;
}
private void onAdditionalAuthnForUpdateCredential(AuthnResult result)
{
if (result == AuthnResult.SUCCESS)
{
updateCredential(true);
if (callback != null)
callback.refresh();
} else if (result == AuthnResult.ERROR)
{
NotificationPopup.showError(msg.getMessage("CredentialChangeDialog.credentialUpdateError"),
msg.getMessage("CredentialChangeDialog.additionalAuthnFailed"));
credEditor.setCredentialError(null);
} else
{
credEditor.setCredentialError(null);
}
}
private void changeCredentialStatus(LocalCredentialState desiredState)
{
EntityParam entityP = new EntityParam(entity.getId());
try
{
ecredMan.setEntityCredentialStatus(entityP, toEdit.getName(), desiredState);
} catch (Exception e)
{
NotificationPopup.showError(msg, msg.getMessage(
"CredentialChangeDialog.credentialUpdateError"), e);
return;
}
loadEntity(entityP);
updateCredentialStatus();
}
private void loadEntity(EntityParam entityP)
{
try
{
entity = entityMan.getEntity(entityP);
} catch (Exception e)
{
NotificationPopup.showError(msg,
msg.getMessage("CredentialChangeDialog.entityRefreshError"),
e);
}
}
}
| true
|
d8b30f5acc12754ff16e6cffb10d04c3aa83c415
|
Java
|
ljmf00-archive/trabalho-laboratorial-app
|
/app/src/main/java/net/lsferreira/school/trabalholaboratorial/Gabinete.java
|
UTF-8
| 864
| 2.859375
| 3
|
[] |
no_license
|
package net.lsferreira.school.trabalholaboratorial;
import net.lsferreira.school.trabalholaboratorial.Divisao;
import net.lsferreira.school.trabalholaboratorial.identificadores.Funcionario;
import java.util.LinkedList;
public class Gabinete<T extends Funcionario> extends Divisao {
private LinkedList<T> pessoas;
public Gabinete(String nome, boolean porta)
{
this(nome, porta, new LinkedList<T>());
}
public Gabinete(String nome, boolean porta, LinkedList<T> pessoas)
{
super(nome, porta);
this.pessoas = pessoas;
}
public LinkedList<T> getpessoas()
{
return new LinkedList<T>(pessoas);
}
public void adicionar(T pessoa)
{
if(this.pessoas.contains(pessoa)) {
return;
}
pessoas.add(pessoa);
}
public void remover(T pessoa)
{
if(pessoa == null || !pessoas.contains(pessoa)) {
return;
}
pessoas.remove(pessoa);
}
}
| true
|
e15e04d3e6cc2addde6d64d9341324b3985af362
|
Java
|
avelana/intersystems-cache-intellij-plugin
|
/cossupport/src/by/vsu/cacheplugin/service/NamePathGenerator.java
|
UTF-8
| 1,114
| 2.640625
| 3
|
[] |
no_license
|
package by.vsu.cacheplugin.service;
import java.io.File;
/**
* Created by mmaya on 15.04.2014.
*/
public class NamePathGenerator {
public static String createPathFromName(String name, String workspaceURL) {
String filename = name.replace(".", ":");
String[] folders = filename.split(":");
filename = workspaceURL;
for (int i = 0; i < folders.length - 2; i++) {
filename += File.separatorChar + folders[i];
File folder = new File(filename);
folder.mkdir();
}
filename += File.separatorChar + folders[folders.length - 2] + "." + folders[folders.length - 1];
return filename;
}
public static String[] pathToName(String path) {
String name = "", ext = "";
path = path.replace("\\", File.separator);
path = path.substring(path.lastIndexOf(File.separator));
ext = path.substring(path.lastIndexOf(".") + 1);
System.out.println(ext);
name = path.substring(1, path.lastIndexOf("."));
System.out.println(name);
return new String[]{name, ext};
}
}
| true
|
88c24d2a684db4f84cbb2a78a0b47a776916c78a
|
Java
|
eriDam/Java_Tutorials_Review
|
/TutorialJavaReview/src/ConstrPizarraHistoria.java
|
ISO-8859-1
| 1,567
| 4.1875
| 4
|
[] |
no_license
|
/* Los mtodos constuctores son llamados automticamente
* cuando se crea un objeto es la nica vez q es llamado, es especial,
* con diferencias respecto a otros metodos regulares:
* - Tiene el mismo nombre que la clase, no tiene tipo de retorno, No return.
* Es un mtodo que no puede ser llamado,
*/
public class ConstrPizarraHistoria {
//Creamos tres variables instancia
String estatus;
int numeroPregunta;
int puntuacion;
//CREAMOS EL 1ER CONSTRUCTOR DE LA CLASE, LE PODEMOS PASAR ARGUMENTOS
/*El constructor es llamado cuando usamos la plabra clave new, lo que hace
* java cuando se crea un objeto es localizar memoria
* para el objeto, despus inicializa las variables instancia de ese Objeto y
* despus llama al mtodo Constructor de la clase*/
public ConstrPizarraHistoria(String entrada1, int entrada2, int entrada3) {
//Damos un valor a las 3 variables q hemos creado antes, de modo que estatus=al parametro pasado String entrada1, numeroPreg=parametro2 int entrada2...
estatus = entrada1;
numeroPregunta = entrada2;
puntuacion = entrada3;
}
//Para poder probarlo creamos un mtodo main, y dentro de nuestro metodo vamos a crear un objeto de nuestra Pizarra
public static void main(String[] args) {
ConstrPizarraHistoria grecia = new ConstrPizarraHistoria("activa", 3, 6);
System.out.println("Los valores de nuetsras variables son: ");
System.out.println(grecia.estatus);
System.out.println(grecia.numeroPregunta);
System.out.println(grecia.puntuacion);
}
}
| true
|
326b72282eb5dd16aabe1b26f505196c8273cc76
|
Java
|
daviddaw/18-TerceraApuntes
|
/18 Tercera Evaluacion Apuntes , Enunciados , ejemplos y soluciones/jefesYObreros/conArrayList_Vector_Comparable_comparator/Jefe.java
|
UTF-8
| 1,431
| 3.34375
| 3
|
[] |
no_license
|
package conArrayList_Vector_Comparable_comparator;
import java.util.ArrayList;
public class Jefe extends Empleado {
static int autonumerico2;
ArrayList<Obrero> listaObreros;
public Jefe() {
super();
this.listaObreros= new ArrayList<Obrero>();
}
public ArrayList<Obrero> getListaObreros() {
return listaObreros;
}
public void setListaObreros(ArrayList<Obrero> listaObreros) {
this.listaObreros = listaObreros;
}
@Override
public String toString() {
return "Jefe [listaObreros=" + listaObreros + ", getNombre()=" + getNombre() + ", getEdad()=" + getEdad()
+ ", getSueldo()=" + getSueldo() + ", getCodigo()=" + getCodigo() + "]";
}
public void insertarEnArray(Obrero o) {
listaObreros.add(o);
}
@Override
public String generadorCodigo() {
return "J"+autonumerico2;
}
public void recorrerListaJefeMostrarNombreDeEmpleados() {
for (int i = 0; i < listaObreros.size(); i++) {
System.out.println(listaObreros.get(i).getNombre());
}
}
public void quitarJefeDelEmpleado() {
for (int i = 0; i < listaObreros.size(); i++) {
listaObreros.get(i).setJefe(null);
}
}
public void borrarDeListaDeJefe(Obrero oAux) {
for (int i = 0; i < listaObreros.size(); i++) {
if (listaObreros.get(i).equals(oAux)) {//hace falta hacer el equals?
listaObreros.remove(oAux);
}
}
}
}
| true
|
5da2f584a690fef1e9c2dd0e52243a0e39a4af3b
|
Java
|
ronakpanchal/LeetcodePractice
|
/src/com/leetcode/problems/MostFrequentSubsetSum.java
|
UTF-8
| 1,609
| 2.9375
| 3
|
[] |
no_license
|
package com.leetcode.problems;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
public class MostFrequentSubsetSum {
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
Queue<Integer> q = new PriorityQueue<Integer>(new Comparator<Integer>(){
public int compare(Integer a, Integer b) {
return map.get(b) - map.get(a);
}
});
public int[] findFrequentTreeSum(TreeNode root) {
generateAllSum(root);
int max = Integer.MIN_VALUE;
List<Integer> result = new ArrayList<Integer>();
Iterator<Integer> itr = map.keySet().iterator();
while (itr.hasNext()) q.add(itr.next());
while (!q.isEmpty()) {
int sum = q.poll();
if (max == Integer.MIN_VALUE) {
max = map.get(sum);
} else {
if (map.get(sum) != max) break;
}
result.add(sum);
}
int[] arr = new int[result.size()];
for (int i = 0;i < arr.length;i++) arr[i] = result.get(i);
return arr;
}
private void generateAllSum (TreeNode root) {
if (root == null) return;
generateAllSum(root.left);
generateAllSum(root.right);
int sum = root.val;
if (root.left != null) sum += root.left.val;
if (root.right != null) sum += root.right.val;
root.val = sum;
map.put(sum, map.getOrDefault(sum, 0) + 1);
}
}
| true
|
fa39ef02d42925d6d8fb595af1eb23cf34052345
|
Java
|
kwes18/HouseCmdState
|
/BlindClosed.java
|
UTF-8
| 800
| 3.375
| 3
|
[] |
no_license
|
/**
*
* @author Kayla Weselowski
* concrete state for blinds
* sets new state after up is called
* other commands print msgs
*/
public class BlindClosed implements BlindState {
Blind blind;
public BlindClosed(Blind newBlind) {
blind = newBlind;
}
@Override
public void fullyOpen() {
System.out.println("...blind is fully closed. Press up to open.");
}
@Override
public void fullyClosed() {
System.out.println("...sensor dectects blind is fully open.");
}
@Override
public void up() {
System.out.println("...blind is opening.");
blind.setState(blind.getOpeningState());
}
@Override
public void down() {
System.out.println("...blind is fully closed.");
}
public String toString() {
return "fully closed";
}
}
| true
|
f8f7268797789bc109871326d0f93d8dca81324e
|
Java
|
madsharm/search-target-case-study
|
/src/main/java/edu/search/rs/SearchRestService.java
|
UTF-8
| 1,790
| 2.109375
| 2
|
[] |
no_license
|
package edu.search.rs;
import edu.search.app.search.Search;
import edu.search.engine.SearcherFactory;
import edu.search.exception.InvalidSearchModeException;
import edu.search.vo.TimedSearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.*;
@RestController
@ComponentScan(basePackages = {"edu.search"})
@SpringBootApplication
public class SearchRestService {
@Autowired
Search search;
@RequestMapping(value= "/", method = RequestMethod.GET, produces = "application/json")
String index() {
return "Invoke endpoint as /search/{simple/indexed}/{string/regex(ab*/*ab/*ab*)}";
}
@RequestMapping(value = "/search/{mode}/{term}" , method = RequestMethod.GET, produces = "application/json")
TimedSearchResult search(@PathVariable(name = "mode") String mode, @PathVariable(name = "term") String term) {
SearcherFactory.MODE searchMode = SearcherFactory.MODE.getMode(mode);
if (searchMode == null) {
throw new InvalidSearchModeException("Invalid search mode " + searchMode);
}
return search.search(term, searchMode);
}
@RequestMapping(value = "/search" , method = RequestMethod.POST, produces = "application/json")
TimedSearchResult search(@RequestBody SearchRequest searchRequest) {
return search(searchRequest.getMode(), searchRequest.getTerm());
}
public static void main(String[] args) {
SpringApplication.run(SearchRestService.class, args);
}
}
| true
|
4cc347ad761db2e26f3bb9ee5efc309d5daa33ce
|
Java
|
bellmit/micro-service
|
/micro-service/mt-core/mt-core-1.0.0/src/main/java/com/ly/mt/core/common/dict/CouponUseTypeEnum.java
|
UTF-8
| 538
| 2.484375
| 2
|
[] |
no_license
|
package com.ly.mt.core.common.dict;
/**
* ไผๆ ๅธไฝฟ็จ็ถๆๆไธพ็ฑป
*
* @author zhanglifeng
* @date 2019-05-22
*/
public enum CouponUseTypeEnum {
COUPON_NOT_USED("1", "ไฝฟ็จ็ถๆไธบๆชไฝฟ็จ"),
COUPON_USED("2", "ไฝฟ็จ็ถๆไธบๅทฒไฝฟ็จ");
private final String id;
private final String name;
public String getId() {
return id;
}
public String getName() {
return name;
}
CouponUseTypeEnum(String id, String name) {
this.id = id;
this.name = name;
}
}
| true
|
0bda33637bb80e5a7af7a9417c694a50eb64e9d6
|
Java
|
MinSeob-Lee/JHTA
|
/oop7/Lotto.java
|
UTF-8
| 1,093
| 3.78125
| 4
|
[] |
no_license
|
package oop7;
import java.util.Arrays;
public class Lotto {
private int[] lottoNumbers = new int[6];
private int position = 0;
// ์ ์ฒด๊ณต๊ฐ๋ ๋ฉ์๋
public int[] generateNumbers() {
clearLottoNumbers();
while (true) {
int number = (int) (Math.random() * 45 + 1);
boolean duplicationChecked = isExist(number);
if (!duplicationChecked) {
lottoNumbers[position] = number;
position++;
}
if (position == 6) {
break;
}
}
// ๋ฐฐ์ด ๋ด์ ์ ์ฅ๋ ์ซ์๋ฅผ ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌํ๊ธฐ
Arrays.sort(lottoNumbers);
return lottoNumbers;
}
// ๋ด๋ถ์ ์ผ๋ก๋ง ์ฌ์ฉ๋๋ ๋ฉ์๋
private void clearLottoNumbers() {
for (int i = 0; i < lottoNumbers.length; i++) {
lottoNumbers[i] = 0;
}
position = 0;
}
// ๋ด๋ถ์ ์ผ๋ก๋ง ์ฌ์ฉ๋๋ ๋ฉ์๋
private boolean isExist(int number) {
boolean result = false;
for (int i = 0; i < lottoNumbers.length; i++) {
if (number == lottoNumbers[i]) {
result = true;
break;
}
}
return result;
}
}
| true
|
f51d9741c0af9bc54c51968b9ce82530b6ade482
|
Java
|
shengqh/projecttrace
|
/src/main/java/edu/vanderbilt/cqs/dao/ProjectTaskStatusDAOImpl.java
|
UTF-8
| 281
| 1.515625
| 2
|
[] |
no_license
|
package edu.vanderbilt.cqs.dao;
import org.springframework.stereotype.Repository;
import edu.vanderbilt.cqs.bean.ProjectTaskStatus;
@Repository
public class ProjectTaskStatusDAOImpl extends GenericDAOImpl<ProjectTaskStatus, Long>
implements ProjectTaskStatusDAO {
}
| true
|
df48f8a4a80dca79821e7201d5b33444ec5360c8
|
Java
|
niemp296/Project-Based-Object-Oriented-Programming-and-Design
|
/Assn1/java/Functions.java
|
UTF-8
| 1,515
| 2.75
| 3
|
[] |
no_license
|
import java.util.List;
import java.util.Optional;
import java.util.Random;
import processing.core.PImage;
final class Functions
{
public static final Random rand = new Random();
public static PImage getCurrentImage(Object entity)
{
if (entity instanceof Background)
{
return ((Background)entity).images
.get(((Background)entity).imageIndex);
}
else if (entity instanceof Entity)
{
return ((Entity)entity).images.get(((Entity)entity).imageIndex);
}
else
{
throw new UnsupportedOperationException(
String.format("getCurrentImage not supported for %s",
entity));
}
}
public static Optional<Entity> nearestEntity(List<Entity> entities,
Point pos)
{
if (entities.isEmpty())
{
return Optional.empty();
}
else
{
Entity nearest = entities.get(0);
int nearestDistance = pos.distanceSquared(nearest.position);
for (Entity other : entities)
{
int otherDistance = pos.distanceSquared(other.position);
if (otherDistance < nearestDistance)
{
nearest = other;
nearestDistance = otherDistance;
}
}
return Optional.of(nearest);
}
}
public static Action createAnimationAction(Entity entity, int repeatCount)
{
return new Action(ActionKind.ANIMATION, entity, null, null, repeatCount);
}
}
| true
|
4e6bca3f22f55babc80a4f608ba0dfffa626295b
|
Java
|
benepell/Capstone-Project
|
/app/src/main/java/info/pelleritoudacity/android/rcapstone/data/db/DbHelper.java
|
UTF-8
| 31,498
| 1.710938
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
*
* ______ _____ _
* | ___ \ / ___| |
* | |_/ /___ __ _ _ __ \ `--.| |_ ___ _ __ ___
* | // __/ _` | '_ \ `--. \ __/ _ \| '_ \ / _ \
* | |\ \ (_| (_| | |_) /\__/ / || (_) | | | | __/
* \_| \_\___\__,_| .__/\____/ \__\___/|_| |_|\___|
* | |
* |_|
*
* Copyright (C) 2018 Benedetto Pellerito
*
* 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 info.pelleritoudacity.android.rcapstone.data.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import info.pelleritoudacity.android.rcapstone.data.db.util.LeaklessCursorFactory;
class DbHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "rcapstone.db";
private static final int DATABASE_VERSION = 1;
public DbHelper(Context context) {
super(context, DATABASE_NAME, new LeaklessCursorFactory(), DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
final String SQL_CREATE_REDDIT_TABLE =
"CREATE TABLE IF NOT EXISTS " + Contract.RedditEntry.TABLE_NAME + " (" +
Contract.RedditEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
Contract.RedditEntry.COLUMN_NAME_KIND + " TEXT NOT NULL, " +
Contract.RedditEntry.COLUMN_NAME_DATA + " INTEGER NOT NULL " +
");";
final String SQL_CREATE_PREFSUBREDDIT_TABLE =
"CREATE TABLE IF NOT EXISTS " + Contract.PrefSubRedditEntry.TABLE_NAME + " (" +
Contract.PrefSubRedditEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
Contract.PrefSubRedditEntry.COLUMN_NAME_NAME + " TEXT NOT NULL, " +
Contract.PrefSubRedditEntry.COLUMN_NAME_IMAGE + " TEXT, " +
Contract.PrefSubRedditEntry.COLUMN_NAME_VISIBLE + " INTEGER DEFAULT 0, " +
Contract.PrefSubRedditEntry.COLUMN_NAME_REMOVED + " INTEGER DEFAULT 0, " +
Contract.PrefSubRedditEntry.COLUMN_NAME_POSITION + " INTEGER DEFAULT 0, " +
Contract.PrefSubRedditEntry.COLUMN_NAME_BACKUP_POSITION + " INTEGER DEFAULT 0, " +
Contract.PrefSubRedditEntry.COLUMN_NAME_TIME_LAST_MODIFIED + " TIMESTAMP DEFAULT CURRENT_TIMESTAMP, " +
" UNIQUE (" + Contract.PrefSubRedditEntry.COLUMN_NAME_NAME + ")" + " ON CONFLICT IGNORE " +
");";
final String SQL_CREATE_DATA_TABLE =
"CREATE TABLE IF NOT EXISTS " + Contract.DataEntry.TABLE_NAME + " (" +
Contract.DataEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
Contract.DataEntry.COLUMN_NAME_AFTER + " TEXT , " +
Contract.DataEntry.COLUMN_NAME_DIST + " INTEGER , " +
Contract.DataEntry.COLUMN_NAME_MODHASH + " TEXT, " +
Contract.DataEntry.COLUMN_NAME_WHITELIST_STATUS + " TEXT, " +
Contract.DataEntry.COLUMN_NAME_CHILDRENS + " INTEGER , " +
Contract.DataEntry.COLUMN_NAME_BEFORE + " TEXT " +
");";
final String SQL_CREATE_T5DATA_TABLE =
"CREATE TABLE IF NOT EXISTS " + Contract.T5dataEntry.TABLE_NAME + " (" +
Contract.T5dataEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
Contract.T5dataEntry.COLUMN_NAME_TIME_LAST_MODIFIED + " TIMESTAMP DEFAULT CURRENT_TIMESTAMP, " +
Contract.T5dataEntry.COLUMN_NAME_SUGGESTED_COMMENT_SORT + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_HIDE_ADS + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_BANNER_IMG + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_SR_THEME_ENABLED + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_USER_FLAIR_TEXT + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_SUBMIT_TEXT_HTML + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_IS_BANNED + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_WIKI_ENABLED + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_SHOW_MEDIA + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_ID + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_CHILDREN_ID + " INTEGER NOT NULL, " +
Contract.T5dataEntry.COLUMN_NAME_DISPLAY_NAME_PREFIXED + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_SUBMIT_TEXT + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_CAN_FLAIR_IN_SR + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_DISPLAY_NAME + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_HEADER_IMG + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_DESCRIPTION_HTML + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_TITLE + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_COLLAPSE_DELETED_COMMENTS + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_USER_HAS_FAVORITED + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_OVER18 + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_PUBLIC_DESCRIPTION_HTML + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_ALLOW_VIDEOS + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_SPOILERS_ENABLED + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_ICON_SIZE + " INTEGER , " +
Contract.T5dataEntry.COLUMN_NAME_AUDIENCE_TARGET + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_NOTIFICATION_LEVEL + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_ACTIVE_USER_COUNT + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_ICON_IMG + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_HEADER_TITLE + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_DESCRIPTION + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_IS_MUTED + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_SUBMIT_LINK_LABEL + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_ACCOUNTS_ACTIVE + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_PUBLIC_TRAFFIC + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_HEADER_SIZE + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_SUBSCRIBERS + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_USER_FLAIR_CSS_CLASS + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_SUBMIT_TEXT_LABEL + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_WHITELIST_STATUS + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_SR_FLAIR_ENABLED + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_LANG + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_IS_MODERATOR + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_IS_ENROLLED_IN_NEW_MODMAIL + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_KEY_COLOR + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_NAME + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_FLAIR_ENABLED_IN_SR + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_ALLOW_VIDEOGIFS + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_URL + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_QUARANTINE + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_CREATED + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_CREATED_UTC + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_BANNER_SIZE + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_USER_IS_CONTRIBUTOR + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_ALLOW_DISCOVERY + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_ACCOUNTS_ACTIVE_IS_FUZZED + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_ADVERTISER_CATEGORY + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_PUBLIC_DESCRIPTION + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_LINK_FLAIR_ENABLED + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_ALLOW_IMAGES + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_SHOW_MEDIA_PREVIEW + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_COMMENT_SCORE_HIDE_MINS + " INTEGER DEFAULT 0, " +
Contract.T5dataEntry.COLUMN_NAME_SUBREDDIT_TYPE + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_SUBMISSION_TYPE + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_USER_IS_SUBSCRIBER + " TEXT, " +
Contract.T5dataEntry.COLUMN_NAME_SORT_BY + " TEXT, " +
" UNIQUE (" + Contract.T5dataEntry.COLUMN_NAME_ID + ")" + " ON CONFLICT REPLACE, " +
" FOREIGN KEY (" + Contract.T5dataEntry.COLUMN_NAME_CHILDREN_ID + ") REFERENCES " +
Contract.DataEntry.TABLE_NAME + "(" + Contract.DataEntry._ID + ")" +
");";
final String SQL_CREATE_T3DATA_TABLE =
"CREATE TABLE IF NOT EXISTS " + Contract.T3dataEntry.TABLE_NAME + " (" +
Contract.T3dataEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
Contract.T3dataEntry.COLUMN_NAME_TIME_LAST_MODIFIED + " TIMESTAMP DEFAULT CURRENT_TIMESTAMP, " +
Contract.T3dataEntry.COLUMN_NAME_APPROVED_AT_UTC + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_APPROVED_BY + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_ARCHIVED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_AUTHOR + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_AUTHOR_FLAIR_CSS_CLASS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_AUTHOR_FLAIR_TEXT + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_BANNED_AT_UTC + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_BANNED_BY + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_CAN_GILD + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_CAN_MOD_POST + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_CHILDREN_ID + " INTEGER NOT NULL, " +
Contract.T3dataEntry.COLUMN_NAME_CLICKED + " INTEGER DEFAULT 0 , " +
Contract.T3dataEntry.COLUMN_NAME_CONTEST_MODE + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_CREATED + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_CREATED_UTC + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_DISTINGUISHED + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_DOMAIN + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_DOWNS + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_EDITED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_GILDED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_HIDDEN + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_HIDE_SCORE + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_ID + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_IS_CROSSPOSTABLE + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_IS_REDDIT_MEDIA_DOMAIN + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_IS_SELF + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_IS_VIDEO + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_LIKES + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_LINK_FLAIR_CSS_CLASS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_LINK_FLAIR_TEXT + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_LOCKED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_EMBED + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MOD_NOTE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MOD_REASON_BY + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MOD_REASON_TITLE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MOD_REPORTS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_NAME + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_NO_FOLLOW + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_NUM_COMMENTS + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_NUM_CROSSPOSTS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_NUM_REPORTS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_OVER_18 + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_PARENT_WHITELIST_STATUS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PERMALINK + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PINNED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_PWLS + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_QUARANTINE + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_REMOVAL_REASON + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_REPORT_REASONS + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_SAVED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_SCORE + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_DIR_SCORE + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_SECURE_MEDIA + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_SECURE_MEDIA_EMBED + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_SELFTEXT + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_SELFTEXT_HTML + " BLOB, " +
Contract.T3dataEntry.COLUMN_NAME_SEND_REPLIES + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_SPOILER + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_STICKIED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_SUBREDDIT + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_SUBREDDIT_ID + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_SUBREDDIT_NAME_PREFIXE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_SUBREDDIT_SUBSCRIBERS + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_SUBREDDIT_TYPE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_SUGGESTED_SORT + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_THUMBNAIL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_THUMBNAIL_HEIGHT + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_THUMBNAIL_WIDTH + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_TITLE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_UPS + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_USER_REPORTS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_VIEW_COUNT + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_VISITED + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_WHITELIST_STATUS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_WLS + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_TARGET + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_SORT_BY + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_IMAGE_SOURCE_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_IMAGE_SOURCE_WIDTH + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_IMAGE_SOURCE_HEIGHT + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_HLS_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_DASH_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_SCRUBBER_MEDIA_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_FALLBACK_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_TRANSCODING_STATUS + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_DURATION + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_WIDTH + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_VIDEO_HEIGHT + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_PREVIEW_IS_VIDEO_GIF + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_VARIANT_VIDEO_MP4_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_VARIANT_VIDEO_MP4_WIDTH + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_VARIANT_VIDEO_MP4_HEIGHT + " INTEGER DEFAULT 0, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_TYPE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_IS_VIDEO + " INTEGER, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_PROVIDER_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_TITLE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_TYPE + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_HTML + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_AUTHOR_NAME + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_HEIGHT + " INTEGER, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_WIDTH + " INTEGER, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_VERSION + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_THUMBNAIL_WIDTH + " INTEGER, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_PROVIDER_NAME + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_THUMBNAIL_URL + " TEXT, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_THUMBNAIL_HEIGHT + " INTEGER, " +
Contract.T3dataEntry.COLUMN_NAME_MEDIA_OEMBED_AUTHOR_URL + " TEXT, " +
" UNIQUE (" + Contract.T3dataEntry.COLUMN_NAME_ID + ")" + " ON CONFLICT REPLACE, " +
" FOREIGN KEY (" + Contract.T3dataEntry.COLUMN_NAME_CHILDREN_ID + ") REFERENCES " +
Contract.DataEntry.TABLE_NAME + "(" + Contract.DataEntry._ID + ")" +
");";
final String SQL_CREATE_T1DATA_TABLE =
"CREATE TABLE IF NOT EXISTS " + Contract.T1dataEntry.TABLE_NAME + " (" +
Contract.T1dataEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
Contract.T1dataEntry.COLUMN_NAME_MORE_REPLIES + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_MORE_LEVEL_REPLIES + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_TIME_LAST_MODIFIED + " TIMESTAMP DEFAULT CURRENT_TIMESTAMP, " +
Contract.T1dataEntry.COLUMN_NAME_ISCROSSPOSTABLE + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_SUBREDDIT + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SUBREDDITID + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_APPROVEDATUTC + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_WLS + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_MODREASONBY + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_BANNEDBY + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_NUMREPORTS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_LINK_ID + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_REMOVALREASON + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_THUMBNAILWIDTH + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SELFTEXTHTML + " INTEGER, " +
Contract.T1dataEntry.COLUMN_NAME_PARENT_ID + " TEXT , " +
Contract.T1dataEntry.COLUMN_NAME_LIKES + " TEXT , " +
Contract.T1dataEntry.COLUMN_NAME_SUGGESTEDSORT + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_USERREPORTS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SECUREMEDIA + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_ISREDDITMEDIADOMAIN + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_SAVED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_ID + " TEXT NOT NULL, " +
Contract.T1dataEntry.COLUMN_NAME_CHILDREN_ID + " TEXT NOT NULL, " +
Contract.T1dataEntry.COLUMN_NAME_BANNEDATUTC + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_MODREASONTITLE + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_VIEWCOUNT + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_ARCHIVED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_CLICKED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_NOFOLLOW + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_AUTHOR + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_NUMCROSSPOSTS + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_LINKFLAIRTEXT + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_CANMODPOST + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_SENDREPLIES + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_PINNED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_DIR_SCORE + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_SCORE + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_APPROVEDBY + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_OVER18 + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_REPORTREASONS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_DOMAIN + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_HIDDEN + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_PREVIEW + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_PWLS + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_THUMBNAIL + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_EDITED + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_LINKFLAIRCSSCLASS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_CONTESTMODE + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_GILDED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_LOCKED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_DOWNS + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_BODY + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_MODREPORTS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SUBREDDITSUBSCRIBERS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SECUREMEDIAEMBED + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_MEDIAEMBED + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_BODY_HTML + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_STICKIED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_VISITED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_CANGILD + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_THUMBNAILHEIGHT + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_NAME + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SPOILER + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_PERMALINK + " BLOB, " +
Contract.T1dataEntry.COLUMN_NAME_SUBREDDITTYPE + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_PARENTWHITELISTSTATUS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_HIDESCORE + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_CREATED + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_URL + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_AUTHORFLAIRTEXT + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_QUARANTINE + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_TITLE + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_DEPTH + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_CREATEDUTC + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_SUBREDDITNAMEPREFIXED + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_UPS + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_NUMCOMMENTS + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_MORECOMMENTS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_ISSELF + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_WHITELISTSTATUS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_MODNOTE + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_MEDIA + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_ISVIDEO + " INTEGER DEFAULT 0, " +
Contract.T1dataEntry.COLUMN_NAME_DISTINGUISHED + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SELFTEXT + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_AUTHORFLAIRCSSCLASS + " TEXT, " +
Contract.T1dataEntry.COLUMN_NAME_SORT_BY + " TEXT, " +
" FOREIGN KEY (" + Contract.T1dataEntry.COLUMN_NAME_CHILDREN_ID + ") REFERENCES " +
Contract.DataEntry.TABLE_NAME + "(" + Contract.DataEntry._ID + ")" +
");";
final String SQL_CREATE_T1MORESDATA_TABLE =
"CREATE TABLE IF NOT EXISTS " + Contract.T1MoresDataEntry.TABLE_NAME + " (" +
Contract.T1MoresDataEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
Contract.T1MoresDataEntry.COLUMN_NAME_MORE_TIME_LAST_MODIFIED + " TIMESTAMP DEFAULT CURRENT_TIMESTAMP, " +
Contract.T1MoresDataEntry.COLUMN_NAME_MORE_COUNT + " INTEGER DEFAULT 0, " +
Contract.T1MoresDataEntry.COLUMN_NAME_MORE_NAME + " TEXT, " +
Contract.T1MoresDataEntry.COLUMN_NAME_MORE_ID + " TEXT, " +
Contract.T1MoresDataEntry.COLUMN_NAME_MORES_PARENT_ID + " INTEGER DEFAULT 0, " +
Contract.T1MoresDataEntry.COLUMN_NAME_MORE_DEPTH + " INTEGER DEFAULT 0, " +
Contract.T1MoresDataEntry.COLUMN_NAME_MORE_CHILDREN + " TEXT, " +
" FOREIGN KEY (" + Contract.T1MoresDataEntry.COLUMN_NAME_MORES_PARENT_ID + ") REFERENCES " +
Contract.T1dataEntry.TABLE_NAME + "(" + Contract.T1dataEntry.COLUMN_NAME_ID + ")" +
");";
db.execSQL(SQL_CREATE_REDDIT_TABLE);
db.execSQL(SQL_CREATE_DATA_TABLE);
db.execSQL(SQL_CREATE_T5DATA_TABLE);
db.execSQL(SQL_CREATE_T3DATA_TABLE);
db.execSQL(SQL_CREATE_PREFSUBREDDIT_TABLE);
db.execSQL(SQL_CREATE_T1DATA_TABLE);
db.execSQL(SQL_CREATE_T1MORESDATA_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + Contract.RedditEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Contract.DataEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Contract.T5dataEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Contract.T3dataEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Contract.PrefSubRedditEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Contract.T1dataEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Contract.T1MoresDataEntry.TABLE_NAME);
onCreate(db);
}
}
| true
|
07913628fc5901c4bf509d399354db0111364871
|
Java
|
PavloKhmarnyi/APhone
|
/app/src/main/java/com/example/pavlo/aphone/interfaces/RtcClient.java
|
UTF-8
| 564
| 2
| 2
|
[] |
no_license
|
package com.example.pavlo.aphone.interfaces;
import com.example.pavlo.aphone.parameters.RoomConnectionParameters;
import org.webrtc.IceCandidate;
import org.webrtc.SessionDescription;
/**
* Created by pavlo on 22.06.16.
*/
public interface RtcClient {
public void connectToRoom(RoomConnectionParameters connectionParameters);
public void sendOfferSdp(final SessionDescription sdp);
public void sendAnswerSdp(final SessionDescription sdp);
public void sendLocalIceCandidate(IceCandidate candidate);
public void disconnectFromRoom();
}
| true
|
c272711811ba7125208ae62001c55930189a1c94
|
Java
|
fossabot/justjournal
|
/src/main/java/com/justjournal/repository/EntryRepository.java
|
UTF-8
| 8,593
| 1.757813
| 2
|
[] |
no_license
|
/*
* Copyright (c) 2014 Lucas Holt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
package com.justjournal.repository;
import com.justjournal.model.Entry;
import com.justjournal.model.PrefBool;
import com.justjournal.model.Security;
import com.justjournal.model.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* Entry Data Access
*
* @author Lucas Holt
*/
@Repository
public interface EntryRepository extends JpaRepository<Entry, Integer> {
List<Entry> findByUser(@Param("user") User user);
@Query("select e from Entry e, User u where e.user = u and LOWER(u.username) = LOWER(:username)")
List<Entry> findByUsername(@Param("username") String username);
@Query("select e from Entry e, User u, EntryTag et, Tag t where e.user = u and LOWER(u.username) = LOWER(:username) and t.name = LOWER(:tag) and et.tag = t and et.entry = e")
List<Entry> findByUsernameAndTag(@Param("username") String username, @Param("tag") String tag);
@Query("select e from Entry e, User u, EntryTag et, Tag t where e.user = u and LOWER(u.username) = LOWER(:username) and e.security = :security" +
" and t.name = LOWER(:tag) and et.tag = t and et.entry = e")
List<Entry> findByUsernameAndSecurityAndTag(@Param("username") String username, @Param("security") Security security, @Param("tag") String tag);
@Query("select e from Entry e, User u, Friend f, Security s where e.user = f.friend and LOWER(u.username) = LOWER(:username) and e.security = s and s.name='public' and f.user = u and e.draft = :draft")
Page<Entry> findByUserFriends(@Param("username") String username, @Param("draft") PrefBool draft, Pageable pageable);
@Query("select e from Entry e, User u where e.user = u and LOWER(u.username) = LOWER(:username) and e.security = :security")
List<Entry> findByUsernameAndSecurity(@Param("username") String username, @Param("security") Security security);
List<Entry> findByUserAndSecurityOrderByDateDesc(@Param("user") User user, @Param("security") Security security);
List<Entry> findByUserAndSecurityAndDraftOrderByDateDesc(@Param("user") User user, @Param("security") Security security, @Param("draft") PrefBool draft);
Page<Entry> findByUserAndSecurityOrderByDateDesc(@Param("user") User user, @Param("security") Security security, Pageable pageable);
Page<Entry> findByUserAndSecurityAndDraft(@Param("user") User user,
@Param("security") Security security,
@Param("draft") PrefBool draft, Pageable pageable);
@Query("select new Entry(e.id, e.subject) from Entry e, User u where e.user = u and LOWER(u.username) = LOWER(:username) and e.security = :security and e.draft = :draft")
Page<Entry> findByUserAndSecurityAndDraftWithSubjectOnly(@Param("username") String username,
@Param("security") Security security,
@Param("draft") PrefBool draft, Pageable pageable);
Page<Entry> findByUserOrderByDateDesc(User user, Pageable pageable);
Page<Entry> findBySecurityOrderByDateDesc(Security security, Pageable pageable);
@Query("select e from Entry e, User u where e.user= u and LOWER(u.username) = LOWER(:username) and e.date >= :startDate and e.date <= :endDate")
List<Entry> findByUsernameAndDate(@Param("username") String username,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
@Query("SELECT count(eh) FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date)= :yr AND us = eh.user")
Long calendarCount(@Param("yr") int year, @Param("username") String username);
@Query("SELECT count(eh) FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date)= :yr AND MONTH(eh.date)= :mn AND us = eh.user")
Long calendarCount(@Param("yr") int year, @Param("mn") int month, @Param("username") String username);
@Query("SELECT eh FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date) = :yr AND us = eh.user and eh.security = :security")
List<Entry> findByUsernameAndYearAndSecurity(@Param("username") String username, @Param("yr") int year, @Param("security") Security security);
@Query("SELECT eh FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date) = :yr AND us = eh.user")
List<Entry> findByUsernameAndYear(@Param("username") String username, @Param("yr") int year);
@Query("SELECT eh FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date) = :yr AND MONTH(eh.date) = :month AND us = eh.user")
List<Entry> findByUsernameAndYearAndMonth(@Param("username") String username,
@Param("yr") int year,
@Param("month") int month);
@Query("SELECT eh FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date) = :yr AND MONTH(eh.date) = :month AND us = eh.user and eh.security = :security")
List<Entry> findByUsernameAndYearAndMonthAndSecurity(@Param("username") String username,
@Param("yr") int year,
@Param("month") int month,
@Param("security") Security security);
@Query("SELECT eh FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date) = :yr AND MONTH(eh.date) = :month AND DAY(eh.date) = :day AND us = eh.user and eh.security = :security")
List<Entry> findByUsernameAndYearAndMonthAndDay(@Param("username") String username,
@Param("yr") int year,
@Param("month") int month,
@Param("day") int day);
@Query("SELECT eh FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND YEAR(eh.date) = :yr AND MONTH(eh.date) = :month AND DAY(eh.date) = :day AND us = eh.user and eh.security = :security")
List<Entry> findByUsernameAndYearAndMonthAndDayAndSecurity(@Param("username") String username,
@Param("yr") int year,
@Param("month") int month,
@Param("day") int day,
@Param("security") Security security);
Long countBySecurity(@Param("security") Security security);
@Query("SELECT count(eh) FROM User us, Entry eh WHERE LOWER(us.username) = LOWER(:username) AND us = eh.user")
Long countByUsername(@Param("username") String username);
}
| true
|
6009024b2dc420e4d001ffb0749e344542f115ba
|
Java
|
ramin32/interpreter
|
/src/interpreter/Lexer.java
|
UTF-8
| 1,139
| 3.34375
| 3
|
[] |
no_license
|
/***********************************************************
* Lexer.java
* Desc: Performs lexical analysis on a given file.
* Uses patterns from Type class to discern between
* the different token types.
*
* Ramin Rakhamimov
* CIS 707
* Interpreter Project
**********************************************************/
package interpreter;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Lexer
{
public static List<Token> tokenizeFile(String fileName)
{
try
{
Scanner scanner = new Scanner(new File(fileName)).useDelimiter("\\s+");
List<Token> tokens = new ArrayList<Token>();
while(scanner.hasNext())
{
String input = scanner.next();
Token token = Token.constructToken(input);
tokens.add(token);
}
return tokens;
}
catch(java.io.FileNotFoundException e)
{
e.printStackTrace();
}
return null;
}
}
| true
|
e9f838e16487158269fb00b7440a95a9ee2ed344
|
Java
|
AggarwalAnkit/MapsDemo
|
/app/src/main/java/com/example/aa/mapsdemo/RestAdapter.java
|
UTF-8
| 1,657
| 2.375
| 2
|
[] |
no_license
|
package com.example.aa.mapsdemo;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by aa on 26/02/17.
*/
public class RestAdapter {
private static final String API_ROOT = "http://sourabh.me";
private static final int TIMEOUT_MILLISECONDS = 60000;
private static RestApi mRestApi;
private RestAdapter() {
}
public static RestApi getRestAdapter() {
if (mRestApi == null) {
synchronized (RestAdapter.class) {
if (mRestApi == null) {
mRestApi = new Retrofit.Builder()
.baseUrl(API_ROOT)
.client(getOkHttpClient())
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(RestApi.class);
}
}
}
return mRestApi;
}
private static OkHttpClient getOkHttpClient() {
return new OkHttpClient.Builder()
.connectTimeout(TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS)
.readTimeout(TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS)
.writeTimeout(TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS)
.addInterceptor(getHttpLoggingInterceptor())
.build();
}
private static HttpLoggingInterceptor getHttpLoggingInterceptor() {
return new HttpLoggingInterceptor()
.setLevel(HttpLoggingInterceptor.Level.BODY);
}
}
| true
|
56a3c83f2657a369f6634fcd2702cdf6de3682b8
|
Java
|
9odes/JAVA-01
|
/Week_09/class17/rpcfx-core/src/main/java/com/nineodes/exception/RpcfxException.java
|
UTF-8
| 312
| 2.015625
| 2
|
[] |
no_license
|
package com.nineodes.exception;
/**
* created by DengJin on 2021/3/18 16:48
*/
public class RpcfxException extends RuntimeException {
public RpcfxException(Throwable cause) {
super(cause);
}
public RpcfxException(String message, Throwable cause) {
super(message, cause);
}
}
| true
|
9b5f02a7e3623745a8c753d50dcafebe9d5695f5
|
Java
|
glelouet/JSwaggerMaker
|
/Examples/Discourse/src/generated/java/discourse/example/com/anonymous/admin/sitesettings/StaffTags.java
|
UTF-8
| 835
| 2.390625
| 2
|
[] |
no_license
|
package discourse.example.com.anonymous.admin.sitesettings;
import java.util.HashMap;
import java.util.Map;
import discourse.example.com.Anonymous;
import fr.lelouet.jswaggermaker.client.common.impl.DelegateTransfer;
public class StaffTags
extends DelegateTransfer<Anonymous>
{
public StaffTags(Anonymous delegate) {
super(delegate);
}
/**
*
* <p>
* "staff tags"
* </p>
*
* @param staff_tags
* "A list of tags that can only be applied by staff members"
*
*/
public void put(String staff_tags) {
String url = ("https://discourse.example.com//admin/site_settings/staff_tags");
Map<String, Object> content = new HashMap<>();
content.put("staff_tags", (staff_tags));
requestPut(url, null, content, Void.class);
}
}
| true
|
fb9bbe20d517999244e495560a9ea2c3570af2d1
|
Java
|
G14TeamWork/G14_GHealth
|
/Tests/Fixtures/InsertTestResultsTest.java
|
UTF-8
| 1,775
| 2.203125
| 2
|
[] |
no_license
|
package Fixtures;
import mainPackage.MainClass;
import ocsf.server.GHealthServer;
import Controllers.FillTestResController;
import Entities.FillTestResEntity;
import fit.ActionFixture;
public class InsertTestResultsTest extends ActionFixture {
Boolean result = true;
FillTestResEntity Entity = new FillTestResEntity();
String testType;
/**
* id = 444
* id ref = 10
* type = rentgen - hand
*/
public InsertTestResultsTest()
{
MainClass.testMain(null);
GHealthServer.testMain(null);
GHealthServer.ServerMasterCont.FTRCont = new FillTestResController();
}
public void setPatientId(String id)
{
Entity.pat.setId(id);
}
/*
public void setTestType(String testType)
{
Entity.TestType = testType;
}
*/
public void setTestResText(String TestResText)
{
Entity.TestRes = TestResText;
}
/*
public void setRefId(String idRef)
{
Entity.arrRef.add(idRef);
Entity.testIndex = 0;
}*/
public boolean checkIdPat()
{
return GHealthServer.ServerMasterCont.FTRCont.checkExistanceSql(Entity);
}
public boolean checkPatRef()
{
return GHealthServer.ServerMasterCont.FTRCont.checkExistanceReferenceSql(Entity);
}
public void setTestType(String testType)
{
this.testType = testType;
}
public boolean checkTestType()
{
if(Entity.arrRef.contains(testType))
{
Entity.TestType = testType;
return true;
}
return false;
}
public boolean checkInsertTestRes()
{
return GHealthServer.ServerMasterCont.FTRCont.insertTestResSql(Entity);
}
}
/* public void setLabWorkerFirstName(String firstName)
{
Entity.labworkerFirstName = firstName;
}
public void setLabWorkerLastName(String lastName)
{
Entity.labworkerLastName = lastName;
}
public boolean checkRefMatch()
{
return type.equals(Entity.arrRef.get(1));
}*/
| true
|
ef57bda39e3d812fa455237e3ef05e3e05d38077
|
Java
|
avorick/silver-potato
|
/ApplicationFramework/src/main/java/com/app/framework/listeners/AddressListener.java
|
UTF-8
| 219
| 1.921875
| 2
|
[] |
no_license
|
package com.app.framework.listeners;
import com.app.framework.entities.Address;
public interface AddressListener {
void onAddressResponse(Address address);
void onAddressError();
void onZeroResults();
}
| true
|
73137179c8cee82a5c5410d7bdc366031d87b6f6
|
Java
|
vFelicio/Rest_JSON
|
/cidade_rest/src/main/java/br/usjt/cidade_rest/CidadeRestApplication.java
|
UTF-8
| 320
| 1.515625
| 2
|
[] |
no_license
|
package br.usjt.cidade_rest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CidadeRestApplication {
public static void main(String[] args) {
SpringApplication.run(CidadeRestApplication.class, args);
}
}
| true
|
985dfbb6d11c0972fd9efb56150e18bca29d3d88
|
Java
|
erickogi/Data-Structures-Algorithims
|
/src/Graphs/AdjencyListGraph.java
|
UTF-8
| 3,270
| 3.859375
| 4
|
[
"MIT"
] |
permissive
|
package Graphs;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class AdjencyListGraph implements Graph{
//List of vertex objects (not adjecent) each has a refrence to its adjacents
private List<Vertex> vertexList = new ArrayList<>();
//Track no of vertices in graph
private int numVertices = 0;
//Track If graph is directed or undirectd
private GraphType graphType = GraphType.DIRECTED;
//cONSTRUCTOR FOR numVertices & GraphType
public AdjencyListGraph(int numVertices, GraphType graphType){
this.numVertices = numVertices;
//Nested for loop to initial all elements to zero (No connections at first)
for( int i = 0; i<numVertices;i++){
vertexList.add(new Vertex(i,0));
}
this.graphType = graphType;
}
@Override
public void addEdge(int v1, int v2,int weight) {
if(v1 >= numVertices || v1 < 0 || v2 >= numVertices || v2 < 0){
throw new IllegalArgumentException("Vertex number is not valid: "+v1+", "+v2);
}
//Access vertex v1 and add v2 as an edge
vertexList.get(v1).addEdge(v2,weight);
//If its an underected graph wwe need to add both directions v1 to v2 and v2 to v1
if(graphType == GraphType.UNDIRECTED){
vertexList.get(v2).addEdge(v1,weight);
}
}
@Override
public void addEdge(int v1, int v2) {
addEdge(v1,v2,1);
}
// Get vertices adjacent to given vertex
@Override
public List<Vertex> getAdjecentVerticesLis(int v) {
if(v <0 || v>= numVertices){
throw new IllegalArgumentException("Vertex number is not valid: "+v);
}
//Very Simple just get the adjacent of given v (vertex)
return vertexList.get(v).getAdjacencyVertices();
}
@Override
public List<VertexSet> getAdjecentVerticesSet(int v) {
return null;
}
@Override
public List<Integer> getAdjecentVerticesMatrix(int v) {
return null;
}
@Override
public int getNumVertices() {
return numVertices;
}
//To calculate the number of edges pointing to given vertex
@Override
public int getIndegree(int v) {
//We only have a one way mapping from vertex to its adjacents
//Initialize to 0
int indegree = 0;
//Iterate over all vertex
for(Vertex vertex : vertexList){
List<Vertex> adjacentVertices = vertex.getAdjacencyVertices();
for(Vertex adjacent : adjacentVertices) {
//Get adjacents of every vertex and check if v is contained.
//If it is then we no there is an incoming from the vertex to V this indegree
if (adjacent.getVertexNumber() ==v) {
indegree++;
}
}
}
return indegree;
}
//Prints out graph representation
@Override
public void displayGraph() {
System.out.println("Adjacency List\n");
for (Vertex vertex : vertexList){
List<Vertex> adjacentVertices = vertex.getAdjacencyVertices();
System.out.println("Edges from "+vertex.getVertexNumber()+ " to : "+adjacentVertices);
}
}
}
| true
|
85c3e43a4bdd37cc5d5dc214c90048d0b5c95273
|
Java
|
xuliangliang1992/gif-maker
|
/CommonLibrary/src/main/java/com/highlands/common/dialog/AuthDialog.java
|
UTF-8
| 2,060
| 2.109375
| 2
|
[] |
no_license
|
package com.highlands.common.dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import com.highlands.common.R;
import com.highlands.common.databinding.AuthDialogBinding;
import com.highlands.common.dialog.base.BaseDialog;
import com.highlands.common.util.ShapeUtil;
import androidx.databinding.DataBindingUtil;
/**
* ๅบ้จๆๅๆถๆ้ฎ็ๅผนๅบๆก ไปๅบ้จๅผนๅบ
*
* @author xll
* @date 2018/1/1
*/
public class AuthDialog extends BaseDialog {
private AuthDialogBinding mBinding;
private DialogClickListener mDialogClickListener;
public AuthDialog(Context context, DialogClickListener dialogClickListener) {
super(context);
this.mDialogClickListener = dialogClickListener;
setCancel(false);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView() {
View view = View.inflate(context, R.layout.auth_dialog, null);
mBinding = DataBindingUtil.bind(view);
widthScale(0.8f);
ShapeUtil.setShape(mBinding.llContent, context, 20, R.color.white);
ShapeUtil.setShape(mBinding.tvTry, context, 10, R.color.red_DE0F04);
ShapeUtil.setShape(mBinding.tvWatch, context, 10, R.color.blue_709AFF);
if (mDialogClickListener != null) {
mBinding.tvTry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mDialogClickListener.rightClickListener();
dismiss();
}
});
mBinding.tvWatch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mDialogClickListener.leftClickListener();
dismiss();
}
});
}
return view;
}
@Override
public boolean setUiBeforeShow() {
return true;
}
}
| true
|
b4dcc407e833f41994d580db164fa25a050d9157
|
Java
|
JonathanWick10/ProyectoFinal
|
/app/src/main/java/com/jonathan/proyectofinal/fragments/hp/TherapyPSFragment.java
|
UTF-8
| 4,080
| 2.09375
| 2
|
[] |
no_license
|
package com.jonathan.proyectofinal.fragments.hp;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabItem;
import com.google.android.material.tabs.TabLayout;
import com.jonathan.proyectofinal.R;
import com.jonathan.proyectofinal.fragments.carer.MemorizameFragment;
import com.jonathan.proyectofinal.interfaces.IMainCarer;
public class TherapyPSFragment extends Fragment {
TabLayout tabs;
TabItem tabPatientInfo, nearbyhospital,tabMemorizame;
ViewPager viewPager;
Adapter adapter;
String text1, text2, text3;
private IMainCarer iMainHealthProfessional;
public TherapyPSFragment() {
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_ps_therapy, container, false);
View view = inflater.inflate(R.layout.fragment_ps_therapy, container, false);
tabPatientInfo = view.findViewById(R.id.ps_tab_therapy_cognitive);
nearbyhospital = view.findViewById(R.id.ps_tab_therapy_motor);
tabMemorizame=view.findViewById(R.id.ps_tab_therapy_memorizame);
tabs = view.findViewById(R.id.ps_tabs_therapy);
viewPager = view.findViewById(R.id.containerPageTherapyPS);
TherapyPSFragment fragment = new TherapyPSFragment();
SetUpViewPager(viewPager, tabs, fragment);
return view;
}
private void SetUpViewPager(ViewPager viewPager, TabLayout tabs, Fragment fragment) {
if (fragment != null) {
adapter = new Adapter(getChildFragmentManager());
tabs.setupWithViewPager(viewPager);
viewPager.setAdapter(adapter);
tabs.getTabAt(0);
tabs.getTabAt(1);
tabs.getTabAt(2);
}
}
public class Adapter extends FragmentPagerAdapter {
public Adapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
CognitiveTherapyPSFragment cognitiveTherapyPSFragment = new CognitiveTherapyPSFragment();
return cognitiveTherapyPSFragment;
case 1:
MotorTherapyPSFragment motorTherapyPSFragment = new MotorTherapyPSFragment();
return motorTherapyPSFragment;
case 2:
MemorizameFragment memorizameFragment = new MemorizameFragment();
return memorizameFragment;
}
return null;
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
switch (position){
case 0:
text1 = getString(R.string.cognitive);
iMainHealthProfessional.inflateFragment(getString(R.string.cognitive));
return text1;
case 1:
text2 = getString(R.string.motor);
iMainHealthProfessional.inflateFragment(getString(R.string.motor));
return text2;
case 2:
text3=getString(R.string.menu_memorizame);
iMainHealthProfessional.inflateFragment(getString(R.string.menu_memorizame));
return text3;
}
return null;
}
@Override
public int getCount() {
return 3;
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
iMainHealthProfessional = (IMainCarer) getActivity();
}
}
| true
|
a9d59ff8e6808ff58f03256f0fe464ccaf84b38a
|
Java
|
Lyrth/DiscordBot-Test
|
/src/main/java/lyr/testbot/util/ReflectionUtil.java
|
UTF-8
| 882
| 2.5625
| 3
|
[] |
no_license
|
package lyr.testbot.util;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
public class ReflectionUtil {
public static List<Method> getAnnotatedMethods(final Class<?> clazz, final Class<? extends Annotation> annotation) {
final List<Method> methods = new ArrayList<>();
for (final Method method : clazz.getDeclaredMethods())
if (method.isAnnotationPresent(annotation))
methods.add(method);
return methods;
}
public static List<Method> getDeclaredMethodsByName(final Class<?> clazz, final String name) {
final List<Method> methods = new ArrayList<>();
for (final Method method : clazz.getDeclaredMethods())
if (method.getName().equals(name))
methods.add(method);
return methods;
}
}
| true
|
298c26e2b7fac628e8fda5b7e100be5a7527d80d
|
Java
|
SJ-Revival/Ye
|
/app/src/main/java/de/ye/app/data/User.java
|
UTF-8
| 272
| 1.945313
| 2
|
[] |
no_license
|
package de.ye.app.data;
/**
* Created by bianca on 23.11.15.
*/
public class User {
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
private Address address;
}
| true
|
56af6a386ec2b5dd1e231631fd466b6d10318222
|
Java
|
bikashpdsah9512/MovieTicketBookingSystem
|
/Test/com/manisha/movieTicketBookingSystem/api/BookingControllerTest.java
|
UTF-8
| 4,751
| 2.390625
| 2
|
[] |
no_license
|
package com.manisha.movieTicketBookingSystem.api;
import com.manisha.movieTicketBookingSystem.exceptions.InvalidStateException;
import com.manisha.movieTicketBookingSystem.exceptions.NotFoundException;
import com.manisha.movieTicketBookingSystem.exceptions.SeatPermanentlyUnavailableException;
import com.manisha.movieTicketBookingSystem.models.Booking;
import com.manisha.movieTicketBookingSystem.models.Seat;
import com.manisha.movieTicketBookingSystem.models.Show;
import com.manisha.movieTicketBookingSystem.services.BookingService;
import com.manisha.movieTicketBookingSystem.services.ShowService;
import com.manisha.movieTicketBookingSystem.services.TheatreService;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import java.util.Collections;
import static com.manisha.movieTicketBookingSystem.constants.TestConstants.*;
import static com.manisha.movieTicketBookingSystem.generator.MockGenerator.getSeat;
import static com.manisha.movieTicketBookingSystem.generator.MockGenerator.getShow;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
public class BookingControllerTest {
private ShowService showService;
private TheatreService theatreService;
private BookingService bookingService;
private BookingController bookingController;
@Before
public void setup() {
showService = mock(ShowService.class);
theatreService = mock(TheatreService.class);
bookingService = mock(BookingService.class);
bookingController = new BookingController(showService, theatreService, bookingService);
}
@Test(expected = InvalidStateException.class)
public void createBookingShouldThrowInvalidExceptionForInvalidShowId()
throws InvalidStateException, NotFoundException, SeatPermanentlyUnavailableException {
when(showService.getShow(anyString())).thenThrow(new InvalidStateException("Invalid show " +
"Id"));
bookingController
.createBooking(TEST_USER_ID, TEST_SHOW_ID, Collections.singletonList(TEST_SEAT_ID));
verify(bookingService, Mockito.never()).createBooking(any(Show.class), anyList(),
anyString());
verify(theatreService, Mockito.never()).getSeat(anyString());
}
@Test(expected = NotFoundException.class)
public void getSeatShouldThrowNotFoundExceptionForInvalidSeatId()
throws NotFoundException, InvalidStateException, SeatPermanentlyUnavailableException {
when(theatreService.getSeat(anyString())).thenThrow(new NotFoundException("Seat id not " +
"found."));
when(showService.getShow(TEST_SHOW_ID)).thenReturn(getShow());
bookingController
.createBooking(TEST_USER_ID, TEST_SHOW_ID, Collections.singletonList(TEST_SEAT_ID));
verify(bookingService, Mockito.never())
.createBooking(any(Show.class), anyList(), anyString());
verify(showService, Mockito.times(1)).getShow(TEST_SHOW_ID);
}
@Test(expected = SeatPermanentlyUnavailableException.class)
public void createBookingShouldThrowSeatPermanentlyUnavailableExceptionForAlreadyBookedSeat()
throws InvalidStateException, NotFoundException, SeatPermanentlyUnavailableException {
when(showService.getShow(TEST_SHOW_ID)).thenReturn(getShow());
when(theatreService.getSeat(TEST_SEAT_ID))
.thenReturn(new Seat(TEST_SEAT_ID, TEST_ROW_NUM, TEST_SEAT_NUM));
when(bookingService.createBooking(any(Show.class), anyList(), anyString()))
.thenThrow(new SeatPermanentlyUnavailableException("Seat unavailable"));
bookingController
.createBooking(TEST_USER_ID, TEST_SHOW_ID, Collections.singletonList(TEST_SEAT_ID));
verify(showService, Mockito.times(1)).getShow(TEST_SHOW_ID);
verify(theatreService, Mockito.times(1)).getSeat(TEST_SEAT_ID);
}
@Test
public void createBookingShouldReturnBookingId() throws InvalidStateException,
NotFoundException, SeatPermanentlyUnavailableException {
when(showService.getShow(TEST_SHOW_ID)).thenReturn(getShow());
when(theatreService.getSeat(TEST_SEAT_ID)).thenReturn(getSeat());
when(bookingService.createBooking(any(Show.class), anyList(), anyString()))
.thenReturn(new Booking(TEST_BOOKING_ID, getShow(), TEST_USER_ID,
Collections.singletonList(getSeat())));
String bookingId = bookingController
.createBooking(TEST_USER_ID, TEST_SHOW_ID, Collections.singletonList(
TEST_SEAT_ID));
assertEquals(TEST_BOOKING_ID, bookingId);
}
}
| true
|
71f0abe919ff597f48ef29ca328d59f925b0a548
|
Java
|
junges521/src_awe
|
/src/main/java/com/ss/android/ugc/aweme/newfollow/util/FeedImpressionReporter.java
|
UTF-8
| 7,575
| 1.695313
| 2
|
[] |
no_license
|
package com.ss.android.ugc.aweme.newfollow.util;
import com.bytedance.common.utility.collection.CollectionUtils;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.ss.android.ugc.aweme.base.sharedpref.e;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class FeedImpressionReporter {
/* renamed from: a reason: collision with root package name */
public static ChangeQuickRedirect f57390a;
/* renamed from: b reason: collision with root package name */
public volatile HashSet<String> f57391b;
/* renamed from: c reason: collision with root package name */
public volatile HashSet<String> f57392c;
/* renamed from: d reason: collision with root package name */
private HashSet<String> f57393d;
/* renamed from: e reason: collision with root package name */
private volatile List<String> f57394e;
public @interface Keys {
}
static class a {
/* renamed from: a reason: collision with root package name */
public static ChangeQuickRedirect f57395a;
/* renamed from: b reason: collision with root package name */
private static final Map<String, FeedImpressionReporter> f57396b = new ConcurrentHashMap(1);
public static FeedImpressionReporter a(@Keys String str) {
String str2 = str;
if (PatchProxy.isSupport(new Object[]{str2}, null, f57395a, true, 61886, new Class[]{String.class}, FeedImpressionReporter.class)) {
return (FeedImpressionReporter) PatchProxy.accessDispatch(new Object[]{str2}, null, f57395a, true, 61886, new Class[]{String.class}, FeedImpressionReporter.class);
}
FeedImpressionReporter feedImpressionReporter = f57396b.get(str2);
if (feedImpressionReporter == null) {
feedImpressionReporter = new FeedImpressionReporter((byte) 0);
f57396b.put(str2, feedImpressionReporter);
}
return feedImpressionReporter;
}
}
private FeedImpressionReporter() {
f();
}
private void g() {
if (PatchProxy.isSupport(new Object[0], this, f57390a, false, 61884, new Class[0], Void.TYPE)) {
PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61884, new Class[0], Void.TYPE);
return;
}
e.f().b("to_report_feed_ids", "");
}
public final boolean b() {
if (!PatchProxy.isSupport(new Object[0], this, f57390a, false, 61879, new Class[0], Boolean.TYPE)) {
return CollectionUtils.isEmpty(this.f57391b);
}
return ((Boolean) PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61879, new Class[0], Boolean.TYPE)).booleanValue();
}
public final void e() {
if (PatchProxy.isSupport(new Object[0], this, f57390a, false, 61883, new Class[0], Void.TYPE)) {
PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61883, new Class[0], Void.TYPE);
return;
}
e.f().b("to_report_feed_ids", c());
}
private void f() {
String str;
if (PatchProxy.isSupport(new Object[0], this, f57390a, false, 61878, new Class[0], Void.TYPE)) {
PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61878, new Class[0], Void.TYPE);
return;
}
if (PatchProxy.isSupport(new Object[0], this, f57390a, false, 61885, new Class[0], String.class)) {
str = (String) PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61885, new Class[0], String.class);
} else {
str = e.f().a("to_report_feed_ids", "");
}
if (str == null || str.isEmpty()) {
return;
}
for (String b2 : str.split(",")) {
b(b2);
}
}
public final String a() {
if (PatchProxy.isSupport(new Object[0], this, f57390a, false, 61877, new Class[0], String.class)) {
return (String) PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61877, new Class[0], String.class);
} else if (CollectionUtils.isEmpty(this.f57394e)) {
return "";
} else {
StringBuilder sb = new StringBuilder();
for (String append : this.f57394e) {
sb.append(append);
sb.append(",");
}
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
}
}
public final String c() {
if (PatchProxy.isSupport(new Object[0], this, f57390a, false, 61880, new Class[0], String.class)) {
return (String) PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61880, new Class[0], String.class);
} else if (CollectionUtils.isEmpty(this.f57391b)) {
return "";
} else {
StringBuilder sb = new StringBuilder();
Iterator<String> it2 = this.f57391b.iterator();
while (it2.hasNext()) {
sb.append(it2.next());
sb.append(",");
}
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
}
}
public final void d() {
if (PatchProxy.isSupport(new Object[0], this, f57390a, false, 61882, new Class[0], Void.TYPE)) {
PatchProxy.accessDispatch(new Object[0], this, f57390a, false, 61882, new Class[0], Void.TYPE);
return;
}
if (this.f57391b != null) {
if (!CollectionUtils.isEmpty(this.f57392c)) {
this.f57391b.removeAll(this.f57392c);
} else {
this.f57391b.clear();
}
}
if (this.f57392c != null) {
this.f57392c.clear();
}
g();
}
/* synthetic */ FeedImpressionReporter(byte b2) {
this();
}
public static FeedImpressionReporter a(@Keys String str) {
if (!PatchProxy.isSupport(new Object[]{str}, null, f57390a, true, 61875, new Class[]{String.class}, FeedImpressionReporter.class)) {
return a.a(str);
}
return (FeedImpressionReporter) PatchProxy.accessDispatch(new Object[]{str}, null, f57390a, true, 61875, new Class[]{String.class}, FeedImpressionReporter.class);
}
public final void b(String str) {
if (PatchProxy.isSupport(new Object[]{str}, this, f57390a, false, 61881, new Class[]{String.class}, Void.TYPE)) {
PatchProxy.accessDispatch(new Object[]{str}, this, f57390a, false, 61881, new Class[]{String.class}, Void.TYPE);
} else if (str != null && !str.isEmpty()) {
if (this.f57393d == null) {
this.f57393d = new HashSet<>();
}
if (this.f57391b == null) {
this.f57391b = new HashSet<>();
}
if (!this.f57393d.contains(str)) {
this.f57391b.add(str);
this.f57393d.add(str);
}
}
}
public final void a(List<String> list) {
if (PatchProxy.isSupport(new Object[]{list}, this, f57390a, false, 61876, new Class[]{List.class}, Void.TYPE)) {
PatchProxy.accessDispatch(new Object[]{list}, this, f57390a, false, 61876, new Class[]{List.class}, Void.TYPE);
} else if (CollectionUtils.isEmpty(list)) {
if (this.f57394e != null) {
this.f57394e.clear();
}
} else {
this.f57394e = list;
}
}
}
| true
|
f9272b8e8544dfe8d5e75004d37ca7d9c4dee8ee
|
Java
|
daMaoCoding/project1
|
/src/main/java/com/xinbo/fundstransfer/chatPay/inmoney/services/impl/ParttimeInmoneyServiceImpl.java
|
UTF-8
| 4,187
| 2.046875
| 2
|
[] |
no_license
|
package com.xinbo.fundstransfer.chatPay.inmoney.services.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xinbo.fundstransfer.chatPay.commons.enums.RedisKeyEnums;
import com.xinbo.fundstransfer.chatPay.inmoney.entity.BizAccountTranslog;
import com.xinbo.fundstransfer.chatPay.inmoney.entity.BizChatpayLog;
import com.xinbo.fundstransfer.chatPay.inmoney.params.InmoneyNotifyInfoDto;
import com.xinbo.fundstransfer.chatPay.inmoney.params.P2pKillIncomDto;
import com.xinbo.fundstransfer.chatPay.inmoney.repository.BizAccountTranslogRepository;
import com.xinbo.fundstransfer.domain.enums.AccountType;
import com.xinbo.fundstransfer.domain.pojo.AccountBaseInfo;
import com.xinbo.fundstransfer.service.AccountService;
import com.xinbo.fundstransfer.service.RedisService;
import lombok.extern.slf4j.Slf4j;
/**
* ๅ
ผ่ไปฃไปๅๆฏไป็ธๅ
ณๅค็
*
* @author ERIC
*
*/
@Slf4j
@Service("ParttimeInmoneyServiceImpl")
public class ParttimeInmoneyServiceImpl extends InmoneyServiceImpl {
@Autowired
private BizAccountTranslogRepository accountTranslogRepository;
@Autowired
RedisService redisService;
@Autowired
private AccountService accountService;
private ObjectMapper mapper = new ObjectMapper();
@Override
void killIncomeOrderDifferent(P2pKillIncomDto p2pKillIncomDto, BizChatpayLog chatpayLog) {
log.info("ๅ
ผ่่ขซ่ธขๆๆถไธๅๅค็");
}
@Override
public void inmoneyCancelDifferent(Long timestamp, BizChatpayLog chatpayLog, String remark) {
BizAccountTranslog translog = chatpayLog.getTranslog();
log.info("ๅๆถๅ
ผ่ไปฃไป่ฎฐๅฝ: {}", translog.getBizId());
translog.setStatus(2);
translog.setFinshTranTime(new Date(timestamp));
accountTranslogRepository.saveAndFlush(translog);
}
@Override
InmoneyNotifyInfoDto inmoneyConfirmDifferent(Long timestamp, BizChatpayLog chatpayLog, String remark) {
BizAccountTranslog translog = chatpayLog.getTranslog();
log.info("็กฎ่ฎคๅ
ผ่ไปฃไป่ฎฐๅฝ: {}",translog.getBizId());
translog.setStatus(1);
translog.setFinshTranTime(new Date(timestamp));
accountTranslogRepository.saveAndFlush(translog);
log.info("ๅๅ
ฅRedis็CHATPAY_SYN_REBATE_USER_ORDER๏ผๅ็ปญๆจ้็ป่ฟๅฉ็ฝ");
try {
redisService.rightPush(RedisKeyEnums.CHATPAY_SYN_REBATE_USER_ORDER.getKey(), mapper.writeValueAsString(toMap(translog)));
} catch (JsonProcessingException e) {
log.error("ๅๅ
ฅRedis็CHATPAY_SYN_REBATE_USER_ORDERๆฅ้", e);
}
return new InmoneyNotifyInfoDto(translog.getBizId(),translog.getCode(),translog.getRoomNum(),translog.getRoomToken());
}
private Map<String, Object> toMap(BizAccountTranslog translog) {
String tradeType = "2";
if(translog.getAccountId() == null) {
throw new IllegalArgumentException("BizAccountTranslog:" + translog.getId() + "็account_idไธบ็ฉบ");
}
AccountBaseInfo account = accountService.getFromCacheById(translog.getAccountId().intValue());
if(account == null) {
throw new IllegalArgumentException("่ดฆๅทID๏ผ"+translog.getAccountId()+"ๅจbiz_accountไธญไธๅญๅจ");
}
if(account.getType() != null && account.getType().intValue() == AccountType.InAccountFlwZfb.getTypeId().intValue()) {
tradeType = "1";
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String, Object> map = new HashMap<String, Object>();
map.put("uid", translog.getRebateUid());
map.put("tradeType", tradeType);
map.put("tradeStatus", "1");
map.put("tradeNo", translog.getCode());
map.put("roomNo", translog.getRoomNum());
map.put("creator", translog.getMember());
map.put("receiver", account.getAlias());
map.put("chkCode", translog.getRoomToken());
map.put("amount", translog.getMoney().negate());
map.put("tradeTime", sdf.format(translog.getFinshTranTime()));
map.put("catchTime", translog.getCreatetime() == null ? sdf.format(new Date()) : sdf.format(translog.getCreatetime()));
return map;
}
}
| true
|
e6f57b703d81d02ad1d6daced07c9a0d30135415
|
Java
|
asetiyadi/spring-web
|
/src/com/ibm/spring/web/controllers/OffersController.java
|
UTF-8
| 3,112
| 2.375
| 2
|
[] |
no_license
|
package com.ibm.spring.web.controllers;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.ibm.spring.web.dao.Offer;
import com.ibm.spring.web.service.OffersService;
@Controller
public class OffersController {
private OffersService offersService;
@Autowired
public void setOffersService(OffersService offersService) {
this.offersService = offersService;
}
@RequestMapping("/offers")
public String showOffers(Model model) {
this.offersService.throwTestException();
List<Offer> offers = this.offersService.getCurrent();
model.addAttribute("offers", offers);
return "offers";
}
@RequestMapping(value="/test", method=RequestMethod.GET)
public String showTest(Model model, @RequestParam("id") String id) {
System.out.println("id is " + id);
return "home";
}
// Handle any database exception
/*@ExceptionHandler(DataAccessException.class)
public String handleDatabaseException(DataAccessException ex) {
return "error";
}*/
@RequestMapping("/createoffer")
public String createOffer(Model model) {
// The "offer" must match the commandName value in createoffer.jsp sf:form
model.addAttribute("offer", new Offer());
return "createoffer";
}
// BindingResult to validate if the the offer object is valid or not
// To tell Spring what to validate, we add @Valid annotation on the argument we want Spring to validate
// To use @Valid, we need to import appropriate jar using Maven
// - validation-api
// - hibernate
// - hibernate-validator
//
// In Offer.java, we need to specify validation we want to perform for each of the Offer property
@RequestMapping(value="/docreate", method=RequestMethod.POST)
public String doCreate(Model model, @Valid Offer offer, BindingResult result) {
if(result.hasErrors()) {
/*System.out.println("Form does not validate");
List<ObjectError> errors = result.getAllErrors();
for(ObjectError error: errors) {
System.out.println(error.getDefaultMessage());
}*/
return "createoffer";
}
this.offersService.create(offer);
return "offercreated";
}
/*@RequestMapping("/")
public ModelAndView showHome() {
// ModelAndView exists in REQUEST Scope //
// pass the logical name of the view to constructor
ModelAndView mv = new ModelAndView("home");
// return map
Map<String, Object> model = mv.getModel();
model.put("name", "Lenon");
return mv;
}*/
/*
* public String showHome(HttpSession session) {
*
* session.setAttribute("name", "Otong");
*
* return "home"; }
*/
}
| true
|
2f91a138c366c1e1f333a622d3feb25fbfce955e
|
Java
|
damithchmr/Assignment
|
/src/assignment/model/ConfigurationData.java
|
UTF-8
| 643
| 2.3125
| 2
|
[] |
no_license
|
package assignment.model;
public class ConfigurationData {
private String boundaryPosition;
private String startPosition;
private String instruction;
public String getBoundaryPosition() {
return boundaryPosition;
}
public void setBoundaryPosition(String boundaryPosition) {
this.boundaryPosition = boundaryPosition;
}
public String getStartPosition() {
return startPosition;
}
public void setStartPosition(String startPosition) {
this.startPosition = startPosition;
}
public String getInstruction() {
return instruction;
}
public void setInstruction(String instruction) {
this.instruction = instruction;
}
}
| true
|
8f5a420a9be2f15e3c585cb7bcce6246f1e914f2
|
Java
|
majiajue/ooobgy
|
/java_study/jung/dynamic_sna/src/edu/zju/cs/ooobgy/algo/dynamic_na/DynamicCluster.java
|
UTF-8
| 1,899
| 2.703125
| 3
|
[] |
no_license
|
package edu.zju.cs.ooobgy.algo.dynamic_na;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.collections15.Transformer;
import edu.zju.cs.ooobgy.algo.dynamic_na.pojo.ClusterSlice;
import edu.zju.cs.ooobgy.algo.dynamic_na.pojo.IdCluster;
import edu.zju.cs.ooobgy.algo.math.matrix.Matrix;
/**
* ๅฏนไธคไธชๅ็่ฟ่กๅจๆๅๆ
*
* @author frogcherry ๅจๆ้พ
* @created 2010-12-22
* @Email frogcherry@gmail.com
*/
public class DynamicCluster<V, E> implements
Transformer<ClusterSlice<V, E>, ClusterSlice<V, E>> {
private ClusterSlice<V, E> preSlice;// ๅทฒ็ฅ็ไธไธๅ็
private Set<Set<V>> newSliceClusters;// ๅทฒ็ฅ็ๅพ
ๅค็ๅ็็ๅขไผไฟกๆฏ
/**
* ไฝฟ็จๅทฒ็ฅ็ไธไธๅ็๏ผๅทฒ็ฅ็ๅพ
ๅค็ๅ็็ๅขไผไฟกๆฏ่ฟ่กๆ้ ; ๅทฒ็ฅๆกไปถไธๆปก่ถณๆ ๆณ่ฟ่กๅๆ
*
* @param preSlice
* @param newSliceClusters
*/
public DynamicCluster(ClusterSlice<V, E> preSlice,
Set<Set<V>> newSliceClusters) {
super();
this.preSlice = preSlice;
this.newSliceClusters = newSliceClusters;
}
/**
* ไผ ๅ
ฅๆฐ็ๅ็๏ผๅ
ๅซๅพไฟกๆฏ๏ผไธๅ
ๅซๅขไผๅฏนๅบไฟกๆฏ๏ผ,ๆ นๆฎๅทฒ็ฅ็ไธไธๅ็่ฟ่กๅฏนๅบๅจๆๅๆ
*/
@Override
public ClusterSlice<V, E> transform(ClusterSlice<V, E> newSlice) {
ClusterSlice<V, E> slice = newSlice;
List<Entry<String, IdCluster<V>>> preCluster = new ArrayList<Entry<String, IdCluster<V>>>(
preSlice.getClusters().entrySet());//ๅทฒ็ฅๅขไผ็idๅฏนๅบๆ
ๅต๏ผ่ฝฌไธบlistๆนไพฟๅ็ปญๅๆ
List<Set<V>> newClusters = new ArrayList<Set<V>>(newSliceClusters);//ๆฐ็ๅขไผไฟกๆฏ๏ผๅพ
ๅๆlist
Matrix similarityMatrix = new Matrix(preCluster.size(), newClusters.size());//็ธไผผๅบฆ็ฉ้ต
//1.ๅกซๅ
็ธไผผๅบฆ็ฉ้ต
for (int i = 0; i < preCluster.size(); i++) {
}
// TODO Auto-generated method stub
return slice;
}
}
| true
|
4ae2462275aecf5874706889a296371bacf83d6a
|
Java
|
javitan/Star-Wars-Labyrinth
|
/src/ED/Pila.java
|
UTF-8
| 2,777
| 3.78125
| 4
|
[] |
no_license
|
/**
* Implementaciรณn de la clase Pila.
* @version 4.0
* @author <b> Planet Express </b><br>
* Nombre y apellidos: Javier Garcรญa Valencia
* Curso: 3ยบ GIIIS
* Asignatura Desarrollo de Programas<br/>
* Curso 15/16
*/
package ED;
public class Pila<TipoDato extends Comparable<TipoDato>> {
/** Puntero a la cima de la pila */
private Nodo<TipoDato> cima;
private class Nodo<TipoDato extends Comparable<TipoDato>> {
/** Dato almacenado en cada nodo */
private TipoDato dato;
/** Enlace al siguiente elemento */
private Nodo<TipoDato> siguiente;
Nodo(TipoDato dato) { // Constructor de la clase Nodo.
this.dato = dato;
this.siguiente = null;
}
}
/**
* Metodo constructor por defecto de la clase Pila.
*/
public Pila() {
cima = null;
}
/**
* Metodo constructor parametrizado de la clase Pila.
*
* @param data
* es el nuevo elemento en la pila.
*/
public Pila(TipoDato dato) {
Nodo<TipoDato> nodo = new Nodo<TipoDato>(dato);
nodo.siguiente = cima;
cima = nodo;
}
/**
* Metodo que permite insertar un dato.
*
* @param dato
* valor que se va a insertar.
*/
public void apilar(TipoDato dato) {
Nodo<TipoDato> nodo = new Nodo<TipoDato>(dato);
nodo.siguiente = cima;
cima = nodo;
}
/**
* Elimina un dato de la pila. Se elimina el dato que esta en la cima.
*/
public void desapilar() {
if (!estaVacia()) {
cima = cima.siguiente;
}
}
/**
* Metodo para comprobar si la pila esta vacia o no.
*
* @return true si estรก vacia o false en caso contrario.
*/
public boolean estaVacia() {
return (cima == null);
}
/**
* Metodo que devuelve el elemento en la cima de la pila.
*
* @return la cima de la pila.
*/
public TipoDato obtenerCima() {
return cima.dato;
}
public String toString() {
String string = "";
Nodo<TipoDato> aux = this.cima;
for (aux = cima; aux != null; aux = aux.siguiente) {
string = string + aux.dato + " ";
}
return string;
}
/**
* Metodo principal. Hace pruebas de inserciones y borrados en la pila y
* muestra el resultado obtenido.
*
* @param args
* Argumentos que recibe el programa principal.
*/
// public static void main(String args[]) {
// Integer[] dataSet = { new Integer(2), new Integer(8), new Integer(3),
// new Integer(4), new Integer(1), new Integer(5) };
//
// // Pruebas de inserciones en la pila.
// Pila<Integer> pila = new Pila<Integer>();
// for (int i = 0; i < dataSet.length; i++) {
// pila.apilar(dataSet[i]);
// }
//
// // Mostrando la pila.
// // while (!pila.estaVacia()) {
// // System.out.print(pila.obtenerCima() + " : ");
// // pila.desapilar();
// // }
// //
// // System.out.println();
// System.out.println(pila);
// // pila.toString();
// }
}
| true
|
bcab00fe9167c0623e5abbd6cfefd40e9d191d50
|
Java
|
gauravjolly2210/GoogleSheets
|
/src/test/java/com/qait/automation/GoogleApi/Runner.java
|
UTF-8
| 256
| 1.507813
| 2
|
[] |
no_license
|
package com.qait.automation.GoogleApi;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
@CucumberOptions(
features ="Feature"
,glue= {"Steps"}
)
public class Runner extends AbstractTestNGCucumberTests{
}
| true
|
bdfbc185e5f790f04e59a68f728fb6caab997a75
|
Java
|
herey-bit/AppClientesMoralFisico
|
/src/DTO/Prueba.java
|
UTF-8
| 437
| 2.40625
| 2
|
[] |
no_license
|
package DTO;
import DTO.*;
public class Prueba {
public static void main(String[] args) {
Persona[] n = new Persona[3];
PersonaMoral ok = new PersonaMoral();
//System.out.println(new PersonaMoral().getClass().getName());
System.out.println(n.getClass()+" "+n.getClass().getName());
if(n.getClass().getName() == "DTO.Prueba"){
System.out.println("aisbfskj");
}
}
}
| true
|
1314383814d4d5853c6be7640a33e1807c598e94
|
Java
|
D-M-Moriarty/DesignPatternsCA
|
/src/main/java/things/entity/strategy/update/UpdateSprite.java
|
UTF-8
| 93
| 1.945313
| 2
|
[] |
no_license
|
package things.entity.strategy.update;
public interface UpdateSprite {
void update();
}
| true
|
1c8f24c43dd9db98ee3e7e9fe24081945002cec2
|
Java
|
aysem61/tekrarveodev
|
/src/udemyProje/Test1BoyVeKilo.java
|
UTF-8
| 1,920
| 3.21875
| 3
|
[] |
no_license
|
package udemyProje;
import java.util.Scanner;
public class Test1BoyVeKilo {
public static void main(String[] args) {
// TODO Auto-generated method stub
boy_kilo();
hiz();
deger_degistirme();
hipotenus();
}
private static void hipotenus() {
// ucgenin dik kenarlari ile hipotenus bulunuz
Scanner s=new Scanner(System.in);
int a;
int b;
System.out.println("ucgenin iki dik kenarini giriniz ");
a=s.nextInt();
b=s.nextInt();
System.out.println("simdi h yi hesaplayiniz ");
double h=Math.sqrt(a*a+b*b);
System.out.println(" hipotenus "+h);
}
private static void deger_degistirme() {
// TODO Auto-generated method stub
//Kullanicidan aldiginiz iki sayinin degerlerini degistirin
Scanner sc=new Scanner(System.in);
System.out.println("lutfen iki deger giriniz");
int a=sc.nextInt();
int b=sc.nextInt();
int c;
c=a;
a=b;
b=c;
System.out.println("yeni degerler :"+a+" ve "+b);
}
public static void boy_kilo() {
/*
* Kullanicidan aldiginiz boy ve kilo degerlerine gore
*
* kullanicinin beden kitle indexini bulun
*
* Beden kitle index= Kilo/boy(m)*Boy(m)
*/
System.out.println("Boy ve kilonunuzu sirayla giriniz");
Scanner sc=new Scanner(System.in);
double boy=sc.nextDouble();
double kilo=sc.nextDouble();
System.out.println("Beden kitle indexiniz : "+(kilo/boy)*boy);
}
public static void hiz() {
/*Bir aracin km de ne kadar yaktigini ve kac km yol yaptigini bilgilerini alin ve
*
* sucurunun toplam ne kadar odemesini gerektigini hesaplayiniz
*
*/
Scanner sc=new Scanner(System.in);
System.out.println("arac bilgilerini giriniz ");
double sarf=sc.nextDouble();
double km=sc.nextDouble();
System.out.println("Odemeniz gereken miktar :"+(sarf*km));
}
}
| true
|
ef1e57913e7793ce3e81e6617c11ba58e54822bc
|
Java
|
chenzhikaizg/MyShppingDemo
|
/app/src/main/java/cn/aiyangkeji/activities/zhaoyys/QuickWenDaActivity.java
|
UTF-8
| 7,245
| 1.9375
| 2
|
[] |
no_license
|
package cn.aiyangkeji.activities.zhaoyys;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.jph.takephoto.app.TakePhotoActivity;
import com.jph.takephoto.model.TImage;
import com.jph.takephoto.model.TResult;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import cn.aiyangkeji.R;
import cn.aiyangkeji.activities.base.BaseActivity;
import cn.aiyangkeji.activities.myinfo.YysRegisterActivity;
import cn.aiyangkeji.util.ImgAndCameraHelper;
import cn.aiyangkeji.util.ListViewUtil;
import cn.aiyangkeji.view.MyDialog;
/**
* Created by chenzhikai on 2017/11/3.
*/
public class QuickWenDaActivity extends TakePhotoActivity implements View.OnClickListener {
private ImageView ivBack;
private Button btnOne;
private Button btnTwo;
private Button btnThree;
private Button btnFour;
private Button btnFive;
private Button btnSix;
private List<Button> list;
private ImgAndCameraHelper imgAndCameraHelper;
private ImageView ivImg;
private ImageView ivConfirmImg;
private TextView tvImg;
private MyDialog myDialog;
private File file;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quick_wenda);
initView();
initListener();
initData();
imgAndCameraHelper = ImgAndCameraHelper.of();
}
public void initView() {
TextView tvTitle = (TextView)findViewById(R.id.tv_title);
tvTitle.setText("ๅฟซ้้ฎ็ญ");
ivBack = (ImageView)findViewById(R.id.iv_back);
btnOne = (Button)findViewById(R.id.btn_one);
btnTwo = (Button)findViewById(R.id.btn_two_class);
btnThree = (Button)findViewById(R.id.btn_three);
btnFour = (Button)findViewById(R.id.btn_four);
btnFive = (Button)findViewById(R.id.btn_five);
btnSix = (Button)findViewById(R.id.btn_six);
ivImg = (ImageView)findViewById(R.id.iv_img);
ivConfirmImg = (ImageView)findViewById(R.id.iv_confirm_img);
tvImg = (TextView)findViewById(R.id.tv_img);
}
public void initListener() {
ivBack.setOnClickListener(this);
btnOne.setOnClickListener(this);
btnTwo.setOnClickListener(this);
btnThree.setOnClickListener(this);
btnFour.setOnClickListener(this);
btnFive.setOnClickListener(this);
btnSix.setOnClickListener(this);
ivImg.setOnClickListener(this);
ivConfirmImg.setOnClickListener(this);
}
public void initData() {
list = new ArrayList<Button>();
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.iv_back:
this.finish();
break;
case R.id.btn_one:
setYysClass(btnOne);
break;
case R.id.btn_two_class:
setYysClass(btnTwo);
break;
case R.id.btn_three:
setYysClass(btnThree);
break;
case R.id.btn_four:
setYysClass(btnFour);
break;
case R.id.btn_five:
setYysClass(btnFive);
break;
case R.id.btn_six:
setYysClass(btnSix);
break;
case R.id.iv_img:
case R.id.iv_confirm_img:
file = new File(Environment.getExternalStorageDirectory(), "/temp/" + System.currentTimeMillis() + ".jpg");
myDialog = new MyDialog(QuickWenDaActivity.this, 0.2f, 0.6f);
myDialog.show();
View view = LayoutInflater.from(QuickWenDaActivity.this).inflate(R.layout.img_and_camera_dialog, null);
myDialog.addView(view);
view.findViewById(R.id.btn_sure).setOnClickListener(this);
view.findViewById(R.id.btn_cancel).setOnClickListener(this);
break;
case R.id.btn_sure:
imgAndCameraHelper.onlick(v, getTakePhoto(), file);
myDialog.cancel();
break;
case R.id.btn_cancel:
imgAndCameraHelper.onlick(v, getTakePhoto(), file);
myDialog.cancel();
break;
default:
break;
}
}
@Override
public void takeCancel() {
super.takeCancel();
}
@Override
public void takeFail(TResult result, String msg) {
super.takeFail(result, msg);
}
@Override
public void takeSuccess(TResult result) {
super.takeSuccess(result);
showImg(result.getImages());
}
private void showImg(ArrayList<TImage> images) {
String compressPath = images.get(0).getOriginalPath();
Log.e("ddddddddddddddddddddddddd", "showImg: " + compressPath);
Log.e("ddddddddddddddddddddddddd", "file: " + file);
ivImg.setVisibility(View.GONE);
tvImg.setVisibility(View.GONE);
Glide.with(this).load(new File(images.get(images.size() - 1).getCompressPath())).into(ivConfirmImg);
}
/**
* ่ฅๅ
ป้ๆฉ
* @param btn
*/
public void setYysClass(Button btn){
btnOne.setBackgroundResource(R.drawable.bg_shape_grey_login_border_no_solid_xiao);
btnOne.setTextColor(getResources().getColor(R.color.text_grey));
btnTwo.setBackgroundResource(R.drawable.bg_shape_grey_login_border_no_solid_xiao);
btnTwo.setTextColor(getResources().getColor(R.color.text_grey));
btnThree.setBackgroundResource(R.drawable.bg_shape_grey_login_border_no_solid_xiao);
btnThree.setTextColor(getResources().getColor(R.color.text_grey));
btnFour.setBackgroundResource(R.drawable.bg_shape_grey_login_border_no_solid_xiao);
btnFour.setTextColor(getResources().getColor(R.color.text_grey));
btnFive.setBackgroundResource(R.drawable.bg_shape_grey_login_border_no_solid_xiao);
btnFive.setTextColor(getResources().getColor(R.color.text_grey));
btnSix.setBackgroundResource(R.drawable.bg_shape_grey_login_border_no_solid_xiao);
btnSix.setTextColor(getResources().getColor(R.color.text_grey));
if (list.size()==0){
btn .setBackgroundResource(R.drawable.bg_shape_pink_shixin_corners_small);
btn.setTextColor(getResources().getColor(R.color.white));
list.add(btn);
}else {
if (list.get(0)==btn){
btn.setBackgroundResource(R.drawable.bg_shape_grey_login_border_no_solid_xiao);
btn.setTextColor(getResources().getColor(R.color.text_grey));
list.clear();
}else {
list.clear();
btn .setBackgroundResource(R.drawable.bg_shape_pink_shixin_corners_small);
btn.setTextColor(getResources().getColor(R.color.white));
list.add(btn);
}
}
}
}
| true
|
7c679b4addf3cbbcbe968079c02247f64f398c5b
|
Java
|
druidJane/Druid3.0.3
|
/web-server/server-common/src/main/java/com/xuanwu/mos/vo/ContentVo.java
|
UTF-8
| 467
| 2.046875
| 2
|
[] |
no_license
|
package com.xuanwu.mos.vo;
/**
* Created by ้ญๅ่พ on 2017/8/8.
*/
public class ContentVo {
private Integer type;
private Object content;
public ContentVo() {
}
public Object getContent() {
return content;
}
public void setContent(Object content) {
this.content = content;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
| true
|
77b9df5c21b3dbf6609c258aceea814059a910d8
|
Java
|
CronutJun/NICE
|
/nibs_ams_broker/src/main/java/com/nicetcm/nibsplus/broker/ams/mapper/TRmFileHisMapper.java
|
UTF-8
| 8,315
| 1.578125
| 2
|
[] |
no_license
|
package com.nicetcm.nibsplus.broker.ams.mapper;
import com.nicetcm.nibsplus.broker.ams.model.TRmFileHis;
import com.nicetcm.nibsplus.broker.ams.model.TRmFileHisKey;
import com.nicetcm.nibsplus.broker.ams.model.TRmFileHisSpec;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
public interface TRmFileHisMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@SelectProvider(type=TRmFileHisSqlProvider.class, method="countBySpec")
int countBySpec(TRmFileHisSpec spec);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@DeleteProvider(type=TRmFileHisSqlProvider.class, method="deleteBySpec")
int deleteBySpec(TRmFileHisSpec spec);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@Delete({
"delete from AMS.T_RM_FILE_HIS",
"where CREATE_DATE = #{createDate,jdbcType=VARCHAR}",
"and FILE_SEQ = #{fileSeq,jdbcType=VARCHAR}",
"and HIS_SEQ = #{hisSeq,jdbcType=VARCHAR}"
})
int deleteByPrimaryKey(TRmFileHisKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@Insert({
"insert into AMS.T_RM_FILE_HIS (CREATE_DATE, FILE_SEQ, ",
"HIS_SEQ, INSERT_DATE, ",
"INSERT_UID, MAC_NO, ",
"TRX_DATE, TRX_NO, ",
"ACT_CD)",
"values (#{createDate,jdbcType=VARCHAR}, #{fileSeq,jdbcType=VARCHAR}, ",
"#{hisSeq,jdbcType=VARCHAR}, #{insertDate,jdbcType=TIMESTAMP}, ",
"#{insertUid,jdbcType=VARCHAR}, #{macNo,jdbcType=VARCHAR}, ",
"#{trxDate,jdbcType=VARCHAR}, #{trxNo,jdbcType=VARCHAR}, ",
"#{actCd,jdbcType=VARCHAR})"
})
int insert(TRmFileHis record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@InsertProvider(type=TRmFileHisSqlProvider.class, method="insertSelective")
int insertSelective(TRmFileHis record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@SelectProvider(type=TRmFileHisSqlProvider.class, method="selectBySpec")
@Results({
@Result(column="CREATE_DATE", property="createDate", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="FILE_SEQ", property="fileSeq", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="HIS_SEQ", property="hisSeq", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="INSERT_DATE", property="insertDate", jdbcType=JdbcType.TIMESTAMP),
@Result(column="INSERT_UID", property="insertUid", jdbcType=JdbcType.VARCHAR),
@Result(column="MAC_NO", property="macNo", jdbcType=JdbcType.VARCHAR),
@Result(column="TRX_DATE", property="trxDate", jdbcType=JdbcType.VARCHAR),
@Result(column="TRX_NO", property="trxNo", jdbcType=JdbcType.VARCHAR),
@Result(column="ACT_CD", property="actCd", jdbcType=JdbcType.VARCHAR)
})
List<TRmFileHis> selectBySpec(TRmFileHisSpec spec);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@Select({
"select",
"CREATE_DATE, FILE_SEQ, HIS_SEQ, INSERT_DATE, INSERT_UID, MAC_NO, TRX_DATE, TRX_NO, ",
"ACT_CD",
"from AMS.T_RM_FILE_HIS",
"where CREATE_DATE = #{createDate,jdbcType=VARCHAR}",
"and FILE_SEQ = #{fileSeq,jdbcType=VARCHAR}",
"and HIS_SEQ = #{hisSeq,jdbcType=VARCHAR}"
})
@Results({
@Result(column="CREATE_DATE", property="createDate", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="FILE_SEQ", property="fileSeq", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="HIS_SEQ", property="hisSeq", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="INSERT_DATE", property="insertDate", jdbcType=JdbcType.TIMESTAMP),
@Result(column="INSERT_UID", property="insertUid", jdbcType=JdbcType.VARCHAR),
@Result(column="MAC_NO", property="macNo", jdbcType=JdbcType.VARCHAR),
@Result(column="TRX_DATE", property="trxDate", jdbcType=JdbcType.VARCHAR),
@Result(column="TRX_NO", property="trxNo", jdbcType=JdbcType.VARCHAR),
@Result(column="ACT_CD", property="actCd", jdbcType=JdbcType.VARCHAR)
})
TRmFileHis selectByPrimaryKey(TRmFileHisKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@UpdateProvider(type=TRmFileHisSqlProvider.class, method="updateBySpecSelective")
int updateBySpecSelective(@Param("record") TRmFileHis record, @Param("spec") TRmFileHisSpec spec);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@UpdateProvider(type=TRmFileHisSqlProvider.class, method="updateBySpec")
int updateBySpec(@Param("record") TRmFileHis record, @Param("spec") TRmFileHisSpec spec);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@UpdateProvider(type=TRmFileHisSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(TRmFileHis record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AMS.T_RM_FILE_HIS
*
* @mbggenerated Mon Sep 01 14:25:50 KST 2014
*/
@Update({
"update AMS.T_RM_FILE_HIS",
"set INSERT_DATE = #{insertDate,jdbcType=TIMESTAMP},",
"INSERT_UID = #{insertUid,jdbcType=VARCHAR},",
"MAC_NO = #{macNo,jdbcType=VARCHAR},",
"TRX_DATE = #{trxDate,jdbcType=VARCHAR},",
"TRX_NO = #{trxNo,jdbcType=VARCHAR},",
"ACT_CD = #{actCd,jdbcType=VARCHAR}",
"where CREATE_DATE = #{createDate,jdbcType=VARCHAR}",
"and FILE_SEQ = #{fileSeq,jdbcType=VARCHAR}",
"and HIS_SEQ = #{hisSeq,jdbcType=VARCHAR}"
})
int updateByPrimaryKey(TRmFileHis record);
/**
* CommonPackImpl.insUpdFile์์ ํธ์ถ
*
* ์ ๋ฌธ์ด๋ ฅ Key Generation
*
* @author KDJ, on Mon Aug 18 10:44:00 KST 2014
*/
@Select({
"SELECT LPAD( NVL(MAX(HIS_SEQ), 0) + 1, 6, '0' ) AS HIS_SEQ",
"FROM AMS.T_RM_FILE_HIS ",
"WHERE CREATE_DATE = #{createDate, jdbcType=VARCHAR} ",
"AND FILE_SEQ = #{fileSeq, jdbcType=VARCHAR} "
})
@Results({
@Result(column="HIS_SEQ", property="hisSeq", jdbcType=JdbcType.VARCHAR)
})
String generateKey(TRmFileHis record);
}
| true
|
0a24acc4f8a96ae23dfa869cffcc5d7c82322815
|
Java
|
cybergrouch/solvers
|
/models/src/main/java/org/lange/experiments/solver/models/CurrencyPairUtil.java
|
UTF-8
| 1,516
| 2.875
| 3
|
[] |
no_license
|
package org.lange.experiments.solver.models;
import org.apache.commons.lang3.tuple.Pair;
import org.paukov.combinatorics3.Generator;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Created by lange on 26/11/16.
*/
public class CurrencyPairUtil {
public static final Comparator<? super Currency> CURRENCY_COMPARATOR = (cur1, cur2) -> cur1.name().compareTo(cur2.name());
public static final Function<List<Currency>, List<Currency>> NORMALISE_LIST = list -> {
list.sort(CURRENCY_COMPARATOR);
return list;
};
public static final Function<List<Currency>, Pair<Currency, Currency>> LIST_TO_PAIR = listPair -> Pair.of(listPair.get(0), listPair.get(1));
public static final Function<Pair<Currency, Currency>, List<Currency>> PAIR_TO_LIST = pair -> Stream.of(pair.getLeft(), pair.getRight()).collect(Collectors.toList());
public static final Function<Pair<Currency, Currency>, Pair<Currency, Currency>> NORMALISE_PAIR = pair -> Optional.ofNullable(pair).map(LIST_TO_PAIR.compose(NORMALISE_LIST).compose(PAIR_TO_LIST)).orElse(null);
public static List<Pair<Currency, Currency>> generate(Currency[] currencies) {
return Generator.combination(currencies)
.simple(2)
.stream()
.map(LIST_TO_PAIR.compose(NORMALISE_LIST))
.collect(Collectors.toList());
}
}
| true
|
ee933abe8e58c8635d4d8cbe468937b28340b1a1
|
Java
|
VNeufeld/testGis
|
/com.dev.gis.connector/src/com/dev/gis/connector/joi/protocol/DayAndHour.java
|
UTF-8
| 664
| 2.296875
| 2
|
[] |
no_license
|
package com.dev.gis.connector.joi.protocol;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name="dayHour")
public class DayAndHour extends BasicProtocol {
private String date = "";
private String time = "";
public DayAndHour() {
// empty
}
public String getDate() {
return date;
}
public String getTime() {
return time;
}
public void setDate(String date) {
this.date = date;
}
public void setTime(String time) {
this.time = time;
}
}
| true
|
ca8068e7baaf3d97d9547ae3a9562bac4079cf3e
|
Java
|
Ariah-Group/Continuity
|
/src/test/java/org/kuali/continuity/admin/dao/ITestSuite.java
|
UTF-8
| 1,934
| 1.671875
| 2
|
[
"LGPL-2.0-or-later",
"ICU",
"CPL-1.0",
"MPL-2.0",
"Apache-2.0",
"Plexus",
"CDDL-1.0",
"ECL-2.0"
] |
permissive
|
//
// Copyright 2011 Kuali Foundation, Inc. Licensed under the
// Educational Community 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.opensource.org/licenses/ecl2.php
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an "AS IS"
// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
package org.kuali.continuity.admin.dao;
import junit.framework.Test;
import junit.framework.TestSuite;
public class ITestSuite {
public static Test suite() {
TestSuite suite = new TestSuite(ITestSuite.class.getName());
suite.addTestSuite(AcronymDAOTest.class);
suite.addTestSuite(AnnualReviewDAOTest.class);
suite.addTestSuite(BuildingDAOTest.class);
suite.addTestSuite(CentralApplicationDAOTest.class);
suite.addTestSuite(ContactInfoDAOTest.class);
suite.addTestSuite(CriticalFunctionExampleDAOTest.class);
suite.addTestSuite(DepartmentTypeDAOTest.class);
suite.addTestSuite(DependencyDAOTest.class);
suite.addTestSuite(FAQDAOTest.class);
suite.addTestSuite(InstructionalDepartmentDAOTest.class);
suite.addTestSuite(MajorDivisionDAOTest.class);
suite.addTestSuite(PlannerLogCategoryDAOTest.class);
suite.addTestSuite(ReferenceDAOTest.class);
suite.addTestSuite(ShiftDAOTest.class);
suite.addTestSuite(SkillDAOTest.class);
suite.addTestSuite(StaffCategoryDAOTest.class);
suite.addTestSuite(SystemDomainDAOTest.class);
suite.addTestSuite(ToKnowItemDAOTest.class);
suite.addTestSuite(UserDAOTest.class);
suite.addTestSuite(UtilityDAOTest.class);
return suite;
}
}
| true
|
5322c6ff97de41506b51b69917316e68f028a02d
|
Java
|
GilBert1987/leetcode
|
/src/com/gilbert/algo/dp/MaxProfile.java
|
UTF-8
| 1,233
| 3.875
| 4
|
[] |
no_license
|
package com.gilbert.algo.dp;
// https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/
// LK 121 ไนฐๅ่ก็ฅจ็ๆไฝณๆถๆบ
//็ปๅฎไธไธชๆฐ็ป๏ผๅฎ็็ฌฌย i ไธชๅ
็ด ๆฏไธๆฏ็ปๅฎ่ก็ฅจ็ฌฌ i ๅคฉ็ไปทๆ ผใ
//
// ๅฆๆไฝ ๆๅคๅชๅ
่ฎธๅฎๆไธ็ฌไบคๆ๏ผๅณไนฐๅ
ฅๅๅๅบไธๆฏ่ก็ฅจไธๆฌก๏ผ๏ผ่ฎพ่ฎกไธไธช็ฎๆณๆฅ่ฎก็ฎไฝ ๆ่ฝ่ทๅ็ๆๅคงๅฉๆถฆใ
//
// ๆณจๆ๏ผไฝ ไธ่ฝๅจไนฐๅ
ฅ่ก็ฅจๅๅๅบ่ก็ฅจใ
// [7,1,5,3,6,4]
// 5
//่พๅ
ฅ: [7,6,4,3,1]
// ่พๅบ: 0
// ่งฃ้: ๅจ่ฟ็งๆ
ๅตไธ, ๆฒกๆไบคๆๅฎๆ, ๆไปฅๆๅคงๅฉๆถฆไธบ 0ใ
public class MaxProfile {
public static int maxProfile(int [] prices) {
if (prices == null || prices.length == 0 ) {
return 0;
}
int minPrize = prices[0];
int maxPro = 0;
for (int i = 1; i< prices.length; i ++) {
int profile = prices[i] - minPrize;
if (profile < 0) {
profile = 0;
minPrize = prices[i];
}
maxPro = Math.max(profile, maxPro);
}
return maxPro;
}
public static void main(String[] a) {
System.out.println(maxProfile(new int[] {7,1,5,3,6,4}));
}
}
| true
|
72d8207772a88df1c71d8bf028a94fce62b929ee
|
Java
|
StefanLevoca/griddlers
|
/griddlers/src/main/java/sk/upjs/paz1c/griddlers/persistentna/MysqlKrizovkaDao.java
|
UTF-8
| 4,200
| 2.25
| 2
|
[] |
no_license
|
package sk.upjs.paz1c.griddlers.persistentna;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import sk.upjs.paz1c.griddlers.Narocnost;
import sk.upjs.paz1c.griddlers.entity.Krizovka;
import sk.upjs.paz1c.griddlers.entity.Legenda;
import sk.upjs.paz1c.griddlers.entity.Policko;
public class MysqlKrizovkaDao implements KrizovkaDao {
private JdbcTemplate jdbcTemplate;
private PolickoDao polickoDao;
private LegendaDao legendaDao;
public MysqlKrizovkaDao(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
this.polickoDao = DaoFactory.INSTANCE.getPolickoDao();
this.legendaDao = DaoFactory.INSTANCE.getLegendaDao();
}
public List<Krizovka> getVsetky() {
String sql = "SELECT id, nazov, narocnost, sirka, vyska FROM krizovka";
return jdbcTemplate.query(sql, new RowMapper<Krizovka>() {
@Override
public Krizovka mapRow(ResultSet rs, int rowNum) throws SQLException {
Krizovka krizovka = new Krizovka();
krizovka.setId(rs.getLong("id"));
krizovka.setNazov(rs.getString("nazov"));
krizovka.setNarocnost(Narocnost.valueOf(rs.getString("narocnost")));
krizovka.setSirka(rs.getInt("sirka"));
krizovka.setVyska(rs.getInt("vyska"));
krizovka.setRiesenie(polickoDao.getPodlaId(krizovka.getId()));
krizovka.setLegendaH(legendaDao.getHornaPodlaId(krizovka.getId()));
krizovka.setLegendaL(legendaDao.getLavaPodlaId(krizovka.getId()));
return krizovka;
}
});
}
@Override
public Krizovka ulozit(Krizovka krizovka) {
if (krizovka == null)
return null;
if (krizovka.getId() == null) {
SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(jdbcTemplate);
simpleJdbcInsert.withTableName("krizovka");
simpleJdbcInsert.usingGeneratedKeyColumns("id");
simpleJdbcInsert.usingColumns("nazov", "narocnost", "sirka", "vyska");
Map<String, Object> hodnoty = new HashMap<>();
hodnoty.put("nazov", krizovka.getNazov());
hodnoty.put("narocnost", krizovka.getNarocnost().name());
hodnoty.put("sirka", krizovka.getSirka());
hodnoty.put("vyska", krizovka.getVyska());
Long id = simpleJdbcInsert.executeAndReturnKey(hodnoty).longValue();
krizovka.setId(id);
List<Legenda> legendaH = krizovka.getLegendaH();
List<Legenda> legendaL = krizovka.getLegendaL();
List<Policko> riesenie = krizovka.getRiesenie();
legendaDao.ulozit(legendaH, krizovka.getId());
legendaDao.ulozit(legendaL, krizovka.getId());
polickoDao.ulozit(riesenie, krizovka.getId());
} else {
// AKTUALIZACIA
String sql = "UPDATE krizovka SET nazov = ?, narocnost = ?, sirka = ?, vyska = ? WHERE id = ?";
jdbcTemplate.update(sql, krizovka.getNazov(), krizovka.getNarocnost().name(), krizovka.getSirka(),
krizovka.getVyska(), krizovka.getId());
}
return krizovka;
}
@Override
public void vymazat(Long krizovkaId) {
String sql = String.format("DELETE FROM krizovka WHERE id = %d", krizovkaId);
jdbcTemplate.update(sql);
}
@Override
public List<Krizovka> getPodlaNarocnosti(Narocnost narocnost) {
String sql = "SELECT id, narocnost, sirka, vyska, nazov FROM krizovka WHERE narocnost = ?";
Object[] parametre = new Object[] { narocnost.name() };
return jdbcTemplate.query(sql, parametre, new RowMapper<Krizovka>() {
@Override
public Krizovka mapRow(ResultSet rs, int row) throws SQLException {
Krizovka krizovka = new Krizovka();
krizovka.setId(rs.getLong("id"));
krizovka.setNarocnost(Narocnost.valueOf(rs.getString("narocnost")));
krizovka.setSirka(rs.getInt("sirka"));
krizovka.setVyska(rs.getInt("vyska"));
krizovka.setNazov(rs.getString("nazov"));
krizovka.setRiesenie(polickoDao.getPodlaId(krizovka.getId()));
krizovka.setLegendaH(legendaDao.getHornaPodlaId(krizovka.getId()));
krizovka.setLegendaL(legendaDao.getLavaPodlaId(krizovka.getId()));
return krizovka;
}
});
}
}
| true
|
b029a655a12c452951a30564ed2d1165608c85d4
|
Java
|
skullbonk/FancySandGame
|
/src/sand/controller/SandLab.java
|
UTF-8
| 7,610
| 3.09375
| 3
|
[] |
no_license
|
package sand.controller;
import java.awt.*;
import java.util.*;
import sand.view.SandDisplay;
public class SandLab
{
// public Map tools = new Hashtable();
//Step 4,6
//add constants for particle types here
public static final int EMPTY = 0;
public static final int METAL = 1;
public static final int SAND = 2;
public static final int WATER = 3;
public static final int DIRT = 4;
public static final int MILK = 5;
public static final int VAPORS = 6;
public static int[] elements = {EMPTY, METAL, SAND, WATER, DIRT, MILK, VAPORS};
public static final int ERROR = elements.length;
//do not add any more fields below
private int[][] grid;
private SandDisplay display;
//sorry Cody, I must add fields because aesthetic
private Color[] colors;
private Random random = new Random();
private int operation;
/**
* Constructor for SandLab
* @param numRows The number of rows to start with
* @param numCols The number of columns to start with;
*/
public SandLab(int numRows, int numCols)
{
String[] names;
// Change this value to add more buttons
//Step 4,6
names = new String[elements.length];
colors = new Color[elements.length + 1];
// Each value needs a name for the button
names[EMPTY] = "Empty";
names[METAL] = "Metal";
names[SAND] = "Sand";
names[WATER] = "Water";
names[DIRT] = "Dirt";
names[MILK] = "Milk";
names[VAPORS] = "Vapors";
colors[EMPTY] = new Color(5, 5, 5);
colors[METAL] = new Color(130, 140, 140);
colors[SAND] = new Color(200, 215, 90);
colors[WATER] = new Color(15, 125, 210);
colors[DIRT] = new Color(80, 40, 0);
colors[MILK] = new Color(230, 230, 200);
colors[VAPORS] = new Color(220, 230, 230);
colors[ERROR] = new Color(245, 40, 35);
//1. Add code to initialize the data member grid with same dimensions
grid = new int[numRows][numCols];
display = new SandDisplay("Falling Sand", numRows, numCols, names);
}
//called when the user clicks on a location using the given tool
private void locationClicked(int row, int col, int tool)
{
//2. Assign the values associated with the parameters to the grid
grid[row][col] = tool;
}
//copies each element of grid into the display
public void updateDisplay()
{
int element;
//Step 3
//Hint - use a nested for loop
for(int row = 0; row < grid.length; row ++)
{
for(int col = 0; col < grid[0].length; col ++)
{
element = grid[row][col];
switch(element)
{
case METAL: element = METAL;
break;
case SAND: element = SAND;
break;
case WATER: element = WATER;
break;
case DIRT: element = DIRT;
break;
case MILK: element = MILK;
break;
case VAPORS: element = VAPORS;
break;
default: element = EMPTY; // default
break;
}
display.setColor(row, col, colors[element]);
} // end col loop
} // end row loop
}
//Step 5,7
//called repeatedly.
//causes one random particle in grid to maybe do something.
public void step()
{
//Remember, you need to access both row and column to specify a spot in the array
//The scalar refers to how big the value could be
//int someRandom = (int) (Math.random() * scalar)
//remember that you need to watch for the edges of the array
int row = getR(grid.length);
int col = getR(grid[0].length);
try
{
if(grid[row][col] == SAND)
{
if(!(row == grid.length - 1))
{
if(grid[row + 1][col] == EMPTY)
{
grid[row][col] = EMPTY;
grid[row + 1][col] = SAND;
}
else if(grid[row + 1][col] == WATER)
{
grid[row][col] = WATER;
grid[row + 1][col] = SAND;
}
else
{
if(col > 0)
{
if(grid[row + 1][col - 1] == EMPTY)
{
grid[row + 1][col - 1] = SAND;
grid[row][col] = EMPTY;
}
else if(grid[row + 1][col + 1] == EMPTY && col < grid[0].length)
{
grid[row + 1][col + 1] = SAND;
grid[row][col] = EMPTY;
}
}
}
}
}
// WATER
liquidSpread(row, col, WATER);
// MILK
liquidSpread(row, col, MILK);
// VAPORS
gasSpread(row, col, VAPORS);
}
catch(ArrayIndexOutOfBoundsException boundsExcept)
{
display.setColor(row, col, colors[ERROR]);
System.out.println("Index out of bounds at row: " + row + ", col: " + col + "\n");
}
}
public void liquidSpread(int row, int col, int element)
{
if(grid[row][col] == element)
{
// fall down
if(row != 19)
{
if(grid[row + 1][col] == EMPTY)
{
grid[row][col] = EMPTY;
grid[row + 1][col] = element;
}
else
{
operation = getR(2);
if(operation == 1) // right
{
if(col != 19)
{
if(grid[row][col + 1] == EMPTY)
{
grid[row][col] = EMPTY;
grid[row][col + 1] = element;
}
else if(col != 0)
{
if(grid[row][col - 1] == EMPTY)
{
grid[row][col] = EMPTY;
grid[row][col - 1] = element;
}
}
}
else
{
if(grid[row][col - 1] == EMPTY)
{
grid[row][col] = EMPTY;
grid[row][col - 1] = element;
}
}
}
else // left
{
if(col != 0)
{
if(grid[row][col - 1] == EMPTY)
{
grid[row][col] = EMPTY;
grid[row][col - 1] = element;
}
}
else if(grid[row][col + 1] == EMPTY)
{
grid[row][col] = EMPTY;
grid[row][col + 1] = element;
}
}
}
}
}
}
public void gasSpread(int row, int col, int element)
{
int displaced;
int up = row + 1;
int down = row - 1;
int left = col - 1;
int right = col + 1;
if(grid[row][col] == element)
{
// check vertical
if(row != 0 || row != 19)
{
if(goThroughable(grid[up][col]))
{
displaced = grid[up][col];
grid[row][col] = displaced;
grid[up][col] = element;
}
}
else // horizontal
{
if(col != 0 || col != 18)
{
operation = getR(2);
if(operation == 1)
{
if(goThroughable(grid[row][left]))
{
displaced = grid[row][left];
grid[row][col] = displaced;
grid[row][left] = element;
}
}
else
{
if(goThroughable(grid[row][right]))
{
displaced = grid[row][right];
grid[row][col] = displaced;
grid[row][right] = element;
}
}
}
}
}
}
public boolean goThroughable(int element)
{
switch(element)
{
case WATER:
return true;
case MILK:
return true;
case SAND:
return true;
case EMPTY:
return true;
default:
return false;
}
}
//do not modify this method!
public void run()
{
while (true) // infinite loop
{
for (int i = 0; i < display.getSpeed(); i++)
{
step();
}
updateDisplay();
display.repaint();
display.pause(1); //wait for redrawing and for mouse
int[] mouseLoc = display.getMouseLocation();
if (mouseLoc != null) //test if mouse clicked
{
locationClicked(mouseLoc[0], mouseLoc[1], display.getTool());
}
}
}
public int getR(int maximum)
{
return random.nextInt(maximum);
}
}
| true
|
821c2221d8dd13ef116082118256440599b7fde9
|
Java
|
Roiko97/coordination
|
/coordination/coordination/coordination_server/src/main/java/com/cd/coordination/impl/UserServiceImpl.java
|
UTF-8
| 3,538
| 2.078125
| 2
|
[] |
no_license
|
package com.cd.coordination.impl;
import com.cd.coordination.TrackService;
import com.cd.coordination.UserService;
import com.cd.coordination.dao.UserDao;
import com.cd.coordination.entity.User;
import com.cd.coordination.global.RedisPoolUtil;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service("userService")
public class UserServiceImpl implements UserService {
@Qualifier("userDao")
@Autowired
private UserDao userDao;
@Autowired
TrackService trackService;
public JSONObject userLogin(String std_id, String std_pwd) {
JSONObject jsonObject ;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//่ทๅๆญคๆฌก็ปๅฝๆถ้ด
Date now = new Date();
String time = df.format(now);
User user = new User();
User user_new = userDao.userLogin(std_id,std_pwd);
System.out.println(user_new);
if(user_new != null)
{
user_new.setLasttime(user_new.getThistime());
user_new.setThistime(time);
Integer isTrue = userDao.userTime(user_new.getLasttime(),user_new.getThistime(),user_new.getStudent_id());
if(isTrue != 0) {
jsonObject = new JSONObject("{result:true}");
}else {
jsonObject = new JSONObject("{result:false}");
}
}else {
jsonObject = new JSONObject("{result:false}");
}
System.out.println("jsonObj="+jsonObject);
return jsonObject;
}
public User userCheck(String std_id) {
return userDao.userCheck(std_id);
}
public JSONObject userRevice(String student_id,String std_pwd, String old_pwd) {
JSONObject jsonObject ;
User user = new User();
user.setStudent_id(student_id);
user.setPassword(old_pwd);
User user_new = userDao.userLogin(user.getStudent_id(),user.getPassword());
user_new.setPassword(std_pwd);
Integer isTrue = userDao.userRevise(user_new.getStudent_id(),user_new.getPassword());
if(isTrue != 0) {
trackService.insertTrack(student_id,trackService.getUserMark(student_id));
jsonObject = new JSONObject("{result:true}");
}else {
jsonObject = new JSONObject("{result:false}");
}
return jsonObject;
}
public Integer userMark(String mark , String std_id) {
return userDao.userMark(mark,std_id);
}
public Integer userTime(String lasttime, String thistime, String std_id) {
return userDao.userTime(lasttime,thistime,std_id);
}
public JSONObject userMessage(String std_id) {
JSONObject jsonObject = new JSONObject();
User stu = new User();
stu.setStudent_id(std_id);
if(userDao.userMessage(std_id)!= null) {
jsonObject.put("message", userDao.userMessage(std_id));
}else {
jsonObject = new JSONObject("{result:false}");
}
return jsonObject;
}
public void userCancellation(String sessionId) {
RedisPoolUtil.del(sessionId);
}
public String userPsw(String student_id){
return userDao.userPsw(student_id);
}
}
| true
|
657d425375abd87d5f042146c86bece4881133f3
|
Java
|
hungngo78/HHMarket2
|
/springboot-hhmarket/src/main/java/com/hhmarket/restfulapi/controllers/CategoryController.java
|
UTF-8
| 7,646
| 2.21875
| 2
|
[] |
no_license
|
package com.hhmarket.restfulapi.controllers;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hhmarket.restfulapi.model.Category;
import com.hhmarket.restfulapi.model.Product;
import com.hhmarket.restfulapi.model.ProductDetails;
import com.hhmarket.restfulapi.pojo.HttpProductionDetail;
import com.hhmarket.restfulapi.pojo.HttpProduction;
import com.hhmarket.restfulapi.pojo.HttpSearchProduction;
import com.hhmarket.restfulapi.services.ProductionService;
@RestController
@RequestMapping(path = "/category")
public class CategoryController {
private static final Logger LOGGER = LoggerFactory.getLogger(LoginController.class);
@Autowired
private ProductionService productionService;
//location: http://localhost:8080/category/get_all_categories
@GetMapping(path="/get_all_categories", produces = "application/json")
public ResponseEntity<Object> getAllCategories()
{
try {
List<Category> categories = productionService.getAllCategories();
if (categories != null) {
ObjectMapper objectMapper = new ObjectMapper();
String categoriesJson = objectMapper.writeValueAsString(categories);
return new ResponseEntity<Object>(categoriesJson, HttpStatus.OK);
}
} catch (JsonProcessingException ex) {
LOGGER.error(ex.getMessage());
}
return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
}
//location: http://localhost:8080/category/get_products_by_category/{categoryId}
@GetMapping(path="/get_products_by_category/{categoryId}", produces = "application/json")
public ResponseEntity<Object> getProductsByCategory(@PathVariable int categoryId)
{
try {
List<HttpProduction> products = productionService.findProductsByCategoryId(categoryId);
if (products != null && products.size() > 0) {
ObjectMapper objectMapper = new ObjectMapper();
String categoriesJson = objectMapper.writeValueAsString(products);
return new ResponseEntity<Object>(categoriesJson, HttpStatus.OK);
}
} catch (JsonProcessingException ex) {
LOGGER.error(ex.getMessage());
}
return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
}
@GetMapping(path="/get_production_by_productId/{productId}", produces = "application/json")
public ResponseEntity<Object> getProductionByProductId(@PathVariable int productId)
{
HttpProduction product = productionService.findProductionById(productId);
return new ResponseEntity<Object>(product, HttpStatus.OK);
}
@GetMapping(path="/get_production_by_product_details_id/{productDetailsId}", produces = "application/json")
public ResponseEntity<Object> getProductionByProductDetailsId(@PathVariable int productDetailsId)
{
HttpProduction product = productionService.findProductionByProductDetailsId(productDetailsId);
return new ResponseEntity<Object>(product, HttpStatus.OK);
}
@GetMapping(path="/get_product_title_by_id/{productId}", produces = "application/json")
public ResponseEntity<Object> getProductByProductId(@PathVariable int productId)
{
try {
Optional<Product> product = productionService.findProductById(productId);
if (product.isPresent()) {
JSONObject jsonObj = new JSONObject();
jsonObj.put("productId", productId);
jsonObj.put("title", product.get().getCategory().getName() + " > " + product.get().getName());
return new ResponseEntity<Object>(jsonObj.toString(), HttpStatus.OK);
}
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
}
//location: http://localhost:8080/category/get_product_details_by_productId/{productId}
@GetMapping(path="/get_product_details_by_productId/{productId}", produces = "application/json")
public ResponseEntity<Object> getProductDetailsByProductId(@PathVariable int productId) {
List<HttpProductionDetail> productionDetailsList = new ArrayList<HttpProductionDetail>();
try {
List<ProductDetails> productDetailsList = productionService.findProductDetailsByProductId(productId);
if (productDetailsList != null && productDetailsList.size() > 0) {
for (ProductDetails p: productDetailsList) {
HttpProductionDetail productionDetails = new HttpProductionDetail();
productionDetails.productDetailsId = p.getProductDetailsId();
productionDetails.color = p.getColor();
productionDetails.picture = p.getPicture();
productionDetails.price = p.getPrice();
productionDetails.size = p.getSize();
productionDetails.amount = p.getAmount();
productionDetails.productId = p.getProduct().getProductId();
productionDetails.productionName = p.getProduct().getName();
productionDetails.description = p.getProduct().getDescription();
productionDetailsList.add(productionDetails);
}
//ObjectMapper objectMapper = new ObjectMapper();
//String productDetailsListJson = objectMapper.writeValueAsString(productDetailsList);
return new ResponseEntity<Object>(productionDetailsList, HttpStatus.OK);
}
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
}
@GetMapping(path="/get_product_details_by_product_details_id/{productDetailsId}", produces = "application/json")
public ResponseEntity<Object> getProductDetailsByProductDetailsId(@PathVariable int productDetailsId) {
HttpProductionDetail productionDetails = new HttpProductionDetail();
try {
Optional<ProductDetails> p = productionService.findProductDetailsById(productDetailsId);
if (p.isPresent()) {
productionDetails.productDetailsId = p.get().getProductDetailsId();
productionDetails.color = p.get().getColor();
productionDetails.picture = p.get().getPicture();
productionDetails.price = p.get().getPrice();
productionDetails.size = p.get().getSize();
productionDetails.amount = p.get().getAmount();
productionDetails.productId = p.get().getProduct().getProductId();
productionDetails.productionName = p.get().getProduct().getName();
productionDetails.description = p.get().getProduct().getDescription();
return new ResponseEntity<Object>(productionDetails, HttpStatus.OK);
}
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
}
@GetMapping(path="/searching", produces = "application/json")
public ResponseEntity<Object> search(@RequestParam(value = "categoryId", required = false) String strId, @RequestParam(value = "criteria") String search) {
try {
int categoryId = -1;
if (strId != null) {
categoryId = Integer.parseInt(strId);
}
List<HttpSearchProduction> searchProductions = this.productionService.findProductsByCategoryIdAndSearchCriteria(categoryId, search);
return new ResponseEntity<Object>(searchProductions, HttpStatus.OK);
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
}
}
| true
|
500fa07a06671eb6da192657f1ad468d741b0dc3
|
Java
|
samuelchoi/snowcms-snippet
|
/src/main/java/org/snow/snippet/cli/CliExample.java
|
UTF-8
| 1,152
| 2.90625
| 3
|
[] |
no_license
|
package org.snow.snippet.cli;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
/**
* Cli is Command Line master feature example
*
*/
public class CliExample {
public static void main(String[] arg) throws ParseException {
// Define command line options
Options options = new Options();
options.addOption("h",false,"list help");
options.addOption("t",true,"set time on system");
// Parse current arg value into CommandLine
CommandLineParser parse = new DefaultParser();
CommandLine cmd = parse.parse(options, arg);
// Define Interact when user input "t" or "h" option tack action
if(cmd.hasOption("t")) {
System.out.printf("system time has setted %s ",cmd.getOptionValue("t"));
return;
}
if(cmd.hasOption("h")) {
String formatter = "CLI Test";
HelpFormatter hf = new HelpFormatter();
hf.printHelp(formatter, options);
return;
}
}
}
| true
|
d5b7aa1c25ab83edc7c50e366adb2f27ba598c8b
|
Java
|
AkashRepository/chess
|
/src/main/java/com/akash/model/King.java
|
UTF-8
| 418
| 2.921875
| 3
|
[] |
no_license
|
package com.akash.model;
public class King extends Piece {
@Override
protected boolean canMove(Board board, Spot start, Spot end) {
if (end.getPiece().isWhite() == this.isWhite())
return false;
if ( Math.abs(start.getX() - end.getX()) +
Math.abs(start.getY() - end.getY()) == 1)
return true;
// check for castling
return false;
}
}
| true
|
1c497137d5016897bd3dda35febf93978eba818f
|
Java
|
NesterovAndrey/Backend
|
/src/main/java/com/backend/config/authentication/ResourceServer.java
|
UTF-8
| 2,893
| 2.125
| 2
|
[] |
no_license
|
package com.backend.config.authentication;
import com.backend.web.authentication.CustomUserAuthenticationConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
import org.springframework.security.oauth2.provider.token.*;
import java.util.Formatter;
@Configuration
@EnableResourceServer
public class ResourceServer extends ResourceServerConfigurerAdapter {
@Value("${host.url}")
private String hostUrl;
@Value("${host.port}")
private String hostPort;
@Value("${host.path}")
private String hostPath;
@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
resources.tokenServices(customResourceRemoteTokenServices());
}
@Override
public void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests().antMatchers("/login", "/oauth/token", "/accounts", "/public/**").permitAll()
.antMatchers("/logout", "/accounts/**", "/private/**").authenticated().and().exceptionHandling()
.accessDeniedHandler(new OAuth2AccessDeniedHandler());
}
@Bean
@Primary
public RemoteTokenServices customResourceRemoteTokenServices() {
Logger log= LoggerFactory.getLogger(this.getClass());
log.info("_---------------------------------- HOOOOOOOSTTTT "+hostUrl+" "+hostPath);
RemoteTokenServices defaultTokenServices = new RemoteTokenServices();
defaultTokenServices.setCheckTokenEndpointUrl(new Formatter().format("%s:%s/%s/oauth/check_token",hostUrl,hostPort,hostPath).toString());
//hostUrl+":"+hostPort+"/"+hostPath+"/oauth/check_token");
defaultTokenServices.setClientId("my_client");
defaultTokenServices.setClientSecret("secret");
defaultTokenServices.setAccessTokenConverter(customConverter());
return defaultTokenServices;
}
@Bean
public DefaultAccessTokenConverter customConverter()
{
DefaultAccessTokenConverter converter=new DefaultAccessTokenConverter();
converter.setUserTokenConverter(authenticationConverter());
return converter;
}
@Bean
public CustomUserAuthenticationConverter authenticationConverter()
{
return new CustomUserAuthenticationConverter();
}
}
| true
|
ebe658450636aa7a3ce26c0e2861cb1edf92ede0
|
Java
|
lookfirst/WePay-Java-SDK
|
/src/test/java/com/lookfirst/wepay/util/FakeDataProvider.java
|
UTF-8
| 560
| 2.421875
| 2
|
[
"MIT"
] |
permissive
|
package com.lookfirst.wepay.util;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* Helper class for faking data responses from the server.
*/
@AllArgsConstructor
public class FakeDataProvider implements DataProvider {
@NonNull
final String data;
@Override
public InputStream getData(String uri, String postJson, String token) throws IOException {
return new ByteArrayInputStream(data.getBytes());
}
}
| true
|
40b171c00036100ed10935c8ad1c5bbb16b3cb81
|
Java
|
readlearncode/AWS-Polly-Custom-Connector
|
/src/main/java/org/mule/extension/aws/polly/internal/VoiceProfile.java
|
UTF-8
| 2,439
| 2.421875
| 2
|
[
"MIT"
] |
permissive
|
package org.mule.extension.aws.polly.internal;
import org.mule.runtime.extension.api.annotation.param.Optional;
import org.mule.runtime.extension.api.annotation.param.Parameter;
import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
import org.mule.runtime.extension.api.annotation.values.OfValues;
public class VoiceProfile {
/**
* The AWS region
*/
@Parameter
@DisplayName("AWS Region")
@Optional(defaultValue = "us-east-1")
@OfValues(RegionValueProvider.class)
private String awsRegion;
/**
* The voice
*/
@Parameter
@DisplayName("Voice")
@Optional(defaultValue = "Joanna")
private String voiceName;
/**
* The engine
*/
@Parameter
@DisplayName("Engine")
@Optional(defaultValue = "standard")
@OfValues(EngineValueProvider.class)
private String engine;
public String getAwsRegion() {
return awsRegion;
}
public void setAwsRegion(String awsRegion) {
this.awsRegion = awsRegion;
}
public String getVoiceName() {
return voiceName;
}
public void setVoiceName(String voiceName) {
this.voiceName = voiceName;
}
public String getEngine() {
return engine;
}
public void setEngine(String engine) {
this.engine = engine;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((awsRegion == null) ? 0 : awsRegion.hashCode());
result = prime * result + ((engine == null) ? 0 : engine.hashCode());
result = prime * result + ((voiceName == null) ? 0 : voiceName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VoiceProfile other = (VoiceProfile) obj;
if (awsRegion == null) {
if (other.awsRegion != null)
return false;
} else if (!awsRegion.equals(other.awsRegion))
return false;
if (engine == null) {
if (other.engine != null)
return false;
} else if (!engine.equals(other.engine))
return false;
if (voiceName == null) {
if (other.voiceName != null)
return false;
} else if (!voiceName.equals(other.voiceName))
return false;
return true;
}
@Override
public String toString() {
return "VoiceProfile [awsRegion=" + awsRegion + ", voiceName=" + voiceName + ", engine=" + engine + "]";
}
}
| true
|
46048e09670f4bf83f6ac43357d1109955245889
|
Java
|
Grandez/SDP_Java
|
/MODDBEntities/src/main/java/com/jgg/sdp/domain/module/MODCics.java
|
UTF-8
| 2,302
| 2.265625
| 2
|
[] |
no_license
|
package com.jgg.sdp.domain.module;
import java.io.Serializable;
import javax.persistence.*;
@Entity
@Table(name="MOD_CICS")
@NamedQueries ({
@NamedQuery( name="MODCics.delete"
,query="DELETE FROM MODCics c WHERE c.idVersion = ?1 ")
,@NamedQuery( name="MODCics.list"
,query="SELECT c FROM MODCics c WHERE c.idVersion = ?1 ")
})
public class MODCics implements Serializable {
private static final long serialVersionUID = -1005481942475720073L;
@Id
@Column(name="idVersion")
Long idVersion;
@Id
@Column(name="verbo")
String verbo;
@Id
@Column(name="tipo")
Integer tipo;
@Column(name="veces")
Integer veces;
public Long getIdVersion() {
return idVersion;
}
public void setIdVersion(Long idVersion) {
this.idVersion = idVersion;
}
public String getVerbo() {
return verbo;
}
public void setVerbo(String verbo) {
this.verbo = verbo;
}
public Integer getVeces() {
return veces;
}
public void setVeces(Integer veces) {
this.veces = veces;
}
public Integer getTipo() {
return tipo;
}
public void setTipo(Integer tipo) {
this.tipo = tipo;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((idVersion == null) ? 0 : idVersion.hashCode());
result = prime * result + ((tipo == null) ? 0 : tipo.hashCode());
result = prime * result + ((veces == null) ? 0 : veces.hashCode());
result = prime * result + ((verbo == null) ? 0 : verbo.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MODCics other = (MODCics) obj;
if (idVersion == null) {
if (other.idVersion != null)
return false;
} else if (!idVersion.equals(other.idVersion))
return false;
if (tipo == null) {
if (other.tipo != null)
return false;
} else if (!tipo.equals(other.tipo))
return false;
if (veces == null) {
if (other.veces != null)
return false;
} else if (!veces.equals(other.veces))
return false;
if (verbo == null) {
if (other.verbo != null)
return false;
} else if (!verbo.equals(other.verbo))
return false;
return true;
}
}
| true
|