blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M โ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5cf22626bd0cec5b7dee52ade4d5785a75390639 | 3a59bd4f3c7841a60444bb5af6c859dd2fe7b355 | /sources/com/google/android/gms/internal/ads/zzbvg.java | ae54adf2adb73c8d1f7bededca391a49efcac426 | [] | no_license | sengeiou/KnowAndGo-android-thunkable | 65ac6882af9b52aac4f5a4999e095eaae4da3c7f | 39e809d0bbbe9a743253bed99b8209679ad449c9 | refs/heads/master | 2023-01-01T02:20:01.680570 | 2020-10-22T04:35:27 | 2020-10-22T04:35:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package com.google.android.gms.internal.ads;
public interface zzbvg {
void zzagx();
}
| [
"joshuahj.tsao@gmail.com"
] | joshuahj.tsao@gmail.com |
3f87bfcc920ac64d38aeebec1a7c412bad1dde45 | 5c815c319b67446e5a09cea153f63ce9972b59bb | /SaneProject/app/src/main/java/com/example/tracynguyen/network/LRPDaemon.java | 25444dc3a0c6d0a4dc4bc178ffa680df16111178 | [] | no_license | xVicii/SANE-Project | 88acddaad8d8cb678eda1693a5561319713265a0 | 99868b2354e7f68960a56ae4de98fc6519cbd6d6 | refs/heads/master | 2021-01-10T01:17:03.283687 | 2016-04-07T14:48:59 | 2016-04-07T14:48:59 | 51,796,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,076 | java | package com.example.tracynguyen.network;
import android.app.Activity;
import com.example.tracynguyen.support.Factory;
import com.example.tracynguyen.support.NetworkConstants;
import com.example.tracynguyen.support.UIManager;
import com.example.tracynguyen.support.Utilities;
import java.util.List;
/**
* Created by tracy.nguyen on 3/18/2016.
*/
public class LRPDaemon implements Runnable{
private ARPTable arpTable;
private RouteTable routeTable;
private ForwardingTable forwardingTable;
private UIManager uiManager;
private Activity activity;
private LL2Daemon ll2Daemon;
public LRPDaemon(){
routeTable = new RouteTable();
forwardingTable = new ForwardingTable();
}
public void getObjectReferences(Factory factory){
arpTable = factory.getArpTable();
//routeTable = factory.getRouteTable();
//forwardingTable = factory.getForwardingTable();
uiManager = factory.getUiManager();
activity = factory.getParentActivity();
ll2Daemon = factory.getLL2_Daemon();
routeTable.getObjectReferences(factory);
forwardingTable.getObjectReferences(factory);
}
public RouteTable getRouteTable() {
return routeTable;
}
public List<RouteTableEntry> getRoutingTableAsList(){
return routeTable.getRouteList();
}
public ForwardingTable getFIB(){
return forwardingTable;
}
public List<RouteTableEntry> getForwardingTableAsList(){
return forwardingTable.getRouteList();
}
public void receiveNewLRP(byte[] lrpPacket, Integer LL2PSource){
LRP receivedLRP = new LRP(lrpPacket);
// Touch ARP table entry
arpTable.addOrUpdate(LL2PSource, receivedLRP.getSourceAddress());
List<NetworkDistancePair> pairList = receivedLRP.getRoutes();
// Add every route in the routing table
for(NetworkDistancePair netDistPair : pairList){
routeTable.addEntry(
receivedLRP.getSourceAddress(),
netDistPair.getNetworkNumber(),
netDistPair.getDistance() + 1,
receivedLRP.getSourceAddress());
}
forwardingTable.addRouteList(routeTable.getRouteList());
// Update tables on UI
uiManager.resetRoutingTableListAdapter();
uiManager.resetForwardingTableListAdapter();
}
@Override
public void run() {
try {
List<ARPTableEntry> arpTableList = arpTable.getARPTableAsList();
routeTable.addEntry(
Integer.valueOf(NetworkConstants.MY_LL3P_ADDRESS, 16),
Utilities.getNetworkFromInteger(Integer.valueOf(NetworkConstants.MY_LL3P_ADDRESS, 16)),
0,
Integer.valueOf(NetworkConstants.MY_LL3P_ADDRESS, 16)
);
// For every entry in the ARP table, add a RouteTableEntry to the routing table
for (ARPTableEntry entry : arpTableList) {
routeTable.addEntry(
Integer.valueOf(NetworkConstants.MY_LL3P_ADDRESS, 16),
Utilities.getNetworkFromInteger(entry.getLL3PAddress()),
1,
entry.getLL3PAddress());
}
// Update the forwarding table
forwardingTable.addRouteList(routeTable.getRouteList());
// For each entry in the ARP table, build an LRP Packet
for (ARPTableEntry entry : arpTableList) {
LRP lrpPacket = new LRP(
Integer.valueOf(NetworkConstants.MY_LL3P_ADDRESS, 16),
forwardingTable,
entry.getLL3PAddress()
);
ll2Daemon.sendLL2PFrame(
lrpPacket.getBytes(),
entry.getLL2PAddress(),
Integer.valueOf(NetworkConstants.LRP, 16)
);
}
} catch(Exception e){
e.printStackTrace();
}
}
}
| [
"tracy.nguyen94@gmail.com"
] | tracy.nguyen94@gmail.com |
e3173038ce2a4ce55d2598319eec83b00389680b | 56e140ccb2f133a287b4324ae7246a0c30380aec | /app/src/main/java/com/websoftquality/adventmingle/views/main/OtpActivity.java | 13b8b3d968b4568212c2a1d490786b80b2521053 | [] | no_license | rajindermcsc/AdventMingle-Android | 693f7ffe9e34bcd2d0f239e425768f59177e0a4d | 23b813a047c20d13ea6cc348f39ec4bae6fe377b | refs/heads/master | 2023-01-10T23:45:22.884365 | 2020-11-08T10:26:09 | 2020-11-08T10:26:09 | 311,036,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,801 | java | package com.websoftquality.adventmingle.views.main;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.websoftquality.adventmingle.R;
import com.websoftquality.adventmingle.utils.MessageToast;
public class OtpActivity extends AppCompatActivity implements View.OnClickListener {
TextView tv_proceed;
Intent intent;
EditText edt_otp1,edt_otp2,edt_otp3,edt_otp4;
String otp,email;
MessageToast messageToast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_otp);
messageToast=new MessageToast(this);
tv_proceed=findViewById(R.id.tv_proceed);
edt_otp1=findViewById(R.id.edt_otp1);
edt_otp2=findViewById(R.id.edt_otp2);
edt_otp3=findViewById(R.id.edt_otp3);
edt_otp4=findViewById(R.id.edt_otp4);
tv_proceed.setOnClickListener(this);
edt_otp1.addTextChangedListener(new GenericTextWatcher(edt_otp1));
edt_otp2.addTextChangedListener(new GenericTextWatcher(edt_otp2));
edt_otp3.addTextChangedListener(new GenericTextWatcher(edt_otp3));
edt_otp4.addTextChangedListener(new GenericTextWatcher(edt_otp4));
intent=getIntent();
otp=intent.getStringExtra("otp");
email=intent.getStringExtra("email");
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.tv_proceed:
validations();
break;
}
}
private void validations() {
if ((edt_otp1.getText().toString()+edt_otp2.getText().toString()+edt_otp3.getText().toString()+edt_otp4.getText().toString()).equalsIgnoreCase(otp)){
Intent intent=new Intent(OtpActivity.this,ResetPasswordActivity.class);
intent.putExtra("otp",otp);
intent.putExtra("email",email);
startActivity(intent);
}
else {
messageToast.showDialog("Invalid OTP");
}
}
public class GenericTextWatcher implements TextWatcher
{
private View view;
private GenericTextWatcher(View view)
{
this.view = view;
}
@Override
public void afterTextChanged(Editable editable) {
// TODO Auto-generated method stub
String text = editable.toString();
switch(view.getId())
{
case R.id.edt_otp1:
if(text.length()==1)
edt_otp2.requestFocus();
break;
case R.id.edt_otp2:
if(text.length()==1)
edt_otp3.requestFocus();
else if(text.length()==0)
edt_otp1.requestFocus();
break;
case R.id.edt_otp3:
if(text.length()==1)
edt_otp4.requestFocus();
else if(text.length()==0)
edt_otp2.requestFocus();
break;
case R.id.edt_otp4:
if(text.length()==0)
edt_otp3.requestFocus();
break;
}
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
}
} | [
"gshubham81@gmail.com"
] | gshubham81@gmail.com |
bb7569045c9b5db78b6dfcbfa8ce1a52314e394c | d233678455207a90bffc1ca4ef5df96fce9f6edc | /fengmangbilu-microservices/fengmangbilu-microservice-oa/src/main/java/com/fengmangbilu/microservice/oa/utils/ExportExcelUtils.java | f55b7325b0ea6a2e2f635c409479028151f36882 | [] | no_license | sunliang123/springboot-springcloud | 09df49fca50c2789c8e39df6eaabc60574aa6e02 | fc155ae875baf3c4ab0763d9b9996aff6bb1afde | refs/heads/master | 2020-03-18T05:29:05.308442 | 2018-05-22T02:09:21 | 2018-05-22T02:09:21 | 134,344,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,963 | java | package com.fengmangbilu.microservice.oa.utils;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
public class ExportExcelUtils {
public static void exportExcel(HttpServletRequest request, HttpServletResponse response, String fileName, ExcelData data)
throws Exception {
String userAgent = request.getHeader("User-Agent");
if (userAgent.contains("MSIE") || userAgent.contains("Trident")) {
fileName = URLEncoder.encode(fileName, "UTF-8");
} else {
fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
}
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Type", "application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
exportExcel(data, response.getOutputStream());
}
public static void exportExcel(ExcelData data, OutputStream out) throws Exception {
HSSFWorkbook wb = new HSSFWorkbook();
try {
String sheetName = data.getName();
if (null == sheetName) {
sheetName = "Sheet1";
}
HSSFSheet sheet = wb.createSheet(sheetName);
writeExcel(wb, sheet, data);
wb.write(out);
} finally {
wb.close();
}
}
private static void writeExcel(HSSFWorkbook wb, HSSFSheet sheet, ExcelData data) {
int rowIndex = 0;
rowIndex = writeTitlesToExcel(wb, sheet, data.getTitles());
writeRowsToExcel(wb, sheet, data.getRows(), rowIndex);
autoSizeColumns(sheet, data.getTitles().size() + 1);
}
private static int writeTitlesToExcel(HSSFWorkbook wb, HSSFSheet sheet, List<String> titles) {
int rowIndex = 0;
int colIndex = 0;
Font titleFont = wb.createFont();
titleFont.setFontName("simsun");
titleFont.setBold(true);
// titleFont.setFontHeightInPoints((short) 14);
titleFont.setColor(IndexedColors.BLACK.index);
HSSFCellStyle titleStyle = wb.createCellStyle();
titleStyle.setAlignment(HorizontalAlignment.CENTER);
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
titleStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
titleStyle.setFont(titleFont);
setBorder(titleStyle, BorderStyle.THIN, HSSFColor.BLACK.index);
Row titleRow = sheet.createRow(rowIndex);
// titleRow.setHeightInPoints(25);
colIndex = 0;
for (String field : titles) {
Cell cell = titleRow.createCell(colIndex);
cell.setCellValue(field);
cell.setCellStyle(titleStyle);
colIndex++;
}
rowIndex++;
return rowIndex;
}
private static int writeRowsToExcel(HSSFWorkbook wb, HSSFSheet sheet, List<List<Object>> rows, int rowIndex) {
int colIndex = 0;
Font dataFont = wb.createFont();
dataFont.setFontName("simsun");
// dataFont.setFontHeightInPoints((short) 14);
dataFont.setColor(IndexedColors.BLACK.index);
HSSFCellStyle dataStyle = wb.createCellStyle();
dataStyle.setAlignment(HorizontalAlignment.CENTER);
dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
dataStyle.setFont(dataFont);
setBorder(dataStyle, BorderStyle.THIN, HSSFColor.BLACK.index);
for (List<Object> rowData : rows) {
Row dataRow = sheet.createRow(rowIndex);
// dataRow.setHeightInPoints(25);
colIndex = 0;
for (Object cellData : rowData) {
Cell cell = dataRow.createCell(colIndex);
if (cellData != null) {
cell.setCellValue(cellData.toString());
} else {
cell.setCellValue("");
}
cell.setCellStyle(dataStyle);
colIndex++;
}
rowIndex++;
}
return rowIndex;
}
private static void autoSizeColumns(Sheet sheet, int columnNumber) {
for (int i = 0; i < columnNumber; i++) {
int orgWidth = sheet.getColumnWidth(i);
sheet.autoSizeColumn(i, true);
int newWidth = (int) (sheet.getColumnWidth(i) + 100);
if (newWidth > orgWidth) {
sheet.setColumnWidth(i, newWidth);
} else {
sheet.setColumnWidth(i, orgWidth);
}
}
}
private static void setBorder(HSSFCellStyle style, BorderStyle border, short color) {
style.setBorderTop(border);
style.setBorderLeft(border);
style.setBorderRight(border);
style.setBorderBottom(border);
style.setTopBorderColor(color);
style.setRightBorderColor(color);
style.setLeftBorderColor(color);
style.setBottomBorderColor(color);
}
}
| [
"493671072@qq.com"
] | 493671072@qq.com |
dd71c4f97d98559cd92463aafb7994cfd81e817f | 9efff28b6d9b249d1d70eb580ca1e3ba898c1ea4 | /p1/src/main/java/com/yst/dto/SysUserRole.java | bac6ca695b5aa91976aad41f69ad798c89da4505 | [] | no_license | yanshuantao/p1 | 4193515e1a25e9ab68ef473017ba2d40681aadfc | bc097201235edcfbd47dbf2e1d8894a7ff0be2c0 | refs/heads/master | 2019-05-14T18:24:17.379303 | 2017-10-20T05:08:35 | 2017-10-20T05:08:35 | 64,853,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.yst.dto;
public class SysUserRole {
private Integer id;
private Integer userid;
private Integer roleid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public Integer getRoleid() {
return roleid;
}
public void setRoleid(Integer roleid) {
this.roleid = roleid;
}
} | [
"447268487@qq.com"
] | 447268487@qq.com |
cb4fa927e6a1f8f259da4d62b7859fa4f8aa180f | ba9ba9a11b53f3d471ee9126df3053478649d63a | /source/src/main/java/edu/newhaven/sgurjar/wikipedia/PageRankComputationBasic.java | a93cbd396ca21ac9e0811077360bd6514a92113a | [] | no_license | sgurjar/wikipedia-pagerank | cef417bc00d938c7ee9f16b56a8c007bb8ad013d | a928838a1d635dcb5ba428ef5ade38b81999b626 | refs/heads/master | 2021-01-21T13:36:44.833982 | 2015-06-16T10:41:25 | 2015-06-16T10:41:25 | 37,523,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,877 | java | package edu.newhaven.sgurjar.wikipedia;
import static edu.newhaven.sgurjar.wikipedia.Globals.*;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.log4j.Logger;
public class PageRankComputationBasic extends Configured implements Tool {
private static final Logger log = Logger.getLogger(PageRankComputationBasic.class);
private static final String JOB_NAME_TEMPLATE = "PageRank:Wikipedia:basic:compute:%s:%s";
private static final float ALPHA = 0.15f;
public static void main(final String[] args) throws Exception {
log.info("main ARGS: " + Arrays.asList(args));
ToolRunner.run(new PageRankComputationBasic(), args);
}
String basepath;
int nodes;
@Override
public int run(final String[] args) throws Exception {
final CmdArgs cmdargs = CmdArgs.parse(args);
assertTrue(cmdargs.getStartIteration() <= cmdargs.getEndIteration());
basepath = cmdargs.getBasepath();
nodes = cmdargs.getNodes();
log.info(strfmt("basepath '%s', nodes '%s', start '%s', end '%s'",
basepath, nodes, cmdargs.getStartIteration(), cmdargs.getEndIteration()));
for (int i = cmdargs.getStartIteration(); i <= cmdargs.getEndIteration(); i++) {
log.info("doing iteration " + i);
if (!phase1(i)) {
log.error("iteration " + i + " failed");
break;
}
}
return 0;
}
private final boolean phase1(final int iteration) throws Exception {
final JobBuilder builder = JobBuilder.build(Job.getInstance(getConf(),
String.format(JOB_NAME_TEMPLATE, iteration, "phase1")));
final String inputpath = new File(basepath, iterDirName(iteration)).getCanonicalPath();
final String outputDir = new File(basepath, iterDirName(iteration + 1)).getCanonicalPath();
builder.inputPaths(new Path(inputpath)).outputPath(new Path(outputDir));
builder.inputFormatClass(PageInputFormat.class).outputFormatClass(TextOutputFormat.class);
builder.mapOutputKeyClass(Text.class).mapOutputValueClass(Page.class);
builder.outputKeyClass(Text.class).outputValueClass(Page.class);
builder.mapperClass(TheMapper.class).reducerClass(TheReducer.class);
builder.setInt(NODES_KEY, nodes).setInt(ITERATION_NUM_KEY, iteration);
final Job job = builder.job();
deleteDirs(job.getConfiguration(), outputDir);
final long startTime = System.nanoTime();
final boolean status = job.waitForCompletion(true);
log.info("job " + job.getJobID() + "completed in " + elapsed(startTime) + " seconds with status " + status);
return status;
}
public static class TheMapper extends Mapper<Text, Page, Text, Page> {
private final Page intermediateStructure = new Page();
private final Page intermediateMass = new Page();
private final Text neighbor = new Text();
@Override
protected void map(final Text title, final Page page, final Context context) throws IOException, InterruptedException {
final int iterationNum = context.getConfiguration().getInt(ITERATION_NUM_KEY, 0);
assertTrue(iterationNum > 0);
if (iterationNum == 1) {
page.rank = 1.0f; // set page rank for first iteration
}
assertTrue(page.type != Page.Type.INVALID);
intermediateStructure.type = Page.Type.STRUCTURE;
intermediateStructure.adjacencyList = page.adjacencyList;
context.write(title, intermediateStructure); // <<<<< write structure
final int nEdges = page.adjacencyList == null ? 0 : page.adjacencyList.size();
int massMessages = 0;
if (nEdges > 0) {
final float mass = page.rank / nEdges;
context.getCounter(Counters.EDGES).increment(nEdges);
for (final String node : page.adjacencyList) {
intermediateMass.type = Page.Type.MASS;
intermediateMass.rank = mass;
neighbor.set(node);
context.write(neighbor, intermediateMass); // <<<<< write mass
massMessages++;
}
}
context.getCounter(Counters.NODES).increment(1);
context.getCounter(Counters.MASS_MESSAGES_SENT).increment(massMessages);
}
}
public static class TheReducer extends Reducer<Text, Page, Text, Page> {
@Override
protected void reduce(final Text title, final Iterable<Page> pages, final Context context) throws IOException, InterruptedException {
final Page node = new Page();
node.type = Page.Type.COMPLETED;
int massMessagesReceived = 0;
int structureReceived = 0;
float mass = 0.0f;
for (final Page page : pages) {
if (page.type == Page.Type.STRUCTURE) {
node.adjacencyList = page.adjacencyList;
structureReceived++;
} else if (page.type == Page.Type.MASS) {
mass += page.rank;
massMessagesReceived++;
} else {
throw new AssertionError("invalid page type received '" + page.type + "'");
}
}
node.rank = (1 - ALPHA) + ALPHA * mass;
context.getCounter(Counters.MASS_MESSAGES_RCVD).increment(massMessagesReceived);
if (structureReceived == 1) {
context.write(title, node); // <==================== write reduce output
} else if (structureReceived == 0) {
context.getCounter(Counters.MISSING_STRUCTURE).increment(1);
log.warn("No structure received for node: '" + title + "' mass: " + massMessagesReceived);
} else {
throw new AssertionError("multiple structures received for '" + title + "'");
}
}
}
}
| [
"satyendra@sgurjar.com"
] | satyendra@sgurjar.com |
0a3fd79827dbd3ce6c595aff2d16bc94b5d0337c | d1e60e814635e32d3765edd30ff10f7f57806302 | /app/src/main/java/com/isc/absa/englishglossary/database/DBGlossary.java | b20d24f05da4f276f74ab2df47f3832746198edd | [] | no_license | AbsaISC/EnglishGlossary | 97c1be257c40612858c3102318ceaaa48d506868 | eec44cac1486d391561abcfa6f8b751c4efab342 | refs/heads/master | 2021-01-17T17:00:30.932321 | 2015-08-07T01:59:14 | 2015-08-07T01:59:14 | 40,320,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,762 | java | package com.isc.absa.englishglossary.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.isc.absa.englishglossary.database.DBContract.Glossary;
/**
* Created by Absalom on 06/08/2015.
*/
public final class DBGlossary extends SQLiteOpenHelper{
public static final String COMMA=", ";
public static final String SQL_Create_Glossary=
"CREATE TABLE "+ DBContract.Glossary.TABLE_NAME+"("+
Glossary.column_id+" INTEGER PRIMARY KEY"+COMMA+
Glossary.column_word+" TEXT"+COMMA+
Glossary.column_pos+" TEXT"+COMMA+
Glossary.column_meaning+" TEXT"+COMMA+
Glossary.column_example+" TEXT"+COMMA+
Glossary.column_esword+" TEXT"+COMMA+
Glossary.column_date+" TEXT"+COMMA+
Glossary.column_title+" TEXT"+COMMA+
Glossary.column_subtitle+" TEXT )";
public static final String SQL_Drop_Glossary=
"DROP TABLE IF EXISTS "+Glossary.TABLE_NAME;
/*********************************************************/
public static final int DATABASE_VERSION = 4;
public static final String DATABASE_NAME = "GlossaryDB.db";
/********************************************************/
public DBGlossary(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(SQL_Create_Glossary);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(SQL_Drop_Glossary);
onCreate(db);
}
}
| [
"absalomaraujo@gmail.com"
] | absalomaraujo@gmail.com |
95068e520e8042511849de8d301a2c71c1a7295c | 7ef41da0e57d6a4c917fc1a14f835103ba02bf42 | /teams/kevinBot/SoldierHandler.java | 3598c78d215ede36bd405d7c026fbf56956078d6 | [] | no_license | kpeng94/Pusheen | 1ebfcee524449b6d04400626bb2b39ed0b8af2c0 | d58eb9896b93de7d0abf92203736e1bdfa624186 | refs/heads/master | 2021-01-10T19:39:19.947823 | 2014-09-22T07:09:23 | 2014-09-22T07:09:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,303 | java | package kevinBot;
import battlecode.common.*;
public class SoldierHandler extends UnitHandler {
static final Direction[] dir = {Direction.NORTH, Direction.NORTH_EAST, Direction.EAST, Direction.SOUTH_EAST, Direction.SOUTH, Direction.SOUTH_WEST, Direction.WEST, Direction.NORTH_WEST};
public static MapLocation enemyHQLocation;
public static MapLocation myHQLocation;
public static MapLocation closeToMe;
public static Direction myHQtoenemyHQ;
public static int myHQtoenemyHQint;
public static MapLocation ctl;
public SoldierHandler(RobotController rcin) {
super(rcin);
enemyHQLocation = rc.senseEnemyHQLocation();
myHQLocation = rc.senseHQLocation();
myHQtoenemyHQ = myHQLocation.directionTo(enemyHQLocation);
myHQtoenemyHQint = myHQtoenemyHQ.ordinal();
closeToMe = new MapLocation((myHQLocation.x + enemyHQLocation.x) / 2,
(myHQLocation.y + enemyHQLocation.y) / 2);
ctl = closeToMe;
Navigation.init(rc, closeToMe, 25);
Attack.init(rc, id, closeToMe);
}
@Override
public void execute() throws GameActionException {
super.execute();
// Navigation for each soldier
if (!Navigation.mapDone) {
if (rc.readBroadcast(1) == 1)
Navigation.mapDone = true;
}
int squadronNumber = rc.readBroadcast(13300 + id);
boolean squadronLeader = (rc.readBroadcast(13000 + squadronNumber) == id);
int bc = rc.readBroadcast(13030 + squadronNumber);
if (bc != 0) {
ctl = new MapLocation(bc / 100, bc % 100);
}
if (rc.isActive()) {
if (!squadronLeader && rc.readBroadcast(13040 + squadronNumber) != 0 && curLoc.distanceSquaredTo(ctl) < 9) {
tryAttack();
} else if (squadronLeader && curLoc.distanceSquaredTo(ctl) < 4) {
tryAttack();
} else {
tryMove();
}
}
calculate();
}
private void detectLeader() throws GameActionException {
}
/* Attempts to attack */
private void tryAttack() throws GameActionException {
Attack.attackMicro();
}
/* Attempts to move */
private void tryMove() throws GameActionException {
if (rc.isActive()) {
Navigation.swarmMove();
rc.setIndicatorString(1, "I moved on round " + Clock.getRoundNum());
}
}
/* Does calculations */
private void calculate() {
Navigation.calculate();
}
/**
*
*/
private void selectStrategy() {
}
}
| [
"kpeng94@mit.edu"
] | kpeng94@mit.edu |
2c10dd3aeb7fed07dccf3c93f54e401231797f00 | 21ae74e58e17ba4bf8fad674ec50d0abc30b9fe4 | /java/JavaTest/src/com/test/io/Ex43_Directory_basic.java | ba3ccf0328971c5e4b662d11860e2ba98e805291 | [] | no_license | Chun0903/classStudy_github.io | 1530004bc89b69a9e31715d856e30c79e19368af | e1de18bd032d1cf70cc8496d7665f8e032553026 | refs/heads/master | 2022-11-28T21:11:12.833316 | 2020-07-27T06:59:14 | 2020-07-27T06:59:14 | 275,155,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,832 | java | package com.test.io;
import java.io.File;
import java.util.Calendar;
import java.util.Date;
public class Ex43_Directory_basic {
private static int count = 0;
public static void main(String[] args) {
// m1();
// m2();
// m3();
// m4();
m5();
// m6(); //****
// m7(); //****
// m8();
}
private static void m8() {
//์ ๋ ฌ
//D:\Class\java\JavaTest\src\com\test\object
String path = "D:\\Class\\java\\JavaTest\\src\\com\\test\\object";
File dir = new File(path);
File[] list = dir.listFiles();
//์ ๋ ฌ : ์ด๋ฆ -> ํฌ๊ธฐ
//์ ๋ น ์๊ณ ๋ฆฌ์ฆ
// - ๋ฒ๋ธ ์ ๋ ฌ vs ํต ์ ๋ ฌ
// ๋ญ์ง ๋ชจ๋ฅด๊ฒ ๋ ์ ๋ ฌ....
// for (int i=0; i <list.length-1;i++) {
// for(int j= i; j<list.length; j++) {
//
// if(list[i].length() < list[j].length()) {
//
// File temp = list[i];
// list[i] = list[j];
// list[j] = temp;
// }
//
// }
// }
//๋ฒ๋ธ ์ ๋ ฌ
for (int i=0; i <list.length;i++) {
for(int j= 0; j<list.length-i-1; j++) {
if(list[j].length() < list[j+1].length()) {
File temp = list[j];
list[j] = list[j+1];
list[j+1] = temp;
}
}
}
for (File file : list) {
if(file.isFile()) {
System.out.printf("[%5dB] %s\n",file.length(),file.getName());
}
}
}
private static void m7() {
//**************************************
//m6() -> ์ฌ๊ท ํธ์ถ ๊ตฌ์กฐ๋ก ๋ณ๊ฒฝ
String path = "C:\\eclipse";
File dir = new File(path);
if(dir.exists()) {
counFile(dir);
}
System.out.println("์ด ํ์ผ ๊ฐ์:" + count);
}
private static void counFile(File dir) {
//1.์์ ๋ชฉ๋ก ๊ฐ์ ธ์ค๊ธฐ
File[] list = dir.listFiles();
//2. ํ์ผ ๊ฐ์ ์ธ๊ธฐ
for(File sub : list) {
if(sub.isFile()) {
count++;
}
}
//์์ ํด๋๋ฅผ ๋์์ผ๋ก ๋ณธ์ธ์ด ํ๋ ํ๋์ ๋ค์ํ๊ธฐ
for (File sub : list) {
if(sub.isDirectory()) {
//๋๊ฐ์ ํ๋์ ๋ฐ๋ณต
counFile(sub); //์ฌ๊ท ํธ์ถ
}
}
}
private static void m6() {
//ํน์ ํด๋ -> ํ์ผ ๊ฐ์?
String path = "C:\\eclipse";
File dir = new File(path);
if(dir.exists()) {
int count = 0; //๋์ ๋ณ์
File[] list = dir.listFiles(); // ์ดํด๋ฆฝ์ค์ ์์
for(File sub : list) {
if(sub.isFile()) {
count++;
}
}//ํ์ผ ๊ฐ์
//์์ ํด๋๋ก ์ด๋
for(File sub : list) {
if(sub.isDirectory()) {
File[] sublist = sub.listFiles(); // ์ดํด๋ฆฝ์ค์ ์์๋ค
for(File subsub : sublist) {
if(subsub.isFile()) {
count++;
}
}
for (File subsub : sublist) {
if(subsub.isDirectory()) {
File[] subsublist = subsub.listFiles(); //์ดํด๋ฆฝ์ค์ ์ฆ์์๋ค
for (File subsubsub : sublist) {
if(subsubsub.isFile()) {
count++;
}
}
}
}
}
}
System.out.println("์ด ํ์ผ ๊ฐ์ : "+ count);
}
}
private static void m5() {
//๋๋ ํ ๋ฆฌ ๋ด์ฉ ๋ณด๊ธฐ(*********)
// - ์์ํ์ผ + ๋๋ ํ ๋ฆฌ
String path = "C:\\eclipse";
File dir = new File(path);
if(dir.exists()) {
//Returns an array of strings naming the files and directories in thedirectory denoted
// by this abstract pathname.
// String[] list = dir.list();
//
// for(String name : list) {
// System.out.println(name);
// File file = new File(path + "\\" + name);
// System.out.println(file.length());
// }
File[] list = dir.listFiles(); //์ฃผ๋ก ์ฌ์ฉ
// for (File file : list) {
// System.out.println(file.getName());
//// System.out.println(file.isFile());
// if(file.isFile()) {
// System.out.println(file.length());
// }
//
// }
for(File sub : list) {
if(sub.isDirectory()) {
System.out.printf("[%s]\t",sub.getName());
System.out.print("\t");
System.out.print("ํ์ผํด๋\t");
Date date = new Date(sub.lastModified());
System.out.printf("%tF %tT\n",date,date);
}
}
for(File sub : list) {
if(sub.isFile()) {
System.out.print(sub.getName() + "\t");
System.out.printf("%dKB\t",sub.length() /1024);
System.out.print("ํ์ผ\t");
Date date = new Date(sub.lastModified());
System.out.printf("%tF %tT\n",date,date);
}
}
}
}
private static void m4() {
//๋๋ ํ ๋ฆฌ ์ญ์ ํ๊ธฐ
//- ๋นํด๋๋ง ์ญ์ ๊ฐ๋ฅํ๋ค.
// - ๋ด์ฉ๋ฌผ์ ์ง์ ์ง์ฐ๋ฉด ํด๋๋ฅผ ์ญ์ ํ ์ ์๋ค. -> ํด๋น ํด๋๋ด์ ๋ชจ๋ ํ์ผ ์ญ์ ํ
// ํด๋๋ฅผ ๋นํด๋๋ก ๋ง๋ค๊ณ ํด๋๋ฅผ ์ญ์ x ๋ฐ๋ณต
String path = "D:\\class\\java\\io\\GGG";
File dir = new File(path);
if(dir.exists()) {
System.out.println(dir.delete());
}else {
System.out.println("์์");
}
}
private static void m3() {
//๋๋ ํ ๋ฆฌ๋ช
๋ฐ๊พธ๊ธฐ && ์ด๋ํ๊ฐ
String path = "D:\\class\\java\\io\\BBB";
File dir = new File(path);
if(dir.exists()) {
String path2 = "D:\\class\\java\\io\\GGG\\BBB";
File dir2 = new File(path2);
dir.renameTo(dir2);
System.out.println("๋๋ ํ ๋ฆฌ๋ช
๋ฐ๊พธ๊ธฐ");
}
}
private static void m2() {
//๋๋ ํ ๋ฆฌ ์กฐ์
// - ์์ฑ, ์ด๋ฆ ๋ฐ๊พธ๊ธฐ, ์ด๋ํ๊ธฐ, ์ญ์ ํ๊ธฐ , ๋ณต์ฌํ๊ธฐ(X)
//์ํด๋ ๋ง๋ค๊ธฐ
// String path = "D:\\class\\java\\io\\CCC"; //ํฌ๋ง ๊ฒฝ๋ก
String path = "D:\\class\\java\\io\\DDD\\EEE\\FFF"; //ํฌ๋ง ๊ฒฝ๋ก
File dir = new File(path);
// boolean result = dir.mkdir(); //๋ง์ง๋ง ๋ชฉ์ ํด๋๋ง ์์ฑ
boolean result = dir.mkdirs(); //๊ฒฝ๋ก ์์ ์๋ ํด๋ ๋ชจ๋ ์์ฑ
if(result) {
System.out.println("ํด๋ ์์ฑ ์ฑ๊ณต");
} else {
System.out.println("ํด๋ ์์ฑ ์คํจ");
}
//์๊ตฌ์ฌํญ] ํ์ -> ํ์๋ณ ๊ฐ์ธ ํด๋ ์์ฑํ๊ธฐ
String[] member = {"ํ๊ธธ๋","์๋ฌด๊ฐ","ํํํ","ํธํธํธ","ํํํ"};
for (String name : member) {
//ํด๋ ์์ฑ
path = String.format( "D:\\class\\java\\io\\AAA\\[๊ฐ์ธํด๋]%s๋", name);
dir = new File(path);
dir.mkdir();
System.out.printf("%s๋์ ๊ฐ์ธํด๋๋ฅผ ์์ฑํ์ต๋๋ค.\n",name);
}
//์๊ตฌ์ฌํจ] ๋ ์ง๋ณ ํด๋ ์์ฑํ๊ธฐ
// - 2020-01-01 ~ 2020-12-31 : 366๊ฐ
// - Calendar ์ฌ์ฉ
Calendar c = Calendar.getInstance();
c.set(2020,0,1);
// System.out.println(c.get(Calendar.DAY_OF_YEAR)); //๋จ์๋
// System.out.println(c.get(Calendar.DAY_OF_MONTH)); //๋จ์๋ฌ
// System.out.println(c.get(Calendar.DAY_OF_YEAR)); //
// System.out.println(c.getMaximum(Calendar.DAY_OF_YEAR)); //ํ ํด๊ฐ ๋ช๋
์ธ์ง
for(int i =0; i<366; i++) {
path = String.format("D:\\class\\java\\io\\BBB\\%tF", c) ;
dir = new File(path);
dir.mkdir();
System.out.printf("%tF\n",c);
c.add(Calendar.DATE, 1);
}
}
private static void m1() {
//๋๋ ํ ๋ฆฌ ์ ๋ณด ํ์ธ
// - ๋๋ ํ ๋ฆฌ ์ฐธ์กฐ ๊ฐ์ฒด -> ์ ๋ณด or ์กฐ์
//๋๋ ํ ๋ฆฌ ์ฐธ์กฐ ๊ฐ์ฒด
String path = "D:\\class\\java\\io\\AAA";
File dir = new File(path);
if(dir.exists()) {
//๋๋ ํ ๋ฆฌ ์ ๋ณด
System.out.println(dir.getName()); //AAA, ํด๋๋ช
System.out.println(dir.isFile()); //ํ์ผ์ด๋?
System.out.println(dir.isDirectory()); //ํด๋๋?
System.out.println(dir.length()); //0
System.out.println(dir.getAbsolutePath()); //์ ๋๊ฒฝ๋ก
System.out.println(dir.getPath()); //์ฐธ์กฐ๊ฒฝ๋ก
System.out.println(dir.getParent()); //๋ถ๋ชจํด๋ ๊ฒฝ๋ก ๋ฐํ
System.out.println(dir.getParentFile()); //๋ถ๋ชจํด๋ ์ฐธ์กฐ ๊ฐ์ฒด ๋ฐํ
}else {
System.out.println("๋๋ ํ ๋ฆฌ ์์.");
}
}
}
| [
"jjchun0903@gmail.com"
] | jjchun0903@gmail.com |
f7fdef684918e2f7337dcc6aefa1ea1cedd5c936 | 3e355a798304584431e5e5a1f1bc141e16c330fc | /AL-Game/data/scripts/system/handlers/quest/daevation/_80291DurableDaevanionWeapon.java | 2bdecc310f78b7f82a5934429780bb158fde5ceb | [] | no_license | webdes27/Aion-Lightning-4.6-SRC | db0b2b547addc368b7d5e3af6c95051be1df8d69 | 8899ce60aae266b849a19c3f93f47be9485c70ab | refs/heads/master | 2021-09-14T19:16:29.368197 | 2018-02-27T16:05:28 | 2018-02-27T16:05:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,095 | java | /**
* This file is part of Aion-Lightning <aion-lightning.org>.
*
* Aion-Lightning is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Aion-Lightning is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License
* along with Aion-Lightning.
* If not, see <http://www.gnu.org/licenses/>.
*/
package quest.daevation;
import com.aionemu.gameserver.model.DialogAction;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.questEngine.handlers.QuestHandler;
import com.aionemu.gameserver.questEngine.model.QuestEnv;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;
/**
* @author Romanz
*/
public class _80291DurableDaevanionWeapon extends QuestHandler {
private final static int questId = 80291;
public _80291DurableDaevanionWeapon() {
super(questId);
}
@Override
public void register() {
qe.registerQuestNpc(831384).addOnQuestStart(questId);
qe.registerQuestNpc(831384).addOnTalkEvent(questId);
}
@Override
public boolean onDialogEvent(QuestEnv env) {
final Player player = env.getPlayer();
int targetId = 0;
if (env.getVisibleObject() instanceof Npc) {
targetId = ((Npc) env.getVisibleObject()).getNpcId();
}
QuestState qs = player.getQuestStateList().getQuestState(questId);
if (qs == null || qs.getStatus() == QuestStatus.NONE) {
if (targetId == 831384) {
if (env.getDialog() == DialogAction.QUEST_SELECT) {
int plate = player.getEquipment().itemSetPartsEquipped(299);
int chain = player.getEquipment().itemSetPartsEquipped(298);
int leather = player.getEquipment().itemSetPartsEquipped(297);
int cloth = player.getEquipment().itemSetPartsEquipped(296);
int gunner = player.getEquipment().itemSetPartsEquipped(371);
if (plate != 5 && chain != 5 && leather != 5 && cloth != 5 && gunner != 5) {
return sendQuestDialog(env, 1003);
} else {
return sendQuestDialog(env, 4762);
}
} else {
return sendQuestStartDialog(env);
}
}
}
if (qs == null) {
return false;
}
<<<<<<< .mine
int var = qs.getQuestVarById(0);
int var1 = qs.getQuestVarById(1);
=======
int var = qs.getQuestVarById(0);
qs.getQuestVarById(1);
>>>>>>> .r274
if (qs.getStatus() == QuestStatus.START) {
if (targetId == 831384) {
switch (env.getDialog()) {
case QUEST_SELECT:
if (var == 0) {
return sendQuestDialog(env, 1011);
}
case CHECK_USER_HAS_QUEST_ITEM:
if (var == 0) {
return checkQuestItems(env, 0, 1, true, 5, 0);
}
break;
case SELECT_ACTION_1352:
if (var == 0) {
return sendQuestDialog(env, 1352);
}
}
}
return false;
} else if (qs.getStatus() == QuestStatus.REWARD) {
if (targetId == 831384) {
return sendQuestEndDialog(env);
}
return false;
}
return false;
}
}
| [
"michelgorter@outlook.com"
] | michelgorter@outlook.com |
bf202b221a3e2d1d5177b830a80f81c29d74581a | 115774dc752c44d69a3e87cf4992b275dbc2e40d | /cientouno-wsclient-agenciatributaria/src/main/java/es/panel/cientouno/wsclient/agenciatributaria/WarningsType.java | 4ad5417aff8deb3b94e315be39f306ee50170e6e | [
"MIT"
] | permissive | davidgrc/cientouno | 4cc30f66b21fb76690cddbb58092afb208b9b8ab | 2b595165abbb0b88b7187d585e5c1cf560ab81ca | refs/heads/master | 2021-01-20T19:00:32.070732 | 2016-06-29T09:56:39 | 2016-06-29T09:56:39 | 61,436,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,531 | java |
package es.panel.cientouno.wsclient.agenciatributaria;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para WarningsType complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType name="WarningsType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Warning" type="{http://www.example.org/AgenciaTributariaService/}WarningType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "WarningsType", propOrder = {
"warning"
})
public class WarningsType {
@XmlElement(name = "Warning", required = true)
protected WarningType warning;
/**
* Obtiene el valor de la propiedad warning.
*
* @return
* possible object is
* {@link WarningType }
*
*/
public WarningType getWarning() {
return warning;
}
/**
* Define el valor de la propiedad warning.
*
* @param value
* allowed object is
* {@link WarningType }
*
*/
public void setWarning(WarningType value) {
this.warning = value;
}
}
| [
"david.garcia@panel.es"
] | david.garcia@panel.es |
d8d8326dfd5e086001a79c703a0bf9583de60db8 | f617e0b23049d0e23d8a83d85f0a36ece5f0c44c | /src/main/java/com/kentarsivi/exception/UserBadCredentialException.java | 20459af71fe9ed3901780e9f12e426bbf3a5bf51 | [] | no_license | kitaptozu/RestApiWithSpringBootKentArsiv | 1ae9ef83bbe8836dc984d0774387eee2ec9ca6b2 | 5f1e975c233f6480c18763385e0cb52dc2a224b2 | refs/heads/main | 2023-06-24T02:38:41.883159 | 2021-07-31T15:52:03 | 2021-07-31T15:52:03 | 350,979,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.kentarsivi.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(code = HttpStatus.BAD_REQUEST)
public class UserBadCredentialException extends RuntimeException{
private static final long serialVersionUID = 1L;
public UserBadCredentialException(String message) {
super(message);
}
}
| [
"mustafaalp@Mustafa-MacBook-Pro.local"
] | mustafaalp@Mustafa-MacBook-Pro.local |
a4d8ac3728e561636fe816cc243086581b9fcdb0 | a58dade8ddc2f0e5b650c6202e381bd72c81741c | /Auxiliary/RecipeManagers/CastingRecipes/Tiles/CropSpeedPlantRecipe.java | f9842dde6cd1ad7830d631a425a8bb794ff1c501 | [] | no_license | neconeco2/ChromatiCraft | e784be93dfa747ae9ccc67d2794e4157b8c3e600 | 90c8eefaf420c0949b7653dd83dccc75a37a849f | refs/heads/master | 2020-12-30T11:51:55.379965 | 2017-05-27T20:03:33 | 2017-05-27T20:03:33 | 91,535,969 | 0 | 0 | null | 2017-05-17T05:11:52 | 2017-05-17T05:11:52 | null | UTF-8 | Java | false | false | 1,032 | java | /*******************************************************************************
* @author Reika Kalseki
*
* Copyright 2016
*
* All rights reserved.
* Distribution of the software in any form is only allowed with
* explicit, prior permission from the owner.
******************************************************************************/
package Reika.ChromatiCraft.Auxiliary.RecipeManagers.CastingRecipes.Tiles;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import Reika.ChromatiCraft.Auxiliary.RecipeManagers.CastingRecipe.TempleCastingRecipe;
import Reika.ChromatiCraft.Registry.CrystalElement;
public class CropSpeedPlantRecipe extends TempleCastingRecipe {
public CropSpeedPlantRecipe(ItemStack out, IRecipe recipe) {
super(out, recipe);
this.addRune(CrystalElement.LIGHTBLUE, 2, -1, -4);
this.addRune(CrystalElement.GREEN, 2, -1, -5);
}
@Override
public int getNumberProduced() {
return 1;
}
@Override
public int getTypicalCraftedAmount() {
return 64;
}
}
| [
"reikasminecraft@gmail.com"
] | reikasminecraft@gmail.com |
3fc697047eb22e5b89e58590d45c79690cc48fff | 47aa9c079f8bf5b33b4d719ec991710d4c993f49 | /src/main/java/cn/ac/iscas/service/ResponseResult.java | 01c07f3166aea72d736c062777d018f3f02677cb | [] | no_license | Zhihao-de/DailyConnect | c4f2c234da4e6c9163f2a7161e3fa10c58d59323 | 4b2d8fc03e099d2d7cc1ec16d5971806b014c4ed | refs/heads/master | 2022-12-22T03:08:04.716285 | 2020-05-05T20:30:27 | 2020-05-05T20:30:27 | 251,192,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,674 | java | package cn.ac.iscas.service;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import net.sf.json.JSONObject;
import org.jetbrains.annotations.Contract;
import java.io.PrintWriter;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseResult implements Serializable {
private int code;
private String msg;
private Map<String, Object> data;
/**
*
*/
@Contract(pure = true)
public ResponseResult() {
}
@Contract(pure = true)
protected ResponseResult(int code, String msg, Map<String, Object> data) {
this.code = code;
this.msg = msg;
this.data = data;
}
/**
* @param errCode
* @param errMsg
* @return
*/
public static ResponseResult error(int errCode, String errMsg) {
return new ResponseResult(errCode, errMsg, null);
}
/**
* @param ex
* @return
* runtimeException
*/
/*
public static ResponseResult error(RuntimeServiceException ex) {
return new ResponseResult(ex.getCode(), ex.getMessage(), null);
}
*/
/**
* ๅๅปบไธไธชๅ
ๅซๆๅ็ปๆ็<code>ResponseResult</code>ๅฏน่ฑก
*
* @return ๅ
ๅซๆๅ็ปๆ็<code>ResponseResult</code>ๅฏน่ฑก
*/
public static ResponseResult ok() {
return new ResponseResult(200, "ok", new HashMap<>());
}
/**
* ไธบ่ฟๅๆฐๆฎๅขๅ ๅฑๆง
*
* @param key ๅฑๆงๅ
* @param value ๅฑๆงๅผ
* @return <code>ResponseResult</code>ๅฏน่ฑก
*/
public ResponseResult put(String key, Object value) {
this.data.put(key, value);
return this;
}
/**
* ๅฐๅฝๅๅฏน่ฑก็JSON่กจ็คบๅๅ
ฅHttpๅๅบ
*
* @param writer Httpๅๅบ็<code>PrintWriter</code>ๅฏน่ฑก
* @return ๅฝๅ<code>ResponseResult</code>ๅฏน่ฑก
*/
public ResponseResult write(PrintWriter writer) {
if (null != writer) {
writer.append(JSONObject.fromObject(this).toString());
}
return this;
}
/**
* ่ฟๅcode
*
* @return <code>int</code>
*/
public int getCode() {
return code;
}
/**
* ่ฟๅmsg
*
* @return <code>String</code>
*/
public String getMsg() {
return msg;
}
/**
* ่ฟๅData
*
* @return <code>map</code>
*/
public Map<String, Object> getData() {
return data;
}
}
| [
"lizhihao@iscas.ac.cn"
] | lizhihao@iscas.ac.cn |
30535e3a92390b5ce1b09323aa7de2268b0c61cc | eac11f910b53fe1cdda8fe31acfe4ee285f84511 | /OnlineSeleniumClass/src/aShotAPI/OrangeHRM.java | c5fbaed58e24e46476ae4a7ea0f48b7f53322274 | [] | no_license | JSSharath/RestFramework | 1855b771535f4e443f5016f988612d976b9a7d56 | 4eae92bcd5691c21967077fba983756408cdc118 | refs/heads/master | 2023-05-25T14:31:59.405672 | 2020-09-06T11:30:24 | 2020-09-06T11:30:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 923 | java | package aShotAPI;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.imageio.ImageIO;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.opera.OperaDriver;
import ru.yandex.qatools.ashot.AShot;
import ru.yandex.qatools.ashot.Screenshot;
public class OrangeHRM {
public static void main(String[] args) throws IOException {
WebDriver driver=new OperaDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://opensource-demo.orangehrmlive.com/");
WebElement logo = driver.findElement(By.xpath("//img[contains(@src,'logo.png')]"));
Screenshot logoimg = new AShot().takeScreenshot(driver, logo);
ImageIO.write(logoimg.getImage(), "png", new File("C:\\Users\\user\\Desktop\\Automation class/orange.png"));
}
}
| [
"user@Nithesh-Gowda"
] | user@Nithesh-Gowda |
6d5a58638e5823e98e04415536608dac101d457d | febada7e33adadf6ff692878ff35c63a4bded1d3 | /src/main/java/generateERD.java | fa00d4216287360e04997349e3d9aec3b5db87bc | [] | no_license | tejaswi1617/Distributed-Database-system- | f37a455fd182a80bb87c3e4b10b7ce1eb17b18dc | 7ab7fc6469263e5cb22cce27e7dfedf53c2c6d4c | refs/heads/master | 2023-07-19T12:19:55.396396 | 2021-09-08T22:33:53 | 2021-09-08T22:33:53 | 401,895,357 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,473 | java | import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
public class generateERD {
private static String local_dir="";
private static String remote_dir="";
private static File myObj=null;
private static FileWriter myWriter = null;
private readMetaData reader;
private readTable readerTable;
public generateERD()
{
local_dir=ConfigurationSetup.getDataPathLocal();
remote_dir=ConfigurationSetup.getDataPathRemote();
reader = new readMetaData();
readerTable = new readTable();
}
public boolean generateERDOfDB(String url, String fileName)
{
boolean result = false;
HashMap<String, MetaData> tablesInLocalDir =reader.readmetaData(true);
HashMap<String, MetaData> tablesInRemoteDir =reader.readmetaData(false);
if(tablesInLocalDir.size()>0)
{
try {
myObj = new File(url+fileName);
if (myObj.createNewFile()) {
System.out.println("File created: " + myObj.getName());
myWriter = new FileWriter(url+fileName);
if(tablesInLocalDir.size()>0){
result = createERDForTable(tablesInLocalDir,true);
}
if(result == true && tablesInRemoteDir.size()>0)
{
result = createERDForTable(tablesInRemoteDir,false);
}
myWriter.close();
} else {
System.out.println("File already exists.");
}
} catch (IOException e) {
System.out.println("An error occurred while creating file please give correct output");
e.printStackTrace();
return result;
}
}
return result;
}
private boolean createERDForTable(HashMap<String, MetaData> tables, boolean isLocal)
{
boolean result = false;
try {
for(String tableName : tables.keySet())
{
MetaData tableMetaData = reader.readmetaData(isLocal).get(tableName);
LinkedHashMap<String, String> columns = tableMetaData.getColumns();
List<String> othertableNames = reader.checkIfTableIsReferenced(tableName,isLocal);
String primaryKeyColumnName =tableMetaData.getPrimaryKeyColumn();
String foreignKeyColumnName = tableMetaData.getForeignkeyColumn();
String getForeignKeyReferenceTableName=null;
String getForeignKeyReferencecolumnName=null;
if(foreignKeyColumnName != null)
{
getForeignKeyReferenceTableName = tableMetaData.getReferencedTable();
getForeignKeyReferencecolumnName = tableMetaData.getReferencedColumnName();
}
if(columns.size()>0)
{
myWriter.write("\n\n"+"TableName : "+tableName);
myWriter.write("\n"+"column_Name | column_DataType");
for(String columnName : columns.keySet())
{
myWriter.write("\n"+columnName+" | "+"["+columns.get(columnName)+"]");
}
myWriter.write("\n"+"Indexes:");
if(primaryKeyColumnName!=null){
myWriter.write("\n"+primaryKeyColumnName+"_CurrentTable_PK");
}
if(foreignKeyColumnName != null) {
myWriter.write("\n" + foreignKeyColumnName + "_" + "CurrentTable_FK" + "_" + getForeignKeyReferenceTableName + "_" + getForeignKeyReferencecolumnName);
myWriter.write("\n" + "Cardinality_" + getForeignKeyReferenceTableName + "_many-to-one");
}
for(int i=0;i<othertableNames.size();i++)
{
myWriter.write("\n"+"Cardinality_"+othertableNames.get(i)+"_one-to-many");
}
myWriter.write("\n************************************");
}
result = true;
}
} catch (Exception e) {
result = false;
e.printStackTrace();
}
return result;
}
}
| [
"tj754396@dal.ca"
] | tj754396@dal.ca |
13385e2c85fa9269ad8900871c2b010e3da2752e | a65aa92fba332cd5a17a3efc188e4c039bc76d35 | /app/src/test/java/tw/edu/pu/s1063656/trafficlight/ExampleUnitTest.java | dce44309d28e702af8012c9ee0b7a737f764fc32 | [] | no_license | s1063656/TrafficLight | 5004fa87c441ef92ec05567a6cba20f7f1f8204b | 0a56dad92e94210a94ca689170884f7a22f131ae | refs/heads/master | 2022-10-18T02:47:06.877081 | 2020-06-05T08:00:48 | 2020-06-05T08:00:48 | 268,832,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package tw.edu.pu.s1063656.trafficlight;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"s1063656@gm.pu.edu.tw"
] | s1063656@gm.pu.edu.tw |
5a23423f743ab5b2ee40fc133cd3457fdd97765b | 435d0b7732b6b5f7505ad860ca02be4df015e495 | /src/main/java/net/openhft/jcache/offheap/container/entries/metadata/OffHeapMetadataTransientCacheValue.java | 61d12ccd1714fd13db90dfa159c4d0fccc240f05 | [] | no_license | Cotton-Ben/JCache | dd0956b5817993cfd32aa7de2d3fffe8d520a2ce | b5a06825fb7f5ca503be029bc3fdf30cc28f1432 | refs/heads/master | 2016-09-10T19:18:03.097602 | 2014-03-31T20:02:39 | 2014-03-31T20:02:39 | 18,119,238 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 3,372 | java | package net.openhft.jcache.offheap.container.entries.metadata;
import net.openhft.jcache.offheap.commons.util.concurrent.OffHeapUtil;
import org.infinispan.commons.io.UnsignedNumeric;
import org.infinispan.container.entries.InternalCacheEntry;
import org.infinispan.container.entries.metadata.MetadataAware;
import org.infinispan.marshall.core.Ids;
import org.infinispan.metadata.Metadata;
import net.openhft.jcache.offheap.commons.marshall.OffHeapAbstractExternalizer;
import net.openhft.jcache.offheap.container.entries.OffHeapExpiryHelper;
import net.openhft.jcache.offheap.container.entries.OffHeapImmortalCacheValue;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Set;
/*
* @author Galder Zamarreรฑo
* @since 5.3
* @author ben.cotton@jpmorgan.com
* @author dmitry.gordeev@jpmorgan.com
* @author peter.lawrey@higherfrequencytrading.com
*
*/
public class OffHeapMetadataTransientCacheValue extends OffHeapImmortalCacheValue implements MetadataAware {
Metadata metadata;
long lastUsed;
public OffHeapMetadataTransientCacheValue(Object value, Metadata metadata, long lastUsed) {
super(value);
this.metadata = metadata;
this.lastUsed = lastUsed;
}
@Override
public InternalCacheEntry toInternalCacheEntry(Object key) {
return new OffHeapMetadataTransientCacheEntry(key, value, metadata, lastUsed);
}
@Override
public long getMaxIdle() {
return metadata.maxIdle();
}
@Override
public long getLastUsed() {
return lastUsed;
}
@Override
public final boolean isExpired(long now) {
return OffHeapExpiryHelper.isExpiredTransient(metadata.maxIdle(), lastUsed, now);
}
@Override
public final boolean isExpired() {
return isExpired(System.currentTimeMillis());
}
@Override
public boolean canExpire() {
return true;
}
@Override
public Metadata getMetadata() {
return metadata;
}
@Override
public void setMetadata(Metadata metadata) {
this.metadata = metadata;
}
@Override
public long getExpiryTime() {
long maxIdle = metadata.maxIdle();
return maxIdle > -1 ? lastUsed + maxIdle : -1;
}
public static class OffHeapExternalizer extends OffHeapAbstractExternalizer<OffHeapMetadataTransientCacheValue> {
@Override
public void writeObject(ObjectOutput output, OffHeapMetadataTransientCacheValue tcv) throws IOException {
output.writeObject(tcv.value);
output.writeObject(tcv.metadata);
UnsignedNumeric.writeUnsignedLong(output, tcv.lastUsed);
}
@Override
public OffHeapMetadataTransientCacheValue readObject(ObjectInput input) throws IOException, ClassNotFoundException {
Object v = input.readObject();
Metadata metadata = (Metadata) input.readObject();
long lastUsed = UnsignedNumeric.readUnsignedLong(input);
return new OffHeapMetadataTransientCacheValue(v, metadata, lastUsed);
}
@Override
public Integer getId() {
return Ids.METADATA_TRANSIENT_VALUE;
}
@Override
public Set<Class<? extends OffHeapMetadataTransientCacheValue>> getTypeClasses() {
return OffHeapUtil.<Class<? extends OffHeapMetadataTransientCacheValue>>asSet(OffHeapMetadataTransientCacheValue.class);
}
}
}
| [
"ben.cotton@alumni.rutgers.edu"
] | ben.cotton@alumni.rutgers.edu |
955c276f2c8d0d8dfb5bcfdf453129c3fe126cc4 | 26d7d6a2d008043749e10fa803a868e2dde6cb4e | /app/src/main/java/com/heshiqi/widget/loadmore/RingAnimHeaderView.java | 2ec96ab0ba0a55654beb0852faa0bd3565b0bd80 | [] | no_license | heshiqi/loadmore-recyclerview | e4dd46b56c6334e45215f60316ed31fbb53b96ee | b0b061ddf4e9653aa3581f4e147d0de4bda374b8 | refs/heads/master | 2022-02-12T20:07:24.108615 | 2019-08-20T02:44:29 | 2019-08-20T02:44:29 | 114,063,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,084 | java | package com.heshiqi.widget.loadmore;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
public class RingAnimHeaderView extends AbsRefreshableHeaderView {
public RingAnimHeaderView(Context context) {
super(context);
}
public RingAnimHeaderView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public RingAnimHeaderView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void init(Context context) {
}
@Override
public void onState(HeaderState state) {
}
@Override
public void setProgress(float progress) {
}
// public static final int STYLE_RING_NEW = 1;
// public static final int STYLE_RING_OLD = 0;
//
// private RingAnimView vRingAnimView;
// private TextGradientView vIndictor;
// private HeaderState mHeaderState;
//
// public RingAnimHeaderView(Context context) {
// super(context);
// }
//
// public RingAnimHeaderView(Context context, AttributeSet attrs) {
// super(context, attrs);
// }
//
// public RingAnimHeaderView(Context context, AttributeSet attrs, int defStyle) {
// super(context, attrs, defStyle);
// }
//
// @Override
// public void init(Context context) {
// initView(context);
// }
//
// private void initView(Context context){
// LayoutInflater.from(context).inflate(R.layout.ahlib_common_ring_anim_refresh_header, this);
// vRingAnimView = (RingAnimView) findViewById(R.id.ring_anim_view);
// vIndictor = (TextGradientView) findViewById(R.id.tv_pull_indicator);
// }
//
// public void setStyle(int style){
// if (style == STYLE_RING_NEW) {
// vIndictor.setGradientStyle(true);
// } else {
// vIndictor.setGradientStyle(false);
// }
// }
//
// @Override
// public void onState(HeaderState state) {
// if (state == null || state == mHeaderState) {
// return;
// }
// mHeaderState = state;
// switch (state) {
// case STATE_RESET:
// vRingAnimView.stop();
// break;
// case STATE_PULL_TO_REFRESH:
// vRingAnimView.start();
// vIndictor.setText(mPullStatusIndictorText);
// break;
// case STATE_RELEASE_TO_REFRESH:
//// vRingAnimView.stop();
// vIndictor.setGradientText(mReleaseStatusIndictorText);
// break;
// case STATE_REFRESHING:
// vRingAnimView.start();
// vIndictor.setGradientText(mRefreshingStatusIndictorText);
// break;
// default:
// break;
// }
// }
//
// @Override
// public void setProgress(float progress) {
//
// }
//
// public void showRefreshText(boolean show){
// if(null != vIndictor){
// vIndictor.setVisibility(show ? VISIBLE : GONE);
// }
// }
}
| [
"heshiqi@autohome.com.cn"
] | heshiqi@autohome.com.cn |
93527c165e11cbbad24dc5d6832d3749cddb5a5b | aede7c3841ff6d621ab5f9973da438e68388a2f5 | /src/test/java/com/zt/demo_test/DemoTestApplicationTests.java | 747f72ddfc0af8d99073a87dd87086a38418c95c | [] | no_license | cnzhoutao/demo_test | 11949c277639381a1db1d47b01c7c36555e06b4f | b09cbf2b5b641ae3b88709c7b06db6d5e91f6210 | refs/heads/master | 2021-09-20T17:10:58.056574 | 2018-08-09T00:43:04 | 2018-08-09T00:43:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.zt.demo_test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoTestApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"619598856@qq.com"
] | 619598856@qq.com |
0168415b9df63f7f246a22c3b0be42615edf5d2b | 419949d4f45fb1614fbee279f9ef1d597f24870f | /android/src/ga/uabart/twimp/android/AndroidLauncher.java | 3050e6db769709b29aa875624145156ee5512d5b | [] | no_license | Rukewetony/TwimpGame | fdc6e0d25d235eeda555ac8479c1a7d532696d56 | 058599f51b5898914897dbb1adcab3ddac7ecd7f | refs/heads/master | 2021-01-21T08:50:43.360094 | 2015-11-11T13:08:45 | 2015-11-11T13:08:45 | 45,983,069 | 1 | 0 | null | 2015-11-11T13:22:47 | 2015-11-11T13:22:45 | null | UTF-8 | Java | false | false | 519 | java | package ga.uabart.twimp.android;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import ga.uabart.twimp.TwimpGame;
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new TwimpGame(), config);
}
}
| [
"uabartgamer@gmail.com"
] | uabartgamer@gmail.com |
5d5fb88ac8c845ce821fc67fcf4466b23262e66e | 4c913803e3927f05ae9011d542e7b764597f5381 | /sample-code/sesi-09/aplikasi-krs/src/aplikasi/krs/RencanaStudi.java | 62d9804b3a55bb7fbb7b454b08b560e169c10883 | [] | no_license | sholihin/java_fundamental | a375f993f62abc59752effb24694ec0c651ae76b | b2df93031fd1949e095c0cc9e767b48b99af2d54 | refs/heads/master | 2020-05-16T09:48:27.811450 | 2013-09-05T02:57:56 | 2013-09-05T02:57:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package aplikasi.krs;
import java.util.List;
import java.util.ArrayList;
public class RencanaStudi {
private String npm;
private String nama;
private Double ipk;
private Integer semester;
private List<RencanaStudiDetail> daftarRencanaStudiDetail
= new ArrayList<RencanaStudiDetail>();
public void tambahDetail(RencanaStudiDetail rd){
rd.setRencanaStudi(this);
daftarRencanaStudiDetail.add(rd);
}
public List<RencanaStudiDetail> getDaftarRencanaStudiDetail(){
return daftarRencanaStudiDetail;
}
public String getNpm(){
return npm;
}
public void setNpm(String s){
this.npm = s;
}
public String getNama(){
return nama;
}
public void setNama(String s){
this.nama = s;
}
public Double getIpk(){
return ipk;
}
public void setIpk(Double s){
this.ipk = s;
}
public Integer getSemester(){
return semester;
}
public void setSemester(Integer s){
this.semester = s;
}
}
| [
"mohamad.sholihin.it@gmail.com"
] | mohamad.sholihin.it@gmail.com |
d6553c312fdbc5dff231c5e4de6321e24c1966c0 | 3c5143a254eb302407f602237b8d203f945027bf | /ไปฃ็ /1. Javaๅบ็ก/bd4j2se/src/com/hp/day8/extend/Person.java | 3ddcc1bd75db17e0c832dfb9e737058c37d3748f | [] | no_license | LilWingXYZ/JavaWeb-Actual-Combat | c447610e1d92a00d0d7984d1b0d11214bb4409c2 | 3edff5fc8932c495ff9ff5bc0ecd77655c3bcd62 | refs/heads/main | 2023-03-23T21:30:11.179822 | 2021-03-10T13:34:13 | 2021-03-10T13:34:13 | 346,353,683 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,776 | java | package com.hp.day8.extend;
import java.util.Date;
public class Person {
// ไฟฎ้ฅฐ็ฌฆ ๆฐๆฎ็ฑปๅ
private String name;
private int age;
private Date birthday;
public Person() {
System.out.println("@@@@");
}
public Person(String name, int age) {
this();
this.name = name;
this.age = age;
}
// ๆๅๆ้ ๆนๆณ็ฎ็๏ผ1.ๅๅปบๅฏน่ฑก 2.ๅๅงๅๆๅๅ้
/**
* ๅฆๆๅจไธไธชๆนๆณไธญ๏ผๅฝขๅผๅๆฐ/ๅฑ้จ
*
* @param name ๅงๅ
* @param age
* @param birthday
*/
public Person(String name, int age, Date birthday) {
// this.name = name;
// this.age = age;
this(name,age);
this.birthday = birthday;
}
public String getInfo() {
String result = this.getInfo2();
return result;
}
public String getInfo2() {
return null;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public static void main(String [] args){
/**
* ๅฏไปฅๆไธค็งๆนๅผๅๅงๅๆๅๅฏน่ฑก
* 1.้่ฟๆ ๅๆ้ ๆนๆณๅๅปบๅฏน่ฑก๏ผ้่ฟๆๅๅ้็setๆนๆณไฟฎๆน๏ผๅๅงๅ๏ผๆๅๅ้็ๅผ
* ๅ
ทไฝ่ฐ็จๅชไบ
* 2.ๅฏไปฅ้่ฟๆๅๆ้ ๆนๆณ
*
* ๅฆๆๅๅงๅๆๅๅ้่พๅฐ๏ผๅฏไปฅไฝฟ็จ็ฌฌไธ็ง
* ๅฆๆๆๅๅ้ๆฏ่พๅค๏ผๅจๅๅปบๅฏน่ฑก้
* springไธญไฝฟ็จ็ฌฌไธ็ง๏ผๆไปฅๅฆๆ้่ฝฝไบๆๅๆ้ ๆนๆณ๏ผๅฟ
้กป่ฆๆไธไธชๆ ๅ
*/
Person p = new Person();
p.setName("zhang");
p.setAge(10);
p.setBirthday(new Date());
Person p2 = new Person("wang", 18, new Date());
}
}
| [
"mcgradyxyz@gmail.com"
] | mcgradyxyz@gmail.com |
7e2b848ccac2be7508924166a1541cfaba9bfd3b | 1fc9a12c86be4e440f4f0d95c8b871c79df07545 | /Java/java_array/Csharpcorner5.java | d524b0474b6905df3976a9e5b78a71c0b4729ac9 | [] | no_license | Rohit-Gupta-Web3/Articles | a56e7f1b36d6d5efd846eec2e1a4036716ac16eb | 0f584916e065059d4dd1e95e7de874a7830fdff4 | refs/heads/master | 2023-05-14T02:50:17.817951 | 2020-07-26T06:44:10 | 2020-07-26T06:44:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | import java.util.Arrays;
public class Csharpcorner5
{
public static void main(String[] args)
{
int demo[] = { 10, 20, 15, 22, 35 };
int demo1[] = { 10, 15, 22 };
int out = Arrays.compare(demo, demo1);
}
}
| [
"rohit.gupta@iic.ac.in"
] | rohit.gupta@iic.ac.in |
fbb77a5d3e379ea8495db04228b63837d5f0dfe3 | 396b5c07ad581891bcdce489ee7ac2686861299b | /QuizWebsite/src/user/admin/AdminServlet.java | cec7522cf41d4b00b4f3c8b2d058d10a7229e46f | [] | no_license | marcelpuyat/QuizWebsite | 237813ed9b0f38f5e48966dcfb6088c284e6a96a | e2952bb73376bf105369adf884f90ec3e019b2c4 | refs/heads/master | 2020-06-26T07:39:59.809860 | 2014-11-25T08:33:10 | 2014-11-25T08:33:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,469 | java | package user.admin;
import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import customObjects.SelfRefreshingConnection;
/**
* Servlet implementation class AdminServlet
*/
@WebServlet("/AdminServlet")
public class AdminServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String PROMOTE_USER = "promote_user";
@SuppressWarnings("unused")
private static final String DELETE_USER = "remove_user";
private static final String DELETE_QUIZ = "remove_quiz";
@SuppressWarnings("unused")
private static final String CLEAR_HISTORY = "clear_history";
/**
* @see HttpServlet#HttpServlet()
*/
public AdminServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext context = getServletContext();
SelfRefreshingConnection con = (SelfRefreshingConnection)context.getAttribute("database_connection");
response.getWriter().println(Admin.getSiteStatistics(con));
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext context = getServletContext();
SelfRefreshingConnection con = (SelfRefreshingConnection)context.getAttribute("database_connection");
String action = request.getParameter("action");
String user_id_string = request.getParameter("user_id");
if (user_id_string != null) {
Long user_id = Long.parseLong(request.getParameter("user_id"));
if (action.equals(PROMOTE_USER)) {
Admin.promoteAccount(user_id, con);
}
else/*if(action.equals(DELETE_USER)*/{
Admin.removeUser(user_id, con);
response.sendRedirect("Home.jsp");
}
} else {
Long quiz_id = Long.parseLong(request.getParameter("quiz_id"));
if (action.equals(DELETE_QUIZ)) {
Admin.removeQuiz(quiz_id, con);
}
else/*if(action.equals(CLEAR_HISTORY)*/{
Admin.clearHistory(quiz_id, con);
}
}
}
}
| [
"marcelp@stanford.edu"
] | marcelp@stanford.edu |
2b7fcbcf572c5bc92771d0ad426941294dd60bad | 56d0d93e1f6a2be5147673c3c0cd8c924fb580ea | /build/classes/org/cinema/view/admin/AdminCompte.java | 8e53c1d4a8e82d1c8d4719801e5f52734a57d0f1 | [] | no_license | yoeo/cinema-management | 036fd922cf7a61c53ffb0375174c16b0dcdd64a1 | 92dcbf289647893913b24e1fd0d0c77fd79bfeec | refs/heads/master | 2020-05-18T09:52:52.570340 | 2015-04-06T16:23:11 | 2015-04-06T16:23:11 | 33,489,585 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,076 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* AdminCompte.java
*
* Created on 18 janv. 2011, 17:42:04
*/
/**
* suite le 19 janvier
*/
package org.cinema.view.admin;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.cinema.dao.film.FilmsDao;
import org.cinema.dao.film.FilmsInfo;
/**
*
* @author lynda and wydad
*/
public class AdminCompte extends javax.swing.JFrame {
// declaration
FilmsDao filmDao;
ArrayList<FilmsInfo> filmsList;
FilmsInfo film;
int recordNumber;
/** Creates new form AdminCompte */
public AdminCompte() throws InstantiationException, IllegalAccessException {
initComponents();
filmDao = new FilmsDao();
}
/** 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() {
jMenuBar2 = new javax.swing.JMenuBar();
jMenu6 = new javax.swing.JMenu();
jMenu7 = new javax.swing.JMenu();
jMenuBar3 = new javax.swing.JMenuBar();
jMenu9 = new javax.swing.JMenu();
jMenu11 = new javax.swing.JMenu();
jPanel1 = new javax.swing.JPanel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem6 = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
jMenuItem8 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenuItem5 = new javax.swing.JMenuItem();
jMenu10 = new javax.swing.JMenu();
jMenuItem7 = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenu8 = new javax.swing.JMenu();
jMenu6.setText("File");
jMenuBar2.add(jMenu6);
jMenu7.setText("Edit");
jMenuBar2.add(jMenu7);
jMenu9.setText("File");
jMenuBar3.add(jMenu9);
jMenu11.setText("Edit");
jMenuBar3.add(jMenu11);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Gestion Cinema\n");
setResizable(false);
addContainerListener(new java.awt.event.ContainerAdapter() {
public void componentAdded(java.awt.event.ContainerEvent evt) {
formComponentAdded(evt);
}
});
jPanel1.setMaximumSize(new java.awt.Dimension(1000, 1000));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 706, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 470, Short.MAX_VALUE)
);
jMenu1.setText(" File ");
jMenuItem1.setText("Quitter");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem1);
jMenuBar1.add(jMenu1);
jMenu2.setText("Films ");
jMenuItem4.setText("Liste des Films");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem4);
jMenuItem6.setText("Nouveau Film");
jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem6ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem6);
jMenuBar1.add(jMenu2);
jMenu4.setText("Salles ");
jMenuItem8.setText("Liste des salles ");
jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem8ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem8);
jMenuBar1.add(jMenu4);
jMenuItem5.setText("Liste de Sรฉances");
jMenu3.add(jMenuItem5);
jMenuBar1.add(jMenu3);
jMenu10.setText("Abonnรฉs");
jMenuItem7.setText("Liste des abonnรฉs");
jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem7ActionPerformed(evt);
}
});
jMenu10.add(jMenuItem7);
jMenuBar1.add(jMenu10);
jMenu5.setText(" Cartes ");
jMenuItem2.setText("Nouvelle Carte");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu5.add(jMenuItem2);
jMenuItem3.setText("Liste de Cartes");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu5.add(jMenuItem3);
jMenuBar1.add(jMenu5);
jMenu8.setText("?");
jMenuBar1.add(jMenu8);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
// TODO add your handling code here:
/* recuperer a liste de film dans la base et les afficher dans
le panel ListeFilms*/
filmsList = (ArrayList<FilmsInfo>) filmDao.allFilm();
if (filmsList.isEmpty()) {
JOptionPane.showMessageDialog(null,
"aucun film dans la liste.");
} else {
// for (FilmsInfo fi : filmsList) {
// System.out.println(fi.getTitre());
// addFilm(jPanel1, fi);}
affichageFilm affichage;
jPanel1.removeAll();
try {
affichage = new affichageFilm();
affichage.setVisible(true);
affichage.setBounds(0, 0, affichage.getPreferredSize().width,affichage.getPreferredSize().height );
jPanel1.add(affichage);
jPanel1.validate();
jPanel1.repaint();
} catch (InstantiationException ex) {
Logger.getLogger(AdminCompte.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(AdminCompte.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_jMenuItem4ActionPerformed
private void formComponentAdded(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_formComponentAdded
// TODO add your handling code here:
}//GEN-LAST:event_formComponentAdded
/* consulter la liste des abonnรฉes au cinema*/ /* Afficher la fenetre qui permet d'organiser et d'ajouter un film*/
/* Film menu est un jFrame qui lorsque on clique sur ajouter un film
ce jFrame est charger d'afficher le panel Nouveau Film*/
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
NouveauFilm nfilm = new NouveauFilm();
nfilm.setVisible(true);
nfilm.setBounds(0, 0, nfilm.getPreferredSize().width,nfilm.getPreferredSize().height );
FilmForm ff = new FilmForm();
ff.setVisible(true);
ff.add(nfilm);
}//GEN-LAST:event_jMenuItem6ActionPerformed
/* fermer la fenetre admin */
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
this.dispose();
}//GEN-LAST:event_jMenuItem1ActionPerformed
/* afficher les diffรฉrentes cartes */
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
CartesForm cf = new CartesForm();
cf.setVisible(true);
cf.setBounds(0, 0, cf.getPreferredSize().width, cf.getPreferredSize().height);
jPanel1.removeAll();
jPanel1.add(cf);
jPanel1.validate();
jPanel1.repaint();
}//GEN-LAST:event_jMenuItem3ActionPerformed
/* ajouter une nouvelle carte*/
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
/* quand je clique sur l'item Nouvelle Carte, la jFrame AjouterCarte
doit s'ouvrir*/
AjouterCarte ajoutCarte = new AjouterCarte();
ajoutCarte.setVisible(true);
ajoutCarte.setBounds(0, 0, ajoutCarte.getPreferredSize().width,ajoutCarte.getPreferredSize().height );
ajoutCarte.setAlwaysOnTop(true);
}//GEN-LAST:event_jMenuItem2ActionPerformed
/* afficher la liste des abonnรฉs*/
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
AbonneForm af = new AbonneForm();
af.setVisible(true);
af.setBounds(0, 0, af.getPreferredSize().width,af.getPreferredSize().height );
jPanel1.removeAll();
jPanel1.add(af);
jPanel1.validate();
jPanel1.repaint();
}//GEN-LAST:event_jMenuItem7ActionPerformed
/* afficher la liste des salles*/
private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
SalleForm sf = new SalleForm();
sf.setVisible(true);
sf.setBounds(0, 0, sf.getPreferredSize().width,sf.getPreferredSize().height);
jPanel1.removeAll();
jPanel1.add(sf);
jPanel1.validate();
jPanel1.repaint();
}//GEN-LAST:event_jMenuItem8ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) throws IOException, SQLException, InstantiationException, IllegalAccessException {
//ConnexionBD.loadTables(null, null);
/* FilmsDao fd = new FilmsDao();
FilmsInfo element = new FilmsInfo(
0,
"Printemps",
new Time(1,12,3),
"Une histoire d'amour",
new Date(2007, 10, 21),
"John Bash, Carrie Bradshow",
0.3f,
"print.jpg"
);
fd.saveFilm(element);
FilmsInfo elemen = new FilmsInfo(
1,
"Salt",
new Time(1,40,3),
"Une histoire d'amour",
new Date(2010, 10, 21),
"John Bash, Carrie Bradshow",
0.3f,
"img.jpg"
);
fd.saveFilm(elemen);*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
new AdminCompte().setVisible(true);
} catch (InstantiationException ex) {
Logger.getLogger(AdminCompte.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(AdminCompte.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu10;
private javax.swing.JMenu jMenu11;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenu jMenu6;
private javax.swing.JMenu jMenu7;
private javax.swing.JMenu jMenu8;
private javax.swing.JMenu jMenu9;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JMenuBar jMenuBar3;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JMenuItem jMenuItem7;
private javax.swing.JMenuItem jMenuItem8;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
/*
private void addFilm(JPanel jPanel1, FilmsInfo fi){
try {
affichageFilm lfilm = new affichageFilm(fi);
lfilm.setBounds(0, 0, 800, 800);
jPanel1.add(lfilm);
/* affichageFilm lfilm = new affichageFilm(fi);
int decalage = 5;
int pwidth = 300;
int pheight = 600;
int mxwidth = 600;
System.out.println(filmsList.size());
int x = (((filmsList.size() % (mxwidth / pwidth)) + 1) * decalage) + ((filmsList.size() * pwidth) % mxwidth);
int y = (((filmsList.size() / (mxwidth / pwidth)) + 1) * decalage) + (filmsList.size() / (mxwidth / pwidth) * pheight);
lfilm.setVisible(true);
// lfilm.setBounds(x, y, pheight, mxwidth);
lfilm.setBounds(x, y, 600, 600);
jPanel1.add(lfilm);
jPanel1.setPreferredSize(new Dimension(jPanel1.getPreferredSize().width, y+pheight));*/
// this.add(jPanel1);
/* } catch (InstantiationException ex) {
Logger.getLogger(AdminCompte.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(AdminCompte.class.getName()).log(Level.SEVERE, null, ex);
}
}
*/
}
| [
"ydeo@ydeo-laptop.(none)"
] | ydeo@ydeo-laptop.(none) |
a3d69b6595d081ab16fe33f72ffd85d7822cc771 | 68f0459ff0733734ddc8457203f82d7c99f50979 | /src/main/java/framework/webdriver/WebDriverFactory.java | afbc0b1e24dfd21b630b7446ccd6b99ffbf16c4a | [] | no_license | tlytvyn/lits-automation-framework | bd954dceeb11ecc703c975436384b935c9ea2149 | d1373a327dc7c95edef60d70e3f43347b5316012 | refs/heads/master | 2020-03-12T04:41:45.580242 | 2018-05-22T15:11:32 | 2018-05-22T15:11:32 | 130,450,112 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,800 | java | package framework.webdriver;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.slf4j.Logger;
import framework.utility.LogFactory;
import framework.utility.PropertyLoader;
import framework.utility.WebDriverListener;
import io.github.bonigarcia.wdm.WebDriverManager;
/**
* A factory that returns a singleton of WebDriver object.
*/
public class WebDriverFactory {
private static final Logger LOG = LogFactory.getLogger(WebDriverFactory.class);
private static final String CHROME = "chrome";
private static final String FIREFOX = "firefox";
private static EventFiringWebDriver eventDriver;
private WebDriverFactory() {
}
/**
* Gets the single instance of WebDriverFactory.
*
* @param browser - the browser set in properties
* @return single instance of WebDriverFactory
*/
public static WebDriver getInstance(String browser) {
WebDriver webDriver = null;
if (eventDriver == null) {
if (CHROME.equals(browser)) {
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("disable-infobars");
webDriver = new ChromeDriver(options);
LOG.info("Chrome driver was started");
} else if (FIREFOX.equals(browser)) {
WebDriverManager.firefoxdriver().setup();
FirefoxOptions options = new FirefoxOptions();
options.setCapability("marionette", false);
webDriver = new FirefoxDriver(options);
LOG.info("Firefox driver was created");
} else throw new IllegalArgumentException("Invalid browser property set in configuration file");
webDriver.manage().timeouts()
.implicitlyWait(Integer.valueOf(PropertyLoader.loadProperty("implicit.timeout")), TimeUnit.SECONDS);
eventDriver = new EventFiringWebDriver(webDriver);
eventDriver.register(new WebDriverListener());
eventDriver.manage().timeouts()
.implicitlyWait(Integer.valueOf(PropertyLoader.loadProperty("implicit.timeout")), TimeUnit.SECONDS);
eventDriver.manage().window().maximize();
}
return eventDriver;
}
public static WebDriver getSetDriver() {
if (eventDriver == null) {
throw new IllegalStateException("Driver is not set");
}
return eventDriver;
}
/**
* Kill driver instance.
*
* @throws Exception
*/
public static void killDriverInstance() {
eventDriver.quit();
eventDriver = null;
LOG.info("Web driver was ended");
}
} | [
"tlytvyn"
] | tlytvyn |
9506dfa1efd89d83e5c8e00d57fa6be4fd314d6a | a9e055225ff84bbccd62cfff9284490607a7ed5c | /Chapter 2/src/debugging/FixDebugTwo2.java | bf44ff068182f89b2f93ce3809f4085993acad71 | [] | no_license | Orion03/Chapter-1 | 7da977f793b6eb834a3529bf52ae1194c06c14cd | 2879bdaadc4f22a9a202a06dadd4ac21a03895c5 | refs/heads/master | 2020-03-27T08:58:02.603705 | 2018-09-10T14:15:29 | 2018-09-10T14:15:29 | 146,302,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package debugging;
public class FixDebugTwo2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a, b;
a = 7;
b = 4;
System.out.println("The sum is " + (a + b));
System.out.println("The difference is " + (a - b));
System.out.println("The product is " + (a * b));
}
}
| [
"jackreis2019@gmail.com"
] | jackreis2019@gmail.com |
ec8a3a6e35af3269f1679aa39b4467bbe9bacdc2 | fe06f97c2cf33a8b4acb7cb324b79a6cb6bb9dac | /java/dao/impl/EHU_SACT/Def$PropagatorDAOImpl.java | 571a811d55e58a7988c5742dc70a1c339dff06a7 | [] | no_license | HeimlichLin/TableSchema | 3f67dae0b5b169ee3a1b34837ea9a2d34265f175 | 64b66a2968c3a169b75d70d9e5cf75fa3bb65354 | refs/heads/master | 2023-02-11T09:42:47.210289 | 2023-02-01T02:58:44 | 2023-02-01T02:58:44 | 196,526,843 | 0 | 0 | null | 2022-06-29T18:53:55 | 2019-07-12T07:03:58 | Java | UTF-8 | Java | false | false | 1,738 | java | package com.doc.common.dao.impl;
public class Def$PropagatorDAOImpl extends GeneralDAOImpl<Def$PropagatorPo> implements IDef$PropagatorDAO {
public static final Def$PropagatorDAOImpl INSTANCE = new Def$PropagatorDAOImpl();
public static final String TABLENAME = "DEF$_PROPAGATOR";
public Def$PropagatorDAOImpl() {
super(TABLENAME);
}
protected static final MapConverter<Def$PropagatorPo> CONVERTER = new MapConverter<Def$PropagatorPo>() {
@Override
public Def$PropagatorPo convert(final DataObject dataObject) {
final Def$PropagatorPo def$PropagatorPo = new Def$PropagatorPo();
def$PropagatorPo.setUserid(BigDecimalUtils.formObj(dataObject.getValue(Def$PropagatorPo.COLUMNS.USERID.name())));
def$PropagatorPo.setUsername(dataObject.getString(Def$PropagatorPo.COLUMNS.USERNAME.name()));
def$PropagatorPo.setCreated(TimestampUtils.of(dataObject.getValue(Def$PropagatorPo.COLUMNS.CREATED.name())));
return def$PropagatorPo;
}
@Override
public DataObject toDataObject(final Def$PropagatorPo def$PropagatorPo) {
final DataObject dataObject = new DataObject();
dataObject.setValue(Def$PropagatorPo.COLUMNS.USERID.name(), def$PropagatorPo.getUserid());
dataObject.setValue(Def$PropagatorPo.COLUMNS.USERNAME.name(), def$PropagatorPo.getUsername());
dataObject.setValue(Def$PropagatorPo.COLUMNS.CREATED.name(), def$PropagatorPo.getCreated());
return dataObject;
}
};
public MapConverter<Def$PropagatorPo> getConverter() {
return CONVERTER;
}
@Override
public SqlWhere getPkSqlWhere(Def$PropagatorPo po) {
SqlWhere sqlWhere = new SqlWhere();
sqlWhere.add(Def$PropagatorPo.COLUMNS.USERID.name(), po.getUserid());
return sqlWhere;
}
}
| [
"jerry.l@acer.com"
] | jerry.l@acer.com |
3c99383b7cf90a265f44e7452ad1a9c63b0f9a63 | 2a7ca83a63fff7c460ac8bcfe6fd9564d898bf5e | /matrix.java | 2441cca7c4e4fa6dbe5dd360e6a93f561228a434 | [] | no_license | shubham05tawade/java | f94d47ba9500ea634c03f0b7875d8729c90cf7aa | a53b505403446af8abbc25edd78cf1730a9b46a6 | refs/heads/master | 2020-03-27T02:37:15.613841 | 2018-09-29T04:32:01 | 2018-09-29T04:32:01 | 145,722,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,229 | java | import java.util.*;
class matrix{
int count1=0,count2=0;
public static void main(String args[]){
Scanner get =new Scanner(System.in);
int n;
n = get.nextInt();
int[][] matrix1 = new int[n][n];
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
matrix1[i][j] = get.nextInt();
}
}
TypeOfMatrix(matrix1[][]);
}
void TypeOfMatrix(int[][] matrix1){
for(int i=0; i<matrix1.length; i++){
for(int j=0; j<matrix1.length; j++){
if(i<j){
if(matrix1[i][j]==0){
count1++;
}
}
else if(i>j){
if(matrix1[i][j]==0){
count2++;
}
}
}
}
int sum = 0;
int temp = 1;
while(temp<4){
sum = sum + temp;
temp++;
}
System.out.print(count1+" "+sum);
if(sum==count1){
System.out.println("Lower Triangular Matrix");
}
else if(sum==count2){
System.out.println("Upper Triangular Matrix");
}
}
} | [
"shubham05tawade@gmail.com"
] | shubham05tawade@gmail.com |
f188698435e54f03e6e020dcd150f52d132569be | 8773cadf5c10245f9579ebc4f55e4cb2469cdeb7 | /src/main/java/JvmTest/GcRootsTest.java | a2b7fde2dd528b977a0e2527511c0d83bc0beb43 | [] | no_license | skyWalkerLong/about_java | b4b607d212733a1d74ddb3b92acbd9aac64f72d1 | 3b10451a390bc097ea855781bc2c3c647dde6165 | refs/heads/master | 2022-06-25T22:17:35.844803 | 2019-09-09T07:06:46 | 2019-09-09T07:06:46 | 113,118,745 | 0 | 0 | null | 2022-06-17T01:48:46 | 2017-12-05T02:01:59 | HTML | UTF-8 | Java | false | false | 2,421 | java | package JvmTest;
/**
* GC ROOTSๅฏน่ฑกๅ
ๅซ๏ผ
* 1.่ๆๆบๆ ๏ผๆ ๅธงไธญ็ๆฌๅฐๅ้่กจ๏ผไธญๅผ็จ็ๅฏน่ฑก๏ผ
* 2.ๆนๆณๅบ๏ผjdk1.8ๆฟๆขไธบๅ
็ฉบ้ด๏ผไธญ็็ฑป้ๆๅฑๆงๅผ็จ็ๅฏน่ฑก๏ผ
* 3.ๆนๆณๅบ๏ผjdk1.8ๆฟๆขไธบๅ
็ฉบ้ด๏ผไธญๅธธ้๏ผjdk1.8ๅญ็ฌฆไธฒๅธธ้็งปๅจๅฐๅ ไธญ๏ผๅผ็จ็ๅฏน่ฑก๏ผ
* 4.ๆฌๅฐๆนๆณๆ ไธญJNI๏ผๅณไธ่ฌ่ฏด็Nativeๆนๆณ๏ผไธญๅผ็จ็ๅฏน่ฑก
* @author longchao
* @date 2018/6/14.
*/
public class GcRootsTest {
private static int _10MB = 10 * 1024 * 1024;
private byte[] memory;
private static GcRootsTest t;
public GcRootsTest(int size) {
memory = new byte[size];
}
public static void main(String[] args) {
//ๅคงๅฏน่ฑก๏ผ้ฟๅญ็ฌฆไธฒๅๆฐ็ป๏ผ็ดๆฅ่ฟๅ
ฅ่ๅนดไปฃ๏ผtๅt2็ดๆฅ่ฟๅ
ฅ่ๅนดไปฃ
GcRootsTest t2 = new GcRootsTest(10 * _10MB);
t2.t = new GcRootsTest(4 * _10MB);
t2 = null;//t2=null๏ผไธๅๅผ็จๅธธ้_10MB๏ผไผ่ขซๅๆถ
// t = null;
System.gc();
}
/**
[GC๏ผๅ้กฟ็ฑปๅ๏ผ (System.gc()) [PSYoungGen: 4373K๏ผๅๆถๅๅนด่ฝปไปฃๅ
ๅญๅ ็จ๏ผ->1204K๏ผๅๆถๅๅนด่ฝปไปฃๅ
ๅญๅ ็จ๏ผ(36352K๏ผๅนด่ฝปไปฃๆปๅ
ๅญ๏ผ)] 147733K๏ผๅๆถๅjavaๅ ๅ
ๅญๅ ็จ๏ผ->144572K๏ผๅๆถๅjavaๅ ๅ
ๅญๅ ็จ๏ผ(222720K๏ผjavaๅ ๆปๅ
ๅญ๏ผ), 0.0021958 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[Full GC๏ผๅ้กฟ็ฑปๅ๏ผstop the word๏ผ (System.gc()) [PSYoungGen๏ผๅนด่ฝปไปฃ๏ผ: 1204K->0K(36352K)] [ParOldGen๏ผ่ๅนดไปฃ๏ผ: 143368K->42074K(186368K)] 144572K->42074K(222720K), [Metaspace๏ผๅ
็ฉบ้ด๏ผ: 3531K->3531K(1056768K)], 0.0123274 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]
Heap
PSYoungGen total 36352K, used 312K [0x00000000d7c00000, 0x00000000da480000, 0x0000000100000000)
eden space 31232K, 1% used [0x00000000d7c00000,0x00000000d7c4e2b8,0x00000000d9a80000)
from space 5120K, 0% used [0x00000000d9a80000,0x00000000d9a80000,0x00000000d9f80000)
to space 5120K, 0% used [0x00000000d9f80000,0x00000000d9f80000,0x00000000da480000)
ParOldGen total 186368K, used 42074K [0x0000000087400000, 0x0000000092a00000, 0x00000000d7c00000)
object space 186368K, 22% used [0x0000000087400000,0x0000000089d16960,0x0000000092a00000)
Metaspace used 3539K, capacity 4500K, committed 4864K, reserved 1056768K
class space used 390K, capacity 392K, committed 512K, reserved 1048576K
*/
}
| [
"longchao@jd.com"
] | longchao@jd.com |
0bc231adcc50333c245258a93afd94940c92922d | c8354b20b2ef263dde99a1609cb2a06bfab2ae1e | /src/com/willyan/iconchanger/BaseActivity.java | e281d0661627ce12004e72cce5c7264b38a81de4 | [] | no_license | ryonplock/IconTransformer | 25a00617a0ed5e3069574ebec1e1373841b57d89 | eb3a7f5895e121da1e237d3e650c7b6670ab21c7 | refs/heads/master | 2016-09-06T16:19:07.303418 | 2013-10-22T06:22:42 | 2013-10-22T06:22:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package com.willyan.iconchanger;
import com.umeng.analytics.MobclickAgent;
import android.app.Activity;
import android.os.Bundle;
public class BaseActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
| [
"willyan0820@gmail.com"
] | willyan0820@gmail.com |
eae75e4feb6afee02bb6b5a4725733ec36fee09a | d40002e61c1949120cd08a71a91fbe44b2225355 | /src/main/java/crawler/Response.java | 9a043814412d8c34817e129187af4f1580305dc0 | [] | no_license | Houjingchao/HttpRequest-Reptile | ea1c613f437f991c245eab1943b55b26d2ab4079 | 52d1d9c96dbefd99356cbd25f978642bb9459beb | refs/heads/master | 2021-01-20T13:11:20.311863 | 2017-05-10T16:41:00 | 2017-05-10T16:41:00 | 90,457,706 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package crawler;
import org.apache.http.HttpException;
import java.io.Serializable;
import java.util.Map;
/**
* Created by Hjc on 2017/5/6.
*/
public interface Response extends Serializable {
int code();
String lastUrl();
Map<String, String> header() throws HttpException;
String string() throws HttpException;
byte[] bin() throws HttpException;
}
| [
"code_writer@163.com"
] | code_writer@163.com |
2c513014e3fa873129089c4e0c43998358504981 | ad6434dc113e22e64f0709c95099babe6b2cc854 | /src/ConcatenatedWords/ConcatenatedWords.java | a91c2de1a90740ce1b04e3416f3ba5b4306f796c | [] | no_license | shiyanch/Leetcode_Java | f8b7807fbbc0174d45127b65b7b48d836887983c | 20df421f44b1907af6528578baf53efddfee48b1 | refs/heads/master | 2023-05-28T00:40:30.569992 | 2023-05-17T03:51:34 | 2023-05-17T03:51:34 | 48,945,641 | 9 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | package ConcatenatedWords;
import java.util.*;
/**
* 472. Concatenated Words
*
* Given a list of words (without duplicates),
* please write a program that returns all concatenated words in the given list of words.
*
* A concatenated word is defined as a string that is comprised
* entirely of at least two shorter words in the given array.
*/
public class ConcatenatedWords {
public List<String> findAllConcatenatedWordsInADict(String[] words) {
List<String> res = new ArrayList<>();
Set<String> preWords = new HashSet<>();
Arrays.sort(words, new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return s1.length() - s2.length();
}
});
for (int i=0; i<words.length; i++) {
if (canFrom(words[i], preWords)) {
res.add(words[i]);
}
preWords.add(words[i]);
}
return res;
}
private boolean canFrom(String word, Set<String> dict) {
if (dict.isEmpty()) {
return false;
}
boolean[] dp = new boolean[word.length()+1];
dp[0] = true;
for (int i=1; i<=word.length(); i++) {
for (int j=0; j<i; j++) {
dp[i] = dp[j] && dict.contains(word.substring(j,i));
if (dp[i]) {
break;
}
}
}
return dp[word.length()];
}
}
| [
"shiyanch@gmail.com"
] | shiyanch@gmail.com |
29673237ea68918819fd31a30861e7cb4a5c9ce3 | fcfa351239a2dbdc243239d2f0654b8333987aa6 | /src/MyDlist.java | c46f943706bfd2adbfed669824303c2ac7d9ae8f | [] | no_license | aakash159/Dnode | 7e32656b9d25d4c0d44133f3e36d657475f4660d | 027500250f32016f2e80dea6471c9896b023f0a7 | refs/heads/master | 2021-01-10T20:45:00.063415 | 2015-08-23T13:17:16 | 2015-08-23T13:17:16 | 41,250,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,251 | java |
import java.io.*;
/**
*
* @author aakash patel
*/
class MyDlist extends DList {
public MyDlist() {
super();
}
public MyDlist(String f) {
super();
String[] result = f.split("\\s");
addToList(result);
}
private void addToList(String[] result) {
DNode node = new DNode(result[0], null, null);
this.addFirst(node);
for (int i = 1; i < result.length; i++) {
DNode nextNode = new DNode(result[i], node, null);
this.addAfter(node, nextNode);
node = nextNode;
}
}
public void printList() {
System.out.println(this.toString());
}
public void newPrintList() {
String s = this.toString();
String[] result = s.split(",");
for (int i = 0; i < result.length; i++) {
System.out.println(result[i]);
}
}
public static MyDlist cloneList(MyDlist originalList) {
String[] str = new String[originalList.size];
DNode orgNode = originalList.getFirst();
str[0] = orgNode.getElement();
for (int i = 1; i < originalList.size; i++) {
orgNode = orgNode.getNext();
str[i] = orgNode.getElement();
}
MyDlist newList = new MyDlist();
newList.addToList(str);
return newList;
}
public void union(MyDlist firstList, MyDlist secList) {
MyDlist mergeList = MyDlist.cloneList(firstList);
DNode nFirstNode = secList.getFirst();
DNode mergeLast = mergeList.getLast();
boolean flag;
for (int i = 0; i < secList.size; i++) {
DNode mNode = firstList.getFirst(); //data
flag = true; //flag=true
for (int j = 0; j < firstList.size; j++) {
if (mNode.getElement().equalsIgnoreCase(nFirstNode.getElement())) {//data == hello
flag = false;
}
mNode = firstList.getNext(mNode);//structures
}
if (flag) {
//insert
DNode nextNode = new DNode(nFirstNode.getElement(), mergeLast,
null);
mergeList.addAfter(mergeLast, nextNode);
mergeLast = nextNode;
}
nFirstNode = secList.getNext(nFirstNode);
}
mergeList.printList();
}
public void intersection(MyDlist firstList, MyDlist secList) {
MyDlist intsecList = new MyDlist();
DNode nFirstNode = secList.getFirst();
DNode intsecLastNode = null;
boolean flag;
for (int i = 0; i < secList.size; i++) {
DNode mNode = firstList.getFirst(); //data
flag = false;
for (int j = 0; j < firstList.size; j++) {
if (mNode.getElement().equalsIgnoreCase(nFirstNode.getElement())) {//data == hello
flag = true;
}
mNode = firstList.getNext(mNode);//structures
}
if (flag) {
//insert
DNode nextNode = new DNode(nFirstNode.getElement(), intsecLastNode,
null);
intsecList.addLast(nextNode);
//intsecList.addAfter(intsecLastNode, nextNode);
intsecLastNode = nextNode;
}
nFirstNode = secList.getNext(nFirstNode);
}
intsecList.printList();
}
public static void main(String args[]) throws Exception {
// Read File
FileReader fileReader = new FileReader("C:\\Users\\aakash patel\\workspace\\Dnode\\src\\StringFile.txt");
BufferedReader bufferRdr = new BufferedReader(fileReader);
String wholeFileStr = "";
String lineStr;
while ((lineStr = bufferRdr.readLine()) != null) {
wholeFileStr += lineStr + ' ';
}
fileReader.close();
// Example Empty List
MyDlist emptyList = new MyDlist();
System.out.println("----------------------Empty list----------------------");
emptyList.printList();
System.out.println();
// Example with File List
System.out.println("----------------------Imported File list----------------");
MyDlist fileList = new MyDlist(wholeFileStr);
fileList.newPrintList();
System.out.println();
MyDlist secondList = new MyDlist("good morning is hello world");
//secondList.printList();
System.out.println("----------------------Union----------------------");
MyDlist m = new MyDlist();
m.union(fileList, secondList);
System.out.println();
System.out.println("----------------------Intersection----------------");
MyDlist insect=new MyDlist();
insect.intersection(fileList, secondList);
System.out.println();
// secondList.printList();
// Example print as original
// fileList.newPrintList();
// Clone List
MyDlist cloneList = MyDlist.cloneList(fileList);
// cloneList.printList();
}
}
| [
"aakash.getready@gmail.com"
] | aakash.getready@gmail.com |
caf1dd6f17f880b0708f28e91d2b03a0799e1822 | 73d6bd74785789adbeb9eb244bef8308bc46c5f9 | /app/src/main/java/com/example/notes/MainActivity.java | f84ad99f95a02e6b3ec99845cd069e15e92f5370 | [] | no_license | jayeshsadhwani99/NotesApp | 691c096ca2a6256e06660f22af92df744accdb7c | 9495b2d10b8a8bcd3bf5fc1d3b6e519fb7ef1589 | refs/heads/main | 2023-01-30T11:44:02.089993 | 2020-12-05T15:58:04 | 2020-12-05T15:58:04 | 318,828,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,809 | java | package com.example.notes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import org.w3c.dom.Text;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
public class MainActivity extends AppCompatActivity {
static ListView listView;
static ArrayAdapter arrayAdapter;
static ArrayList<String> notes;
SharedPreferences sharedPreferences;
Intent intent;
public void addNewNote() {
intent = new Intent(getApplicationContext(), NotesActivity.class);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.main_menu ,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
super.onOptionsItemSelected(item);
addNewNote();
return true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sharedPreferences = getApplicationContext().getSharedPreferences("package com.example.notes", Context.MODE_PRIVATE);
HashSet<String> set = (HashSet<String>) sharedPreferences.getStringSet("notes", null);
notes = new ArrayList<String>();
if(set == null) {
notes.add("Example Note");
} else {
notes = new ArrayList(set);
}
sharedPreferences = getSharedPreferences("package com.example.notes", Context.MODE_PRIVATE);
listView = findViewById(R.id.notes);
arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, notes);
listView.setAdapter(arrayAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
intent = new Intent(getApplicationContext(), NotesActivity.class);
intent.putExtra("noteId", position);
startActivity(intent);
}
});
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
new AlertDialog.Builder(MainActivity.this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle("Delete Note")
.setMessage("Are you sure?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
notes.remove(position);
arrayAdapter.notifyDataSetChanged();
}
})
.setNegativeButton("No", null)
.show();
HashSet<String> set = new HashSet<>(MainActivity.notes);
sharedPreferences.edit().putStringSet("notes", set).apply();
return true;
}
});
}
}
| [
"69295377+jayeshsadhwani99@users.noreply.github.com"
] | 69295377+jayeshsadhwani99@users.noreply.github.com |
6786a7708b2828383cac6c67452060999442ea1b | 2aa763e19de97be502a301f514f227b25e715ab8 | /src/main/java/app/psych/game/GameApplication.java | 95bb664b4d6fb7a2199dfe99a58fd814cac47314 | [] | no_license | 96mohitm/psych | 4057f204f19400febf9d87c414f25b47c613f154 | 32ecba013f39ec28525dc5c6d430afa40e625935 | refs/heads/master | 2020-12-01T22:32:51.294332 | 2019-12-31T17:38:05 | 2019-12-31T17:38:05 | 230,793,771 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package app.psych.game;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@SpringBootApplication
@EnableJpaAuditing
public class GameApplication {
public static void main(String[] args) {
SpringApplication.run(GameApplication.class, args);
}
}
| [
"96mohitm@gmail.com"
] | 96mohitm@gmail.com |
04f4a22f4c4f1b6b355c1d6d93a65d995567e6c2 | a2505ebd827b045ac67697d5b2008e9024b33d26 | /plugins/src/main/java/com/ericliu/language_plugin/SimpleCodeStyleSettingsProvider.java | 7a9ecf029df6a3b3f96f849587889b7401eb85d8 | [] | no_license | Ericliu001/eric-intellij-plugins | 949dd637fc30b3df74f083ca981afe144326b494 | e755fba2fb078af8e4fd80845335d96541972581 | refs/heads/master | 2020-05-18T03:52:44.500924 | 2020-04-22T01:13:07 | 2020-04-22T01:13:07 | 184,157,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,823 | java | package com.ericliu.language_plugin;
import com.intellij.application.options.CodeStyleAbstractConfigurable;
import com.intellij.application.options.CodeStyleAbstractPanel;
import com.intellij.application.options.TabbedLanguageCodeStylePanel;
import com.intellij.openapi.options.Configurable;
import com.intellij.psi.codeStyle.CodeStyleConfigurable;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SimpleCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
return new SimpleCodeStyleSettings(settings);
}
@NotNull
@Override
public Configurable createSettingsPage(
final CodeStyleSettings settings, final CodeStyleSettings modelSettings) {
return null;
}
@Nullable
@Override
public String getConfigurableDisplayName() {
return "Simple";
}
@NotNull
public CodeStyleConfigurable createConfigurable(@NotNull CodeStyleSettings settings, @NotNull CodeStyleSettings modelSettings) {
return new CodeStyleAbstractConfigurable(settings, modelSettings, this.getConfigurableDisplayName()) {
@Override
protected CodeStyleAbstractPanel createPanel(CodeStyleSettings settings) {
return new SimpleCodeStyleMainPanel(getCurrentSettings(), settings);
}
};
}
private static class SimpleCodeStyleMainPanel extends TabbedLanguageCodeStylePanel {
public SimpleCodeStyleMainPanel(CodeStyleSettings currentSettings, CodeStyleSettings settings) {
super(SimpleLanguage.INSTANCE, currentSettings, settings);
}
}
} | [
"eric.liu@uber.com"
] | eric.liu@uber.com |
92140f5e8c137289603a1bf67e4c01774150c8af | 6e0024936e95df28dfaa205dc1796887b8d6e3a2 | /SpringBoot/src/main/java/com/sut/sa/cpe/entity/User.java | acabbdd59dc02d125388dc91e5ba31e26786c344 | [] | no_license | tanapon395/Angular-and-SpringBoot | 8f53e9063e50db4b51b04630c56f30f994bbbb5c | e640646eb83cd8687095fc7dd5b462e82a2bd8b0 | refs/heads/master | 2023-01-05T17:01:43.304493 | 2019-09-11T05:28:22 | 2019-09-11T05:28:22 | 150,644,437 | 1 | 0 | null | 2023-01-04T13:45:19 | 2018-09-27T20:32:20 | Java | UTF-8 | Java | false | false | 700 | java | package com.sut.sa.cpe.entity;
import lombok.*;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Column;
import javax.persistence.Entity;
@Data
@Entity
@Getter @Setter
@NoArgsConstructor
@ToString
@EqualsAndHashCode
@Table(name="user")
public class User {
@Id
@SequenceGenerator(name="user_seq",sequenceName="user_seq")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="user_seq")
@Column(name="USER_ID",unique = true, nullable = true)
private @NonNull Long id;
private @NonNull String username;
}
| [
"tanapon395@gmail.com"
] | tanapon395@gmail.com |
0032d1004d30bb6e8dddd1c8d07cad3bbfae73ba | c2dcb8b01139356670dd35bdab78415ac9d47471 | /src/main/resources/archetype-resources/environment/src/main/java/EnvironmentConfig.java | cb8322e0d8c6058c333f39a907fbc17580a1bf83 | [
"MIT"
] | permissive | kgress/scaffold-archetype | 201fb9f3b89b583310ea51c0f924f936f8799d4e | 14117816b2b6d1ff9f61bed8884bee21f4728cf0 | refs/heads/main | 2022-03-08T20:10:20.446404 | 2022-02-27T03:19:29 | 2022-02-27T03:19:29 | 201,316,685 | 2 | 2 | MIT | 2022-02-27T02:20:25 | 2019-08-08T18:37:31 | Java | UTF-8 | Java | false | false | 878 | java | package ${package};
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/**
* This class is a required spring boot configuration file for scanning all files in the project
* that contain the {@link Component} and {@link Service} annotation. It's also used to create
* specify the destination of the application's properties files. In addition, you can create
* spring beans on this file using a method level annotation that can be injected into other portions
* of the code base, if needed.
*/
@Configuration
@ComponentScan(value = "${groupId}")
@PropertySource({
"classpath:/application.properties"
})
public class EnvironmentConfig {
} | [
"kgress88@gmail.com"
] | kgress88@gmail.com |
1008e6c898aa0d5320a55db85e9d22a803984f6e | 546c892cad0aa2a680f7eb4fc3d026e392738a3a | /AndroidApp/TEScheduler/TEScheduler/app/src/main/java/com/ericsson/project/tescheduler/Objects/Route.java | d56b503c0ff913f669be9970a7faad48ffb5f568 | [
"MIT"
] | permissive | CityPulse/CityPulse-Tourism-Planner | 4b2275cfd22f4ba4e64f7ec7a62073cab8c6b4c8 | 1ad0b10e2d7e8018f0a58497ebc45be0c9255d80 | refs/heads/master | 2021-01-15T22:03:49.746516 | 2016-07-21T09:50:24 | 2016-07-21T09:50:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package com.ericsson.project.tescheduler.Objects;
import android.util.Log;
import java.util.ArrayList;
public class Route {
private ArrayList<RouteSegment> segmentToPoI;
public Route() {
this.segmentToPoI = new ArrayList<>();
}
public ArrayList<RouteSegment> getSegmentToPoI() {
return segmentToPoI;
}
public RouteSegment getSegmentAt(int index){
return segmentToPoI.get(index);
}
public void setSegmentToPoI(ArrayList<RouteSegment> segmentToPoI) {
this.segmentToPoI = segmentToPoI;
}
public void printValues(){
Log.w(AppData.LOG_TAG, "Printing the Segments: ");
for(int i=0; i<segmentToPoI.size(); i++){
Log.w(AppData.LOG_TAG, "=========Segment" + i + "=========");
segmentToPoI.get(i).printValues();
}
}
}
| [
"i.garara@gmail.com"
] | i.garara@gmail.com |
47e6be9d3e49a11f0eb22a7a86fc14e574f03439 | 6e3292ec5001d464d956d74678f05ada050f9968 | /PriorityQueue.java | c0da71cb5baf735cc44748e5efc72dc4f396375d | [] | no_license | Yuqiwu/Jojo | 2ea0e9c46e243b1a2517c463a38d81a9adad70fe | 9099119b23e07984af856de23c6f31ab860dc647 | refs/heads/master | 2021-01-19T22:47:55.915017 | 2017-04-25T02:51:47 | 2017-04-25T02:51:47 | 88,872,355 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 120 | java | public interface PriorityQueue<T>{
void add (T x);
boolean isEmpty();
T peekMin();
T removeMin();
}
| [
"mwong8@stuy.edu"
] | mwong8@stuy.edu |
c25a18429916c242378e786e86a826d8cf8b3761 | 653ee1e900e44b96ebc9cd9417cbf2c1eafe723c | /app/src/main/java/com/example/myapplication/MainActivity.java | 4cc66b465a40192824da055e743c088bd08cff37 | [] | no_license | androidRollin/BasicMyApplication | 82e7c7ef403e627e87536d49ddf922055392e009 | d286f2aef03e01ea5f4b005511de5e0c73609477 | refs/heads/master | 2022-12-24T12:56:49.924997 | 2020-10-06T07:57:13 | 2020-10-06T07:57:13 | 301,654,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,210 | java | package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private EditText edtTxtName,edtTxtEmail,edtTxtPassword,edtTxtPassRepeat;
private Button btnPickImage, btnRegister;
private TextView txtWarnName, txtWarnEmail, txtWarnPassword, txtWarnPassRepeat;
private Spinner spinnerCountry;
private RadioGroup rgGender;
private CheckBox cbAgreement;
private ConstraintLayout parent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initViews();
btnPickImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Yet to talk about", Toast.LENGTH_SHORT).show();
}
});
btnRegister.setOnClickListener((new View.OnClickListener() {
@Override
public void onClick(View v) {
initRegister();
}
}));
}
private void initRegister()
{
Log.d(TAG, "initRegister: Started");
if(validateData())
{
if(cbAgreement.isChecked())
{
showSnackBar();
}
else
{
Toast.makeText(this, "You need to agree to the license agreement", Toast.LENGTH_SHORT).show();
}
}
}
private void showSnackBar()
{
Log.d(TAG, "initRegister: Started");
txtWarnName.setVisibility(View.GONE);
txtWarnEmail.setVisibility(View.GONE);
txtWarnPassword.setVisibility(View.GONE);
txtWarnPassRepeat.setVisibility((View.GONE));
String name = edtTxtName.getText().toString();
String email = edtTxtEmail.getText().toString();
String country = spinnerCountry.getSelectedItem().toString();
String gender = "";
switch( rgGender.getCheckedRadioButtonId())
{
case R.id.rbMale:
gender = "Male";
break;
case R.id.rbFemale:
gender = "Female";
break;
case R.id.rbOther:
gender = "Other";
default:
gender = "Unknown";
}
String snackText = "Name32131: " + name + "\n" +
"Email: " + email + "\n" +
"Gender: " + gender + "\n" +
"Country: " + country + "\n" +
"Password: " + edtTxtPassword.getText() + "\n" +
"C-Password: " + edtTxtPassRepeat.getText();
Log.d(TAG, "showSnackBar: Snack Bar Text: " + snackText );
Snackbar.make(parent, snackText,Snackbar.LENGTH_SHORT)
.setAction("Dismiss", new View.OnClickListener() {
@Override
public void onClick(View v) {
edtTxtName.setText("");
edtTxtEmail.setText("");
edtTxtPassword.setText("");
edtTxtPassword.setText("");
edtTxtPassRepeat.setText("");
cbAgreement.setChecked(false);
}
}).show();
}
private boolean validateData ()
{
boolean error1,error2,error3,error4,error5;
error1 = error2 = error3 = error4 = error5 = false;
Log.d(TAG, "validateData: started");
if(edtTxtName.getText().toString().equals(""))
{
txtWarnName.setVisibility(View.VISIBLE);
txtWarnName.setText("Enter your name");
error1 = true;
}
if(edtTxtEmail.getText().toString().equals(""))
{
txtWarnEmail.setVisibility(View.VISIBLE);
txtWarnEmail.setText("Enter your email");
error2 = true;
}
if(edtTxtPassword.getText().toString().equals(""))
{
txtWarnPassword.setVisibility(View.VISIBLE);
txtWarnPassword.setText("Enter your password");
error3 = true;
}
if(edtTxtPassRepeat.getText().toString().equals(""))
{
txtWarnPassRepeat.setVisibility(View.VISIBLE);
txtWarnPassRepeat.setText("Enter re-entered password");
error4 = true;
}
if(!edtTxtPassword.getText().toString().equals(edtTxtPassRepeat.getText().toString())) {
txtWarnPassRepeat.setVisibility(View.VISIBLE);
txtWarnPassRepeat.setText("Password and re-entered password are not the same");
error5 = true;
}
if(error1 == true || error2 == true || error3 == true || error4 == true || error5 == true)
return false;
else
return true;
}
private void initViews() {
Log.d(TAG, "initViews Started");
edtTxtName =findViewById(R.id.edtTxtName);
edtTxtEmail = findViewById(R.id.edtTxtEmail);
edtTxtPassword = findViewById(R.id.edtTxtPassword);
edtTxtPassRepeat = findViewById(R.id.edtTxtPassRepeat);
btnPickImage = findViewById(R.id.btnPickImage);
btnRegister = findViewById(R.id.btnRegister);
txtWarnName = findViewById(R.id.txtWarnName);
txtWarnEmail = findViewById(R.id.txtWarnEmail);
txtWarnPassword = findViewById(R.id.txtWarnPassword);
txtWarnPassRepeat =findViewById(R.id.txtWarnRepeatPass);
spinnerCountry = findViewById(R.id.spinnerCountry);
rgGender = findViewById(R.id.rgGender);
cbAgreement = findViewById(R.id.cbAgreement);
parent = findViewById(R.id.parent);
}
} | [
"69499178+androidRollin@users.noreply.github.com"
] | 69499178+androidRollin@users.noreply.github.com |
55f20cb551a72edb835f325d4b6f1dd66da105ce | f5a66dcc8c2cdbf18695d2ecebd0cc194194ce96 | /src/Line.java | 383a78f2995cd881ee7ce0b50cc5f982c92bdf9b | [] | no_license | beniamin-benek/zadanie-java-47 | 9f942248b158cf68e44933fad161f15c9cc20c3f | fd3141e68ae1d665365d8e6b07cdbb8160dce974 | refs/heads/master | 2020-04-17T23:37:59.955229 | 2019-01-23T19:03:21 | 2019-01-23T19:03:21 | 167,043,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | class Line {
private Point start;
private Point end;
public Line(Point start, Point end) {
this.start = start;
this.end = end;
}
public Point getStart() {
return start;
}
public Point getEnd() {
return end;
}
} | [
"ben.lyzn@wp.pl"
] | ben.lyzn@wp.pl |
fc795e241c1b4d3f5821a27563666eed3ec69267 | 4fb13240c34e9373696e17c5ac601d206bf3c9e1 | /discovery-server/src/main/java/com/mithuns/cloud/discovery/DiscoveryServerApplication.java | 3d99b80127bb6890f4737fb47e5f9909ff7a8898 | [] | no_license | infomithun/spring-cloud-micro-services | ad993dc5e73c78356dea0c90b9c551169c66e190 | 09bcac61887f7c9122be982134e4654fc448b6c8 | refs/heads/main | 2023-08-22T23:42:07.063257 | 2021-10-31T16:10:46 | 2021-10-31T16:10:46 | 420,743,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.mithuns.cloud.discovery;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class DiscoveryServerApplication {
public static void main(String[] args) {
SpringApplication.run(DiscoveryServerApplication.class, args);
}
}
| [
"info.mithun@gmail.com"
] | info.mithun@gmail.com |
386cb90c634d01dfa559f8b2f443a0dcc54e9084 | ce20cea5055b975fa7df8a12d882fa08e1731444 | /MyApp/gen/com/example/myapp/R.java | f3f851bfa816aacdcc9b078b4d02656082f12783 | [] | no_license | ivan-i1/MobileApp | 8a58d03eb6b43148d76149ff1af3240d8535de3b | fc971738479151ff0b6939277aba7aaafc784037 | refs/heads/master | 2016-09-10T17:03:56.704297 | 2014-05-17T22:45:37 | 2014-05-17T22:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,206 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.myapp;
public final class R {
public static final class array {
public static final int Array=0x7f070000;
}
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f050000;
public static final int activity_vertical_margin=0x7f050001;
}
public static final class drawable {
public static final int batman=0x7f020000;
public static final int ic_launcher=0x7f020001;
public static final int red=0x7f020002;
public static final int robin=0x7f020003;
}
public static final class id {
public static final int action_settings=0x7f0a001a;
public static final int button1=0x7f0a000e;
public static final int button2=0x7f0a000f;
public static final int button3=0x7f0a0010;
public static final int button4=0x7f0a0011;
public static final int button5=0x7f0a0014;
public static final int button6=0x7f0a0015;
public static final int exit_button=0x7f0a000c;
public static final int exit_menu=0x7f0a0016;
public static final int highscore=0x7f0a000a;
public static final int imExit=0x7f0a0006;
public static final int imMusic=0x7f0a0007;
public static final int imSound=0x7f0a0008;
public static final int imageButton=0x7f0a0019;
public static final int imageButton1=0x7f0a0000;
public static final int imageButton2=0x7f0a0001;
public static final int imageButton3=0x7f0a0002;
public static final int imageButton4=0x7f0a0003;
public static final int imageButton5=0x7f0a0004;
public static final int imageButton6=0x7f0a0005;
public static final int image_menu=0x7f0a0018;
public static final int music=0x7f0a000b;
public static final int music_label=0x7f0a0012;
public static final int numbers_menu=0x7f0a0017;
public static final int score=0x7f0a0009;
public static final int sound=0x7f0a000d;
public static final int sound_label=0x7f0a0013;
}
public static final class layout {
public static final int activity_image=0x7f030000;
public static final int activity_main=0x7f030001;
public static final int activity_menu=0x7f030002;
}
public static final class menu {
public static final int main=0x7f090000;
}
public static final class raw {
public static final int batman=0x7f040000;
public static final int red=0x7f040001;
public static final int robin=0x7f040002;
public static final int sakura=0x7f040003;
public static final int secret=0x7f040004;
public static final int step=0x7f040005;
}
public static final class string {
public static final int Value1=0x7f06000a;
public static final int Value2=0x7f06000b;
public static final int Value3=0x7f06000c;
public static final int Value4=0x7f06000d;
public static final int Value5=0x7f06000e;
public static final int Value6=0x7f06000f;
public static final int action_settings=0x7f060001;
public static final int app_name=0x7f060000;
public static final int exit_button=0x7f060004;
public static final int highscore=0x7f060005;
public static final int image_button=0x7f060008;
public static final int music=0x7f060002;
public static final int numbers_button=0x7f060009;
public static final int score=0x7f060006;
public static final int secret=0x7f060007;
public static final int sound=0x7f060003;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f080000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f080001;
}
}
| [
"ivan_i1@hotmail.com"
] | ivan_i1@hotmail.com |
49194c8e760f6eaaac2c65a2f95439a590e934f4 | 3f19e31ce4e87f8faf5e9c339a9cf3048ded2a22 | /src/server/GetKeyHandler.java | 4dbbfac7ec2a3fce8120ba9030313abbba828bdc | [
"MIT"
] | permissive | buttercrab/solvegarage-java-server | fac6005dd633910ef97cad560cafaa9ee2e0d984 | 35155d375dbb04de31f70dbab68a95981b06dd1b | refs/heads/master | 2020-06-05T04:16:29.674787 | 2020-02-08T02:52:26 | 2020-02-08T02:52:26 | 192,310,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | package server;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import util.Util;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
public class GetKeyHandler implements HttpHandler {
/**
* Sends a server's public RSA key to use.
*
* @param exchange http exchange object
* @throws IOException when something goes wrong
*/
@Override
public void handle(HttpExchange exchange) throws IOException {
if (exchange.getRequestMethod().equals("GET")) {
if (Server.debugLevel >= 2) {
Util.log("server", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) +
" /get-key GET 200", Commands.LOG);
}
exchange.sendResponseHeaders(200, Server.publicKey.length());
OutputStream os = exchange.getResponseBody();
os.write(Server.publicKey.getBytes());
os.close();
}
}
}
| [
"jaeyong0201@gmail.com"
] | jaeyong0201@gmail.com |
d4b05ee549b0fe4f49b787bc5dfa2584b9812a4b | ffee806fd1d85577c1f23a2e16e69a7723311a07 | /src/main/java/javahive/util/Runner.java | d1baa55c08598e38c1d317a17f02190d46fe4eaa | [] | no_license | lukasz-winiarczyk/Silnia_ | febfcf72b1e9446c55af3102aee330d18cca51a8 | 9b14bdbfde93f98f5f8a1dbe176b1d1eb798831f | refs/heads/master | 2016-08-04T11:31:16.690550 | 2014-03-25T16:31:00 | 2014-03-25T16:31:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package javahive.util;
/**
* @author Marcin Grabowiecki zlicza czas wykonania kodu
*/
public abstract class Runner<T>{
private long start=System.nanoTime();
public abstract T run();
public long getCzasWykonania(){
this.run();
return System.nanoTime()-start;
};
}
| [
"lk.winiarczyk@gmail.com"
] | lk.winiarczyk@gmail.com |
b6e4263258782d9d5d47b2fd96792fe2b186690c | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project47/src/main/java/org/gradle/test/performance47_2/Production47_158.java | 189358fc9c627ef1250f401905dc3268e76edd96 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance47_2;
public class Production47_158 extends org.gradle.test.performance14_2.Production14_158 {
private final String property;
public Production47_158() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
7b3ce4a3cb1bf70056fa26a82f4c64ea2a882068 | 6a464ee1f58740cb1e23d348e807ebd2915d6860 | /src/main/java/ru/javarush/task/controller/IndexController.java | 9dda0d92b74a37426d5dc3b51ba1a1561b88cd81 | [] | no_license | niitp/javarush_study | 3341da8b7d83bd59a4236f354696d6333c77cff0 | 2a608bffdd9be030c946f68d55fe41d64f10b93f | refs/heads/master | 2020-12-24T19:04:32.283108 | 2016-05-24T09:13:30 | 2016-05-24T09:13:30 | 59,557,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package ru.javarush.task.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/")
public class IndexController {
@RequestMapping(method = RequestMethod.GET)
public String getIndexPage() {
return "UserManagement";
}
} | [
"romec87@mail.ru"
] | romec87@mail.ru |
850ed3bad143172194a720dd8d395c17fbd2b39c | 39826de22712bd79a8e37dc6d01662baad3085db | /app/src/main/java/com/devmc/spotlisty/GeneratedFromGenreActivity.java | ab95ae9a4345a91f32303b9dc0370024222c3529 | [] | no_license | Aemack/Android-Spotlisty-App | b52317b2b45ac628adf8a85ac424efc0323b39fc | 6ba9f57f7c8931d6e3246302ba09c5d2e19e6d8d | refs/heads/main | 2023-01-14T09:32:09.255454 | 2020-11-16T09:33:38 | 2020-11-16T09:33:38 | 311,652,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,888 | java | package com.devmc.spotlisty;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.devmc.spotlisty.Connectors.GenerateFromGenresService;
import com.devmc.spotlisty.Connectors.GenerateFromTracksService;
import com.devmc.spotlisty.Model.Song;
import java.util.ArrayList;
import java.util.Random;
public class GeneratedFromGenreActivity extends Activity {
private RecyclerView recyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager layoutManager;
private GenerateFromGenresService generateFromGenresService;
private Song song;
private ArrayList<Song> tracks;
private String genreSeed;
private String trackUris;
private EditText editPlaylistName;
//Generate Button
private Button regenerateButton;
private Button saveButton;
//Nav Buttons
private Button userPlaylistsBtn;
private Button genresBtn;
private Button generateBtn;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.generated_from_genre_activity);
recyclerView = findViewById(R.id.generated_from_genre_recycler);
Bundle extras = getIntent().getExtras();
if (extras != null){
genreSeed = extras.getString("genreSeed");
}
generateFromGenresService = new GenerateFromGenresService(getApplicationContext());
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
getTracks();
//Nav Buttons
generateBtn = (Button) findViewById(R.id.generate_button);
generateBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(GeneratedFromGenreActivity.this, GenerateFromRecentActivity.class));
}
});
genresBtn = (Button) findViewById(R.id.genres_button);
genresBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(GeneratedFromGenreActivity.this, GenresActivity.class));
}
});
userPlaylistsBtn = (Button) findViewById(R.id.your_playlist_button);
userPlaylistsBtn.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(GeneratedFromGenreActivity.this, PlaylistsActivity.class));
}
});
regenerateButton = findViewById(R.id.regenerate_playlist_from_genre_button);
regenerateButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent i = new Intent(v.getContext(), GeneratedFromGenreActivity.class);
i.putExtra("genreSeed",genreSeed);
startActivity(i);
}
});
editPlaylistName = findViewById(R.id.editGenrePlaylistTitle);
saveButton = findViewById(R.id.save_playlist_from_genre_button);
saveButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
String playlistName = editPlaylistName.getText().toString();
trackUris = getAllTrackUris();
Intent i = new Intent(v.getContext(), SavePlaylistActivity.class);
i.putExtra("trackUris",trackUris);
i.putExtra("playlistName",playlistName);
startActivity(i);
}
});
}
private String getAllTrackUris(){
String uriString = "";
int iter = 0;
for (Song track : tracks) {
if (iter == 0){
//spotify:track:4iEOVEULZRvmzYSZY2ViKN
uriString = "spotify:track:"+track.getId();
} else {
uriString =uriString+",spotify:track:"+track.getId();
}
iter ++;
}
return uriString;
}
//Get tracks from playlistTracksService
private void getTracks(){
generateFromGenresService.setGenreSeed(genreSeed);
generateFromGenresService.getTracks(() -> {
tracks = generateFromGenresService.getTracks();
//Call to update playlists
updateTracks();
});
}
private void updateTracks(){
// Creates adapter, passing in user playlists
mAdapter = new TracksAdapter(tracks);
// Sets adapter on recycle view
recyclerView.setAdapter(mAdapter);
}
}
| [
"adam_mcgrane@msn.com"
] | adam_mcgrane@msn.com |
dba92065fe2e769a380b3430d93d356aca464218 | f37b706b1622f9846486967376edd4f9ffb6ca47 | /src/test/java/Testcases/Gradients_bg_test.java | 8b117205ce5527d78824a8ffa817f607e9de518e | [] | no_license | Aqsab991/Triual_two | 061cb9d99d828c4f1d9e5e3d142c1b737cf25f24 | 181a34c29d254b8be53d01889450b05cfe2dfdcc | refs/heads/main | 2023-07-16T03:09:50.720755 | 2021-09-09T06:33:09 | 2021-09-09T06:33:09 | 404,598,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,099 | java | package Testcases;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.applitools.eyes.MatchLevel;
import com.applitools.eyes.selenium.Eyes;
import Baseclass.baseclasstwo;
import java.time.Duration;
import java.util.List;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import io.appium.java_client.MobileBy;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.PointOption;
import pageobjects.Crop_view;
import pageobjects.Magazine_pageobject;
import pageobjects.gradient_pg;
public class Gradients_bg_test extends baseclasstwo{
@BeforeClass
public void auto_set_up() throws InterruptedException
{
eyes = new Eyes();
//Set API Key of Eyes
eyes.setApiKey("XFwgHiQ104nHxkVwl8OL8101bIaMfLnGIkL8p3DPgfFcSvQ110");
//Set Match Level
eyes.setMatchLevel(MatchLevel.STRICT);
//Set host operating System as our device
eyes.setHostOS(DEVICE);
// return driver;
eyes.open(driver, APP_NAME, TEST_NAME);
System.out.println("Eyes open");
}
@Test
public void A_Testcase1() throws InterruptedException {
//Thread.sleep(10000);
gradient_pg element2= new gradient_pg((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
//com.vyroai.AutoCutCut:id/thumbnailIV
for(int i=0;i<7;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement secondElement=e.get(1);
AndroidElement thirdElement=e.get(2);
AndroidElement fourthElement=e.get(3);
AndroidElement fifthElement=e.get(4);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
System.out.println(fromXLocation +" fromXLocation");
System.out.println(fromXLocation*1 +" fromXLocation");
System.out.println(fromXLocation+1000 +" fromXLocation");
System.out.println(midOfY+" mid of y");
System.out.println(midOfY*2+" mid of y");
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(i +" scroll done");
if(i==6) {
for(int j=0;j<3;j++) {
bg_options.get(j+2).click();
eyes.checkWindow("Bg "+j+" in Gradients cat");
}
}
else {
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==1&&i==0) {
Thread.sleep(5000);}
else {
System.out.println("Don't wait");
}
eyes.checkWindow("Bg "+j+" in "+i+" set of Gradients cat");
}
}
System.out.println("i="+i);
}
}
@Test
public void B_Testcase2() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
// gradient_pg element2= new gradient_pg((AndroidDriver) driver);
List<MobileElement> categories=element2.categories;
categories.get(2).click();
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(10000);}
else {
System.out.println("Don't wait");
}
eyes.checkWindow("Bg "+j+" in Magazine Cat");
}
for(int i=0;i<2;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement secondElement=e.get(1);
AndroidElement thirdElement=e.get(2);
AndroidElement fourthElement=e.get(3);
AndroidElement fifthElement=e.get(4);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(i +" scroll done");
if(i==1) {
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+"in "+i+" set Magazine Cat");
}
}
else {
for(int j=0;j<3;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+"in "+i+" set Magazine Cat");
}
}
System.out.println("i="+i);
}
}
@Test
public void C_Testcase3() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
// gradient_pg element2= new gradient_pg((AndroidDriver) driver);
List<MobileElement> categories=element2.categories;
categories.get(3).click();
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(10000);}
else {
System.out.println("Don't wait");
}
eyes.checkWindow("Bg "+j+" in Neon cat");
}
for(int i=0;i<1;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement secondElement=e.get(1);
AndroidElement thirdElement=e.get(2);
AndroidElement fourthElement=e.get(3);
AndroidElement fifthElement=e.get(4);
int midOfY =fifthElement.getLocation().y +(fifthElement.getSize().height/2);
int fromXLocation=fifthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(i +" scroll done");
for(int j=0;j<5;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+" in 2nd set of neon cat");
}
System.out.println("i="+i);
}
}
@Test
public void D_Testcase4() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
// gradient_pg element2= new gradient_pg((AndroidDriver) driver);
List<MobileElement> categories=element2.categories;
categories.get(4).click();
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(10000);}
else {
System.out.println("Don't wait");
}
eyes.checkWindow("Bg "+j+" in Qoutes cat");
}
for(int i=0;i<2;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement secondElement=e.get(1);
AndroidElement thirdElement=e.get(2);
AndroidElement fourthElement=e.get(3);
AndroidElement fifthElement=e.get(4);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(i +" scroll done");
if(i==1) {
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+"in "+i+" set of Qoutes cat");
}
}
else {
for(int j=0;j<3;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+"in "+i+" set of Qoutes cat");
}
}
System.out.println("i="+i);
}
}
@Test
public void E_Testcase5() throws InterruptedException {
// Thread.sleep(10000);
System.out.println("TC 1 started executing");
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
// gradient_pg element2= new gradient_pg((AndroidDriver) driver);
List<MobileElement> categories=element2.categories;
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/categoryTV\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
// AndroidElement fifthElement=e.get(4);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
MobileElement recording=(MobileElement) element2.recording;
recording.click();
System.out.println("Recording cat being selected");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg in "+j+" Recording cat ");
}
/* Thread.sleep(10000);
List<AndroidElement> e1=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement1=e1.get(0);
AndroidElement secondElement1=e1.get(1);
AndroidElement thirdElement1=e1.get(2);
AndroidElement fourthElement1=e1.get(3);
AndroidElement fifthElement1=e1.get(4);
int midOfY1 =fourthElement1.getLocation().y +(fourthElement1.getSize().height/2);
int fromXLocation1=fourthElement1.getLocation().x;
int toXLocation1=firdelement1.getLocation().x;
TouchAction action1 =new TouchAction(driver);
action1.press(PointOption.point(fromXLocation1, midOfY1))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation1, midOfY1))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
// eyes.checkWindow("Bg "+j+"in 2nd set Screen");
}
}*/
}
@Test
public void F_Testcase6() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> categories=element2.categories;
List<MobileElement> bg_options=element2.gradient_option;
MobileElement Frames=(MobileElement) element2.Frames;
Frames.click();
System.out.println("Frames cat being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Frames cat");
}
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+" in 2nd set of Frames cat");
}
}
@Test
public void G_Testcase7() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
// List<MobileElement> categories=element2.categories;
List<MobileElement> bg_options=element2.gradient_option;
MobileElement stroke=(MobileElement) element2.Stroke;
stroke.click();
System.out.println("Stroke cat being selected");
for(int j=0;j<5;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(15000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Stroke cat");
}
/* List<AndroidElement> e1=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement fe=e1.get(0);
AndroidElement foue=e1.get(3);
int middleofY =foue.getLocation().y +(foue.getSize().height/2);
int fromX=foue.getLocation().x;
int toXn=fe.getLocation().x;
TouchAction action1 =new TouchAction(driver);
action1.press(PointOption.point(fromX+60, middleofY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXn, middleofY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<2;j++) {
bg_options.get(j+3).click();
// eyes.checkWindow("Bg "+j+"in "+i+"2nd set Screen");
}
*/
}
@Test
public void H_Testcase8() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement space=(MobileElement) element2.Space;
space.click();
System.out.println("Space Cat being selected");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(15000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Space Cat");
}
for(int i=0;i<1;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fifthElement=e.get(4);
int midOfY =fifthElement.getLocation().y +(fifthElement.getSize().height/2);
int fromXLocation=fifthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+" in 2nd set of Space Cat");
}
}
}
@Test
public void I_Testcase9() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement wall=(MobileElement) element2.Walls;
wall.click();
System.out.println("Wall Cat being selected");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg in Wall Cat");
}
for(int i=0;i<1;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fifthElement=e.get(4);
int midOfY =fifthElement.getLocation().y +(fifthElement.getSize().height/3);
int fromXLocation=fifthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+" in 2nd set of Wall Cat");
}
}
}
@Test
public void J_Testcase10() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement creative=(MobileElement) element2.Creative;
creative.click();
System.out.println("Creative Cat being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Creative Cat");
}
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<3;j++) {
bg_options.get(j+2).click();
eyes.checkWindow("Bg "+j+" in 2nd set of Creative Cat");
}
}
@Test
public void K_Testcase11() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement graffiti=(MobileElement) element2.Graffiti;
graffiti.click();
System.out.println("Grafitti Cat being selected");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(12000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Grafitti Cat");
}
for(int i=0;i<1;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
AndroidElement fifthElement=e.get(4);
int midOfY =fifthElement.getLocation().y +(fifthElement.getSize().height/3);
int fromXLocation=fifthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+" in 2nd set Grafitti Cat");
}
}
}
@Test
public void L_Testcase12() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
List<AndroidElement> e1=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/categoryTV\")"));
AndroidElement firdelement1=e1.get(0);
AndroidElement fourthElement1=e1.get(3);
// AndroidElement fifthElement=e.get(4);
int midOfY1 =fourthElement1.getLocation().y +(fourthElement1.getSize().height/2);
int fromXLocation1=fourthElement1.getLocation().x;
int toXLocation1=firdelement1.getLocation().x;
TouchAction action1 =new TouchAction(driver);
action1.press(PointOption.point(fromXLocation1, midOfY1))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation1, midOfY1))
.release()
.perform();
MobileElement texture=(MobileElement) element2.texture_cat;
texture.click();
System.out.println("Texture Cat being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(10000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Texture Cat");
}
for(int i=0;i<3;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
if(i==2) {
for(int j=0;j<3;j++) {
bg_options.get(j+2).click();
eyes.checkWindow("Bg "+j+" in "+i+"set of Texture Cat");
}
}
else
for(int j=0;j<3;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+"in "+i+"set of Texture Cat");
}
}
}
@Test
public void M_Testcase13() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement splitup=(MobileElement) element2.SplitUp;
splitup.click();
System.out.println("Split Up Cat being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Split Up Cat");
}
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+" in 2nd set of Split Up Cat");
}
}
@Test
public void N_Testcase14() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement drip=(MobileElement) element2.Drip;
drip.click();
System.out.println("Drip Cat being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Drip Cat");
}
for(int i=0;i<2;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
if(i==1) {
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg "+j+" in "+i+" set Screen of Drip Cat");
}
}
else {
for(int j=0;j<3;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+" in "+i+" set Screen of Drip Cat");
}
}
}
}
@Test
public void O_Testcase15() throws InterruptedException {
System.out.println("TC 2 started executing");
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
// gradient_pg element2= new gradient_pg((AndroidDriver) driver);
MobileElement wall=(MobileElement) element2.Wall;
wall.click();
System.out.println("Wall cat being selected");
for(int j=0;j<5;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Wall cat");
}
}
@Test
public void P_Testcase16() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
/* List<AndroidElement> e1=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/categoryTV\")"));
AndroidElement firdelement1=e1.get(0);
AndroidElement secondElement1=e1.get(1);
AndroidElement thirdElement1=e1.get(2);
AndroidElement fourthElement1=e1.get(3);
// AndroidElement fifthElement=e.get(4);
int midOfY1 =fourthElement1.getLocation().y +(fourthElement1.getSize().height/3);
int fromXLocation1=fourthElement1.getLocation().x;
int toXLocation1=firdelement1.getLocation().x;
TouchAction action1 =new TouchAction(driver);
action1.press(PointOption.point(fromXLocation1, midOfY1))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation1, midOfY1))
.release()
.perform();*/
MobileElement Newspaper_cat=(MobileElement) element2.Newspaper_cat;
Newspaper_cat.click();
System.out.println("Newspaper Cat being selected");
for(int j=0;j<5;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(5000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Newspaper Cat");
}
}
@Test
public void Q_Testcase17() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement solid=(MobileElement) element2.Solid;
solid.click();
System.out.println("Solid Cat being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(20000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Solid Cat");
}
for(int i=0;i<5;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
if(i==4) {
for(int j=0;j<5;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+" in "+i+" set of Solid Cat");
}
}
else {
for(int j=0;j<3;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+" in "+i+" set of Solid Cat");
}
}
}
}
@Test
public void R_Testcase18() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement cloud=(MobileElement) element2.cloud;
cloud.click();
System.out.println("Clouds Cat being selected");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(15000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Clouds Cat");
}
for(int i=0;i<1;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fifthElement=e.get(4);
int midOfY =fifthElement.getLocation().y +(fifthElement.getSize().height/2);
int fromXLocation=fifthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg"+j+" in 2nd set of Clouds Cat");
}
}
}
@Test
public void S_Testcase19() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement colorcombo_cat=(MobileElement) element2.colorcombo_cat;
colorcombo_cat.click();
System.out.println("ColorCombo Cat being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in ColorCombo Cat");
}
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
for(int j=0;j<4;j++) {
bg_options.get(j+1).click();
eyes.checkWindow("Bg"+j+" in 2nd set of ColorCombo Cat");
}
}
@Test
public void T_Testcase20() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement window=(MobileElement) element2.window;
window.click();
System.out.println("Window being selected");
for(int j=0;j<3;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(10000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Window");
}
for(int i=0;i<2;i++) {
List<AndroidElement> e=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.vyroai.AutoCutCut:id/downloadLay\")"));
AndroidElement firdelement=e.get(0);
AndroidElement fourthElement=e.get(3);
int midOfY =fourthElement.getLocation().y +(fourthElement.getSize().height/2);
int fromXLocation=fourthElement.getLocation().x;
int toXLocation=firdelement.getLocation().x;
TouchAction action =new TouchAction(driver);
action.press(PointOption.point(fromXLocation+60, midOfY))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3)))
.moveTo(PointOption.point(toXLocation, midOfY))
.release()
.perform();
System.out.println(" scroll done");
if(i==1) {
for(int j=0;j<3;j++) {
bg_options.get(j+2).click();
eyes.checkWindow("Bg "+j+" in "+i+" set of Window");
}
}
else {
for(int j=0;j<4;j++) {
bg_options.get(j).click();
eyes.checkWindow("Bg "+j+" in "+i+" set of Window");
}
}
}
}
@Test
public void U_Testcase21() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement painting_cat=(MobileElement) element2.painting_cat;
painting_cat.click();
System.out.println("Painting Cat being selected");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Painting Cat");
}
}
@Test
public void V_Testcase22() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement Papertorn=(MobileElement) element2.papertorn_cat;
Papertorn.click();
System.out.println("Papertorn Cat being selected");
for(int j=0;j<5;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Papertorn Cat");
}
}
@Test
public void W_Testcase23() throws InterruptedException {
Magazine_pageobject element2= new Magazine_pageobject((AndroidDriver) driver);
List<MobileElement> bg_options=element2.gradient_option;
MobileElement text=(MobileElement) element2.text_cat;
text.click();
System.out.println("Text Cat being selected");
for(int j=0;j<4;j++) {
bg_options.get(j).click();
if(j==0) {
Thread.sleep(7000);}
else {
System.out.println("Don't wait");
}
System.out.println(" bg being selected");
eyes.checkWindow("Bg "+j+" in Text Cat");
}
}
@AfterClass
public void teardown() {
eyes.close();
System.out.println("closed window");
//Abort eyes if it is not closed
eyes.abortIfNotClosed();
}
}
| [
"aqsa@Vyro-MacBook.local"
] | aqsa@Vyro-MacBook.local |
e5e7812698f0712349d5d1e9f34dd149b05057a4 | 98bfbb9c0d0dc614eb624b69e7e17f67fced0933 | /proposals/system-test/sample-apps/everything-app/src/test/java/org/eclipse/microprofile/system/test/app/BasicJAXRSServiceTest.java | 44c831a3e74c01442465109f5b08b478b359d3ee | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | eclipse/microprofile-sandbox | f3ac9cdb3814f049526eba6af2ecef5a29c0eb42 | 6ff385401d3e804824fd77df0e2febcebdcf5ad7 | refs/heads/main | 2023-09-06T08:39:36.302945 | 2023-07-13T13:42:02 | 2023-07-13T13:42:02 | 93,201,544 | 43 | 47 | Apache-2.0 | 2023-07-06T14:25:17 | 2017-06-02T20:30:35 | Java | UTF-8 | Java | false | false | 4,459 | java | /*
* Copyright (c) 2019 IBM Corporation and others
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eclipse.microprofile.system.test.app;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Collection;
import javax.inject.Inject;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.NotFoundException;
import org.eclipse.microprofile.system.test.jupiter.MicroProfileTest;
import org.eclipse.microprofile.system.test.jupiter.SharedContainerConfig;
import org.junit.jupiter.api.Test;
@MicroProfileTest
@SharedContainerConfig(AppContainerConfig.class)
public class BasicJAXRSServiceTest {
@Inject
public static PersonService personSvc;
@Test
public void testCreatePerson() {
Long createId = personSvc.createPerson("Hank", 42);
assertNotNull(createId);
}
@Test
public void testMinSizeName() {
Long minSizeNameId = personSvc.createPerson("Ha", 42);
assertEquals(new Person("Ha", 42, minSizeNameId),
personSvc.getPerson(minSizeNameId));
}
@Test
public void testMinAge() {
Long minAgeId = personSvc.createPerson("Newborn", 0);
assertEquals(new Person("Newborn", 0, minAgeId),
personSvc.getPerson(minAgeId));
}
@Test
public void testGetPerson() {
Long bobId = personSvc.createPerson("Bob", 24);
Person bob = personSvc.getPerson(bobId);
assertEquals("Bob", bob.name);
assertEquals(24, bob.age);
assertNotNull(bob.id);
}
@Test
public void testGetAllPeople() {
Long person1Id = personSvc.createPerson("Person1", 1);
Long person2Id = personSvc.createPerson("Person2", 2);
Person expected1 = new Person("Person1", 1, person1Id);
Person expected2 = new Person("Person2", 2, person2Id);
Collection<Person> allPeople = personSvc.getAllPeople();
assertTrue("Expected at least 2 people to be registered, but there were only: " + allPeople,
allPeople.size() >= 2);
assertTrue("Did not find person " + expected1 + " in all people: " + allPeople,
allPeople.contains(expected1));
assertTrue("Did not find person " + expected2 + " in all people: " + allPeople,
allPeople.contains(expected2));
}
@Test
public void testUpdateAge() {
Long personId = personSvc.createPerson("newAgePerson", 1);
Person originalPerson = personSvc.getPerson(personId);
assertEquals("newAgePerson", originalPerson.name);
assertEquals(1, originalPerson.age);
assertEquals(personId, Long.valueOf(originalPerson.id));
personSvc.updatePerson(personId, new Person(originalPerson.name, 2, originalPerson.id));
Person updatedPerson = personSvc.getPerson(personId);
assertEquals("newAgePerson", updatedPerson.name);
assertEquals(2, updatedPerson.age);
assertEquals(personId, Long.valueOf(updatedPerson.id));
}
@Test
public void testGetUnknownPerson() {
assertThrows(NotFoundException.class, () -> personSvc.getPerson(-1L));
}
@Test
public void testCreateBadPersonNullName() {
assertThrows(BadRequestException.class, () -> personSvc.createPerson(null, 5));
}
@Test
public void testCreateBadPersonNegativeAge() {
assertThrows(BadRequestException.class, () -> personSvc.createPerson("NegativeAgePersoN", -1));
}
@Test
public void testCreateBadPersonNameTooLong() {
assertThrows(BadRequestException.class, () -> personSvc.createPerson("NameTooLongPersonNameTooLongPersonNameTooLongPerson", 5));
}
} | [
"andy.guibert@gmail.com"
] | andy.guibert@gmail.com |
b32493487f946c293be83f444d40ef281ea29c39 | f409a66d807491c451cccced74ecdf61cd6dbdd8 | /app/util/jpaUtil/Query.java | 5ee511c40553e2273cc30ec93a2771b8f3b63fdc | [] | no_license | baozong-gao/ubs-api | 6569a7916fca3e3dc998be1c25f4d7726061470f | 4ca5de0330f68fa3a6c697ab194c09fb8d8ead55 | refs/heads/master | 2021-08-30T13:52:11.696295 | 2017-12-18T06:59:31 | 2017-12-18T06:59:31 | 110,229,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,370 | java | package util.jpaUtil;
import org.apache.log4j.Logger;
import util.BeanUtil;
import javax.persistence.EntityManager;
import javax.persistence.criteria.*;
import javax.persistence.criteria.CriteriaBuilder.In;
import java.io.Serializable;
import java.util.*;
/**
* @Author: gaobaozong
* @Description: jpa ๆฅ่ฏขๅทฅๅ
ท็ฑป๏ผไปฃ็ ๆฅๆบ็ฝ็ป๏ผ
* @Date: Created in 2017/9/26 - 15:24
* @Version: V1.0
*/
@SuppressWarnings({ "unused", "unchecked", "rawtypes", "null", "hiding" })
public class Query implements Serializable {
private static final long serialVersionUID = 5064932771068929342L;
private static Logger log = Logger.getLogger(Query.class);
private EntityManager entityManager;
/** ่ฆๆฅ่ฏข็ๆจกๅๅฏน่ฑก */
private Class clazz;
/** ๆฅ่ฏขๆกไปถๅ่กจ */
private Root from;
private List<Predicate> predicates;
private CriteriaQuery criteriaQuery;
private CriteriaBuilder criteriaBuilder;
/** ๆๅบๆนๅผๅ่กจ */
private List<Order> orders;
/** ๅ
ณ่ๆจกๅผ */
private Map<String, Query> subQuery;
private Map<String, Query> linkQuery;
private String projection;
/** ๆๆกไปถ */
private List<Query> orQuery;
private String groupBy;
private Query() {
}
private Query(Class clazz, EntityManager entityManager) {
this.clazz = clazz;
this.entityManager = entityManager;
this.criteriaBuilder = this.entityManager.getCriteriaBuilder();
this.criteriaQuery = criteriaBuilder.createQuery(this.clazz);
this.from = criteriaQuery.from(this.clazz);
this.predicates = new ArrayList();
this.orders = new ArrayList();
}
/** ้่ฟ็ฑปๅๅปบๆฅ่ฏขๆกไปถ */
public static Query forClass(Class clazz, EntityManager entityManager) {
return new Query(clazz, entityManager);
}
/** ๅขๅ ๅญๆฅ่ฏข */
private void addSubQuery(String propertyName, Query query) {
if (this.subQuery == null)
this.subQuery = new HashMap();
if (query.projection == null)
throw new RuntimeException("ๅญๆฅ่ฏขๅญๆฎตๆช่ฎพ็ฝฎ");
this.subQuery.put(propertyName, query);
}
private void addSubQuery(Query query) {
addSubQuery(query.projection, query);
}
/** ๅขๅ
ณ่ๆฅ่ฏข */
public void addLinkQuery(String propertyName, Query query) {
if (this.linkQuery == null)
this.linkQuery = new HashMap();
this.linkQuery.put(propertyName, query);
}
/** ็ธ็ญ */
public void eq(String propertyName, Object value) {
if (isNullOrEmpty(value))
return;
this.predicates.add(criteriaBuilder.equal(from.get(propertyName), value));
}
private boolean isNullOrEmpty(Object value) {
if (value instanceof String) {
return value == null || "".equals(value);
}
return value == null;
}
public void or(List<String> propertyName, Object value) {
if (isNullOrEmpty(value))
return;
if ((propertyName == null) || (propertyName.size() == 0))
return;
Predicate predicate = criteriaBuilder.or(criteriaBuilder.equal(from.get(propertyName.get(0)), value));
for (int i = 1; i < propertyName.size(); ++i)
predicate = criteriaBuilder.or(predicate, criteriaBuilder.equal(from.get(propertyName.get(i)), value));
this.predicates.add(predicate);
}
public void orLike(List<String> propertyName, String value) {
if (isNullOrEmpty(value) || (propertyName.size() == 0))
return;
if (value.indexOf("%") < 0)
value = "%" + value + "%";
Predicate predicate = criteriaBuilder.or(criteriaBuilder.like(from.get(propertyName.get(0)), value.toString()));
for (int i = 1; i < propertyName.size(); ++i)
predicate = criteriaBuilder.or(predicate, criteriaBuilder.like(from.get(propertyName.get(i)), value));
this.predicates.add(predicate);
}
/** ็ฉบ */
public void isNull(String propertyName) {
this.predicates.add(criteriaBuilder.isNull(from.get(propertyName)));
}
/** ้็ฉบ */
public void isNotNull(String propertyName) {
this.predicates.add(criteriaBuilder.isNotNull(from.get(propertyName)));
}
/** ไธ็ธ็ญ */
public void notEq(String propertyName, Object value) {
if (isNullOrEmpty(value)) {
return;
}
this.predicates.add(criteriaBuilder.notEqual(from.get(propertyName), value));
}
/**
* not in
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param value
* ๅผ้ๅ
*/
public void notIn(String propertyName, Collection value) {
if ((value == null) || (value.size() == 0)) {
return;
}
Iterator iterator = value.iterator();
In in = criteriaBuilder.in(from.get(propertyName));
while (iterator.hasNext()) {
in.value(iterator.next());
}
this.predicates.add(criteriaBuilder.not(in));
}
/**
* ๆจก็ณๅน้
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param value
* ๅฑๆงๅผ
*/
public void like(String propertyName, String value) {
if (isNullOrEmpty(value))
return;
if (value.indexOf("%") < 0)
value = "%" + value + "%";
this.predicates.add(criteriaBuilder.like(from.get(propertyName), value));
}
/**
* ๆถ้ดๅบ้ดๆฅ่ฏข
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param lo
* ๅฑๆง่ตทๅงๅผ
* @param go
* ๅฑๆง็ปๆๅผ
*/
public void between(String propertyName, Date lo, Date go) {
if (!isNullOrEmpty(lo) && !isNullOrEmpty(go)) {
this.predicates.add(criteriaBuilder.between(from.get(propertyName), lo, go));
}
// if (!isNullOrEmpty(lo) && !isNullOrEmpty(go)) {
// this.predicates.add(criteriaBuilder.lessThan(from.get(propertyName),
// new DateTime(lo).toString()));
// }
// if (!isNullOrEmpty(go)) {
// this.predicates.add(criteriaBuilder.greaterThan(from.get(propertyName),
// new DateTime(go).toString()));
// }
}
public void between(String propertyName, String start, String end) {
if (!(isNullOrEmpty(end)))
this.predicates.add(criteriaBuilder.lessThanOrEqualTo(from.get(propertyName).as(String.class),end));
if (!(isNullOrEmpty(start)))
this.predicates.add(criteriaBuilder.greaterThanOrEqualTo(from.get(propertyName).as(String.class),start));
}
public void between(String propertyName, Number lo, Number go) {
if (!(isNullOrEmpty(lo)))
ge(propertyName, lo);
if (!(isNullOrEmpty(go)))
le(propertyName, go);
}
/**
* ๅฐไบ็ญไบ
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param value
* ๅฑๆงๅผ
*/
public void le(String propertyName, Number value) {
if (isNullOrEmpty(value)) {
return;
}
this.predicates.add(criteriaBuilder.le(from.get(propertyName), value));
}
/**
* ๅฐไบ
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param value
* ๅฑๆงๅผ
*/
public void lt(String propertyName, Number value) {
if (isNullOrEmpty(value)) {
return;
}
this.predicates.add(criteriaBuilder.lt(from.get(propertyName), value));
}
/**
* ๅคงไบ็ญไบ
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param value
* ๅฑๆงๅผ
*/
public void ge(String propertyName, Number value) {
if (isNullOrEmpty(value)) {
return;
}
this.predicates.add(criteriaBuilder.ge(from.get(propertyName), value));
}
/**
* ๅคงไบ
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param value
* ๅฑๆงๅผ
*/
public void gt(String propertyName, Number value) {
if (isNullOrEmpty(value)) {
return;
}
this.predicates.add(criteriaBuilder.gt(from.get(propertyName), value));
}
/**
* in
*
* @param propertyName
* ๅฑๆงๅ็งฐ
* @param value
* ๅผ้ๅ
*/
public void in(String propertyName, Collection value) {
if ((value == null) || (value.size() == 0)) {
return;
}
Iterator iterator = value.iterator();
In in = criteriaBuilder.in(from.get(propertyName));
while (iterator.hasNext()) {
in.value(iterator.next());
}
this.predicates.add(in);
}
/** ็ดๆฅๆทปๅ JPAๅ
้จ็ๆฅ่ฏขๆกไปถ,็จไบๅบไปไธไบๅคๆๆฅ่ฏข็ๆ
ๅต,ไพๅฆๆ */
public void addCriterions(Predicate predicate) {
this.predicates.add(predicate);
}
/**
* ๅๅปบๆฅ่ฏขๆกไปถ
*
* @return JPA็ฆป็บฟๆฅ่ฏข
*/
public CriteriaQuery newCriteriaQuery() {
criteriaQuery.where(predicates.toArray(new Predicate[0]));
if (!isNullOrEmpty(groupBy)) {
criteriaQuery.groupBy(from.get(groupBy));
}
if (this.orders != null) {
criteriaQuery.orderBy(orders);
}
addLinkCondition(this);
return criteriaQuery;
}
private void addLinkCondition(Query query) {
Map subQuery = query.linkQuery;
if (subQuery == null)
return;
for (Iterator queryIterator = subQuery.keySet().iterator(); queryIterator.hasNext();) {
String key = (String) queryIterator.next();
Query sub = (Query) subQuery.get(key);
from.join(key);
criteriaQuery.where(sub.predicates.toArray(new Predicate[0]));
addLinkCondition(sub);
}
}
public void addOrder(String propertyName, String order) {
if (order == null || propertyName == null)
return;
if (this.orders == null)
this.orders = new ArrayList();
if (order.equalsIgnoreCase("asc"))
this.orders.add(criteriaBuilder.asc(from.get(propertyName)));
else if (order.equalsIgnoreCase("desc"))
this.orders.add(criteriaBuilder.desc(from.get(propertyName)));
}
public void setOrder(String propertyName, String order) {
this.orders = null;
addOrder(propertyName, order);
}
public Class getModleClass() {
return this.clazz;
}
public String getProjection() {
return this.projection;
}
public void setProjection(String projection) {
this.projection = projection;
}
public Class getClazz() {
return this.clazz;
}
public List<Order> getOrders() {
return orders;
}
public void setOrders(List<Order> orders) {
this.orders = orders;
}
public EntityManager getEntityManager() {
return this.entityManager;
}
public void setEntityManager(EntityManager em) {
this.entityManager = em;
}
public Root getFrom() {
return from;
}
public List<Predicate> getPredicates() {
return predicates;
}
public void setPredicates(List<Predicate> predicates) {
this.predicates = predicates;
}
public CriteriaQuery getCriteriaQuery() {
return criteriaQuery;
}
public CriteriaBuilder getCriteriaBuilder() {
return criteriaBuilder;
}
public void setFetchModes(List<String> fetchField, List<String> fetchMode) {
}
public String getGroupBy() {
return groupBy;
}
public void setGroupBy(String groupBy) {
this.groupBy = groupBy;
}
public void build(Object filed) throws Exception{
Map<String, Object> fieldValue = BeanUtil.beanFiledValue(filed);
fieldValue.keySet().stream().forEach(key ->{
Object value = fieldValue.get(key);
if(value.getClass().isArray()){
String [] values = (String []) value;
this.between(key,values[0],values[1]);
}else{
this.eq(key, value);
}
});
}
}
| [
"gaobaozong@77pay.com.cn"
] | gaobaozong@77pay.com.cn |
0234eadf370f2843ea8b69d1b3a3b4062f612924 | e4ed8068745b06e7c38ff1c6d4b809875546d498 | /src/test/java/FizzBuzzTest.java | 0532bc1acbd0e295dba8c09d15fb2f78d863b521 | [] | no_license | crkubiak/fizzbuzz | 5387d298377591460a06ae037ce9098a82960f04 | 04280b1b6ff64c95ad5551e7469e91608a567251 | refs/heads/master | 2020-05-26T04:30:38.465837 | 2019-05-22T20:25:33 | 2019-05-22T20:25:33 | 188,107,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java |
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class FizzBuzzTest {
@Test
public void of_0is0() {
assertEquals(FizzBuzz.of(0), "0");
}
@Test
public void of_1is1() {
assertEquals(FizzBuzz.of(1), "1");
}
@Test
public void of_3isFizz() {
assertEquals(FizzBuzz.of(3), "Fizz");
}
@Test
public void of_5isBuzz() {
assertEquals(FizzBuzz.of(5), "Buzz");
}
@Test
public void of_6isBuzz() {
assertEquals(FizzBuzz.of(6), "Fizz");
}
@Test
public void of_10isBuzz() {
assertEquals(FizzBuzz.of(10), "Buzz");
}
@Test
public void of_15isBuzz() {
assertEquals(FizzBuzz.of(15), "FizzBuzz");
}
} | [
"crkubiak@Charless-MacBook-Pro.local"
] | crkubiak@Charless-MacBook-Pro.local |
c2bd994f8ef5f9e2b51a86d16313b3a1043c1ae3 | 2bf587aa8a96fc826ba92ca0c867838077cd5ccc | /src/SesameApp/UARTListener.java | a38b57d778a1775613de068d92871cf02d696b7b | [] | no_license | lemzoo/Sesame_Universel | 8d5f395192bd61edf6c0ffc49d69c6a0cc024dfe | 446927330551ae9b7fc158ceaf6403c375730a66 | refs/heads/master | 2021-01-10T08:39:51.964663 | 2016-02-26T20:20:57 | 2016-02-26T20:20:57 | 51,518,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,843 | java | // SESAME
/*
* 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 SesameApp;
import AccesGUI.*;
import HomeGUI.*;
import LinkingGUI.*;
import SharingGUI.*;
import com.pi4j.io.serial.*;
public class UARTListener implements SerialDataListener, ConstantsConfiguration {
SerialPortGPIO uart;
private StringBuffer new_received_data;
private StringBuffer old_received_data;
public UARTListener(SerialPortGPIO uart){
this.uart = uart;
new_received_data = new StringBuffer();
old_received_data = new StringBuffer();
}
@Override
public void dataReceived(SerialDataEvent event) {
if (event.getData() != null && !event.getData().isEmpty()){
// Get the new data and put it in the temp string
String str_new_data = event.getData();
// Replace the "\n" and "\r" by empty char
String str_replace = str_new_data.replace("\n", "").replace("\r", "");
// reset the buffer
resetBufferReception(new_received_data);
new_received_data.insert(0, str_replace);
System.out.println("Received Data = [" + new_received_data.toString() + "]");
/*
* Check if the rattachement flag is true. if the flag is true, copy the RX Data on the table
* to save the information about the Owner of the Sesame.
*/
try {
uart.analyzeDataReceived(new_received_data.toString());
} catch (InterruptedException ex) {}
// Start to write the Owner information in the buffer which allocated
if (uart.getSavingFlag()){
if(new_received_data.toString() == null ? BEGIN != null : !new_received_data.toString().equals(BEGIN)){
uart.setBufferReception(new_received_data.toString());
}
else if (new_received_data.toString() == null ? END != null : new_received_data.toString().equals(END)){
uart.setSavingFlag(false);
}
else{
// Nothing
}
}
else{
// Nothing
}
}
else{
System.out.println("No data available on the GPIO Buffer");
}
}
public String getLastReceivedData(){
String last_data = "";
return last_data;
}
/**
* Methode : resetBufferReception(String data)
*/
private void resetBufferReception (StringBuffer str_buffer){
int len = str_buffer.length();
str_buffer.delete(0, len);
}
} | [
"lemzoba@gmail.com"
] | lemzoba@gmail.com |
98c00a2f07beae5a7072cb1e0c2c6a8d97fe779a | 5bf51189dc25d4f71b7c4593329c80820145abb7 | /src/Persistence/Html.java | 8058772bd7a7cde8fb6f17bbec64739973db2fce | [] | no_license | VitorMascarenhas/LAPR3-2015-2016 | 8bacf8274a9a88f39b410bd789c5bf63c6a3432a | 8b51aa2678d767c949ac71e25235a5ab64c0aac5 | refs/heads/master | 2020-03-19T10:35:39.520690 | 2018-06-06T20:57:15 | 2018-06-06T20:57:15 | 136,384,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,695 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Persistence;
import DataAnalysis.CarPhysics;
import Model.Junction;
import Model.Project;
import Model.Section;
import Model.Segment;
import Model.Vehicle;
import Model.Wind;
import java.awt.Desktop;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Deque;
import java.util.Formatter;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author suq-madik
*/
public class Html {
public static void exportSimulation(Project p, double result, Deque<Junction> bestPathJunctions, Deque<Section> bestPathSections, Vehicle vehicle) throws IOException{
String pro = prologo(p.toString());
String epi = epilogo();
String center = center(p);
String bestPath = bestPath(p, result, bestPathJunctions, bestPathSections, vehicle);
String html = pro + center + bestPath + epi;
File htmlFile = new File(p.getId()+p.getDescription()+".html");
try (Formatter fo = new Formatter ()) {
fo.format(html);
fo.close();
Desktop.getDesktop().browse(htmlFile.toURI());
} catch (FileNotFoundException ex) {
Logger.getLogger(Html.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static String prologo(String title){
String pro = " <!DOCTYPE html>\n" +
" <html>\n" +
" <head>\n" +
" <title>"+ title +"</title>\n" +
" </head>\n" +
" <body>\n";
return pro;
}
public static String epilogo(){
String epi = " </body>\n" +
"</html> ";
return epi;
}
public static String center(Project p){
String htmlCenter = "<h5>ROAD NETWORK</h5>";
htmlCenter += "<table border=\"1\">" +
" <tr>\n" +
" <th>Junctions</th>\n" +
" </tr>\n";
for(Junction j : p.getJunctions()){
htmlCenter += " <tr>\n" +
" <td>"+ j.toString() + "</td>\n" +
" </tr>";
}
htmlCenter +="</table>";
htmlCenter += "<table border=\"1\">" +
" <tr>\n" +
" <th>Sections</th>\n" +
" <th>Segments</th>\n" +
" </tr>\n";
for(Section s : p.getSections()){
htmlCenter += " <tr>\n" +
" <td>" + s.toString() +"</td>\n" +
" <td>" + htmlSegments(s) + "</td>\n" +
" </tr>\n";
}
htmlCenter +="</table>";
return htmlCenter;
}
public static String htmlSegments(Section s){
String ret = "";
for(Segment z : s.getSegments()){
ret += z.toString() + "</br>";
}
return ret;
}
public static String bestPath(Project model, double result, Deque<Junction> bestPathJunctions, Deque<Section> bestPathSections, Vehicle vehicle){
CarPhysics physics = new CarPhysics();
String ret = "";
float distance = 0;
float travelTime=0;
double energy=0.0;
float toll=0;
float velocity = 0.0f;
Wind wind;
ArrayList<String> path = new ArrayList();
for(Section sec : bestPathSections){
distance+=sec.getLength();
travelTime+=sec.getTravelTime(vehicle);
wind = sec.getWind();
toll+=sec.getToll();
for(Segment segment : sec.getSegments()){
velocity = segment.getMaximumVelocity(vehicle.returnVelocityLimitFromSegment(sec.getTypology().toString()));
energy = (double)physics.theoricalVehicleWork(vehicle, velocity, segment, wind);
}
path.add("from " + sec.getStartingNode().getId() + " take " + sec.getRoad() + " to " + sec.getEndingNode().getId() + " for " + String.format("%.1f",sec.getLength()) + " km");
}
ret+= "<h5>PATH</h5>";
/*Imprime caminho*/
ret += "<table border=\"1\">\n" +
" <tr>\n" +
" <th>Order</th>\n" +
" <th>Section</th>\n" +
" </tr>";
int cont = 1;
for(String s : path){
ret += " <tr>\n" +
" <td>"+cont+"</td>\n" +
" <td>"+s+"</td> \n" +
" </tr>";
cont++;
}
ret += "</table>";
/*Imprime resultados*/
ret+= "<h5>RESULTS</h5>";
ret+="<table border=\"1\">\n" +
" <tr>\n" +
" <th>Distance</th>\n" +
" <th>Travel Time</th> \n" +
" <th>Energy</th>\n" +
" <th>Toll</th>\n" +
" </tr>\n" +
" <tr>\n" +
" <td>"+distance+" km</td>\n" +
" <td>"+travelTime+" m</td> \n" +
" <td>"+energy+" J</td>\n" +
" <td>"+toll+" €</td>\n" +
" </tr>\n" +
"</table>";
return ret;
}
}
| [
"1120035@isep.ipp.pt"
] | 1120035@isep.ipp.pt |
69ed430feb0d1caa24e64b6cb9e4656b677bb971 | 6e03c4eac29c4f5b54d021df7e92a540f858f0d3 | /Top-Pharm RESTful Service/src/main/java/md/pharm/hibernate/task/attributes/PromoItemManage.java | 4631c378c17cd4bf95b7d65692eb254a63aacb2b | [] | no_license | andreitara/TopPharm-REST | b0b83b3c7676e4263acc0a734e03d739e496a8a8 | 4be8f99b7b5721b4d044a91a6d0f8897ffc3e77a | refs/heads/master | 2016-08-12T05:22:58.606101 | 2016-03-21T20:31:10 | 2016-03-21T20:31:10 | 44,655,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,290 | java | package md.pharm.hibernate.task.attributes;
import md.pharm.hibernate.doctor.Doctor;
import md.pharm.hibernate.doctor.attributes.GeneralType;
import md.pharm.hibernate.doctor.attributes.Speciality;
import md.pharm.hibernate.task.Task;
import md.pharm.util.Country;
import md.pharm.util.HibernateUtil;
import org.hibernate.*;
import org.hibernate.criterion.Order;
import java.util.List;
import java.util.Set;
/**
* Created by Andrei on 12/20/2015.
*/
public class PromoItemManage {
private Session session;
Country country;
public PromoItemManage(String country){
this.country = Country.valueOf(country);
}
public List<PromoItem> getAll(String field, boolean ascending){
session = HibernateUtil.getSession(country);
Transaction tx = null;
List<PromoItem> list = null;
try{
tx = session.beginTransaction();
Order order = null;
if(ascending) order = Order.asc(field);
else order = Order.desc(field);
Criteria criteria = session.createCriteria(PromoItem.class)
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
.setFetchMode("childFiles", FetchMode.SELECT)
.addOrder(order);
list = criteria.list();
tx.commit();
}catch (HibernateException e){
if(tx!=null) tx.rollback();
e.printStackTrace();
}finally {
}
return list;
}
public Integer add(PromoItem speciality){
session = HibernateUtil.getSession(country);
boolean flag = false;
Transaction tx = null;
Integer doctorID = null;
try{
tx = session.beginTransaction();
doctorID = (Integer) session.save(speciality);
tx.commit();
flag = true;
}catch(HibernateException e){
if(tx!=null)tx.rollback();
e.printStackTrace();
}finally {
}
if(flag) return doctorID;
else return null;
}
public boolean update(PromoItem promoItem){
session = HibernateUtil.getSession(country);
boolean flag = false;
Transaction tx = null;
Transaction tx2 = null;
Set<Task> taskSet = null;
try{
tx2 = session.beginTransaction();
PromoItem itemDB = (PromoItem)session.get(PromoItem.class, promoItem.getId());
taskSet = itemDB.getTasks();
tx2.commit();
flag = true;
}catch(HibernateException e){
if(tx2!=null)tx2.rollback();
e.printStackTrace();
flag = false;
}
if(flag) {
session = HibernateUtil.getSession(country);
try {
tx = session.beginTransaction();
promoItem.setTasks(taskSet);
session.update(promoItem);
tx.commit();
flag = true;
} catch (HibernateException e) {
if (tx != null) tx.rollback();
e.printStackTrace();
flag = false;
}
}
return flag;
}
public boolean delete(PromoItem promoItem){
session = HibernateUtil.getSession(country);
Transaction tx = null;
boolean flag = false;
try{
tx = session.beginTransaction();
session.createSQLQuery("delete from PromoItemTask where promoitemID="+promoItem.getId()+"").executeUpdate();
session.delete(promoItem);
tx.commit();
flag = true;
}catch(HibernateException e){
if(tx!=null)tx.rollback();
e.printStackTrace();
flag = false;
}finally {
}
return flag;
}
public PromoItem getByID(int id){
session = HibernateUtil.getSession(country);
Transaction tx = null;
PromoItem speciality = null;
try{
tx = session.beginTransaction();
speciality = (PromoItem)session.get(PromoItem.class, id);
tx.commit();
}catch (HibernateException e){
if(tx!=null) tx.rollback();
e.printStackTrace();
}finally {
}
return speciality;
}
}
| [
"kantry007@gmail.com"
] | kantry007@gmail.com |
2d167431dde4815d71d84a85960ce6fc4518bcf0 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /junit_cluster/1293/src_1.java | 516bd25ad8573991f120f134ad0e9174df0e5db0 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 799 | java | package junit.tests.framework;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* TestSuite that runs all the sample tests
*
*/
public class AllTests {
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
public static Test suite() {
TestSuite suite= new TestSuite("Framework Tests");
suite.addTestSuite(TestCaseTest.class);
suite.addTest(SuiteTest.suite()); // Tests suite building, so can't use automatic test extraction
suite.addTestSuite(TestListenerTest.class);
suite.addTestSuite(AssertTest.class);
suite.addTestSuite(TestImplementorTest.class);
suite.addTestSuite(NoArgTestCaseTest.class);
suite.addTestSuite(ComparisonFailureTest.class);
suite.addTestSuite(DoublePrecisionAssertTest.class);
return suite;
}
} | [
"375833274@qq.com"
] | 375833274@qq.com |
fe9ee6c15c4fd417f107148bf99355850ffb4eec | 9666cc7c24946620a5214979490cbb2cef41858e | /JavaEx_Part1/src/ch10/EmployeePoly.java | 15dd987de27e00a0d081f3dbffeeab9fab2d37a8 | [] | no_license | aipingyen/java101 | 3b36e0c23bcf30a4ee5bb4c2eef4bf7db0fecf16 | 8502f5c8e4f7204e33b4d38132c86f0bbac777c3 | refs/heads/master | 2021-01-16T11:30:31.976210 | 2017-08-11T06:29:46 | 2017-08-11T06:29:46 | 99,997,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | package ch10;
public class EmployeePoly {
private int empno;
private String ename;
public void setEmpno(int empno) {
this.empno = empno;
}
public int getEmpno() {
return empno;
}
public void setEname(String ename) {
this.ename = ename;
}
public String getEname() {
return ename;
}
public EmployeePoly(int empno, String ename) {
this.empno = empno;
this.ename = ename;
}
public EmployeePoly(int empno) {
this(empno, "-");
}
public EmployeePoly(String ename) {
this(0, ename);
}
public EmployeePoly() {
this(0, "-"); // ๆ empno = 0; ename = "-";
}
public void display() {
System.out.println("empno=" + empno);
System.out.println("ename=" + ename);
}
// ๆฐๅขgetSalaryๆนๆณ,่ฎๅญ้กๅฅๅปoverride, ็ๆฏ่ฐๆ
public double getSalary() {
return 0;
}
}
| [
"ireneyen928@gmail.com"
] | ireneyen928@gmail.com |
fdf1186fec8ea79d2edd62274f1990ef048f196b | c18338a2d274a9355f43907b997ddeef094bdf7b | /nist/senstore/senstore-java-client/trunk/src/edu/umich/senstore/.svn/text-base/FEMElasticMaterialFields.java.svn-base | 41bd4392b60a5d5bc6e68837ebd2da87fc478274 | [] | no_license | athuls/eclipse_ws | 730c6b0fb743ae24f21a336165368a09154ab4af | aeb369ecc045fbf290c4ac1dc4a43349399d405c | refs/heads/master | 2020-03-29T12:55:52.838333 | 2012-04-12T00:21:58 | 2012-04-12T00:21:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,207 | // **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
// Ice version 3.3.1
package edu.umich.senstore;
public final class FEMElasticMaterialFields implements java.lang.Cloneable, java.io.Serializable
{
public long id;
public double mAlpha;
public double mDensity;
public double mE;
public long mMaterial;
public double mNU;
public FEMElasticMaterialFields()
{
}
public FEMElasticMaterialFields(long id, double mAlpha, double mDensity, double mE, long mMaterial, double mNU)
{
this.id = id;
this.mAlpha = mAlpha;
this.mDensity = mDensity;
this.mE = mE;
this.mMaterial = mMaterial;
this.mNU = mNU;
}
public boolean
equals(java.lang.Object rhs)
{
if(this == rhs)
{
return true;
}
FEMElasticMaterialFields _r = null;
try
{
_r = (FEMElasticMaterialFields)rhs;
}
catch(ClassCastException ex)
{
}
if(_r != null)
{
if(id != _r.id)
{
return false;
}
if(mAlpha != _r.mAlpha)
{
return false;
}
if(mDensity != _r.mDensity)
{
return false;
}
if(mE != _r.mE)
{
return false;
}
if(mMaterial != _r.mMaterial)
{
return false;
}
if(mNU != _r.mNU)
{
return false;
}
return true;
}
return false;
}
public int
hashCode()
{
int __h = 0;
__h = 5 * __h + (int)id;
__h = 5 * __h + (int)java.lang.Double.doubleToLongBits(mAlpha);
__h = 5 * __h + (int)java.lang.Double.doubleToLongBits(mDensity);
__h = 5 * __h + (int)java.lang.Double.doubleToLongBits(mE);
__h = 5 * __h + (int)mMaterial;
__h = 5 * __h + (int)java.lang.Double.doubleToLongBits(mNU);
return __h;
}
public java.lang.Object
clone()
{
java.lang.Object o = null;
try
{
o = super.clone();
}
catch(CloneNotSupportedException ex)
{
assert false; // impossible
}
return o;
}
public void
__write(IceInternal.BasicStream __os)
{
__os.writeLong(id);
__os.writeDouble(mAlpha);
__os.writeDouble(mDensity);
__os.writeDouble(mE);
__os.writeLong(mMaterial);
__os.writeDouble(mNU);
}
public void
__read(IceInternal.BasicStream __is)
{
id = __is.readLong();
mAlpha = __is.readDouble();
mDensity = __is.readDouble();
mE = __is.readDouble();
mMaterial = __is.readLong();
mNU = __is.readDouble();
}
}
| [
"athuls89@gmail.com"
] | athuls89@gmail.com | |
38caaf03723649506bff0f9bb83442fa413c518f | 09a205d29b11ee9d426b9d8004d205cdbc3e9fbc | /src/org/umit/ns/mobile/model/PortScanDatabase.java | f6e6e5124ab51eaac4fbe8f89ca81588add3d22e | [] | no_license | sundiyone/ns-mobile | 206812d601f988347f02efad92cd8aacafd41876 | 676ad6fd512fa8e23097619083ecc53036f8dce2 | refs/heads/master | 2021-01-23T21:22:59.845304 | 2012-06-26T05:34:55 | 2012-06-26T05:34:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,058 | java | /*
Android Network Scanner Umit Project
Copyright (C) 2011 Adriano Monteiro Marques
Author: Angad Singh <angad@angad.sg>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @author angadsg
*
* CRUD for Database.
*
*/
package org.umit.ns.mobile.model;
import org.umit.ns.mobile.nsandroid;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class PortScanDatabase extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "portscan";
public static final int DATABASE_VERSION = 1;
public static final String DATABASE_CREATE = "CREATE TABLE portscan " +
"(id INTEGER PRIMARY KEY autoincrement, time TEXT, " +
"profile TEXT, type TEXT, target TEXT, " +
"args TEXT, open TEXT, closed TEXT, range TEXT, " +
"filtered TEXT, protocol TEXT, d_id TEXT, total NUMERIC)";
public PortScanDatabase(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DATABASE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
nsandroid.resultPublish("Upgrading databse from version " + oldVersion + " to " + newVersion);
db.execSQL("DROP TABLE IF EXISTS portscan");
onCreate(db);
}
}
| [
"angad@angad.sg"
] | angad@angad.sg |
c6532ed30ec7d0e387724028f17ccb3f9a78ece0 | eb8eb9c4c14f338b445f5aaabc6c4e208a30373b | /phase1/src/Entities/Attendee.java | 709966f095c73014a771c68cc9c362b8c5a65be3 | [] | no_license | aribshaikh/tech-conference-application | b55b2e8efe2487e475a531f267aba3d54d9baa94 | 161a166d457ae3f35d23d7e42d4297fdc3014251 | refs/heads/main | 2023-05-04T05:15:46.571091 | 2021-05-20T04:42:19 | 2021-05-20T04:42:19 | 328,856,897 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package Entities;
import java.io.Serializable;
import java.util.ArrayList;
/**
* this class stores all info relating to an Entities.Attendee
* and provides getters to extract those info
* Entities.Attendee is a subclass of Entities.User
* @author Khoa Pham
* @see User
* A few notes to consider:
* * disallows changes in username, password for now
*/
public class Attendee extends User implements Serializable {
private ArrayList<String> eventsAttending = new ArrayList<>();
/**
* a constructor to create an Entities.Attendee object
*
* @param username: the username of this Entities.Attendee
* @param password: the password of this Entities.Attendee
*/
public Attendee(String username, String password) {
super(username, password);
}
/**
* return the list of all events that this Entities.Attendee is participating
* @return ArrayList<String> participating events
*/
public ArrayList<String> getEventsAttending() {
return eventsAttending;
}
/**
* update the list of all events that this Entities.Attendee is participating
* @param eventsAttending: the new list of all participating events (param_type: ArrayList<String>)
*/
public void setEventsAttending(ArrayList<String> eventsAttending) {
this.eventsAttending = eventsAttending;
}
}
| [
"aribshaikh10@gmail.com"
] | aribshaikh10@gmail.com |
c09620a1120e0c61d834f05f4a0e974ca4355bc1 | fcd6a596fed57dfa63b87c22d4dfe297ad8a53ff | /Civilization/src/Civ/PanelTest.java | d78b11a1b0bd1e03d7e2ca426f8005009ed9019b | [] | no_license | Civilization-CSSE376/Civilization | 7ef33f5a1674ffa26347f6645d168c6171e64430 | 7b1a3999ad50ef291f1c0ce28fccf0afc4ed6c42 | refs/heads/master | 2016-09-06T02:31:40.893638 | 2013-05-17T22:37:39 | 2013-05-17T22:37:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 878 | java | package Civ;
import static org.junit.Assert.*;
import org.junit.Test;
public class PanelTest {
@Test
public void testJUnit() {
assertTrue("It's working", true);
}
@Test
public void testPanelInitializes(){
Panel target = new Panel();
assertNotNull(target);
}
@Test
public void testPanelisExploredAtInitialization(){
Panel target = new Panel();
assertFalse(target.getIsExplored());
}
@Test
public void testCanChangeisExplored(){
Panel target = new Panel();
target.changeIsExplored();
assertTrue(target.getIsExplored());
}
@Test
public void testTilesAreInitialized(){
Panel target = new Panel();
Tile[][] tiles = target.getTiles();
assertEquals(4, tiles.length);
assertNotNull(tiles[3][3]);
}
// @Test
// public void testSetAndGetNeighbors(){
// Panel target = new Panel();
// assertNotNull(target.getNeighbors());
// }
}
| [
"harbisjs@rose-hulman.edu"
] | harbisjs@rose-hulman.edu |
7549206e4a1a1340fa062e42aad894918625c608 | 563c7dd9131fbc3473262308ff12ffa355a04a6c | /src/top/forethought/concurrency/threads/ReadVolatile.java | bfc14d4fa541a6f682a64fc654f6eff31e3089e4 | [] | no_license | TopForethought/java | 370168419b5365ebb4dacf5a1ae175b6b1e51a51 | b03e76dd63fa907ba0ccc154665d203b4d675e5d | refs/heads/master | 2022-07-02T11:56:30.291025 | 2019-11-06T02:37:50 | 2019-11-06T02:37:50 | 181,810,709 | 1 | 0 | null | 2022-06-21T01:04:09 | 2019-04-17T03:29:46 | Java | UTF-8 | Java | false | false | 2,109 | java | package top.forethought.concurrency.threads;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
/**
* author : wangwei
* description: volatile ่ฟไธๅ
ณ้ฎๅญ๏ผไฟ่ฏไบ็บฟ็จ้ด็ๅฏ่งๆง
* volatile ๅ้่ช่บซๅ
ทๆ็็นๆง๏ผ
* 1. ๅฏ่งๆง๏ผๅฏนไธไธชvolatile ๅ้็ๅไธช่ฏป/ๅ ๆไฝ๏ผๆปๆฏ่ฝ็ๅฐไปปๆ็บฟ็จๅฏน่ฟไธชๅ้็ๆๅๅๅ
ฅ
* 2. :ๅๅญๆง๏ผๅฏนไปปๆๅไธชvolatile ๅ้็่ฏป/ๅ ๅ
ทๆๅๅญๆง๏ผไฝๆฏๅฏนไบ volatile ++ ่ฟ็งๅคๅๆไฝไธๅ
ทๆๅๅญๆง
* date: 2019/8/5
*/
public class ReadVolatile {
private static AtomicInteger count=new AtomicInteger();
// ๅคไธช็บฟ็จๅฏนvolatile ไฟฎ้ฅฐ็ๅ้ๆไฝ็ญไปทๆๆๅฆไธ
private volatile long value=0;
public synchronized void set(long l){
this.value=l;
// System.out.println(Thread.currentThread().getId()+" val:"+this.value);
}
public synchronized long get(){
return this.value;
}
public void getAndIncrement(){
long temp=get();
temp=temp+1;
set(temp);
count.getAndIncrement();
}
public void getAndIncrement2(){
long temp=this.value;
temp=temp+1;
this.value=temp;
count.getAndIncrement();
}
public static void main(String[] args) throws InterruptedException {
int MAX_THRED =2000;
ExecutorService executorService = Executors.newFixedThreadPool(MAX_THRED);
CountDownLatch countDownLatch = new CountDownLatch(20);
final ReadVolatile obj = new ReadVolatile();
for (int i = 0; i < MAX_THRED; i++) {
executorService.submit(() -> {
// obj.getAndIncrement2();
obj.getAndIncrement();
countDownLatch.countDown();
});
}
countDownLatch.await();
executorService.shutdown();
System.out.println("result:" + obj.get()+" count:"+count.get());
}
}
| [
"wang.wei.hit@outlook.com"
] | wang.wei.hit@outlook.com |
22b678834e2c489be51c1c9f852608129c35f54b | b6a9cc9e40f03540162ebdfaf3a38a3fe384ec44 | /Lab01/app/src/androidTest/java/edu/calvin/cs262/pjh26/lab01/ExampleInstrumentedTest.java | adfb79bced4b39f096c7cf56eae54b687c8279f2 | [] | no_license | pjh26/cs262 | f113b1e83edc90fbff495fdd534923ab4ac61d43 | 41a112dcb44652adf28337f6b45655fc2dca5237 | refs/heads/master | 2020-03-29T10:23:33.117993 | 2018-11-02T21:02:30 | 2018-11-02T21:02:30 | 149,803,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package edu.calvin.cs262.pjh26.lab01;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("edu.calvin.cs262.pjh26.lab01", appContext.getPackageName());
}
}
| [
"pjh26@gold03.cs.calvin.edu"
] | pjh26@gold03.cs.calvin.edu |
4987fca2777310b571ef1a1079d76cd8bcdd1ee1 | 3941243a80b553206558321fa49b8ca03ea599fa | /bin/custom/myhybris/myhybrisstorefront/web/src/mx/myhybris/storefront/controllers/pages/QuickOrderPageController.java | a84d12f897d29563fe433ee800b534d29c2383fa | [] | no_license | lmartinezmx/MyStoreHybris | 31c5f2ef85b6d9120ce4e252a1554ae250bae3a4 | 9451b9e8215d42be02b59a3cae5316ff1fd24996 | refs/heads/master | 2020-07-14T21:42:49.175463 | 2019-08-30T17:15:53 | 2019-08-30T17:15:53 | 205,409,281 | 0 | 0 | null | 2020-04-30T11:28:14 | 2019-08-30T15:30:13 | Java | UTF-8 | Java | false | false | 4,607 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package mx.myhybris.storefront.controllers.pages;
import de.hybris.platform.acceleratorfacades.product.data.ProductWrapperData;
import de.hybris.platform.acceleratorstorefrontcommons.breadcrumb.ResourceBreadcrumbBuilder;
import de.hybris.platform.acceleratorstorefrontcommons.constants.WebConstants;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.ThirdPartyConstants;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController;
import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException;
import de.hybris.platform.commercefacades.product.ProductFacade;
import de.hybris.platform.commercefacades.product.ProductOption;
import de.hybris.platform.commercefacades.product.data.ProductData;
import de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException;
import de.hybris.platform.util.Config;
import mx.myhybris.storefront.controllers.ControllerConstants;
import java.util.Arrays;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
*
*/
@Controller
@RequestMapping(value = "/quickOrder")
public class QuickOrderPageController extends AbstractPageController
{
private static final Logger LOG = Logger.getLogger(QuickOrderPageController.class);
@Resource(name = "simpleBreadcrumbBuilder")
private ResourceBreadcrumbBuilder resourceBreadcrumbBuilder;
@Resource(name = "productVariantFacade")
private ProductFacade productFacade;
@RequestMapping(method = RequestMethod.GET)
public String getQuickOrderPage(final Model model) throws CMSItemNotFoundException // NOSONAR
{
storeCmsPageInModel(model, getContentPageForLabelOrId("quickOrderPage"));
model.addAttribute("quickOrderMinRows", Integer.valueOf(Config.getInt("myhybrisstorefront.quick.order.rows.min", 3)));
model.addAttribute("quickOrderMaxRows", Integer.valueOf(Config.getInt("myhybrisstorefront.quick.order.rows.max", 25)));
model.addAttribute(WebConstants.BREADCRUMBS_KEY, resourceBreadcrumbBuilder.getBreadcrumbs("breadcrumb.quickOrder"));
model.addAttribute(ThirdPartyConstants.SeoRobots.META_ROBOTS, ThirdPartyConstants.SeoRobots.NOINDEX_NOFOLLOW);
return ControllerConstants.Views.Pages.QuickOrder.QuickOrderPage;
}
@RequestMapping(value = "/productInfo", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public ProductWrapperData getProductInfo(@RequestParam("code") final String code)
{
ProductData productData = null;
String errorMsg = null;
try
{
productData = productFacade.getProductForCodeAndOptions(code, Arrays.asList(ProductOption.BASIC, ProductOption.PRICE,
ProductOption.URL, ProductOption.STOCK, ProductOption.VARIANT_MATRIX_BASE, ProductOption.VARIANT_MATRIX_URL,
ProductOption.VARIANT_MATRIX_MEDIA));
if (Boolean.FALSE.equals(productData.getPurchasable()))
{
errorMsg = getErrorMessage("text.quickOrder.product.not.purchaseable", null);
}
}
catch (final IllegalArgumentException iae)
{
errorMsg = getErrorMessage("text.quickOrder.product.not.unique", null);
logDebugException(iae);
}
catch (final UnknownIdentifierException uie)
{
errorMsg = getErrorMessage("text.quickOrder.product.not.found", null);
logDebugException(uie);
}
return createProductWrapperData(productData, errorMsg);
}
protected void logDebugException(final Exception ex)
{
if (LOG.isDebugEnabled())
{
LOG.debug(ex);
}
}
protected String getErrorMessage(final String messageKey, final Object[] args)
{
return getMessageSource().getMessage(messageKey, args, getI18nService().getCurrentLocale());
}
protected ProductWrapperData createProductWrapperData(final ProductData productData, final String errorMsg)
{
final ProductWrapperData productWrapperData = new ProductWrapperData();
productWrapperData.setProductData(productData);
productWrapperData.setErrorMsg(errorMsg);
return productWrapperData;
}
} | [
"leonardo.lmv@gmail.com"
] | leonardo.lmv@gmail.com |
bfb5855be33acd4c699a153a92a20d4e35206df3 | 5119693954a68508c60c1f04624780b5f085188f | /jmfsrc/javax/media/rtp/TransmissionStats.java | 819a0c5caad8feb4f6e5d386678e496ae0b9753b | [] | no_license | faustvault/JavaFrameByFrameVideo | 1356b2b278c60ea74035a0b0f9739f81bb2a171b | cfd67b91ee648b8babc93e94d2780884463987b4 | refs/heads/master | 2020-12-25T15:40:18.935023 | 2013-03-24T07:28:37 | 2013-03-24T07:28:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | /*
* @(#)TransmissionStats.java 1.6 02/08/21
*
* Copyright (c) 1996-2002 Sun Microsystems, Inc. All rights reserved.
*/
package javax.media.rtp;
/**
* Interface TransmissionStats---
* encapsulates data transmission statistics as well as RTCP statistics
* prepared by the RTPSM.A "PDU" is a a Protocol Data Unit and
* represents a single RTP packet.
*/
public interface TransmissionStats
{
/**
* Get the total number of PDU sent out by this source. This will
* be the total numer of RTP data packets sent out by this source.
*/
public int
getPDUTransmitted();
/**
* Get the total number of bytes or octets of data transmitted by
* this source.
*/
public int
getBytesTransmitted();
/**
* Get the total number of RTCP packets sent out by this source
* i.e total number of Sender Reports sent out by this source.
*/
public int
getRTCPSent();
}
| [
"tjrantal@gmail.com"
] | tjrantal@gmail.com |
857ea89b85e983c42f79914429a494b4160fd306 | b8f524d06f308dbe77302a1d91ac61f23a59bce8 | /src/mori/Category/C_GeneticPrmtr.java | 944da2bb817c168cc74d1c42df234143f4973f73 | [] | no_license | takatoshimorisaki/Viewer | 12275fdbcaffdabe08136d6bdb3d43920b2926c6 | e60fab3c1461fefd19687f750c702e02f466f86f | refs/heads/master | 2021-01-17T16:21:38.137387 | 2016-12-04T07:45:34 | 2016-12-04T07:45:34 | 71,739,705 | 0 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 144 | java | package mori.Category;
public class C_GeneticPrmtr{
//! ๅๆๅไฝใฎๆฐ
public final static int INIT_INDIVIDUAL_NUM = 1000;
}
| [
"t-morisaki@muj.biglobe.ne.jp"
] | t-morisaki@muj.biglobe.ne.jp |
ac958c00a3bae5fdbab03354662a44513467db7b | 2d859206522dbbe07e679178ad229e414010044e | /app/src/main/java/com/klikeat/p2p/klikeat/model/PopularModel.java | 5869b43d568061c713afa9627b846474c1f5d458 | [] | no_license | putrautama007/KlikEat | 07953703db52a902063fc52d7f803984afe8d889 | 2e3950470057e1f8706466552962a682d7da0981 | refs/heads/master | 2020-04-22T22:15:46.344615 | 2019-04-05T09:48:20 | 2019-04-05T09:48:20 | 170,701,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package com.klikeat.p2p.klikeat.model;
public class PopularModel {
String foodName;
String foodPrice;
int picture;
public PopularModel(){
}
public PopularModel(String foodName, String foodPrice, int picture) {
this.foodName = foodName;
this.foodPrice = foodPrice;
this.picture = picture;
}
public String getFoodName() {
return foodName;
}
public void setFoodName(String foodName) {
this.foodName = foodName;
}
public String getFoodPrice() {
return foodPrice;
}
public void setFoodPrice(String foodPrice) {
this.foodPrice = foodPrice;
}
public int getPicture() {
return picture;
}
public void setPicture(int picture) {
this.picture = picture;
}
}
| [
"miftahfarhan20@gmail.com"
] | miftahfarhan20@gmail.com |
438ca493d17a006caf684565f557c2da20e5c631 | a666c798a28223f97d74d21786f9a4f4000d5acb | /edu.harvard.i2b2.crc/gensrc/edu/harvard/i2b2/crc/datavo/setfinder/query/TimingStepType.java | aae60b4ff73116af0f03e6ee7a4e36cf8586a096 | [] | no_license | gmacdonnell/i2b2-fsu-1704 | d65239edf95aa3b25844a6ed9af599e06dcaa185 | 12638996fe46a7014ac827e359c40e5b0e8c1d3e | refs/heads/master | 2021-01-23T07:02:31.537241 | 2015-01-27T15:09:33 | 2015-01-27T15:09:33 | 29,916,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,545 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.01.26 at 12:45:17 PM EST
//
package edu.harvard.i2b2.crc.datavo.setfinder.query;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Java class for timingStepType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="timingStepType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="start_date" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="end_date" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="total_time_second" type="{http://www.w3.org/2001/XMLSchema}double"/>
* <element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "timingStepType", propOrder = {
"name",
"startDate",
"endDate",
"totalTimeSecond",
"message"
})
public class TimingStepType {
@XmlElement(required = true)
protected String name;
@XmlElement(name = "start_date", required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar startDate;
@XmlElement(name = "end_date", required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar endDate;
@XmlElement(name = "total_time_second")
protected double totalTimeSecond;
@XmlElement(required = true)
protected String message;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the startDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getStartDate() {
return startDate;
}
/**
* Sets the value of the startDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setStartDate(XMLGregorianCalendar value) {
this.startDate = value;
}
/**
* Gets the value of the endDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getEndDate() {
return endDate;
}
/**
* Sets the value of the endDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setEndDate(XMLGregorianCalendar value) {
this.endDate = value;
}
/**
* Gets the value of the totalTimeSecond property.
*
*/
public double getTotalTimeSecond() {
return totalTimeSecond;
}
/**
* Sets the value of the totalTimeSecond property.
*
*/
public void setTotalTimeSecond(double value) {
this.totalTimeSecond = value;
}
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
}
| [
"gmacdonnell@fsu.edu"
] | gmacdonnell@fsu.edu |
244a4de34e7f7b176888fb3482005f9a4df59f3c | 8b1f9fbec49a2d89467854ec8ba117fe33337524 | /generic-arg/modules/interface/src/main/java/com/kepler/list/Members.java | ec70116c06e30eaa4888c80598f86c6135b81b07 | [] | no_license | Kepler-Framework/Kepler-Example | c13c91c80bfbdf11ea1ef53b9a5aeee921c52ff0 | 210aa7c0a172014d0c78de0430a77d346b0c12f4 | refs/heads/master | 2020-04-16T20:13:40.372720 | 2016-08-24T06:44:39 | 2016-08-24T06:44:39 | 52,214,797 | 3 | 12 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | package com.kepler.list;
import java.util.List;
/**
* @author KimShen
*
*/
public class Members {
private List<String> names;
private List<Role> roles;
public List<String> getNames() {
return this.names;
}
public void setNames(List<String> names) {
this.names = names;
}
public List<Role> getRoles() {
return this.roles;
}
public void setRoles(List<Role> roles) {
this.roles = roles;
}
public String toString() {
return "[names=" + this.names + "][roles=" + this.roles + "]";
}
}
| [
"shenjiawei@didichuxing.com"
] | shenjiawei@didichuxing.com |
4735146cd5f53324deda95dfd608557d9526f033 | 9caa786e43545a563aefe08b1545decd763e38fb | /stdlib/llvm/src/main/java/org/ballerinalang/nativeimpl/llvm/gen/LLVMViewFunctionCFG.java | 5fae425c56c15f87d182577da0f15fa4ad2766ae | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-mit-old-style",
"MPL-2.0",
"LicenseRef-scancode-unicode",
"MIT"
] | permissive | mohamednizar/ballerina-lang | 2bb5c2df3143af1894e06d8c25716512e74e1a0c | 22efe9bfac8daf9318bbfb38c72771b5272a11fa | refs/heads/master | 2023-02-05T20:58:27.718202 | 2019-11-02T12:16:10 | 2019-11-02T12:16:10 | 212,315,547 | 1 | 0 | Apache-2.0 | 2023-01-26T10:32:48 | 2019-10-02T10:55:23 | Java | UTF-8 | Java | false | false | 1,647 | java | // Copyright (c) 2018 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 Inc. 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.ballerinalang.nativeimpl.llvm.gen;
import org.ballerinalang.bre.Context;
import org.ballerinalang.bre.bvm.BlockingNativeCallableUnit;
import org.ballerinalang.nativeimpl.llvm.FFIUtil;
import org.ballerinalang.natives.annotations.Argument;
import org.ballerinalang.natives.annotations.BallerinaFunction;
import org.bytedeco.javacpp.LLVM;
import static org.ballerinalang.model.types.TypeKind.RECORD;
import static org.bytedeco.javacpp.LLVM.LLVMViewFunctionCFG;
/**
* Auto generated class.
*/
@BallerinaFunction(
orgName = "ballerina", packageName = "llvm",
functionName = "LLVMViewFunctionCFG",
args = {
@Argument(name = "fn", type = RECORD, structType = "LLVMValueRef"),
})
public class LLVMViewFunctionCFG extends BlockingNativeCallableUnit {
@Override
public void execute(Context context) {
LLVM.LLVMValueRef fn = FFIUtil.getRecodeArgumentNative(context, 0);
LLVMViewFunctionCFG(fn);
}
}
| [
"manu@wso2.com"
] | manu@wso2.com |
18abf5df0c4b0df28d7cb3d99907cb607786c8a2 | 996e3276d13e5836af1eae68d52c787c8fefba2b | /cartagonew/src/main/cartago/tools/.svn/text-base/Console.java.svn-base | 228031232b9afee5f39afd3b77685c21bae0056a | [] | no_license | ivanomanca/fcrr_app | 8ae21cb6ab727e6950b7ef776409fc89747f9a07 | cc1ed76d531647b465740ee650d88de5c0a9c8d9 | refs/heads/master | 2021-01-25T05:22:21.877616 | 2013-07-20T13:19:34 | 2013-07-20T13:19:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | package cartago.tools;
import cartago.*;
@ARTIFACT_INFO(
manual_file = "cartago/tools/Console.man"
) public class Console extends Artifact {
/**
* <p>Print a sequence of messages on the console</p>
*
* <p>Parameters:
* <ul>
* <li>arg (Object) - msg to print</li>
* </ul></p>
*
*/
@OPERATION void print(Object... args){
System.out.print("["+getOpUserName()+"] ");
for (Object st: args){
System.out.print(st);
}
}
/**
* <p>Print a sequence of messages on the console</p>
*
* <p>Parameters:
* <ul>
* <li>arg (Object) - msg to print</li>
* </ul></p>
*
*/
@OPERATION void println(Object... args){
System.out.print("["+getOpUserName()+"] ");
for (Object st: args){
System.out.print(st);
}
System.out.println();
}
/**
* <p>Print a sequence of messages on the console</p>
*
* <p>Parameters:
* <ul>
* <li>arg (Object) - msg to print</li>
* </ul></p>
*
*/
@OPERATION void anonimousPrint(Object... args){
System.out.print("["+getOpUserName()+"] ");
for (Object st: args){
System.out.print(st);
}
}
/**
* <p>Print a sequence of messages on the console</p>
*
* <p>Parameters:
* <ul>
* <li>arg (Object) - msg to print</li>
* </ul></p>
*
*/
@OPERATION void anonimousPrintln(Object... args){
System.out.print("["+getOpUserName()+"] ");
for (Object st: args){
System.out.print(st);
}
System.out.println();
}
}
| [
"ivano.manca@gmail.com"
] | ivano.manca@gmail.com | |
85bba6423b588ad72cdf9c7062c8c873000ea05b | 2ec381dc7922f0ce0cf1a064271a0ded3997f40c | /Homework1/src/main/java/lab/beans3/BeanD.java | 9a6012d2ea43e54f2ec701ce4df8162f8e47c482 | [] | no_license | Taras-Chaban/Lab-Homework | 062b57cfcd6267bf134758828fc9c7ecf5f8f34f | 9331e4122bc25bc96683fd628e921160fa4d3a33 | refs/heads/master | 2023-05-14T07:46:14.194184 | 2021-06-07T09:06:35 | 2021-06-07T09:06:35 | 354,719,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 105 | java | package lab.beans3;
import org.springframework.stereotype.Component;
@Component
public class BeanD {
}
| [
"gold.bender2001@gmail.com"
] | gold.bender2001@gmail.com |
ea3f74f76a3e36d97c96bfd2c93e7431257a7686 | 41b9e0afec5ca6a6cf553a78b2ae38487af232ee | /ime/app/src/test/java/com/anysoftkeyboard/ime/AnySoftKeyboardThemeOverlayTest.java | 867f70b8aad61d460bfa7e8d6423558f72305990 | [
"Apache-2.0"
] | permissive | menny/AnySoftKeyboard | 76b649d1a3bb5facfa6c9cff832590c400f5e77e | 0af30adf2ba1ca00801c9dd23f9b338661c35215 | refs/heads/master | 2023-09-03T07:35:05.310482 | 2022-03-11T18:59:37 | 2022-03-11T18:59:37 | 4,159,267 | 6 | 1 | Apache-2.0 | 2022-12-19T13:12:07 | 2012-04-27T14:49:42 | Java | UTF-8 | Java | false | false | 8,497 | java | package com.anysoftkeyboard.ime;
import android.content.ComponentName;
import android.os.Build;
import android.view.inputmethod.EditorInfo;
import androidx.test.core.app.ApplicationProvider;
import com.anysoftkeyboard.AnySoftKeyboardBaseTest;
import com.anysoftkeyboard.AnySoftKeyboardRobolectricTestRunner;
import com.anysoftkeyboard.TestableAnySoftKeyboard;
import com.anysoftkeyboard.android.PowerSavingTest;
import com.anysoftkeyboard.overlay.OverlayData;
import com.anysoftkeyboard.overlay.OverlyDataCreator;
import com.anysoftkeyboard.test.SharedPrefsHelper;
import com.anysoftkeyboard.ui.settings.MainSettingsActivity;
import com.menny.android.anysoftkeyboard.R;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.robolectric.annotation.Config;
@RunWith(AnySoftKeyboardRobolectricTestRunner.class)
public class AnySoftKeyboardThemeOverlayTest extends AnySoftKeyboardBaseTest {
@Test
public void testDefaultAppliesInvalidOverlayAndDoesNotInteractWithCreator() {
simulateOnStartInputFlow();
OverlayData appliedData = captureOverlay();
Assert.assertFalse(appliedData.isValid());
Assert.assertSame(AnySoftKeyboardThemeOverlay.INVALID_OVERLAY_DATA, appliedData);
}
@Test
public void testWhenEnabledAppliesOverlayFromCreator() {
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
Mockito.reset(mAnySoftKeyboardUnderTest.getMockOverlayDataCreator());
final EditorInfo editorInfo = createEditorInfoTextWithSuggestionsForSetUp();
simulateOnStartInputFlow(false, editorInfo);
ArgumentCaptor<ComponentName> componentNameArgumentCaptor =
ArgumentCaptor.forClass(ComponentName.class);
Mockito.verify(mAnySoftKeyboardUnderTest.getMockOverlayDataCreator())
.createOverlayData(componentNameArgumentCaptor.capture());
Assert.assertEquals(
editorInfo.packageName, componentNameArgumentCaptor.getValue().getPackageName());
OverlayData appliedData = captureOverlay();
Assert.assertTrue(appliedData.isValid());
}
@Test
public void testStartsEnabledStopsApplyingAfterDisabled() {
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
simulateOnStartInputFlow(false, createEditorInfoTextWithSuggestionsForSetUp());
Assert.assertTrue(captureOverlay().isValid());
simulateFinishInputFlow();
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, false);
simulateOnStartInputFlow(false, createEditorInfoTextWithSuggestionsForSetUp());
Assert.assertSame(captureOverlay(), AnySoftKeyboardThemeOverlay.INVALID_OVERLAY_DATA);
}
@Test
public void testAppliesInvalidIfRemotePackageDoesNotHaveIntent() {
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
final EditorInfo editorInfo = createEditorInfoTextWithSuggestionsForSetUp();
editorInfo.packageName = "com.is.not.there";
simulateOnStartInputFlow(false, editorInfo);
OverlayData appliedData = captureOverlay();
Assert.assertFalse(appliedData.isValid());
Assert.assertSame(AnySoftKeyboardThemeOverlay.INVALID_OVERLAY_DATA, appliedData);
}
@Test
public void testSwitchesBetweenApps() {
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
simulateFinishInputFlow();
final EditorInfo editorInfo = createEditorInfoTextWithSuggestionsForSetUp();
editorInfo.packageName = "com.is.not.there";
simulateOnStartInputFlow(false, editorInfo);
Assert.assertFalse(captureOverlay().isValid());
simulateFinishInputFlow();
// again, a valid app
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
}
@Test
public void testRestartsInputField() {
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, false);
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertFalse(captureOverlay().isValid());
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertFalse(captureOverlay().isValid());
}
@Test
@Config(sdk = Build.VERSION_CODES.KITKAT)
public void testDoesNotWorkPriorToLollipop() {
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertFalse(captureOverlay().isValid());
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertFalse(captureOverlay().isValid());
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertFalse(captureOverlay().isValid());
}
@Test
public void testDoesNotFailWithEmptyPackageName() {
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
simulateFinishInputFlow();
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
simulateFinishInputFlow();
final EditorInfo editorInfo = createEditorInfoTextWithSuggestionsForSetUp();
editorInfo.packageName = null;
simulateOnStartInputFlow(false, editorInfo);
Assert.assertFalse(captureOverlay().isValid());
simulateFinishInputFlow();
// again, a valid app
simulateOnStartInputFlow();
Assert.assertTrue(captureOverlay().isValid());
}
@Test
public void testPowerSavingPriority() {
SharedPrefsHelper.setPrefsValue(R.string.settings_key_power_save_mode_theme_control, true);
SharedPrefsHelper.setPrefsValue(R.string.settings_key_apply_remote_app_colors, true);
final OverlyDataCreator originalOverlayDataCreator =
mAnySoftKeyboardUnderTest.getOriginalOverlayDataCreator();
final OverlayData normal =
originalOverlayDataCreator.createOverlayData(
new ComponentName(
ApplicationProvider.getApplicationContext(),
MainSettingsActivity.class));
Assert.assertTrue(normal.isValid());
Assert.assertEquals(0xFFCC99FF, normal.getPrimaryColor());
Assert.assertEquals(0xFFAA77DD, normal.getPrimaryDarkColor());
Assert.assertEquals(0xFF000000, normal.getPrimaryTextColor());
PowerSavingTest.sendBatteryState(true);
final OverlayData powerSaving =
originalOverlayDataCreator.createOverlayData(
new ComponentName(
ApplicationProvider.getApplicationContext(),
MainSettingsActivity.class));
Assert.assertTrue(powerSaving.isValid());
Assert.assertEquals(0xFF000000, powerSaving.getPrimaryColor());
Assert.assertEquals(0xFF000000, powerSaving.getPrimaryDarkColor());
Assert.assertEquals(0xFF888888, powerSaving.getPrimaryTextColor());
}
private OverlayData captureOverlay() {
return captureOverlay(mAnySoftKeyboardUnderTest);
}
public static OverlayData captureOverlay(TestableAnySoftKeyboard testableAnySoftKeyboard) {
ArgumentCaptor<OverlayData> captor = ArgumentCaptor.forClass(OverlayData.class);
Mockito.verify(testableAnySoftKeyboard.getInputView(), Mockito.atLeastOnce())
.setThemeOverlay(captor.capture());
return captor.getValue();
}
}
| [
"menny@evendanan.net"
] | menny@evendanan.net |
42d88b681c6b18970e44c6a1776132626d511753 | 57f710ac4307ac0ee6be0865dadfe9ed19a9d005 | /src/main/java/ec/ups/edu/app/g2/cooperativaUnion/Ser/Cambiopass.java | 060b20a990dc94f598316bcb8a8bfad68a63b0d5 | [] | no_license | farmijoss1995/cooperativaUnion1 | 69932f2ca11dc4d25cdfc6ec297e505b4fa1e5ee | 0abafa0f18c3089dc68933474382d39edcf57079 | refs/heads/master | 2023-03-07T02:34:00.820947 | 2021-02-13T02:32:42 | 2021-02-13T02:32:42 | 338,481,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package ec.ups.edu.app.g2.cooperativaUnion.Ser;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import ec.ups.edu.app.g2.cooperativaUnion.modelo.UsuarioON;
import ec.ups.edu.app.g2.cooperativaUnion.utils.Respuesta;
import ec.ups.edu.app.g2.cooperativaUnion.utils.Trans;
import ec.ups.edu.app.g2.cooperativaUnion.utils.UsuarioTemp;
@Path("/cambiopass")
public class Cambiopass {
@Inject
private UsuarioON clienteON;
@POST
@Produces("application/json")
@Consumes("application/json")
public Respuesta transacciones( UsuarioTemp sesion) {
Respuesta r = new Respuesta();
try {
r = clienteON.cambioContrasenia(sesion);
} catch (Exception e) {
e.printStackTrace();
r.setCodigo(88);
r.setMensaje(e.getMessage());
}
return r;
}
}
| [
"62902977+farmijoss1995@users.noreply.github.com"
] | 62902977+farmijoss1995@users.noreply.github.com |
409715f33ffe9b6446ba53c2dd28bab5499e5c27 | 7ab6f4e52dd665714e244c6f34e08f1fd4ef3469 | /ciyuanplus2/app/src/main/java/com/ciyuanplus/mobile/net/parameter/RequestOrderListApiParameter.java | 65610400c053b9ddb2d4686e4719a787fb28be07 | [] | no_license | heqianqian0516/ciyuan | 2e9f8f84a1595317e8911cfece2e3f3919ebddeb | 44410726a8f7e4467f06fab1ae709451ef293b3b | refs/heads/master | 2020-07-11T04:11:24.935457 | 2019-11-06T03:37:45 | 2019-11-06T03:37:45 | 204,436,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | package com.ciyuanplus.mobile.net.parameter;
import com.ciyuanplus.mobile.manager.UserInfoData;
import com.ciyuanplus.mobile.net.ApiParamMap;
import com.ciyuanplus.mobile.net.ApiParameter;
/**
* Created by Alen on 2017/2/11.
*/
public class RequestOrderListApiParameter extends ApiParameter {
private final String merId;
private final String status;
private final String pager;
private final String pageSize;
private String userUuid;
public RequestOrderListApiParameter(String merId, String status, String pager, String pageSize) {
this.pager = pager;
this.pageSize = pageSize;
this.merId = merId;
this.status = status;
this.userUuid = UserInfoData.getInstance().getUserInfoItem().uuid;
}
@Override
public ApiParamMap buildExtraParameter() {
ApiParamMap map = new ApiParamMap();
map.put("pager", new ApiParamMap.ParamData(this.pager));
map.put("pageSize", new ApiParamMap.ParamData(this.pageSize));
map.put("merId", new ApiParamMap.ParamData(this.merId));
map.put("status", new ApiParamMap.ParamData(this.status));
map.put("userUuid", new ApiParamMap.ParamData(this.userUuid));
return map;
}
}
| [
"xixi0516@163.com"
] | xixi0516@163.com |
1a80093d9c9d9a02b164e7e23ba69fef5ff68405 | 66e239dcffdd6e5f451ca46bb21deabf6b73fc98 | /app/src/main/java/eugenio/nuc/SmoothiesSpinachSmoothie.java | 4727d03a60bb9e04a42f66f96418d6b4f7543c31 | [] | no_license | eugeniomorocho/NUC_WC300_Final_2.0 | 7202262bbf7b03f747267edc792d2265a617e3f5 | 509dab97863c73fcdca22da02a41196d695cba7c | refs/heads/master | 2021-09-04T03:43:11.202972 | 2018-01-15T12:24:19 | 2018-01-15T12:24:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package eugenio.nuc;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class SmoothiesSpinachSmoothie extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_smoothies_spinach_smoothie);
}
public void button_ready (View view){
Intent intent = new Intent(this, Settings.class);
startActivity(intent);
}
}
| [
"sf4e@outlook.com"
] | sf4e@outlook.com |
4c4b75ce84ebcc6f5ca7b4b1b55d44699d0e2d5c | a3308700e6e1025eaa28e001c1bdefa338097545 | /src/main/cn/xukai/kafka/producer/intercepter/CounterInterceptor.java | 17a0f0fb6ff224de118ed43d72390214b1c5e9e5 | [] | no_license | xukai5265/kafkaDemo | ab707a980ba94e671f60eb5d8f8a559277186071 | 1a12b0fe232ca6eedf0b026799945366026eac1a | refs/heads/master | 2020-12-02T22:50:20.313252 | 2017-11-30T03:17:27 | 2017-11-30T03:17:27 | 96,190,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package cn.xukai.kafka.producer.intercepter;
import org.apache.kafka.clients.producer.ProducerInterceptor;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import java.util.Map;
/**
* Created by kaixu on 2017/11/30.
* ็ไบง่
ๆฆๆชๅจ
* ๅจ็ไบง่
่ฐ็จๅ่ฐๅฝๆฐไนๅ็ๅค็
* ็ฎ็๏ผ่ฎฐๅฝๆถๆฏๅ้ๆๅๆฐ้ไธๅ้ๅคฑ่ดฅๆฐ้
*/
public class CounterInterceptor implements ProducerInterceptor {
private int errorCounter = 0;
private int successCounter = 0;
@Override
public ProducerRecord onSend(ProducerRecord producerRecord) {
return producerRecord;
}
@Override
public void onAcknowledgement(RecordMetadata recordMetadata, Exception e) {
if(e==null){
successCounter++;
}else {
errorCounter++;
}
}
@Override
public void close() {
// ไฟๅญ็ปๆ
System.out.println("Successful sent: " + successCounter);
System.out.println("Failed sent: " + errorCounter);
}
@Override
public void configure(Map<String, ?> map) {
}
}
| [
"xukai5265@126.com"
] | xukai5265@126.com |
1d512a7cd5585c537e5ccd222e26fcc2a7658db7 | 20f2cf3b7f8aab2f401534f57f25b663896977ba | /library/src/main/java/de/koandesign/recyclerbase/BindableView.java | 5fe64975ea9cc89ed3fb8de3111ac9ecebd285ac | [] | no_license | kihaki/recycler-base | c68be895a7d5c07bd7a53ea5ef8509169bed1349 | 5c5f53981a85bce5173e65b2be07b2ed5b8966f1 | refs/heads/master | 2021-01-19T01:05:56.796409 | 2016-08-17T21:16:13 | 2016-08-17T21:16:13 | 65,406,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package de.koandesign.recyclerbase;
import android.support.annotation.Nullable;
public interface BindableView<T> {
Class<T> getType();
void bind(@Nullable T item);
} | [
"kihaki@gmail.com"
] | kihaki@gmail.com |
2083309c76f4fe9a9e7ea1e7e7998da16dbad95b | 63924ac5510404afd1e97e83626b03b01debdc88 | /org.jkiss.utils/tests/removedTests/GetterNameTest.java | 89fe833a4d278fa83150a8135048370ec855056b | [] | no_license | rmishra92/SVT-Project1-T4 | e9a6d183fb014ce217e27ab19bf90c54e7044507 | c0815236f1c97b80d05e2578ac1cbdb4ff3efb6e | refs/heads/master | 2021-03-13T10:07:50.140606 | 2020-03-22T21:20:07 | 2020-03-22T21:20:07 | 246,668,009 | 0 | 0 | null | 2020-10-13T20:21:39 | 2020-03-11T19:59:21 | Java | UTF-8 | Java | false | false | 2,838 | java | package removedTests;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import org.jkiss.utils.BeanUtils;
import org.junit.Test;
public class GetterNameTest {
@Test(expected = NullPointerException.class)
public void isGetterNameThrowErrorIfInputIsInvalid() {
BeanUtils.isGetterName(null);
}
@Test
public void isGetterNameReturnFalseForNonGetterInput() {
String input = "notGetter";
assertFalse(BeanUtils.isGetterName(input));
}
@Test
public void isGetterNameReturnFalseForGetterInputStartsWithIs() {
String input = "isGetter";
assertTrue(BeanUtils.isGetterName(input));
}
@Test
public void iisGetterNameReturnFalseForGetterInputStartsWithGet() {
String input = "getGetter";
assertTrue(BeanUtils.isGetterName(input));
}
@Test
public void isGetterNameReturnFalseForGetterInputStartsWithHas() {
String input = "hasGetter";
assertTrue(BeanUtils.isGetterName(input));
}
@Test(expected = NullPointerException.class)
public void getSetterNameThrowErrorIfInputIsInvalid() {
BeanUtils.getSetterName(null);
}
@Test
public void getSetterNameReturnNullForNonGetterInput() {
String input = "notGetter";
assertNull(BeanUtils.getSetterName(input));
}
@Test
public void getSetterNameReturnPropertyForGetterInputStartsWithIs() {
String input = "isGetter";
assertEquals("setGetter", BeanUtils.getSetterName(input));
}
@Test
public void getSetterNameReturnPropertyForGetterInputStartsWithGet() {
String input = "getGetter";
assertEquals("setGetter", BeanUtils.getSetterName(input));
}
@Test
public void getSetterNameReturnPropertyForGetterInputStartsWithHas() {
String input = "hasGetter";
assertEquals("setGetter", BeanUtils.getSetterName(input));
}
@Test(expected = NullPointerException.class)
public void getPropertyNameThrowErrorIfInputIsInvalid() {
BeanUtils.getPropertyNameFromGetter(null);
}
@Test
public void getPropertyNameReturnNullForNonGetterInput() {
String input = "notGetter";
assertNull(BeanUtils.getPropertyNameFromGetter(input));
}
@Test
public void getPropertyNameReturnPropertyForGetterInputStartsWithIs() {
String input = "isGetter";
assertEquals("getter", BeanUtils.getPropertyNameFromGetter(input));
}
@Test
public void getPropertyNameReturnPropertyForGetterInputStartsWithGet() {
String input = "getGetter";
assertEquals("getter", BeanUtils.getPropertyNameFromGetter(input));
}
@Test
public void getPropertyNameReturnPropertyForGetterInputStartsWithHas() {
String input = "hasGetter";
assertEquals("getter", BeanUtils.getPropertyNameFromGetter(input));
}
}
| [
"yundanangel@outlook.com"
] | yundanangel@outlook.com |
6f36194265c736e7ab6597398800504fd85a2211 | a79d77856a2c0d97990dc25261978cc16e5697db | /src/event/presenter/EventPrompts.java | 51fd2d93dd0129f768be464402093ac768f7c59e | [] | no_license | tiffanietruong/conference-organizer | 822ec88bf6dc086a83d9733bfe5999df175a9925 | bf98fac4f74e89ae49f6f609d8744506abe0ac2c | refs/heads/main | 2023-08-21T05:12:04.663922 | 2021-10-11T22:35:47 | 2021-10-11T22:35:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,464 | java | package event.presenter;
/**
* This enum contains keys specifying the one-line text prompts
* that can be printed to console during interactions in <code>EventController</code>.
*/
public enum EventPrompts {
EVENT_TITLE_PROMPT,
EVENT_SPEAKER_PROMPT,
EVENT_HAS_SPEAKER,
SPEAKER_ALREADY_BOOKED,
SPEAKER_SUCCESSFULLY_ASSIGNED,
SPEAKER_SUCCESSFULLY_REMOVED,
NO_SUCH_SPEAKER_USERNAME,
EVENT_DATE_PROMPT,
EVENT_START_TIME_PROMPT,
EVENT_ROOM_ID_PROMPT,
EVENT_CAPACITY_PROMPT,
EVENT_DURATION_PROMPT,
EVENT_NOT_FOUND,
EVENTS_NOT_FOUND,
SPEAKER_NOT_FOR_EVENT,
SPEAKER_NOT_FOUND_IN_EVENT,
EVENT_EXISTS_ERROR,
NOT_REGISTERED_IN_EVENT,
EVENT_SCHEDULE_DISPLAYED,
EVENT_LIST_DISPLAYED,
EVENT_CREATION_SUCCESS,
ROOM_NOT_FOUND_ERROR,
INVALID_INPUT_DATE,
TIME_ERROR,
INVALID_ATTENDEE_CAPACITY_ERROR,
INVALID_SPEAKER_CAPACITY_ERROR,
INVALID_DURATION_ERROR,
INPUT_NOT_INT_ERROR,
EVENT_CAPACITY_TOO_LARGE_ERROR,
ROOM_IS_BOOKED,
SPEAKER_SCHEDULE_DISPLAYED,
SPEAKER_NOT_SCHEDULED,
INVALID_INPUT_TIME,
EVENT_DELETE_PROMPT1,
EVENT_DELETE_PROMPT2,
EVENT_DELETE_PROMPT3,
EVENT_DELETE_FAIL,
EVENT_SUCCESSFULLY_DELETED,
SPEAKER_CAPACITY_PROMPT,
SPEAKER_ADD_SUCCESS,
SPEAKER_ADD_ERROR,
EVENT_VIP_PROMPT,
EVENT_VIP_ERROR,
EVENT_VIP_SCHEDULE_DISPLAYED,
REVIEW_PROMPT,
REVIEW_SUCCESS,
NO_REVIEWS_ERROR
}
| [
"tiffanie.truong@hotmail.com"
] | tiffanie.truong@hotmail.com |
702c84ce2651bacb57f425ff0b340df719a535d5 | 4c1c7f4f6f1dc4e747342d002192058a220887ba | /src/main/java/de/hopp/generator/backends/unparser/CppUnparser.java | daa62030bddbd6440421f7b29a0bd71d7f45bbf9 | [] | no_license | VladimirRybalkin/msdlib.loopy | 2d05c9a77f10d1e458a02076a0ed90306ed1218a | aef0952b8e2b1e6df86db6cb3ce3209e4d2042a2 | refs/heads/master | 2021-01-22T02:04:03.700861 | 2013-08-08T09:09:31 | 2013-08-08T09:09:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,776 | java | package de.hopp.generator.backends.unparser;
import static de.hopp.generator.model.Model.PRIVATE;
import katja.common.NE;
import de.hopp.generator.exceptions.InvalidConstruct;
import de.hopp.generator.model.*;
/**
* C++ unparser. Generates C++ code out of the given model.
* Everything specifiable using the model will be unparsed.
* @author Thomas Fischer
*/
public class CppUnparser extends CUnparser {
/**
* Create a MFile unparser
* @param buffer the buffer to unparse into
* @param name file name where the buffer should be unparsed to
*/
public CppUnparser(StringBuffer buffer, String name) {
super(buffer, name);
}
@Override
protected String qualifiedName(MMethodInFile method) {
return method.Switch(new MMethodInFile.Switch<String, NE>() {
public String CaseMProcedureInFile(MProcedureInFile proc) {
if(proc.parent().parent() instanceof MFileInFile)
return proc.name().term();
else if(proc.parent().parent() instanceof MClassInFile)
return qualifiedName((MClassInFile)proc.parent().parent()) + "::" + proc.name().term();
throw new RuntimeException();
}
public String CaseMConstrInFile(MConstrInFile constr) {
String name = constr.parent().parent().name().term();
return name + "::" + name;
}
public String CaseMDestrInFile(MDestrInFile destr) {
String name = destr.parent().parent().name().term();
return name + "::~" + name;
}
});
}
@Override
protected String qualifiedName(MClassInFile mclass) {
if(mclass.parent().parent() instanceof MFileInFile)
return mclass.name().term();
else if(mclass.parent().parent() instanceof MClassInFile)
return qualifiedName((MClassInFile)mclass.parent().parent()) + "::" + mclass.name().term();
throw new RuntimeException();
}
@Override
public void visit(MClassesInFile classes) throws InvalidConstruct {
if(classes.size() > 0) {
// unparse "private" classes first
for(MClassInFile mclass : filter(classes, PRIVATE()))
visit(mclass);
// unparse "public" classes afterwards
for(MClassInFile mclass : classes.removeAll(filter(classes, PRIVATE()).term()))
visit(mclass);
buffer.append('\n');
}
}
@Override
public void visit(MClassInFile mclass) throws InvalidConstruct {
visit(mclass.methods());
visit(mclass.nested());
}
@Override
public void visit(MVoidInFile mvoid) { buffer.append("void"); }
// @Override
// public void visit(MInitInFile init) {
// visit(init.con());
// visit(init.vals());
// }
@Override
public void visit(MMemberInitsInFile inits) {
if(!inits.isEmpty()) {
buffer.append(" : ");
for(MMemberInitInFile init : inits) visit(init);
}
}
@Override
public void visit(MInitListInFile list) {
buffer.append('(');
for(StringInFile s : list.params()) {
if(s.position() != 0) buffer.append(", ");
buffer.append(s.term());
}
buffer.append(')');
}
//
// public void visit(MConstrInFile constr) throws InvalidConstruct {
// visit(constr.doc());
// super.visit(constr);
// }
//
// public void visit(MDestrInFile destr) throws InvalidConstruct {
// visit(destr.doc());
// super.visit(destr);
// }
//
// @Override
// Do not unparse attributes in sourcefile
// public void visit(MAttributesInFile attributes) { }
}
| [
"t_fish@cs.uni-kl.de"
] | t_fish@cs.uni-kl.de |
25c0d34b5b8b65488632fa0e9b34094b946f2aa1 | f3e93d74afd29f8b66ec8c637fd2fd42e5666352 | /src/main/java/com/blog/web/CommentController.java | d9bd382c122a4e0ec3e7e317b75d5ca1664d92c2 | [] | no_license | LiuToJian/blog | a260693f2c1afd053592b9d40fb95abdf75d9156 | fa013deca563b11fc19d85bc27034b6462f9c7f1 | refs/heads/master | 2022-11-30T00:45:44.500736 | 2020-08-12T03:42:20 | 2020-08-12T03:42:20 | 286,904,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,636 | java | package com.blog.web;
import com.blog.entity.Comment;
import com.blog.entity.User;
import com.blog.service.BlogService;
import com.blog.service.CommentServiceDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import javax.servlet.http.HttpSession;
@Controller
public class CommentController {
@Autowired
CommentServiceDao commentServiceDao;
@Autowired
BlogService blogService;
@Value("${comment.avatar}")
String avatar;
@GetMapping("/comments/{blogId}")
public String commentList(@PathVariable Integer blogId, Model model) {
model.addAttribute("comments", commentServiceDao.listCommentByBlogId(blogId));
return "blog::commentList";
}
@PostMapping("/comments")
public String post(Comment comment, HttpSession session) {
Integer blogId = comment.getBlog().getId();
comment.setBlog(blogService.getBlog(blogId));
User user = (User) session.getAttribute("user");
if (user != null) {
comment.setAvatar(user.getAvatar());
comment.setAdminComment(true);
/* comment.setNickname(user.getNickname());*/
} else {
comment.setAvatar(avatar);
}
commentServiceDao.saveComment(comment);
return "redirect:/comments/" + blogId;
}
}
| [
"1929696300@qq.com"
] | 1929696300@qq.com |
999d066dce0b4d7be0e191ba6f67d88a47d72167 | fdac29341ee82f0b6080af618be084a9dd64735a | /FiapMetro/app/src/main/java/br/com/tairoroberto/fiapmetro/api/MetroApi.java | 0c4d5d6ca776073e739e4f63bb46d85831802846 | [] | no_license | tairoroberto/Android_FIAP | ffdb6b4ffc028fa2a04211e1d76abdef5fef3a86 | e9b4afca7f7a0631613e96e65576a57d25d482f8 | refs/heads/master | 2021-05-11T19:47:43.099925 | 2018-01-17T20:23:36 | 2018-01-17T20:23:36 | 117,888,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package br.com.tairoroberto.fiapmetro.api;
import java.util.List;
import br.com.tairoroberto.fiapmetro.model.Estacao;
import br.com.tairoroberto.fiapmetro.model.LinhaMetro;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
/**
* Created by logonrm on 26/06/2017.
*/
public interface MetroApi {
@GET("/linhas")
Call<List<LinhaMetro>> consultarLinhasMetro();
@GET("/linhas/{linha}/estacoes")
rx.Observable<List<Estacao>> consultarEstacaoes(@Path("linha") String linha);
}
| [
"tairoroberto@hotmail.com"
] | tairoroberto@hotmail.com |
8d2061b5c5c35ff1c27ae3e9952e827e4764a91c | 364bd91497a498b899c1de60e1ff028795eddbbc | /02Benchmarks/Openj9Test-Test/src/javaT/nio/channels/AsynchronousSocketChannel/StressLoopback.java | 74daee42aa9e6fe8773a02c05a6c34d13628863e | [] | no_license | JavaTailor/CFSynthesis | 8485f5d94cec335bedfdf18c88ddc523e05a0567 | bf9421fea49469fbac554da91169cf07aae3e08c | refs/heads/master | 2023-04-15T02:37:04.252151 | 2021-11-12T09:57:06 | 2021-11-12T09:57:06 | 402,928,654 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,415 | java | package javaT.nio.channels.AsynchronousSocketChannel;
/*
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 6834246 6842687 8133647
* @summary Stress test connections through the loopback interface
* @run main StressLoopback
* @run main/othervm -Djdk.net.useFastTcpLoopback StressLoopback
* @key randomness
*/
import java.nio.ByteBuffer;
import java.net.*;
import java.nio.channels.*;
import java.util.Random;
import java.io.IOException;
public class StressLoopback {
static final Random rand = new Random();
public static void main(String[] args) throws Exception {
// setup listener
AsynchronousServerSocketChannel listener =
AsynchronousServerSocketChannel.open().bind(new InetSocketAddress(0));
int port =((InetSocketAddress)(listener.getLocalAddress())).getPort();
InetAddress lh = InetAddress.getLocalHost();
SocketAddress remote = new InetSocketAddress(lh, port);
// create sources and sinks
int count = 2 + rand.nextInt(9);
Source[] source = new Source[count];
Sink[] sink = new Sink[count];
for (int i=0; i<count; i++) {
AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
ch.connect(remote).get();
source[i] = new Source(ch);
sink[i] = new Sink(listener.accept().get());
}
// start the sinks and sources
for (int i=0; i<count; i++) {
sink[i].start();
source[i].start();
}
// let the test run for a while
Thread.sleep(20*1000);
// wait until everyone is done
boolean failed = false;
long total = 0L;
for (int i=0; i<count; i++) {
long nwrote = source[i].finish();
long nread = sink[i].finish();
if (nread != nwrote)
failed = true;
System.out.format("%d -> %d (%s)\n",
nwrote, nread, (failed) ? "FAIL" : "PASS");
total += nwrote;
}
if (failed)
throw new RuntimeException("Test failed - see log for details");
System.out.format("Total sent %d MB\n", total / (1024L * 1024L));
}
/**
* Writes bytes to a channel until "done". When done the channel is closed.
*/
static class Source {
private final AsynchronousByteChannel channel;
private final ByteBuffer sentBuffer;
private volatile long bytesSent;
private volatile boolean finished;
Source(AsynchronousByteChannel channel) {
this.channel = channel;
int size = 1024 + rand.nextInt(10000);
this.sentBuffer = (rand.nextBoolean()) ?
ByteBuffer.allocateDirect(size) : ByteBuffer.allocate(size);
}
void start() {
sentBuffer.position(0);
sentBuffer.limit(sentBuffer.capacity());
channel.write(sentBuffer, (Void)null, new CompletionHandler<Integer,Void> () {
public void completed(Integer nwrote, Void att) {
bytesSent += nwrote;
if (finished) {
closeUnchecked(channel);
} else {
sentBuffer.position(0);
sentBuffer.limit(sentBuffer.capacity());
channel.write(sentBuffer, (Void)null, this);
}
}
public void failed(Throwable exc, Void att) {
exc.printStackTrace();
closeUnchecked(channel);
}
});
}
long finish() {
finished = true;
waitUntilClosed(channel);
return bytesSent;
}
}
/**
* Read bytes from a channel until EOF is received.
*/
static class Sink {
private final AsynchronousByteChannel channel;
private final ByteBuffer readBuffer;
private volatile long bytesRead;
Sink(AsynchronousByteChannel channel) {
this.channel = channel;
int size = 1024 + rand.nextInt(10000);
this.readBuffer = (rand.nextBoolean()) ?
ByteBuffer.allocateDirect(size) : ByteBuffer.allocate(size);
}
void start() {
channel.read(readBuffer, (Void)null, new CompletionHandler<Integer,Void> () {
public void completed(Integer nread, Void att) {
if (nread < 0) {
closeUnchecked(channel);
} else {
bytesRead += nread;
readBuffer.clear();
channel.read(readBuffer, (Void)null, this);
}
}
public void failed(Throwable exc, Void att) {
exc.printStackTrace();
closeUnchecked(channel);
}
});
}
long finish() {
waitUntilClosed(channel);
return bytesRead;
}
}
static void waitUntilClosed(Channel c) {
while (c.isOpen()) {
try {
Thread.sleep(100);
} catch (InterruptedException ignore) { }
}
}
static void closeUnchecked(Channel c) {
try {
c.close();
} catch (IOException ignore) { }
}
}
| [
"JavaTailorZYQ@gmail.com"
] | JavaTailorZYQ@gmail.com |
5a79d947db44acb9daebf6004993299b3e6ee87b | 82c73b14ca77a4e36976aab39d3a406faad399d1 | /app/src/main/java/com/merrichat/net/activity/groupmarket/MarketActivity.java | b5cf33949f2bb5c1b9610509beede3789048b542 | [] | no_license | AndroidDeveloperRaj/aaaaa | ab85835b3155ebe8701085560c550a676098736d | e6733ab804168065926f41b7e8723e0d92cd1682 | refs/heads/master | 2020-03-25T11:19:48.899989 | 2018-05-10T05:53:07 | 2018-05-10T05:53:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,459 | java | package com.merrichat.net.activity.groupmarket;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.merrichat.net.R;
import com.merrichat.net.activity.BaseActivity;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* ็พคๅธๅบ๏ผๆถๅใๆ่ฆไนฐใๅใๆ่ฆๅใ๏ผ
* Created by amssy on 18/1/18.
*/
public class MarketActivity extends BaseActivity {
@BindView(R.id.iv_back)
ImageView ivBack;
@BindView(R.id.tv_title_text)
TextView tvTitleText;
@BindView(R.id.viewPager_market)
ViewPager viewPagerMarket;
private ArrayList<Fragment> list;
private BuyMarketFragment buyMarketFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_market);
ButterKnife.bind(this);
initView();
}
private void initView() {
tvTitleText.setText("็พคๅธๅบ");
buyMarketFragment = new BuyMarketFragment();
list = new ArrayList<>();
list.add(buyMarketFragment);
FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return list.get(position);
}
@Override
public int getCount() {
return list.size();
}
};
viewPagerMarket.setAdapter(adapter);
viewPagerMarket.setCurrentItem(0);
viewPagerMarket.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
viewPagerMarket.setCurrentItem(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
@OnClick({R.id.iv_back})
public void onViewClick(View view){
switch (view.getId()){
case R.id.iv_back:
finish();
break;
}
}
}
| [
"309672235@qq.com"
] | 309672235@qq.com |
55eefaa5f83131c18d348348ce0622127d5d2f17 | 11ad578975cc420895ab01c67b784827eba6d0a3 | /app/src/test/java/dozapps/com/distancecalculator/ExampleUnitTest.java | 62ea90261b3ec75d5a2a48b309f81e4a6babdad4 | [] | no_license | Vaironl/DistanceCalculator | d035ced5d78113a6469e1239fedda610815aac0e | d772c15bd67e93b2a6238c8ce4cd7cf73dcf9547 | refs/heads/master | 2020-07-04T00:58:22.373123 | 2016-11-19T16:58:16 | 2016-11-19T16:58:16 | 74,222,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package dozapps.com.distancecalculator;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"vairon@live.com"
] | vairon@live.com |
2d704043a9b89d77f0386cd437324ec3c1be95b5 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_4a27806cef1297fcb6fc37ee47641f488483c948/RecordsSidePanel/11_4a27806cef1297fcb6fc37ee47641f488483c948_RecordsSidePanel_t.java | d60f9b883949be6fb3b80f4aad864eca291f11de | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,133 | java | package edu.brown.cs32.MFTG.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import edu.brown.cs32.MFTG.tournament.Record;
public class RecordsSidePanel extends JPanel{
private JLabel _numMatches, _numMatchesWon, _numSets, _numSetsWon, _numGames, _numGamesWon, _numTurnsTaken;
private JLabel _matchWinningPercentage, _setWinningPercentage, _gameWinningPercentage;
private JLabel _numMatchesRecord, _numMatchesWonRecord, _numSetsRecord, _numSetsWonRecord, _numGamesRecord, _numGamesWonRecord, _numTurnsTakenRecord;
private JLabel _matchWinningPercentageRecord, _setWinningPercentageRecord, _gameWinningPercentageRecord;
public RecordsSidePanel() {
this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE);
this.setBorder(new EmptyBorder(3,3,3,3));
JPanel topPanel = new JPanel();
topPanel.setBackground(Color.WHITE);
JLabel header= new JLabel("Records for this Profile");
topPanel.add(header);
_numMatches = new JLabel("Number of Matches: ");
_numMatchesRecord = new JLabel("");
_numMatchesWon = new JLabel("Number of Matches Won: ");
_numMatchesWonRecord = new JLabel("");
_matchWinningPercentage = new JLabel("Percentage of Matches Won: ");
_matchWinningPercentageRecord = new JLabel("");
JLabel break1 = new JLabel("");
JLabel break2 = new JLabel("");
_numSets = new JLabel("Number of Sets: ");
_numSetsRecord = new JLabel("");
_numSetsWon = new JLabel("Number of Sets Won: ");
_numSetsWonRecord = new JLabel("");
_setWinningPercentage = new JLabel("Percentage of Sets Won: ");
_setWinningPercentageRecord = new JLabel("");
JLabel break3 = new JLabel("");
JLabel break4 = new JLabel("");
_numGames = new JLabel("Number of Games: ");
_numGamesRecord = new JLabel("");
_numGamesWon = new JLabel("Number of Games Won: ");
_numGamesWonRecord = new JLabel("");
_gameWinningPercentage = new JLabel("Percentage of Games Won: ");
_gameWinningPercentageRecord = new JLabel("");
JPanel leftPanel = new JPanel();
leftPanel.setLayout(new GridLayout(0,1));
leftPanel.setBackground(Color.WHITE);
JPanel rightPanel = new JPanel();
rightPanel.setLayout(new GridLayout(0,1));
rightPanel.setBackground(Color.WHITE);
leftPanel.add(_numMatches);
rightPanel.add(_numMatchesRecord);
leftPanel.add(_numMatchesWon);
rightPanel.add(_numMatchesWonRecord);
leftPanel.add(_matchWinningPercentage);
rightPanel.add(_matchWinningPercentageRecord);
leftPanel.add(break1);
rightPanel.add(break2);
leftPanel.add(_numSets);
rightPanel.add(_numSetsRecord);
leftPanel.add(_numSetsWon);
rightPanel.add(_numSetsWonRecord);
leftPanel.add(_setWinningPercentage);
rightPanel.add(_setWinningPercentageRecord);
leftPanel.add(break3);
rightPanel.add(break4);
leftPanel.add(_numGames);
rightPanel.add(_numGamesRecord);
leftPanel.add(_numGamesWon);
rightPanel.add(_numGamesWonRecord);
leftPanel.add(_gameWinningPercentage);
rightPanel.add(_gameWinningPercentageRecord);
this.add(topPanel, BorderLayout.NORTH);
this.add(leftPanel,BorderLayout.WEST);
this.add(rightPanel,BorderLayout.EAST);
}
/**
* sets text based on a record
* @param r
*/
public void setRecords(Record r) {
if(r==null) {
return;
}
_numMatchesRecord.setText(String.valueOf(r.getNumMatches()));
_numMatchesWonRecord.setText(String.valueOf(r.getNumMatchesWon()));
_matchWinningPercentageRecord.setText(String.format("%.3f", r.getMatchWinningPercentage()));
_numSetsRecord.setText(String.valueOf(r.getNumSets()));
_numSetsWonRecord.setText(String.valueOf(r.getNumSetsWon()));
_setWinningPercentageRecord.setText(String.format("%.3f", r.getSetWinningPercentage()));
_numGamesRecord.setText(String.valueOf(r.getNumGames()));
_numGamesWonRecord.setText(String.valueOf(r.getNumGamesWon()));
_gameWinningPercentageRecord.setText(String.format("%.3f", r.getGameWinningPercentage()));
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b5918992d4c1c4dd240d3e76a948463ef04e09c3 | 26a36be2e1ec68a304a1235d73ea75f4813443cf | /moxm-utils/src/main/java/com/moxm/frameworks/utils/ListUtils.java | 2227ad37c159482cbe2202519847831eafdae742 | [
"MIT"
] | permissive | moxm/moxm-frameworks | f28a998807583e04c1eb0065604c802f983c5492 | a13ecccc8127b9b4893aa21ae6fe51eb8db8075d | refs/heads/master | 2021-01-21T15:31:47.281312 | 2020-12-02T01:47:00 | 2020-12-02T01:47:00 | 36,721,135 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,138 | java | package com.moxm.frameworks.utils;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.List;
/**
* List Utils
*
* @author <a href="http://www.moxm.com" target="_blank">Moxm</a> 2011-7-22
*/
public class ListUtils {
/** default join separator **/
public static final String DEFAULT_JOIN_SEPARATOR = ",";
private ListUtils() {
throw new AssertionError();
}
/**
* get size of list
*
* <pre>
* getSize(null) = 0;
* getSize({}) = 0;
* getSize({1}) = 1;
* </pre>
*
* @param <V>
* @param sourceList
* @return if list is null or empty, return 0, else return {@link List#size()}.
*/
public static <V> int getSize(List<V> sourceList) {
return sourceList == null ? 0 : sourceList.size();
}
/**
* is null or its size is 0
*
* <pre>
* isEmpty(null) = true;
* isEmpty({}) = true;
* isEmpty({1}) = false;
* </pre>
*
* @param <V>
* @param sourceList
* @return if list is null or its size is 0, return true, else return false.
*/
public static <V> boolean isEmpty(List<V> sourceList) {
return (sourceList == null || sourceList.size() == 0);
}
/**
* compare two list
*
* <pre>
* isEquals(null, null) = true;
* isEquals(new ArrayList<String>(), null) = false;
* isEquals(null, new ArrayList<String>()) = false;
* isEquals(new ArrayList<String>(), new ArrayList<String>()) = true;
* </pre>
*
* @param <V>
* @param actual
* @param expected
* @return
*/
public static <V> boolean isEquals(ArrayList<V> actual, ArrayList<V> expected) {
if (actual == null) {
return expected == null;
}
if (expected == null) {
return false;
}
if (actual.size() != expected.size()) {
return false;
}
for (int i = 0; i < actual.size(); i++) {
if (!ObjectUtils.isEquals(actual.get(i), expected.get(i))) {
return false;
}
}
return true;
}
/**
* join list to string, separator is ","
*
* <pre>
* join(null) = "";
* join({}) = "";
* join({a,b}) = "a,b";
* </pre>
*
* @param list
* @return join list to string, separator is ",". if list is empty, return ""
*/
public static String join(List<String> list) {
return join(list, DEFAULT_JOIN_SEPARATOR);
}
/**
* join list to string
*
* <pre>
* join(null, '#') = "";
* join({}, '#') = "";
* join({a,b,c}, ' ') = "abc";
* join({a,b,c}, '#') = "a#b#c";
* </pre>
*
* @param list
* @param separator
* @return join list to string. if list is empty, return ""
*/
public static String join(List<String> list, char separator) {
return join(list, new String(new char[] {separator}));
}
/**
* join list to string. if separator is null, use {@link #DEFAULT_JOIN_SEPARATOR}
*
* <pre>
* join(null, "#") = "";
* join({}, "#$") = "";
* join({a,b,c}, null) = "a,b,c";
* join({a,b,c}, "") = "abc";
* join({a,b,c}, "#") = "a#b#c";
* join({a,b,c}, "#$") = "a#$b#$c";
* </pre>
*
* @param list
* @param separator
* @return join list to string with separator. if list is empty, return ""
*/
public static String join(List<String> list, String separator) {
return list == null ? "" : TextUtils.join(separator, list);
}
/**
* add distinct entry to list
*
* @param <V>
* @param sourceList
* @param entry
* @return if entry already exist in sourceList, return false, else add it and return true.
*/
public static <V> boolean addDistinctEntry(List<V> sourceList, V entry) {
return (sourceList != null && !sourceList.contains(entry)) ? sourceList.add(entry) : false;
}
/**
* add all distinct entry to list1 from list2
*
* @param <V>
* @param sourceList
* @param entryList
* @return the count of entries be added
*/
public static <V> int addDistinctList(List<V> sourceList, List<V> entryList) {
if (sourceList == null || isEmpty(entryList)) {
return 0;
}
int sourceCount = sourceList.size();
for (V entry : entryList) {
if (!sourceList.contains(entry)) {
sourceList.add(entry);
}
}
return sourceList.size() - sourceCount;
}
/**
* remove duplicate entries in list
*
* @param <V>
* @param sourceList
* @return the count of entries be removed
*/
public static <V> int distinctList(List<V> sourceList) {
if (isEmpty(sourceList)) {
return 0;
}
int sourceCount = sourceList.size();
int sourceListSize = sourceList.size();
for (int i = 0; i < sourceListSize; i++) {
for (int j = (i + 1); j < sourceListSize; j++) {
if (sourceList.get(i).equals(sourceList.get(j))) {
sourceList.remove(j);
sourceListSize = sourceList.size();
j--;
}
}
}
return sourceCount - sourceList.size();
}
/**
* add not null entry to list
*
* @param sourceList
* @param value
* @return <ul>
* <li>if sourceList is null, return false</li>
* <li>if value is null, return false</li>
* <li>return {@link List#add(Object)}</li>
* </ul>
*/
public static <V> boolean addListNotNullValue(List<V> sourceList, V value) {
return (sourceList != null && value != null) ? sourceList.add(value) : false;
}
/**
* @see {@link ArrayUtils#getLast(Object[], Object, Object, boolean)} defaultValue is null, isCircle is true
*/
@SuppressWarnings("unchecked")
public static <V> V getLast(List<V> sourceList, V value) {
return (sourceList == null) ? null : (V)ArrayUtils.getLast(sourceList.toArray(), value, true);
}
/**
* @see {@link ArrayUtils#getNext(Object[], Object, Object, boolean)} defaultValue is null, isCircle is true
*/
@SuppressWarnings("unchecked")
public static <V> V getNext(List<V> sourceList, V value) {
return (sourceList == null) ? null : (V)ArrayUtils.getNext(sourceList.toArray(), value, true);
}
/**
* invert list
*
* @param <V>
* @param sourceList
* @return
*/
public static <V> List<V> invertList(List<V> sourceList) {
if (isEmpty(sourceList)) {
return sourceList;
}
List<V> invertList = new ArrayList<V>(sourceList.size());
for (int i = sourceList.size() - 1; i >= 0; i--) {
invertList.add(sourceList.get(i));
}
return invertList;
}
}
| [
"xiangli.ma@newtouch.cn"
] | xiangli.ma@newtouch.cn |
c7fccb5685674a24e34a09b297d1d1e1c5c4bde2 | 72f2719ce5dc554ef4f51747fe919dfdc56bd4a0 | /backend/src/main/java/com/highform/datastore/db/cassandra/cql/CQLIndexCmdBuilder.java | 1f4d965df43791355bec44d3444a3b8235f24e30 | [
"Apache-2.0"
] | permissive | fei-chen/AmberAlert | f40f8938bd3bac2b4aaf6f21c01ce16eec9df90b | 87921f9e044dc5372e268bafd822b9eaf4599942 | refs/heads/master | 2022-11-03T23:13:26.354723 | 2015-08-07T20:53:19 | 2015-08-07T20:53:19 | 39,152,666 | 0 | 0 | Apache-2.0 | 2022-10-04T23:44:39 | 2015-07-15T18:06:20 | Java | UTF-8 | Java | false | false | 2,067 | java | package com.highform.datastore.db.cassandra.cql;
import org.apache.commons.lang.StringUtils;
import com.highform.datastore.db.IndexCmdBuilder;
import com.google.common.base.Preconditions;
public class CQLIndexCmdBuilder implements IndexCmdBuilder {
/**
* Operator represents the operators
*/
public enum Operator {
DROP("DROP"),
CREATE("CREATE");
private final String opStr;
private Operator(String opStr) {
this.opStr = opStr;
}
@Override
public String toString() { return this.opStr; }
}
// create index on <table> (<column>);
// drop index on <table>_<column>_idx;
private Operator op;
private String table;
private String column;
private CQLIndexCmdBuilder(Operator op) {
this.op = op;
}
/**
* Generate a CQLIndexCmdBuilder with CREATE operator
*/
public static CQLIndexCmdBuilder create() {
return new CQLIndexCmdBuilder(Operator.CREATE);
}
/**
* Generate a CQLIndexCmdBuilder with DROP operator
*/
public static CQLIndexCmdBuilder drop() {
return new CQLIndexCmdBuilder(Operator.DROP);
}
@Override
public String build() {
// if the command is not valid, return empty string
String cmd = "";
if (this.isValid()) {
String onClause = "";
switch(this.op) {
case CREATE:
onClause = " INDEX ON " + this.table + " (" + this.column + ")";
break;
case DROP:
onClause = " INDEX " + this.table + "_" + this.column + "_idx";
break;
}
cmd = this.op.toString() + onClause + ";";
}
return cmd;
}
@Override
public boolean isValid() {
return StringUtils.isNotBlank(this.table) && StringUtils.isNotBlank(this.column);
}
@Override
public IndexCmdBuilder table(String table) {
Preconditions.checkArgument(StringUtils.isNotBlank(table));
this.table = table;
return this;
}
@Override
public IndexCmdBuilder column(String column) {
Preconditions.checkArgument(StringUtils.isNotBlank(column));
this.column = column;
return this;
}
}
| [
"fei@highform.com"
] | fei@highform.com |
f22ce5d8fa10dc2b8e95823946157ec90a1ccd2e | bec0ff4f2e94def3c3b6bc4a66d632c1c1e822b6 | /core/src/com/dontmiss/GameInput.java | fc1cea2f17c266f526edb69d56c71720d9cfb7da | [] | no_license | MattRychtarczyk/DontMiss | 15cc94aa8f32c14c9c1a40bb9b69393c2b4aba6c | 299e7491f46962d326902c0681452683beac07f9 | refs/heads/master | 2020-12-24T14:26:35.414480 | 2014-05-30T11:38:14 | 2014-05-30T11:38:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | package com.dontmiss;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Input.Keys;
import com.dontmiss.display.PlayDisplay;
public class GameInput implements InputProcessor
{
private PlayDisplay playDisplay;
public GameInput(PlayDisplay playDisplay)
{
this.playDisplay = playDisplay;
}
@Override
public boolean keyDown(int keycode)
{
return false;
}
@Override
public boolean keyUp(int keycode)
{
if(keycode == Keys.P&&(!playDisplay.isPaused()))
playDisplay.setPaused(true);
else if(keycode == Keys.P&&(playDisplay.isPaused()))
playDisplay.setPaused(false);
if(keycode==Keys.G);
playDisplay.setRateFire(.000000000001f);
return false;
}
@Override
public boolean keyTyped(char character)
{
return false;
}
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button)
{
return false;
}
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button)
{
if(playDisplay.getRateFireCounter()>=playDisplay.getRateFire())
playDisplay.createProjectiles();
return false;
}
@Override
public boolean touchDragged(int screenX, int screenY, int pointer)
{
return false;
}
@Override
public boolean mouseMoved(int screenX, int screenY)
{
return false;
}
@Override
public boolean scrolled(int amount)
{
return false;
}
}
| [
"bayanijulian@gmail.com"
] | bayanijulian@gmail.com |
2ec3115b1cab19975c6d3331c49d9a09129427bf | 040f1cb6fb373433d3849b189e21b9c244ceea72 | /Lab_7/project/TEST/EXERCISE1/src/UserTest.java | 6f4b372b00bd1b75fd000c318b6e1efbb20566f4 | [] | no_license | dreamking60/SUSTech_CS102A | 148ffd49865e487151333f64fbaeeb2e1573fc7a | fb6a274412a5d5b26ff69e0caffb498e9e99eead | refs/heads/master | 2023-05-02T00:04:43.574024 | 2021-05-18T03:24:07 | 2021-05-18T03:24:07 | 368,385,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | import java.util.Scanner;
public class UserTest {
public static void main(String[] args) {
User user = new User();
Scanner in = new Scanner(System.in);
user.setUser("Lucy");
user.setPassword("123456");
user.setMoney(1000);
user.introduce();
user.expense(2000,in);
user.expense(500,in);
user.income(1000);
user.introduce();
in.close();
}
}
| [
"61385974+dreamking60@users.noreply.github.com"
] | 61385974+dreamking60@users.noreply.github.com |
4e0e4679bcf1629916299c6f210629bbb5626c59 | 0de83203000285adc959780e5620149128a0d863 | /src/main/java/leetcode/_990_SatisfiabilityOfEqualityEquations.java | 069fe4c22aa4efb518b42752f33682a94da9cda8 | [] | no_license | balkrishan333/problems-implementation | 7e5dbe709ada3090eb65a676fbcc15c881be3ed5 | 5b157aa5346f7c6c630555c93b10518204589596 | refs/heads/master | 2023-08-31T00:57:26.906284 | 2023-08-30T14:49:11 | 2023-08-30T14:49:11 | 236,116,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,735 | java | package leetcode;
public class _990_SatisfiabilityOfEqualityEquations {
public static void main(String[] args) {
_990_SatisfiabilityOfEqualityEquations obj = new _990_SatisfiabilityOfEqualityEquations();
String[] equations = {"a==b","b==a"};
System.out.println(obj.equationsPossible(equations));
}
public boolean equationsPossible(String[] equations) {
//use union-find algorithm
//step 0: initialize set, each variable has its own set
int[] ids = new int[26]; // since variables are lowercase letters
for (int i = 0; i < 26; i++) {
ids[i] = i;
}
//step 1: for all equality equations put variables in same group
for(String equation : equations) {
if (equation.charAt(1) == '=') {
int leftGrp = find(equation.charAt(0)-'a', ids);
int rightGrp = find(equation.charAt(3)-'a', ids);
if (leftGrp != rightGrp) {
ids[rightGrp] = leftGrp;
}
}
}
//step 2: for all inequality equations, check of variables are in same group
// if yes, return false
for(String equation : equations) {
if (equation.charAt(1) == '!') {
int leftGrp = find(equation.charAt(0)-'a', ids);
int rightGrp = find(equation.charAt(3)-'a', ids);
if (leftGrp == rightGrp) {
return false;
}
}
}
//step3: return true
return true;
}
private int find(int var, int[] ids) {
if(ids[var] == var) {
return var;
}
return find(ids[var], ids);
}
}
| [
"balkrishan.nagpal@optum.com"
] | balkrishan.nagpal@optum.com |
93d5474aa6e7a167247451faa2c751aa81fb3f74 | c1c70dda6d073d85900cb47e856a6b9f456fade0 | /app/src/main/java/com/example/week1/Adapter/AutoScrollAdapter.java | 04a70e4bd8d19f038b74e0865c6ab37b434d0ca5 | [] | no_license | ag502/MadCamp_1 | f9fb92dcffc0223a3c795221b2bfae1255a9b3d9 | 36767672c9d0663fb9f2b29dec3f0a812c5f6ecd | refs/heads/master | 2020-11-30T10:20:07.707755 | 2020-01-03T07:27:00 | 2020-01-03T07:27:00 | 230,258,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,556 | java | package com.example.week1.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.viewpager.widget.PagerAdapter;
import com.bumptech.glide.Glide;
import com.example.week1.R;
import java.util.ArrayList;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
public class AutoScrollAdapter extends PagerAdapter {
Context context;
ArrayList<String> data;
public AutoScrollAdapter(Context context, ArrayList<String> data) {
this.context = context;
this.data = data;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
//๋ทฐํ์ด์ง ์ฌ๋ผ์ด๋ฉ ํ ๋ ์ด์์ ์ธํ๋ ์ด์
LayoutInflater inflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.auto_viewpager,null);
ImageView image_container = (ImageView) v.findViewById(R.id.image_container);
int realpos = position % 5;
Glide.with(context).load(data.get(position)).into(image_container);
container.addView(v);
return v;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View)object);
}
@Override
public int getCount() {
return data.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}
| [
"kksan07@kaist.ac.kr"
] | kksan07@kaist.ac.kr |
78eaf88a12ed459c3f5961ad3151a2819b725e7c | b2231c6687c7e7dd25b2fb36b26843d783a55872 | /src/main/java/com/demo/needmanage/service/InstructorService.java | dcb74344044d9c2e8dcbc9003be16955887c68b7 | [] | no_license | wangronghui97/manage | abffcf1d9bd33903dfe51dcb48ab6cc499ae0d21 | bbb9e07054dd7c248ea2111847023be519061be4 | refs/heads/master | 2020-06-05T09:50:57.750596 | 2019-06-17T18:52:29 | 2019-06-17T18:52:29 | 192,399,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 710 | java | package com.demo.needmanage.service;
import com.demo.needmanage.dto.AdminDto;
import com.demo.needmanage.dto.ListDto;
import com.demo.needmanage.dto.LoginResponse;
import com.demo.needmanage.dto.ResponeCode;
import com.demo.needmanage.entity.Instructor;
public interface InstructorService {
ResponeCode addInsructor(Instructor instructor);
ResponeCode<ListDto<Instructor>> getInstructors(Integer offset, Integer limit,String number);
ResponeCode deleteInstructor(Integer id);
ResponeCode modifyInstructor(Instructor instructor);
ResponeCode<LoginResponse<Instructor>> modifyInstructorByInstructor(Instructor instructor);
public ResponeCode modifyPassword(AdminDto adminDto);
}
| [
"1615630473@qq.com"
] | 1615630473@qq.com |
35e99aa0cd43d5afbd8dd8718e43d1a8a63aa0bc | 18848693a288066b3092d4f8ec03ab5d7bb373a9 | /src/service/IUserService.java | a365bac2ca4a42391c5b9ca1afdaca42d72372dc | [] | no_license | 761710244/Spring01 | 19be717e359e5a13294f933483e8549ffd9221f0 | ebe8118eb5547c764ba488fed18783a22bc832c2 | refs/heads/main | 2023-02-03T17:27:03.326845 | 2020-12-18T14:43:44 | 2020-12-18T14:43:44 | 322,597,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 72 | java | package service;
public interface IUserService {
void getUser();
}
| [
"1596454155@qq.com"
] | 1596454155@qq.com |
72ca03ce61880413e1a0efc877927cde31033597 | 8b1f4ad6f32c57138d2e17197c3b0b894dcc044c | /app/src/main/java/com/example/gseviepenyewa/MODEL/Komentar.java | 40871c8e547a6a1f6993487a6361b9976dd2690e | [] | no_license | mita-sdama/Android-Penyewa-GSevie | b9f4cb81011232845b2fa13bac0ca6e03d3cc808 | 98b66fec76d2b352d624ebe0ccb456f73c2cd758 | refs/heads/master | 2020-12-11T23:50:00.625622 | 2020-01-15T03:35:36 | 2020-01-15T03:35:36 | 233,988,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,301 | java | package com.example.gseviepenyewa.MODEL;
import com.google.gson.annotations.SerializedName;
public class Komentar {
@SerializedName("id_komentar")
private String id_komentar;
@SerializedName("komentar")
private String komentar;
@SerializedName("id_user")
private String id_user;
@SerializedName("nama")
private String nama;
@SerializedName("foto_user")
private String foto_user;
@SerializedName("id_kostum")
private String id_kostum;
@SerializedName("nama_kostum")
private String nama_kostum;
@SerializedName("jumlah_kostum")
private String jumlah_kostum;
@SerializedName("harga_kostum")
private String harga_kostum;
@SerializedName("deskripsi_kostum")
private String deskripsi_kostum;
@SerializedName("foto_kostum")
private String foto_kostum;
@SerializedName("id_kategori")
private String id_kategori;
@SerializedName("kategori")
private String kategori;
@SerializedName("id_sewa")
private String id_sewa;
@SerializedName("tgl_transaksi")
private String tgl_transaksi;
@SerializedName("jumlah_denda")
private String jumlah_denda;
@SerializedName("jumlah")
private String jumlah;
@SerializedName("id_detail")
private String id_detail;
public Komentar(String id_komentar, String komentar, String id_detail, String id_user, String nama, String jumlah, String jumlah_denda, String foto_user, String id_kostum, String nama_kostum, String jumlah_kostum, String harga_kostum, String deskripsi_kostum, String foto_kostum, String id_kategori, String kategori, String id_sewa, String tgl_transaksi) {
this.id_komentar = id_komentar;
this.id_detail = id_detail;
this.komentar = komentar;
this.id_user = id_user;
this.jumlah = jumlah;
this.jumlah_denda = jumlah_denda;
this.nama = nama;
this.foto_user = foto_user;
this.id_kostum = id_kostum;
this.nama_kostum = nama_kostum;
this.jumlah_kostum = jumlah_kostum;
this.harga_kostum = harga_kostum;
this.deskripsi_kostum = deskripsi_kostum;
this.foto_kostum = foto_kostum;
this.id_kategori = id_kategori;
this.kategori = kategori;
this.id_sewa = id_sewa;
this.tgl_transaksi = tgl_transaksi;
}
public String getId_komentar() {
return id_komentar;
}
public void setId_komentar(String id_komentar) {
this.id_komentar = id_komentar;
}
public String getKomentar() {
return komentar;
}
public void setKomentar(String komentar) {
this.komentar = komentar;
}
public String getId_user() {
return id_user;
}
public void setId_user(String id_user) {
this.id_user = id_user;
}
public String getNama() {
return nama;
}
public void setNama(String nama) {
this.nama = nama;
}
public String getFoto_user() {
return foto_user;
}
public void setFoto_user(String foto_user) {
this.foto_user = foto_user;
}
public String getId_kostum() {
return id_kostum;
}
public void setId_kostum(String id_kostum) {
this.id_kostum = id_kostum;
}
public String getNama_kostum() {
return nama_kostum;
}
public void setNama_kostum(String nama_kostum) {
this.nama_kostum = nama_kostum;
}
public String getJumlah_kostum() {
return jumlah_kostum;
}
public void setJumlah_kostum(String jumlah_kostum) {
this.jumlah_kostum = jumlah_kostum;
}
public String getHarga_kostum() {
return harga_kostum;
}
public void setHarga_kostum(String harga_kostum) {
this.harga_kostum = harga_kostum;
}
public String getDeskripsi_kostum() {
return deskripsi_kostum;
}
public void setDeskripsi_kostum(String deskripsi_kostum) {
this.deskripsi_kostum = deskripsi_kostum;
}
public String getFoto_kostum() {
return foto_kostum;
}
public void setFoto_kostum(String foto_kostum) {
this.foto_kostum = foto_kostum;
}
public String getId_kategori() {
return id_kategori;
}
public void setId_kategori(String id_kategori) {
this.id_kategori = id_kategori;
}
public String getKategori() {
return kategori;
}
public void setKategori(String kategori) {
this.kategori = kategori;
}
public String getId_sewa() {
return id_sewa;
}
public void setId_sewa(String id_sewa) {
this.id_sewa = id_sewa;
}
public String getTgl_transaksi() {
return tgl_transaksi;
}
public void setTgl_transaksi(String tgl_transaksi) {
this.tgl_transaksi = tgl_transaksi;
}
public String getJumlah_denda() {
return jumlah_denda;
}
public void setJumlah_denda(String jumlah_denda) {
this.jumlah_denda = jumlah_denda;
}
public String getJumlah() {
return jumlah;
}
public void setJumlah(String jumlah) {
this.jumlah = jumlah;
}
public String getId_detail() {
return id_detail;
}
public void setId_detail(String id_detail) {
this.id_detail = id_detail;
}
}
| [
"mitasdama@gmail.com"
] | mitasdama@gmail.com |
e7f4e78ddb12ae690428b9dd91ddccfec3043f90 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-recyclebin/src/main/java/com/amazonaws/services/recyclebin/model/RuleStatus.java | 885e44974ec0ed8736b04ab4cd32fbe7246e954e | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 1,760 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.recyclebin.model;
import javax.annotation.Generated;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum RuleStatus {
Pending("pending"),
Available("available");
private String value;
private RuleStatus(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
/**
* Use this in place of valueOf.
*
* @param value
* real value
* @return RuleStatus corresponding to the value
*
* @throws IllegalArgumentException
* If the specified value does not map to one of the known values in this enum.
*/
public static RuleStatus fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (RuleStatus enumEntry : RuleStatus.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
| [
""
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.